Merge remote-tracking branch 'origin/dev_天津_意博凯信' into dev_天津_意博凯信
已修改51个文件
已重命名1个文件
已添加7个文件
已删除58个文件
| | |
| | | ######################################################################
|
| | | # Claude Code
|
| | | .claude/
|
| | | .mcp.json
|
| | |
|
| | |
|
| | | ### STS ###
|
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | # æ°å¢ä»æ¬¾æ¥å£èè°ææ¡£ |
| | | |
| | | ## æ¦è¿° |
| | | |
| | | å¨ä»æ¬¾å°è´¦é¡µé¢ï¼`src/views/procurementManagement/paymentLedger/index.vue`ï¼å³ä¾§ä¾åºåæç»è¡¨æ ¼ä¸ï¼æ¯æ¡æ°æ®æ°å¢äºãæ°å¢ä»æ¬¾ãæä½æé®ãç¹å»åå¼¹åºè¡¨åï¼å¡«å仿¬¾ä¿¡æ¯å¹¶æäº¤ã |
| | | |
| | | --- |
| | | |
| | | ## æ¥å£ä¿¡æ¯ |
| | | |
| | | - **URL**: `/purchase/report/savePayment` |
| | | - **Method**: `POST` |
| | | - **Content-Type**: `application/json` |
| | | |
| | | --- |
| | | |
| | | ## 请æ±åæ° |
| | | |
| | | | åæ®µ | ç±»å | å¿
å¡« | 说æ | |
| | | |------|------|------|------| |
| | | | `supplierId` | String | æ¯ | ä¾åºåIDï¼æ¥èªä¸»è¡¨ï¼å·¦ä¾§ï¼å½åéä¸è¡ç `supplierId` | |
| | | | `purchaseContractNumber` | String | æ¯ | éè´ååå·ï¼æ¥èªæç»è¡ï¼å³ä¾§ï¼æ°æ®ç `purchaseContractNumber` | |
| | | | `paymentDate` | String | æ¯ | 仿¬¾æ¥æï¼æ ¼å¼ `YYYY-MM-DD` | |
| | | | `paymentAmount` | Number | æ¯ | 仿¬¾éé¢ï¼ä¿ç两ä½å°æ°ï¼æå°å¼ 0.01 | |
| | | | `paymentMethod` | String | æ¯ | 仿¬¾æ¹å¼ï¼å¯éå¼è§ä¸æ¹æä¸¾è¡¨ | |
| | | | `remark` | String | å¦ | 夿³¨ä¿¡æ¯ | |
| | | |
| | | ### 仿¬¾æ¹å¼æä¸¾å¼ |
| | | |
| | | | å¼ | 说æ | |
| | | |------|------| |
| | | | `é¶è¡è½¬è´¦` | é¶è¡è½¬è´¦ | |
| | | | `ç°é` | ç°é | |
| | | | `æ¯ç¥¨` | æ¯ç¥¨ | |
| | | | `微信/æ¯ä»å®` | 微信/æ¯ä»å® | |
| | | | `å
¶ä»` | å
¶ä»æ¹å¼ | |
| | | |
| | | --- |
| | | |
| | | ## 请æ±ç¤ºä¾ |
| | | |
| | | ```json |
| | | { |
| | | "supplierId": "SUPP001", |
| | | "purchaseContractNumber": "CG-2024-0001", |
| | | "paymentDate": "2024-08-12", |
| | | "paymentAmount": 50000.00, |
| | | "paymentMethod": "é¶è¡è½¬è´¦", |
| | | "remark": "ååç¬¬ä¸æä»æ¬¾" |
| | | } |
| | | ``` |
| | | |
| | | --- |
| | | |
| | | ## ååºæ ¼å¼ |
| | | |
| | | ### æå |
| | | |
| | | ```json |
| | | { |
| | | "code": 200, |
| | | "msg": "æä½æå", |
| | | "data": null |
| | | } |
| | | ``` |
| | | |
| | | ### 失败 |
| | | |
| | | ```json |
| | | { |
| | | "code": 500, |
| | | "msg": "å
·ä½é误信æ¯", |
| | | "data": null |
| | | } |
| | | ``` |
| | | |
| | | --- |
| | | |
| | | ## å端è°ç¨æµç¨ |
| | | |
| | | 1. ç¨æ·å¨å·¦ä¾§ä¸»è¡¨ç¹å»æä¾åºåè¡ï¼å³ä¾§å 载该ä¾åºåçååæç» |
| | | 2. ç¨æ·å¨å³ä¾§æç»è¡¨ç¹å»æè¡çãæ°å¢ä»æ¬¾ãæé® |
| | | 3. å¼¹åºå¯¹è¯æ¡ï¼å±ç¤ºå½åååçéè´ååå·ï¼åªè¯»ï¼ |
| | | 4. ç¨æ·å¡«å仿¬¾æ¥æãéé¢ãæ¹å¼ã夿³¨åç¹å»ç¡®è®¤ |
| | | 5. å端è°ç¨ `POST /purchase/report/savePayment` |
| | | 6. æååå
³éå¼¹æ¡ï¼èªå¨å·æ°å·¦ä¾§ä¾åºåæ±æ»è¡¨åå³ä¾§æç»è¡¨ |
| | | 7. 失败åæç¤ºå端è¿åç `msg` éè¯¯ä¿¡æ¯ |
| | | |
| | | --- |
| | | |
| | | ## åç«¯è¡¨åæ ¡éªè§å |
| | | |
| | | | åæ®µ | è§å | |
| | | |------|------| |
| | | | `paymentDate` | å¿
å¡«ï¼æªéæ©æ¶æç¤º"è¯·éæ©ä»æ¬¾æ¥æ" | |
| | | | `paymentAmount` | å¿
å¡«ï¼ä¸è½è¶
è¿å¯ä»æ¬¾ä½é¢ï¼åºä»éé¢ - 仿¬¾éé¢ï¼ï¼è¶
éæ¶æç¤º"仿¬¾éé¢ä¸è½è¶
è¿å¯ä»æ¬¾ä½é¢ XXX å
" | |
| | | | `paymentMethod` | å¿
å¡«ï¼æªéæ©æ¶æç¤º"è¯·éæ©ä»æ¬¾æ¹å¼" | |
| | | | `remark` | éå¡«ï¼æ æ ¡éª | |
| | | |
| | | ### å¯ä»æ¬¾ä½é¢è®¡ç® |
| | | |
| | | å½åè¡å¯ä»æ¬¾ä½é¢ = `payableAmount`ï¼åºä»éé¢ï¼ - `paymentAmount`ï¼ä»æ¬¾éé¢ï¼ |
| | | |
| | | æ¯æ¬¡æå¼æ°å¢ä»æ¬¾å¼¹æ¡æ¶ï¼ä»æ¬¾éé¢è¾å
¥æ¡ä¸æ¹ä¼æ¾ç¤ºé»è²æç¤ºæå"å½åå¯ä»æ¬¾ä½é¢ï¼XXX å
"ã |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | # æ°å¢å款æ¥å£èè°ææ¡£ |
| | | |
| | | ## æ¦è¿° |
| | | |
| | | 卿¶ä»æ¬¾å°è´¦é¡µé¢ï¼`src/views/salesManagement/receiptPaymentLedger/index.vue`ï¼å³ä¾§å®¢æ·æç»è¡¨æ ¼ä¸ï¼æ¯æ¡æ°æ®æ°å¢äºãæ°å¢å款ãæä½æé®ãç¹å»åå¼¹åºè¡¨åï¼å¡«å忬¾ä¿¡æ¯å¹¶æäº¤ã |
| | | |
| | | --- |
| | | |
| | | ## æ¥å£ä¿¡æ¯ |
| | | |
| | | - **URL**: `/metricStatistics/saveReceiptPayment` |
| | | - **Method**: `POST` |
| | | - **Content-Type**: `application/json` |
| | | |
| | | --- |
| | | |
| | | ## 请æ±åæ° |
| | | |
| | | | åæ®µ | ç±»å | å¿
å¡« | 说æ | |
| | | |------|------|------|------| |
| | | | `customerId` | String | æ¯ | 客æ·IDï¼æ¥èªä¸»è¡¨ï¼å·¦ä¾§ï¼å½åéä¸è¡ç `customerId` | |
| | | | `salesContractNo` | String | æ¯ | éå®ååå·ï¼æ¥èªæç»è¡ï¼å³ä¾§ï¼æ°æ®ç `salesContractNo` | |
| | | | `paymentDate` | String | æ¯ | 忬¾æ¥æï¼æ ¼å¼ `YYYY-MM-DD` | |
| | | | `paymentAmount` | Number | æ¯ | 忬¾éé¢ï¼ä¿ç两ä½å°æ°ï¼æå°å¼ 0.01 | |
| | | | `paymentMethod` | String | æ¯ | 忬¾æ¹å¼ï¼å¯éå¼è§ä¸æ¹æä¸¾è¡¨ | |
| | | | `remark` | String | å¦ | 夿³¨ä¿¡æ¯ | |
| | | |
| | | ### 忬¾æ¹å¼æä¸¾å¼ |
| | | |
| | | | å¼ | 说æ | |
| | | |------|------| |
| | | | `é¶è¡è½¬è´¦` | é¶è¡è½¬è´¦ | |
| | | | `ç°é` | ç°é | |
| | | | `æ¯ç¥¨` | æ¯ç¥¨ | |
| | | | `微信/æ¯ä»å®` | 微信/æ¯ä»å® | |
| | | | `å
¶ä»` | å
¶ä»æ¹å¼ | |
| | | |
| | | --- |
| | | |
| | | ## 请æ±ç¤ºä¾ |
| | | |
| | | ```json |
| | | { |
| | | "customerId": "CUST001", |
| | | "salesContractNo": "XS-2024-0001", |
| | | "paymentDate": "2024-08-12", |
| | | "paymentAmount": 50000.00, |
| | | "paymentMethod": "é¶è¡è½¬è´¦", |
| | | "remark": "ååç¬¬ä¸æåæ¬¾" |
| | | } |
| | | ``` |
| | | |
| | | --- |
| | | |
| | | ## ååºæ ¼å¼ |
| | | |
| | | ### æå |
| | | |
| | | ```json |
| | | { |
| | | "code": 200, |
| | | "msg": "æä½æå", |
| | | "data": null |
| | | } |
| | | ``` |
| | | |
| | | ### 失败 |
| | | |
| | | ```json |
| | | { |
| | | "code": 500, |
| | | "msg": "å
·ä½é误信æ¯", |
| | | "data": null |
| | | } |
| | | ``` |
| | | |
| | | --- |
| | | |
| | | ## å端è°ç¨æµç¨ |
| | | |
| | | 1. ç¨æ·å¨å³ä¾§æç»è¡¨ç¹å»æè¡çãæ°å¢å款ãæé® |
| | | 2. å¼¹åºå¯¹è¯æ¡ï¼å±ç¤ºå½åååçéå®ååå·ï¼åªè¯»ï¼ |
| | | 3. ç¨æ·å¡«å忬¾æ¥æãéé¢ãæ¹å¼ã夿³¨åç¹å»ç¡®è®¤ |
| | | 4. å端è°ç¨ `POST /metricStatistics/saveReceiptPayment` |
| | | 5. æååå
³éå¼¹æ¡ï¼èªå¨å·æ°å·¦ä¾§å®¢æ·æ±æ»è¡¨åå³ä¾§æç»è¡¨ |
| | | 6. 失败åæç¤ºå端è¿åç `msg` éè¯¯ä¿¡æ¯ |
| | | |
| | | --- |
| | | |
| | | ## åç«¯è¡¨åæ ¡éªè§å |
| | | |
| | | | åæ®µ | è§å | |
| | | |------|------| |
| | | | `paymentDate` | å¿
å¡«ï¼æªéæ©æ¶æç¤º"è¯·éæ©åæ¬¾æ¥æ" | |
| | | | `paymentAmount` | å¿
å¡«ï¼æªè¾å
¥æ¶æç¤º"请è¾å
¥å款éé¢" | |
| | | | `paymentMethod` | å¿
å¡«ï¼æªéæ©æ¶æç¤º"è¯·éæ©åæ¬¾æ¹å¼" | |
| | | | `remark` | éå¡«ï¼æ æ ¡éª | |
| | |
| | | import com.ruoyi.account.bean.vo.StatementAccountVo; |
| | | import com.ruoyi.account.pojo.AccountStatement; |
| | | import com.ruoyi.purchase.dto.VatDto; |
| | | import com.ruoyi.purchase.dto.VatSummaryDto; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | /** |
| | | * <p> |
| | | * Mapper æ¥å£ |
| | | * </p> |
| | | * |
| | | * @author è¯å¯¼è½¯ä»¶ï¼æ±èï¼æéå
¬å¸ |
| | | * @since 2026-05-19 09:42:47 |
| | | */ |
| | | import java.util.List; |
| | | |
| | | @Mapper |
| | | public interface AccountStatementMapper extends BaseMapper<AccountStatement> { |
| | | |
| | | |
| | | IPage<StatementAccountVo> listPageAccountStatement(Page page, @Param("req") StatementAccountDto statementAccountDto); |
| | | |
| | | IPage<VatDto> selectVatDtoPage(Page page, @Param("month") String month); |
| | | IPage<VatDto> selectVatDtoPage(Page page, @Param("month") String month, @Param("type") String type); |
| | | |
| | | List<VatSummaryDto> selectVatSummary(@Param("year") String year); |
| | | |
| | | IPage<VatDto> listVatDetail(Page page, @Param("month") String month); |
| | | } |
| | |
| | | IPage<AccountPurchasePaymentVo> listPageAccountPurchasePayment(Page page, @Param("req") AccountPurchasePaymentDto accountPurchasePaymentDto); |
| | | |
| | | List<IncomeExpenseAnalysisDto> selectPayment(@Param("startStr") String startStr, @Param("endStr") String endStr, @Param("dateFormat") String dateFormat); |
| | | |
| | | /** |
| | | * æ¥è¯¢æéè´å°è´¦ä¸å·²å®¡æ¹çéè´å
¥åºè®°å½idå表 |
| | | * @param purchaseLedgerId éè´å°è´¦id |
| | | * @return å
¥åºè®°å½idå表 |
| | | */ |
| | | List<Long> selectStockInRecordIdsByPurchaseLedgerId(@Param("purchaseLedgerId") Long purchaseLedgerId); |
| | | } |
| | |
| | | List<SalesOutboundVo> getOutboundBatchesByCustomer(@Param("customerId") Integer customerId); |
| | | |
| | | List<IncomeExpenseAnalysisDto> selectIncomeStats(@Param("startStr") String startStr, @Param("endStr") String endStr, @Param("dateFormat") String dateFormat); |
| | | |
| | | /** |
| | | * æ¥è¯¢æéå®å°è´¦ä¸å·²å®¡æ¹çéå®åºåºè®°å½idå表 |
| | | * @param salesLedgerId éå®å°è´¦id |
| | | * @return åºåºè®°å½idå表 |
| | | */ |
| | | List<Long> selectStockOutRecordIdsBySalesLedgerId(@Param("salesLedgerId") Long salesLedgerId); |
| | | } |
| | |
| | | package com.ruoyi.account.service.impl.purchase; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.core.toolkit.CollectionUtils; |
| | | 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.github.xiaoymin.knife4j.core.util.CollectionUtils; |
| | | import com.ruoyi.account.bean.dto.purchase.AccountPurchasePaymentDto; |
| | | import com.ruoyi.account.bean.vo.purchase.AccountPurchasePaymentVo; |
| | | import com.ruoyi.account.mapper.AccountStatementDetailsMapper; |
| | |
| | | import com.ruoyi.common.exception.ServiceException; |
| | | import com.ruoyi.common.utils.StringUtils; |
| | | import com.ruoyi.common.utils.poi.ExcelUtil; |
| | | import com.ruoyi.purchase.dto.SavePaymentDto; |
| | | import com.ruoyi.purchase.mapper.PurchaseLedgerMapper; |
| | | import com.ruoyi.purchase.pojo.PurchaseLedger; |
| | | import jakarta.servlet.http.HttpServletResponse; |
| | | import lombok.RequiredArgsConstructor; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.time.LocalDateTime; |
| | | import java.time.format.DateTimeFormatter; |
| | | import java.util.List; |
| | | import java.util.Random; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | private final AccountPurchasePaymentMapper accountPurchasePaymentMapper; |
| | | private final AccountStatementDetailsMapper accountStatementDetailsMapper; |
| | | private final AccountPaymentApplicationMapper accountPaymentApplicationMapper; |
| | | private final PurchaseLedgerMapper purchaseLedgerMapper; |
| | | |
| | | @Override |
| | | public IPage<AccountPurchasePaymentVo> listPageAccountPurchasePayment(Page page, AccountPurchasePaymentDto accountPurchasePaymentDto) { |
| | |
| | | return removeByIds(ids); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public boolean savePayment(SavePaymentDto dto) { |
| | | if (dto.getPaymentDate() == null) { |
| | | throw new ServiceException("è¯·éæ©ä»æ¬¾æ¥æ"); |
| | | } |
| | | if (dto.getPaymentAmount() == null || dto.getPaymentAmount().compareTo(BigDecimal.valueOf(0.01)) < 0) { |
| | | throw new ServiceException("请è¾å
¥ä»æ¬¾éé¢"); |
| | | } |
| | | if (StringUtils.isEmpty(dto.getPurchaseContractNumber())) { |
| | | throw new ServiceException("éè´ååå·ä¸è½ä¸ºç©º"); |
| | | } |
| | | if (dto.getSupplierId() == null) { |
| | | throw new ServiceException("ä¾åºåä¸è½ä¸ºç©º"); |
| | | } |
| | | |
| | | PurchaseLedger purchaseLedger = purchaseLedgerMapper.selectOne(new LambdaQueryWrapper<PurchaseLedger>() |
| | | .eq(PurchaseLedger::getPurchaseContractNumber, dto.getPurchaseContractNumber())); |
| | | if (purchaseLedger == null) { |
| | | throw new ServiceException("éè´ååä¸åå¨"); |
| | | } |
| | | if (purchaseLedger.getSupplierId() == null || purchaseLedger.getSupplierId().longValue() != dto.getSupplierId().longValue()) { |
| | | throw new ServiceException("ä¾åºåä¸ååä¸å¹é
"); |
| | | } |
| | | |
| | | List<Long> stockInRecordIds = accountPurchasePaymentMapper.selectStockInRecordIdsByPurchaseLedgerId(purchaseLedger.getId()); |
| | | if (CollectionUtils.isEmpty(stockInRecordIds)) { |
| | | throw new ServiceException("该ååææ å¯ä»æ¬¾çéè´å
¥åºè®°å½"); |
| | | } |
| | | |
| | | AccountPaymentApplication application = new AccountPaymentApplication(); |
| | | application.setSupplierId(dto.getSupplierId().intValue()); |
| | | application.setStockInRecordIds(stockInRecordIds.stream().map(String::valueOf).collect(Collectors.joining(","))); |
| | | application.setInvoiceApplicationNo(genPaymentApplicationNo()); |
| | | application.setPaymentMethod(dto.getPaymentMethod()); |
| | | application.setPaymentContent(dto.getPurchaseContractNumber()); |
| | | application.setApplyDate(dto.getPaymentDate()); |
| | | application.setRemark(dto.getRemark()); |
| | | application.setStatus(1); |
| | | application.setPaymentAmount(dto.getPaymentAmount()); |
| | | accountPaymentApplicationMapper.insert(application); |
| | | |
| | | AccountPurchasePayment payment = new AccountPurchasePayment(); |
| | | payment.setAccountPaymentApplicationId(application.getId()); |
| | | payment.setSupplierId(dto.getSupplierId().intValue()); |
| | | payment.setPaymentDate(dto.getPaymentDate()); |
| | | payment.setPaymentMethod(dto.getPaymentMethod()); |
| | | payment.setPaymentAmount(dto.getPaymentAmount()); |
| | | payment.setPaymentNumber(genAccountPurchasePaymentNo()); |
| | | payment.setRemark(dto.getRemark()); |
| | | return save(payment); |
| | | } |
| | | |
| | | private String genPaymentApplicationNo() { |
| | | return "FK" + LocalDateTime.now().format(CODE_TIME_FORMATTER) + new Random().nextInt(10); |
| | | } |
| | | |
| | | private String genAccountPurchasePaymentNo() { |
| | | return "SK" + LocalDateTime.now().format(CODE_TIME_FORMATTER) + new Random().nextInt(10); |
| | | } |
| | |
| | | package com.ruoyi.account.service.impl.sales; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.core.toolkit.CollectionUtils; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | |
| | | import com.ruoyi.common.exception.ServiceException; |
| | | import com.ruoyi.common.utils.StringUtils; |
| | | import com.ruoyi.common.utils.poi.ExcelUtil; |
| | | import com.ruoyi.sales.dto.SaveReceiptPaymentDto; |
| | | import com.ruoyi.sales.mapper.SalesLedgerMapper; |
| | | import com.ruoyi.sales.pojo.SalesLedger; |
| | | import jakarta.servlet.http.HttpServletResponse; |
| | | import lombok.RequiredArgsConstructor; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.time.LocalDateTime; |
| | | import java.time.format.DateTimeFormatter; |
| | | import java.util.Arrays; |
| | | import java.util.List; |
| | | import java.util.Random; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | |
| | | private final AccountSalesCollectionMapper accountSalesCollectionMapper; |
| | | private final AccountStatementDetailsMapper accountStatementDetailsMapper; |
| | | private final SalesLedgerMapper salesLedgerMapper; |
| | | private static final DateTimeFormatter CODE_TIME_FORMATTER = DateTimeFormatter.ofPattern("yyMMddHHmmss"); |
| | | |
| | | |
| | |
| | | return accountSalesCollectionMapper.getOutboundBatchesByCustomer(customerId); |
| | | } |
| | | |
| | | @Override |
| | | public boolean saveReceiptPayment(SaveReceiptPaymentDto dto) { |
| | | if (dto.getPaymentDate() == null) { |
| | | throw new ServiceException("è¯·éæ©åæ¬¾æ¥æ"); |
| | | } |
| | | if (dto.getPaymentAmount() == null || dto.getPaymentAmount().compareTo(BigDecimal.valueOf(0.01)) < 0) { |
| | | throw new ServiceException("请è¾å
¥å款éé¢"); |
| | | } |
| | | if (StringUtils.isEmpty(dto.getSalesContractNo())) { |
| | | throw new ServiceException("éå®ååå·ä¸è½ä¸ºç©º"); |
| | | } |
| | | if (dto.getCustomerId() == null) { |
| | | throw new ServiceException("客æ·ä¸è½ä¸ºç©º"); |
| | | } |
| | | |
| | | SalesLedger salesLedger = salesLedgerMapper.selectOne(new LambdaQueryWrapper<SalesLedger>() |
| | | .eq(SalesLedger::getSalesContractNo, dto.getSalesContractNo())); |
| | | if (salesLedger == null) { |
| | | throw new ServiceException("éå®ååä¸åå¨"); |
| | | } |
| | | if (salesLedger.getCustomerId() == null || salesLedger.getCustomerId().longValue() != dto.getCustomerId().longValue()) { |
| | | throw new ServiceException("客æ·ä¸ååä¸å¹é
"); |
| | | } |
| | | |
| | | List<Long> stockOutRecordIds = accountSalesCollectionMapper.selectStockOutRecordIdsBySalesLedgerId(salesLedger.getId()); |
| | | if (CollectionUtils.isEmpty(stockOutRecordIds)) { |
| | | throw new ServiceException("该ååææ å¯å款çéå®åºåºè®°å½"); |
| | | } |
| | | |
| | | AccountSalesCollection collection = new AccountSalesCollection(); |
| | | collection.setCustomerId(dto.getCustomerId().intValue()); |
| | | collection.setStockOutRecordIds(stockOutRecordIds.stream().map(String::valueOf).collect(Collectors.joining(","))); |
| | | collection.setCollectionDate(dto.getPaymentDate()); |
| | | collection.setCollectionAmount(dto.getPaymentAmount()); |
| | | collection.setCollectionMethod(dto.getPaymentMethod()); |
| | | collection.setCollectionNumber(genAccountSalesCollectionNo()); |
| | | collection.setRemark(dto.getRemark()); |
| | | return save(collection); |
| | | } |
| | | |
| | | private String genAccountSalesCollectionNo() { |
| | | return "SK" + LocalDateTime.now().format(CODE_TIME_FORMATTER) + new Random().nextInt(10); |
| | | } |
| | |
| | | import com.ruoyi.account.bean.dto.purchase.AccountPurchasePaymentDto; |
| | | import com.ruoyi.account.bean.vo.purchase.AccountPurchasePaymentVo; |
| | | import com.ruoyi.account.pojo.purchase.AccountPurchasePayment; |
| | | import com.ruoyi.purchase.dto.SavePaymentDto; |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import jakarta.servlet.http.HttpServletResponse; |
| | | |
| | |
| | | void exportAccountPurchasePayment(HttpServletResponse response, AccountPurchasePaymentDto accountPurchasePaymentDto); |
| | | |
| | | boolean deleteAccountPurchasePayment(List<Long> ids); |
| | | |
| | | /** |
| | | * éè´ç®¡ç--ä¾åºå徿¥ æ°å¢ä»æ¬¾ |
| | | * |
| | | * @param dto 仿¬¾è¯·æ±åæ° |
| | | * @return æ¯å¦æå |
| | | */ |
| | | boolean savePayment(SavePaymentDto dto); |
| | | } |
| | |
| | | import com.ruoyi.account.bean.vo.sales.AccountSalesCollectionVo; |
| | | import com.ruoyi.account.bean.vo.sales.SalesOutboundVo; |
| | | import com.ruoyi.account.pojo.sales.AccountSalesCollection; |
| | | import com.ruoyi.sales.dto.SaveReceiptPaymentDto; |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import jakarta.servlet.http.HttpServletResponse; |
| | | |
| | |
| | | boolean deleteAccountSalesCollection(List<Long> ids); |
| | | |
| | | List<SalesOutboundVo> getOutboundBatchesByCustomer(Integer customerId); |
| | | |
| | | /** |
| | | * è¥é管ç--客æ·å¾æ¥ æ°å¢å款 |
| | | * |
| | | * @param dto 忬¾è¯·æ±åæ° |
| | | * @return æ¯å¦æå |
| | | */ |
| | | boolean saveReceiptPayment(SaveReceiptPaymentDto dto); |
| | | } |
| | |
| | | if (TypeEnums.PURCHASE_APPROVAL.getCode().equals(vo.getBusinessType())) { |
| | | // éè´å®¡æ¹ - æ¥è¯¢éè´åå· |
| | | PurchaseLedger purchaseLedger = purchaseLedgerMapper.selectById(vo.getBusinessId()); |
| | | System.out.println("ä¸å¡ç±»åï¼" + purchaseLedger.getPurchaseContractNumber()); |
| | | if (purchaseLedger != null) { |
| | | vo.setPurchaseContractNumber(purchaseLedger.getPurchaseContractNumber()); |
| | | } |
| | |
| | | |
| | | List<Long> instanceIds = records.stream() |
| | | .map(ApprovalInstanceVo::getId) |
| | | .filter(id -> id != null) |
| | | .filter(Objects::nonNull) |
| | | .distinct() |
| | | .collect(Collectors.toList()); |
| | | |
| | |
| | | @Getter |
| | | public enum SparePartsRequisitionRecordSourceTypeEnum implements BaseEnum<Integer> { |
| | | SparePartsRequisitionRecordSourceTypeRepair(0, "ç»´ä¿®"), |
| | | SparePartsRequisitionRecordSourceTypeMaintenance(1, "ä¿å
»"); |
| | | SparePartsRequisitionRecordSourceTypeMaintenance(1, "ä¿å
»"), |
| | | SparePartsRequisitionRecordSourceTypeDirectOutbound(2, "ç´æ¥åºåº"); |
| | | |
| | | private final Integer code; |
| | | private final String value; |
| | |
| | | |
| | | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.device.dto.DeviceMaintenanceBatchCompleteDto; |
| | | import com.ruoyi.device.dto.DeviceMaintenanceDto; |
| | | import com.ruoyi.device.pojo.DeviceLedger; |
| | | import com.ruoyi.device.pojo.DeviceMaintenance; |
| | |
| | | import io.swagger.v3.oas.annotations.Operation; |
| | | import jakarta.servlet.http.HttpServletResponse; |
| | | import lombok.AllArgsConstructor; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.util.Arrays; |
| | |
| | | deviceMaintenanceService.export(response, ids); |
| | | } |
| | | |
| | | @PostMapping("/batchComplete") |
| | | @Operation(summary = "ä¸é®ä¿å
»å®æ") |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public AjaxResult batchComplete(@RequestBody DeviceMaintenanceBatchCompleteDto dto) { |
| | | return deviceMaintenanceService.batchComplete(dto); |
| | | } |
| | | |
| | | @PutMapping("/complete/{id}") |
| | | @Operation(summary = "ä¿å
»å®æ") |
| | | public AjaxResult complete(@PathVariable Long id) { |
| | | return deviceMaintenanceService.complete(id); |
| | | } |
| | | |
| | | @PutMapping("/batchComplete") |
| | | @Operation(summary = "ä¸é®ä¿å
»å®æ") |
| | | public AjaxResult batchComplete(String dateStr) { |
| | | return deviceMaintenanceService.batchComplete(dateStr); |
| | | } |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.device.dto; |
| | | |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.Data; |
| | | |
| | | import java.time.LocalDate; |
| | | import java.time.LocalDateTime; |
| | | |
| | | @Data |
| | | @Schema(name = "设å¤ä¿å
»æ¹éå®æè¯·æ±") |
| | | public class DeviceMaintenanceBatchCompleteDto { |
| | | |
| | | @Schema(description = "计åä¿å
»æ¥æ", requiredMode = Schema.RequiredMode.REQUIRED) |
| | | private LocalDate maintenancePlanDate; |
| | | |
| | | @Schema(description = "å®é
ä¿å
»äºº") |
| | | private String maintenanceActuallyName; |
| | | |
| | | @Schema(description = "å®é
ä¿å
»æ¶é´") |
| | | private LocalDateTime maintenanceActuallyTime; |
| | | |
| | | @Schema(description = "ä¿å
ȍȾ") |
| | | private String maintenanceResult; |
| | | } |
| | |
| | | @Schema(description = "ä¿å
»å¾ç") |
| | | private List<StorageBlobDTO> storageBlobDTOs; |
| | | |
| | | @Schema(description = "æ¥æåç»å段(yyyy-MM-dd)") |
| | | private String dateStr; |
| | | |
| | | } |
| | | |
| | |
| | | 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.device.dto.DeviceMaintenanceBatchCompleteDto; |
| | | import com.ruoyi.device.dto.DeviceMaintenanceDto; |
| | | import com.ruoyi.device.pojo.DeviceMaintenance; |
| | | import com.ruoyi.device.vo.DeviceMaintenanceVo; |
| | |
| | | void export(HttpServletResponse response, Long[] ids); |
| | | |
| | | DeviceMaintenanceVo detailById(Long id); |
| | | |
| | | AjaxResult batchComplete(DeviceMaintenanceBatchCompleteDto dto); |
| | | |
| | | AjaxResult complete(Long id); |
| | | |
| | | AjaxResult batchComplete(String dateStr); |
| | | } |
| | |
| | | package com.ruoyi.device.service.impl; |
| | | |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | 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.basic.enums.RecordTypeEnum; |
| | | import com.ruoyi.basic.utils.FileUtil; |
| | | import com.ruoyi.common.utils.SecurityUtils; |
| | | import com.ruoyi.common.utils.bean.BeanUtils; |
| | | import com.ruoyi.common.utils.poi.ExcelUtil; |
| | | import com.ruoyi.device.dto.DeviceMaintenanceBatchCompleteDto; |
| | | import com.ruoyi.device.dto.DeviceMaintenanceDto; |
| | | import com.ruoyi.device.execl.DeviceMaintenanceExeclDto; |
| | | import com.ruoyi.device.mapper.DeviceMaintenanceMapper; |
| | |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.time.LocalDate; |
| | | import java.time.LocalDateTime; |
| | | import java.time.LocalTime; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | |
| | | } |
| | | } |
| | | |
| | | // è¥è®¾ç½®äºå®é
ä¿å
»æ¥æï¼åèªå¨æ 记为å®ç» |
| | | if (deviceMaintenance.getMaintenanceActuallyTime() != null && deviceMaintenance.getStatus() == null) { |
| | | deviceMaintenance.setStatus(1); |
| | | } |
| | | |
| | | if (this.updateById(deviceMaintenance)) { |
| | | // å¤çå¾çä¸ä¼ |
| | | fileUtil.saveStorageAttachmentByRecordTypeAndRecordId("file", RecordTypeEnum.DEVICE_MAINTENANCE, deviceMaintenance.getId(), deviceMaintenance.getStorageBlobDTOs()); |
| | |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public AjaxResult complete(Long id) { |
| | | DeviceMaintenance record = this.getById(id); |
| | | if (record == null) { |
| | | return AjaxResult.error("ä¿å
»è®°å½ä¸åå¨"); |
| | | } |
| | | if (record.getStatus() != null && record.getStatus() == 1) { |
| | | return AjaxResult.error("该ä¿å
»è®°å½å·²å®æ"); |
| | | } |
| | | record.setStatus(1); |
| | | record.setMaintenanceActuallyName(SecurityUtils.getLoginUser().getNickName()); |
| | | record.setMaintenanceActuallyTime(LocalDateTime.now()); |
| | | this.updateById(record); |
| | | return AjaxResult.success(); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public AjaxResult batchComplete(String dateStr) { |
| | | if (StringUtils.isBlank(dateStr)) { |
| | | return AjaxResult.error("æ¥æåæ°ä¸è½ä¸ºç©º"); |
| | | } |
| | | LocalDate date = LocalDate.parse(dateStr); |
| | | LocalDateTime startOfDay = date.atStartOfDay(); |
| | | LocalDateTime endOfDay = date.atTime(LocalTime.MAX); |
| | | List<DeviceMaintenance> records = this.lambdaQuery() |
| | | .eq(DeviceMaintenance::getStatus, 0) |
| | | .ge(DeviceMaintenance::getCreateTime, startOfDay) |
| | | .le(DeviceMaintenance::getCreateTime, endOfDay) |
| | | .list(); |
| | | if (records.isEmpty()) { |
| | | return AjaxResult.error("è¯¥æ¥æä¸æ²¡æå¾
宿çä¿å
»è®°å½"); |
| | | } |
| | | String nickName = SecurityUtils.getLoginUser().getNickName(); |
| | | LocalDateTime now = LocalDateTime.now(); |
| | | for (DeviceMaintenance record : records) { |
| | | record.setStatus(1); |
| | | record.setMaintenanceActuallyName(nickName); |
| | | record.setMaintenanceActuallyTime(now); |
| | | } |
| | | this.updateBatchById(records); |
| | | return AjaxResult.success("已宿 " + records.size() + " æ¡ä¿å
»è®°å½"); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public AjaxResult batchComplete(DeviceMaintenanceBatchCompleteDto dto) { |
| | | if (dto.getMaintenancePlanDate() == null) { |
| | | return AjaxResult.error("计åä¿å
»æ¥æä¸è½ä¸ºç©º"); |
| | | } |
| | | LambdaQueryWrapper<DeviceMaintenance> wrapper = new LambdaQueryWrapper<>(); |
| | | wrapper.eq(DeviceMaintenance::getStatus, 0) |
| | | .apply("DATE(maintenance_plan_time) = {0}", dto.getMaintenancePlanDate().toString()); |
| | | List<DeviceMaintenance> list = this.list(wrapper); |
| | | if (list.isEmpty()) { |
| | | return AjaxResult.success("è¯¥æ¥æä¸æ²¡æå¾
ä¿å
»çè®°å½"); |
| | | } |
| | | list.forEach(task -> { |
| | | task.setStatus(1); |
| | | if (StringUtils.isNotBlank(dto.getMaintenanceActuallyName())) { |
| | | task.setMaintenanceActuallyName(dto.getMaintenanceActuallyName()); |
| | | } |
| | | if (dto.getMaintenanceActuallyTime() != null) { |
| | | task.setMaintenanceActuallyTime(dto.getMaintenanceActuallyTime()); |
| | | } |
| | | if (StringUtils.isNotBlank(dto.getMaintenanceResult())) { |
| | | task.setMaintenanceResult(dto.getMaintenanceResult()); |
| | | } |
| | | }); |
| | | this.updateBatchById(list); |
| | | return AjaxResult.success("å
±å®æ " + list.size() + " æ¡ä¿å
»è®°å½"); |
| | | } |
| | | |
| | | @Override |
| | | public void export(HttpServletResponse response, Long[] ids) { |
| | | List<DeviceMaintenance> supplierManageList = deviceMaintenanceMapper.selectList(null); |
| | | ArrayList<DeviceMaintenanceExeclDto> deviceLedgerExeclDtos = new ArrayList<>(); |
| | |
| | | private static final Integer ORDER_STATUS_WAIT = 1; |
| | | private static final Integer ORDER_STATUS_RUNNING = 2; |
| | | private static final Integer ORDER_STATUS_COMPLETED = 3; |
| | | //private static final Integer ORDER_STATUS_END = 4; // 已忶 |
| | | private static final Integer ORDER_STATUS_END = 5; |
| | | private static final Integer ORDER_STATUS_PAUSED = 4; |
| | | |
| | | /********************************************************åºç¡ç±»*****************************************************/ |
| | | @GetMapping("/todos") |
| | |
| | | /********************************************************è¥ééè´ç±»**************************************************/ |
| | | @GetMapping("/supplierPurchaseRanking") |
| | | @Operation(summary = "ä¾åºåéè´æå") |
| | | public R supplierPurchaseRanking(@DefaultType Integer type) { |
| | | List<SupplierPurchaseRankingDto> list = homeService.supplierPurchaseRanking(type); |
| | | public R supplierPurchaseRanking(@DefaultType Integer type, |
| | | @RequestParam(required = false) String startDate, |
| | | @RequestParam(required = false) String endDate) { |
| | | List<SupplierPurchaseRankingDto> list = homeService.supplierPurchaseRanking(type, startDate, endDate); |
| | | return R.ok(list); |
| | | } |
| | | |
| | |
| | | |
| | | @GetMapping("/customerContributionRanking") |
| | | @Operation(summary = "客æ·éé¢è´¡ç®æå") |
| | | public R customerContributionRanking(@DefaultType Integer type) { |
| | | List<CustomerContributionRankingDto> list = homeService.customerContributionRanking(type); |
| | | public R customerContributionRanking(@DefaultType Integer type, |
| | | @RequestParam(required = false) String startDate, |
| | | @RequestParam(required = false) String endDate) { |
| | | List<CustomerContributionRankingDto> list = homeService.customerContributionRanking(type, startDate, endDate); |
| | | return R.ok(list); |
| | | } |
| | | |
| | | @GetMapping("/productSalesAnalysis") |
| | | @Operation(summary = "å产åéå®éé¢åæ") |
| | | public R productSalesAnalysis() { |
| | | List<MapDto> list = homeService.productSalesAnalysis(); |
| | | public R productSalesAnalysis( |
| | | @RequestParam(required = false) String startDate, |
| | | @RequestParam(required = false) String endDate) { |
| | | List<MapDto> list = homeService.productSalesAnalysis(startDate, endDate); |
| | | return R.ok(list); |
| | | } |
| | | |
| | | @GetMapping("/rawMaterialPurchaseAmountRatio") |
| | | @Operation(summary = "åææéè´éé¢å æ¯") |
| | | public R rawMaterialPurchaseAmountRatio(){ |
| | | List<MapDto> list = homeService.rawMaterialPurchaseAmountRatio(); |
| | | public R rawMaterialPurchaseAmountRatio( |
| | | @RequestParam(required = false) String startDate, |
| | | @RequestParam(required = false) String endDate){ |
| | | List<MapDto> list = homeService.rawMaterialPurchaseAmountRatio(startDate, endDate); |
| | | return R.ok(list); |
| | | } |
| | | |
| | |
| | | } |
| | | Integer statusFromParam = parseOrderStatus(status); |
| | | if (!isBlank(status) && statusFromParam == null && !"all".equalsIgnoreCase(status.trim())) { |
| | | return R.fail("statusåæ°ä¸åæ³ï¼å¯éå¼ï¼all/waiting/inProgress/completed/end æ 1/2/3/5"); |
| | | return R.fail("statusåæ°ä¸åæ³ï¼å¯éå¼ï¼all/waiting/inProgress/completed/paused æ 1/2/3/4"); |
| | | } |
| | | Integer queryStatus = resolveOrderStatus(status, tab); |
| | | |
| | |
| | | long waitingCount = 0L; |
| | | long inProgressCount = 0L; |
| | | long completedCount = 0L; |
| | | long endCount = 0L; |
| | | long pausedCount = 0L; |
| | | List<Map<String, Object>> statusCountRows = productionOrderMapper.countHomeOrderProgressByStatus(startTime, endTime); |
| | | if (statusCountRows != null) { |
| | | for (Map<String, Object> countRow : statusCountRows) { |
| | |
| | | inProgressCount = cnt; |
| | | } else if (Objects.equals(statusKey, ORDER_STATUS_COMPLETED)) { |
| | | completedCount = cnt; |
| | | } else if (Objects.equals(statusKey, ORDER_STATUS_END)) { |
| | | endCount = cnt; |
| | | } else if (Objects.equals(statusKey, ORDER_STATUS_PAUSED)) { |
| | | pausedCount = cnt; |
| | | } |
| | | } |
| | | } |
| | |
| | | result.put("waitingCount", waitingCount); |
| | | result.put("inProgressCount", inProgressCount); |
| | | result.put("completedCount", completedCount); |
| | | result.put("endCount", endCount); |
| | | result.put("pausedCount", pausedCount); |
| | | result.put("records", records); |
| | | return R.ok(result); |
| | | } |
| | |
| | | |
| | | @GetMapping("/salesPurchaseStorageProductCount") |
| | | @Operation(summary = "éå®-éè´-å¨åäº§åæ°") |
| | | public R salesPurchaseStorageProductCount(){ |
| | | List<MapDto> list = homeService.salesPurchaseStorageProductCount(); |
| | | public R salesPurchaseStorageProductCount( |
| | | @RequestParam(required = false) String startDate, |
| | | @RequestParam(required = false) String endDate){ |
| | | List<MapDto> list = homeService.salesPurchaseStorageProductCount(startDate, endDate); |
| | | return R.ok(list); |
| | | } |
| | | |
| | | @GetMapping("/productInOutAnalysis") |
| | | @Operation(summary = "产ååºå
¥åºåæ") |
| | | public R productInOutAnalysis(@DefaultType Integer type){ |
| | | List<Map<String, Object>> result = homeService.productInOutAnalysis(type); |
| | | public R productInOutAnalysis(@DefaultType Integer type, |
| | | @RequestParam(required = false) String startDate, |
| | | @RequestParam(required = false) String endDate){ |
| | | List<Map<String, Object>> result = homeService.productInOutAnalysis(type, startDate, endDate); |
| | | return R.ok(result); |
| | | } |
| | | |
| | | @GetMapping("/productTurnoverDays") |
| | | @Operation(summary = "产åå¨è½¬å¤©æ°") |
| | | public R productTurnoverDays(){ |
| | | List<MapDto> list = homeService.productTurnoverDays(); |
| | | public R productTurnoverDays( |
| | | @RequestParam(required = false) String startDate, |
| | | @RequestParam(required = false) String endDate){ |
| | | List<MapDto> list = homeService.productTurnoverDays(startDate, endDate); |
| | | return R.ok(list); |
| | | } |
| | | |
| | |
| | | if ("3".equals(normalized) || "completed".equals(normalized)) { |
| | | return ORDER_STATUS_COMPLETED; |
| | | } |
| | | if ("5".equals(normalized) || "end".equals(normalized)) { |
| | | return ORDER_STATUS_END; |
| | | if ("4".equals(normalized) || "paused".equals(normalized)) { |
| | | return ORDER_STATUS_PAUSED; |
| | | } |
| | | return null; |
| | | } |
| | |
| | | if (Objects.equals(status, ORDER_STATUS_COMPLETED)) { |
| | | return "completed"; |
| | | } |
| | | if (Objects.equals(status, ORDER_STATUS_END)) { |
| | | return "end"; |
| | | if (Objects.equals(status, ORDER_STATUS_PAUSED)) { |
| | | return "paused"; |
| | | } |
| | | if (Objects.equals(status, ORDER_STATUS_WAIT)) { |
| | | return "waiting"; |
| | |
| | | if (Objects.equals(status, ORDER_STATUS_COMPLETED)) { |
| | | return "completed"; |
| | | } |
| | | if (Objects.equals(status, ORDER_STATUS_END)) { |
| | | return "end"; |
| | | if (Objects.equals(status, ORDER_STATUS_PAUSED)) { |
| | | return "paused"; |
| | | } |
| | | return "all"; |
| | | } |
| | |
| | | if (Objects.equals(status, ORDER_STATUS_COMPLETED)) { |
| | | return "已宿"; |
| | | } |
| | | if (Objects.equals(status, ORDER_STATUS_END)) { |
| | | return "å·²ç»æ"; |
| | | if (Objects.equals(status, ORDER_STATUS_PAUSED)) { |
| | | return "å·²æå"; |
| | | } |
| | | return "æªç¥"; |
| | | } |
| | |
| | | .select(ProductionOrder::getQuantity, ProductionOrder::getCompleteQuantity) |
| | | .ge(ProductionOrder::getCreateTime, day.atStartOfDay()) |
| | | .lt(ProductionOrder::getCreateTime, day.plusDays(1).atStartOfDay()) |
| | | .ne(ProductionOrder::getStatus, ORDER_STATUS_END)); |
| | | .ne(ProductionOrder::getStatus, ORDER_STATUS_PAUSED)); |
| | | |
| | | BigDecimal totalQuantity = BigDecimal.ZERO; |
| | | BigDecimal totalCompleteQuantity = BigDecimal.ZERO; |
| | |
| | | |
| | | import com.ruoyi.dto.MapDto; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | import org.apache.ibatis.annotations.Param; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * é¦é¡µç»è®¡ Mapper |
| | | * |
| | | * @author antigravity |
| | | */ |
| | | @Mapper |
| | | public interface HomeMapper { |
| | | /** |
| | | * æ¥è¯¢äº§åå¨è½¬å¤©æ° |
| | | * |
| | | * |
| | | * @return 产åå¨è½¬å¤©æ°å表 |
| | | */ |
| | | List<MapDto> productTurnoverDays(); |
| | | |
| | | List<MapDto> productTurnoverDaysByDate(@Param("startDate") String startDate, @Param("endDate") String endDate); |
| | | |
| | | /** |
| | | * æ¥è¯¢éè´å大类åå¸ï¼å产åå°ç±»çéè´æ°é/éé¢ï¼ |
| | | * |
| | | * @return éè´åå¸å表 |
| | | */ |
| | | List<MapDto> selectPurchaseCategoryDistribution(); |
| | | } |
| | |
| | | |
| | | HomeSummaryDto summaryStatistics(); |
| | | |
| | | List<SupplierPurchaseRankingDto> supplierPurchaseRanking(Integer type); |
| | | List<SupplierPurchaseRankingDto> supplierPurchaseRanking(Integer type, String startDate, String endDate); |
| | | |
| | | CustomerRevenueAnalysisDto customerRevenueAnalysis(Long customerId, Integer type); |
| | | |
| | | ProductCategoryDistributionDto productCategoryDistribution(); |
| | | |
| | | List<CustomerContributionRankingDto> customerContributionRanking(Integer type); |
| | | List<CustomerContributionRankingDto> customerContributionRanking(Integer type, String startDate, String endDate); |
| | | |
| | | List<MapDto> productSalesAnalysis(); |
| | | List<MapDto> productSalesAnalysis(String startDate, String endDate); |
| | | |
| | | List<MapDto> rawMaterialPurchaseAmountRatio(); |
| | | List<MapDto> rawMaterialPurchaseAmountRatio(String startDate, String endDate); |
| | | |
| | | List<MapDto> salesPurchaseStorageProductCount(); |
| | | List<MapDto> salesPurchaseStorageProductCount(String startDate, String endDate); |
| | | |
| | | List<Map<String, Object>> productInOutAnalysis(Integer type); |
| | | List<Map<String, Object>> productInOutAnalysis(Integer type, String startDate, String endDate); |
| | | |
| | | List<MapDto> productTurnoverDays(); |
| | | List<MapDto> productTurnoverDays(String startDate, String endDate); |
| | | |
| | | List<Map<String, Object>> incomeExpenseAnalysis(Integer type); |
| | | |
| | |
| | | } |
| | | |
| | | @Override |
| | | public List<SupplierPurchaseRankingDto> supplierPurchaseRanking(Integer type) { |
| | | LocalDate today = LocalDate.now(); |
| | | public List<SupplierPurchaseRankingDto> supplierPurchaseRanking(Integer type, String startDateStr, String endDateStr) { |
| | | LocalDate startDate; |
| | | LocalDate endDate; |
| | | switch (type) { |
| | | case 1: // å¨ |
| | | startDate = today.with(DayOfWeek.MONDAY); |
| | | endDate = today.with(DayOfWeek.SUNDAY); |
| | | break; |
| | | case 2: // æ |
| | | startDate = today.with(TemporalAdjusters.firstDayOfMonth()); |
| | | endDate = today.with(TemporalAdjusters.lastDayOfMonth()); |
| | | break; |
| | | case 3: // å£åº¦ |
| | | Month currentMonth = today.getMonth(); |
| | | Month firstMonthOfQuarter = currentMonth.firstMonthOfQuarter(); |
| | | Month lastMonthOfQuarter = Month.of(firstMonthOfQuarter.getValue() + 2); |
| | | |
| | | startDate = today.withMonth(firstMonthOfQuarter.getValue()).with(TemporalAdjusters.firstDayOfMonth()); |
| | | endDate = today.withMonth(lastMonthOfQuarter.getValue()).with(TemporalAdjusters.lastDayOfMonth()); |
| | | break; |
| | | default: |
| | | return new ArrayList<>(); |
| | | if (com.ruoyi.common.utils.StringUtils.isNotBlank(startDateStr) && com.ruoyi.common.utils.StringUtils.isNotBlank(endDateStr)) { |
| | | startDate = LocalDate.parse(startDateStr); |
| | | endDate = LocalDate.parse(endDateStr); |
| | | } else { |
| | | LocalDate today = LocalDate.now(); |
| | | switch (type) { |
| | | case 1: // å¨ |
| | | startDate = today.with(DayOfWeek.MONDAY); |
| | | endDate = today.with(DayOfWeek.SUNDAY); |
| | | break; |
| | | case 2: // æ |
| | | startDate = today.with(TemporalAdjusters.firstDayOfMonth()); |
| | | endDate = today.with(TemporalAdjusters.lastDayOfMonth()); |
| | | break; |
| | | case 3: // å£åº¦ |
| | | Month currentMonth = today.getMonth(); |
| | | Month firstMonthOfQuarter = currentMonth.firstMonthOfQuarter(); |
| | | Month lastMonthOfQuarter = Month.of(firstMonthOfQuarter.getValue() + 2); |
| | | startDate = today.withMonth(firstMonthOfQuarter.getValue()).with(TemporalAdjusters.firstDayOfMonth()); |
| | | endDate = today.withMonth(lastMonthOfQuarter.getValue()).with(TemporalAdjusters.lastDayOfMonth()); |
| | | break; |
| | | default: |
| | | return new ArrayList<>(); |
| | | } |
| | | } |
| | | |
| | | QueryWrapper<PurchaseLedger> queryWrapper = new QueryWrapper<>(); |
| | | queryWrapper.select("supplier_name", "SUM(contract_amount) as total_amount") |
| | | .ge("entry_date", startDate) |
| | | .le("entry_date", endDate) |
| | | // .ne("approval_status", 3) |
| | | .groupBy("supplier_name") |
| | | .orderByDesc("total_amount") |
| | | .last("LIMIT 5"); |
| | |
| | | majorDto.setRate("0.00"); |
| | | } |
| | | |
| | | // æ¥è¯¢å产åå°ç±»çéè´æ°é |
| | | Map<String, BigDecimal> purchaseDataMap = new java.util.HashMap<>(); |
| | | List<com.ruoyi.dto.MapDto> purchaseDistribution = homeMapper.selectPurchaseCategoryDistribution(); |
| | | if (purchaseDistribution != null) { |
| | | for (com.ruoyi.dto.MapDto item : purchaseDistribution) { |
| | | if (item.getName() != null && item.getValue() != null) { |
| | | purchaseDataMap.put(item.getName(), new BigDecimal(item.getValue())); |
| | | } |
| | | } |
| | | } |
| | | |
| | | BigDecimal majorTotalChildrenValue = BigDecimal.ZERO; |
| | | List<ProductCategoryDistributionDto.MinorCategoryDto> minorDtos = new ArrayList<>(); |
| | | for (Product minor : children) { |
| | | ProductCategoryDistributionDto.MinorCategoryDto minorDto = new ProductCategoryDistributionDto.MinorCategoryDto(); |
| | | minorDto.setName(minor.getProductName()); |
| | | minorDto.setValue("0"); |
| | | BigDecimal minorValue = purchaseDataMap.getOrDefault(minor.getProductName(), BigDecimal.ZERO); |
| | | minorDto.setValue(minorValue.toString()); |
| | | minorDto.setRate("0.00"); |
| | | minorDto.setChildren(new ArrayList<>()); |
| | | minorDtos.add(minorDto); |
| | | majorTotalChildrenValue = majorTotalChildrenValue.add(minorValue); |
| | | } |
| | | majorDto.setChildren(minorDtos); |
| | | // 使ç¨å®é
éè´æ°æ®æ´æ°å¤§ç±»ç value |
| | | if (majorTotalChildrenValue.compareTo(BigDecimal.ZERO) > 0) { |
| | | majorDto.setValue(majorTotalChildrenValue.toString()); |
| | | } |
| | | majorItems.add(majorDto); |
| | | } |
| | | |
| | | // 计ç®å¤§ç±»å æ¯ |
| | | BigDecimal totalAllValue = BigDecimal.ZERO; |
| | | for (ProductCategoryDistributionDto.MajorCategoryDto m : majorItems) { |
| | | try { |
| | | totalAllValue = totalAllValue.add(new BigDecimal(m.getValue())); |
| | | } catch (NumberFormatException ignored) { |
| | | } |
| | | } |
| | | if (totalAllValue.compareTo(BigDecimal.ZERO) > 0) { |
| | | for (ProductCategoryDistributionDto.MajorCategoryDto m : majorItems) { |
| | | try { |
| | | BigDecimal val = new BigDecimal(m.getValue()); |
| | | m.setRate(val.divide(totalAllValue, 4, RoundingMode.HALF_UP) |
| | | .multiply(new BigDecimal("100")) |
| | | .setScale(2, RoundingMode.HALF_UP) |
| | | .toString()); |
| | | } catch (NumberFormatException ignored) { |
| | | } |
| | | } |
| | | } |
| | | // 计ç®å°ç±»å æ¯ï¼å¨å大类å
ï¼ |
| | | for (ProductCategoryDistributionDto.MajorCategoryDto m : majorItems) { |
| | | if (m.getChildren() == null || m.getChildren().isEmpty()) { |
| | | continue; |
| | | } |
| | | BigDecimal parentVal = BigDecimal.ZERO; |
| | | for (ProductCategoryDistributionDto.MinorCategoryDto child : m.getChildren()) { |
| | | try { |
| | | parentVal = parentVal.add(new BigDecimal(child.getValue())); |
| | | } catch (NumberFormatException ignored) { |
| | | } |
| | | } |
| | | if (parentVal.compareTo(BigDecimal.ZERO) > 0) { |
| | | for (ProductCategoryDistributionDto.MinorCategoryDto child : m.getChildren()) { |
| | | try { |
| | | BigDecimal childVal = new BigDecimal(child.getValue()); |
| | | child.setRate(childVal.divide(parentVal, 4, RoundingMode.HALF_UP) |
| | | .multiply(new BigDecimal("100")) |
| | | .setScale(2, RoundingMode.HALF_UP) |
| | | .toString()); |
| | | } catch (NumberFormatException ignored) { |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | dto.setItems(majorItems); |
| | |
| | | } |
| | | |
| | | @Override |
| | | public List<CustomerContributionRankingDto> customerContributionRanking(Integer type) { |
| | | LocalDate today = LocalDate.now(); |
| | | LocalDate startDate = null; |
| | | LocalDate endDate = null; |
| | | switch (type) { |
| | | case 1: |
| | | startDate = today.with(DayOfWeek.MONDAY); |
| | | endDate = today.with(DayOfWeek.SUNDAY); |
| | | break; |
| | | case 2: |
| | | startDate = today.with(TemporalAdjusters.firstDayOfMonth()); |
| | | endDate = today.with(TemporalAdjusters.lastDayOfMonth()); |
| | | break; |
| | | case 3: |
| | | Month currentMonth = today.getMonth(); |
| | | Month firstMonthOfQuarter = currentMonth.firstMonthOfQuarter(); |
| | | Month lastMonthOfQuarter = Month.of(firstMonthOfQuarter.getValue() + 2); |
| | | startDate = today.withMonth(firstMonthOfQuarter.getValue()).with(TemporalAdjusters.firstDayOfMonth()); |
| | | endDate = today.withMonth(lastMonthOfQuarter.getValue()).with(TemporalAdjusters.lastDayOfMonth()); |
| | | break; |
| | | public List<CustomerContributionRankingDto> customerContributionRanking(Integer type, String startDateStr, String endDateStr) { |
| | | LocalDate startDate; |
| | | LocalDate endDate; |
| | | if (com.ruoyi.common.utils.StringUtils.isNotBlank(startDateStr) && com.ruoyi.common.utils.StringUtils.isNotBlank(endDateStr)) { |
| | | startDate = LocalDate.parse(startDateStr); |
| | | endDate = LocalDate.parse(endDateStr); |
| | | } else { |
| | | LocalDate today = LocalDate.now(); |
| | | switch (type) { |
| | | case 1: |
| | | startDate = today.with(DayOfWeek.MONDAY); |
| | | endDate = today.with(DayOfWeek.SUNDAY); |
| | | break; |
| | | case 2: |
| | | startDate = today.with(TemporalAdjusters.firstDayOfMonth()); |
| | | endDate = today.with(TemporalAdjusters.lastDayOfMonth()); |
| | | break; |
| | | case 3: |
| | | Month currentMonth = today.getMonth(); |
| | | Month firstMonthOfQuarter = currentMonth.firstMonthOfQuarter(); |
| | | Month lastMonthOfQuarter = Month.of(firstMonthOfQuarter.getValue() + 2); |
| | | startDate = today.withMonth(firstMonthOfQuarter.getValue()).with(TemporalAdjusters.firstDayOfMonth()); |
| | | endDate = today.withMonth(lastMonthOfQuarter.getValue()).with(TemporalAdjusters.lastDayOfMonth()); |
| | | break; |
| | | default: |
| | | return new ArrayList<>(); |
| | | } |
| | | } |
| | | |
| | | QueryWrapper<SalesLedger> queryWrapper = new QueryWrapper<>(); |
| | | queryWrapper.select("customer_name", "SUM(contract_amount) as total_amount") |
| | | .isNotNull("customer_name") |
| | | .between("entry_date", startDate, endDate) |
| | | .groupBy("customer_name") |
| | | .orderByDesc("total_amount") |
| | | .last("LIMIT 5"); |
| | | |
| | | if (startDate != null && endDate != null) { |
| | | queryWrapper.between("entry_date", startDate, endDate); |
| | | } |
| | | |
| | | List<Map<String, Object>> maps = salesLedgerMapper.selectMaps(queryWrapper); |
| | | List<CustomerContributionRankingDto> result = new ArrayList<>(); |
| | |
| | | } |
| | | |
| | | @Override |
| | | public List<MapDto> productSalesAnalysis() { |
| | | // è·åææäº§å大类çéå®é¢ |
| | | List<Map<String, Object>> analysisResults = salesLedgerProductMapper.selectProductSalesAnalysis(); |
| | | public List<MapDto> productSalesAnalysis(String startDateStr, String endDateStr) { |
| | | List<Map<String, Object>> analysisResults; |
| | | if (com.ruoyi.common.utils.StringUtils.isNotBlank(startDateStr) && com.ruoyi.common.utils.StringUtils.isNotBlank(endDateStr)) { |
| | | analysisResults = salesLedgerProductMapper.selectProductSalesAnalysisByDate(startDateStr, endDateStr); |
| | | } else { |
| | | analysisResults = salesLedgerProductMapper.selectProductSalesAnalysis(); |
| | | } |
| | | if (CollectionUtils.isEmpty(analysisResults)) { |
| | | return new ArrayList<>(); |
| | | } |
| | |
| | | } |
| | | |
| | | @Override |
| | | public List<MapDto> rawMaterialPurchaseAmountRatio() { |
| | | // è·åææåææçéè´é¢ |
| | | List<Map<String, Object>> analysisResults = salesLedgerProductMapper.selectRawMaterialPurchaseAnalysis(); |
| | | public List<MapDto> rawMaterialPurchaseAmountRatio(String startDateStr, String endDateStr) { |
| | | List<Map<String, Object>> analysisResults; |
| | | if (com.ruoyi.common.utils.StringUtils.isNotBlank(startDateStr) && com.ruoyi.common.utils.StringUtils.isNotBlank(endDateStr)) { |
| | | analysisResults = salesLedgerProductMapper.selectRawMaterialPurchaseAnalysisByDate(startDateStr, endDateStr); |
| | | } else { |
| | | analysisResults = salesLedgerProductMapper.selectRawMaterialPurchaseAnalysis(); |
| | | } |
| | | if (CollectionUtils.isEmpty(analysisResults)) { |
| | | return new ArrayList<>(); |
| | | } |
| | |
| | | } |
| | | |
| | | @Override |
| | | public List<MapDto> salesPurchaseStorageProductCount() { |
| | | public List<MapDto> salesPurchaseStorageProductCount(String startDate, String endDate) { |
| | | LocalDateTime now = LocalDateTime.now(); |
| | | LocalDateTime currentMonthStart = now.with(TemporalAdjusters.firstDayOfMonth()).with(LocalTime.MIN); |
| | | LocalDateTime lastMonth = now.minusMonths(1); |
| | | LocalDateTime lastMonthStart = lastMonth.with(TemporalAdjusters.firstDayOfMonth()).with(LocalTime.MIN); |
| | | LocalDateTime lastMonthEnd = lastMonth.with(TemporalAdjusters.lastDayOfMonth()).with(LocalTime.MAX); |
| | | LocalDateTime currentMonthStart; |
| | | LocalDateTime currentMonthEnd; |
| | | LocalDateTime lastMonthStart; |
| | | LocalDateTime lastMonthEnd; |
| | | |
| | | // éå® |
| | | int currentSales = salesLedgerProductMapper.selectProductCountByTypeAndDate(1, currentMonthStart, now); |
| | | int lastSales = salesLedgerProductMapper.selectProductCountByTypeAndDate(1, lastMonthStart, lastMonthEnd); |
| | | // éè´ |
| | | int currentPurchase = salesLedgerProductMapper.selectProductCountByTypeAndDate(2, currentMonthStart, now); |
| | | if (StringUtils.isNotBlank(startDate) && StringUtils.isNotBlank(endDate)) { |
| | | LocalDate start = LocalDate.parse(startDate); |
| | | LocalDate end = LocalDate.parse(endDate); |
| | | currentMonthStart = start.atStartOfDay(); |
| | | currentMonthEnd = end.atTime(LocalTime.MAX); |
| | | long daysBetween = java.time.temporal.ChronoUnit.DAYS.between(start, end) + 1; |
| | | LocalDate lastStart = start.minusDays(daysBetween); |
| | | LocalDate lastEnd = start.minusDays(1); |
| | | lastMonthStart = lastStart.atStartOfDay(); |
| | | lastMonthEnd = lastEnd.atTime(LocalTime.MAX); |
| | | } else { |
| | | currentMonthStart = now.with(TemporalAdjusters.firstDayOfMonth()).with(LocalTime.MIN); |
| | | currentMonthEnd = now; |
| | | LocalDateTime lastMonth = now.minusMonths(1); |
| | | lastMonthStart = lastMonth.with(TemporalAdjusters.firstDayOfMonth()).with(LocalTime.MIN); |
| | | lastMonthEnd = lastMonth.with(TemporalAdjusters.lastDayOfMonth()).with(LocalTime.MAX); |
| | | } |
| | | |
| | | // éå®è®¢åæ°ï¼ç»è®¡sales_ledgerè¡¨ï¼ |
| | | int currentSales = Math.toIntExact(salesLedgerMapper.selectCount(new LambdaQueryWrapper<SalesLedger>() |
| | | .ge(SalesLedger::getEntryDate, currentMonthStart) |
| | | .le(SalesLedger::getEntryDate, currentMonthEnd))); |
| | | int lastSales = Math.toIntExact(salesLedgerMapper.selectCount(new LambdaQueryWrapper<SalesLedger>() |
| | | .ge(SalesLedger::getEntryDate, lastMonthStart) |
| | | .le(SalesLedger::getEntryDate, lastMonthEnd))); |
| | | // éè´äº§åæ° |
| | | int currentPurchase = salesLedgerProductMapper.selectProductCountByTypeAndDate(2, currentMonthStart, currentMonthEnd); |
| | | int lastPurchase = salesLedgerProductMapper.selectProductCountByTypeAndDate(2, lastMonthStart, lastMonthEnd); |
| | | // å¨å |
| | | int currentStorage = stockInventoryMapper.selectStorageProductCountByDate(currentMonthStart, now); |
| | | // å¨åäº§åæ° |
| | | int currentStorage = stockInventoryMapper.selectStorageProductCountByDate(currentMonthStart, currentMonthEnd); |
| | | int lastStorage = stockInventoryMapper.selectStorageProductCountByDate(lastMonthStart, lastMonthEnd); |
| | | |
| | | List<MapDto> list = new ArrayList<>(); |
| | | list.add(createMapDto("éå®äº§åæ°", currentSales, lastSales)); |
| | | list.add(createMapDto("éå®è®¢åæ°", currentSales, lastSales)); |
| | | list.add(createMapDto("éè´äº§åæ°", currentPurchase, lastPurchase)); |
| | | list.add(createMapDto("å¨åäº§åæ°", currentStorage, lastStorage)); |
| | | |
| | |
| | | } |
| | | |
| | | @Override |
| | | public List<Map<String, Object>> productInOutAnalysis(Integer type) { |
| | | public List<Map<String, Object>> productInOutAnalysis(Integer type, String startDateStr, String endDateStr) { |
| | | String targetName; |
| | | if (type == 1) { |
| | | targetName = "åææ"; |
| | |
| | | LocalDate now = LocalDate.now(); |
| | | DateTimeFormatter displayDtf = DateTimeFormatter.ofPattern("M/d"); |
| | | |
| | | String startDate = now.minusDays(6).toString(); |
| | | String endDate = now.toString(); |
| | | LocalDate start; |
| | | LocalDate end; |
| | | if (com.ruoyi.common.utils.StringUtils.isNotBlank(startDateStr) && com.ruoyi.common.utils.StringUtils.isNotBlank(endDateStr)) { |
| | | start = LocalDate.parse(startDateStr); |
| | | end = LocalDate.parse(endDateStr); |
| | | } else { |
| | | end = now; |
| | | start = now.minusDays(6); |
| | | } |
| | | String startDate = start.toString(); |
| | | String endDate = end.toString(); |
| | | |
| | | List<Map<String, Object>> inCounts = stockInventoryMapper.selectDailyStockInCounts(rootCategoryId, startDate, |
| | | endDate + " 23:59:59"); |
| | |
| | | |
| | | List<Map<String, Object>> result = new ArrayList<>(); |
| | | |
| | | for (int i = 6; i >= 0; i--) { |
| | | LocalDate date = now.minusDays(i); |
| | | long daysBetween = ChronoUnit.DAYS.between(start, end); |
| | | for (int i = (int) daysBetween; i >= 0; i--) { |
| | | LocalDate date = end.minusDays(i); |
| | | |
| | | Map<String, Object> dataPoint = new LinkedHashMap<>(); |
| | | dataPoint.put("date", date.format(displayDtf)); // 1/23 |
| | |
| | | } |
| | | |
| | | @Override |
| | | public List<MapDto> productTurnoverDays() { |
| | | public List<MapDto> productTurnoverDays(String startDateStr, String endDateStr) { |
| | | if (com.ruoyi.common.utils.StringUtils.isNotBlank(startDateStr) && com.ruoyi.common.utils.StringUtils.isNotBlank(endDateStr)) { |
| | | return homeMapper.productTurnoverDaysByDate(startDateStr, endDateStr); |
| | | } |
| | | return homeMapper.productTurnoverDays(); |
| | | } |
| | | |
| | |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.io.IOException; |
| | | |
| | | /** |
| | | * @author :yys |
| | | * @date : 2025/9/19 10:52 |
| | | */ |
| | | @RestController |
| | | @Tag(name = "å·¡æ£ä»»å¡è®°å½") |
| | | @RequestMapping("/inspectionTask") |
| | |
| | | |
| | | private InspectionTaskService inspectionTaskService; |
| | | |
| | | /** |
| | | * å·¡æ£ä»»å¡è¡¨è¡¨æ¥è¯¢ |
| | | */ |
| | | @GetMapping("/list") |
| | | @Operation(summary = "å·¡æ£ä»»å¡è¡¨è¡¨æ¥è¯¢") |
| | | @Operation(summary = "å·¡æ£ä»»å¡è¡¨æ¥è¯¢") |
| | | public R<IPage<InspectionTaskDto>> list(Page<InspectionTask> page, InspectionTaskDto inspectionTaskDto) { |
| | | IPage<InspectionTaskDto> list = inspectionTaskService.selectInspectionTaskList(page, inspectionTaskDto); |
| | | return R.ok(list); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * å¯¼åº |
| | | */ |
| | | @PostMapping("/export") |
| | | @Operation(summary = "导åºå®æ¶ä»»å¡è®°å½") |
| | | public void export(HttpServletResponse response) { |
| | |
| | | util.exportExcel(response, list.getRecords(), "导åºå®æ¶ä»»å¡è®°å½"); |
| | | } |
| | | |
| | | /** |
| | | * å·¡æ£ä»»å¡è¡¨æ°å¢ä¿®æ¹ |
| | | */ |
| | | @PostMapping("/addOrEditInspectionTask") |
| | | @Operation(summary = "å·¡æ£ä»»å¡è¡¨æ°å¢ä¿®æ¹") |
| | | @Transactional(rollbackFor = Exception.class) |
| | |
| | | return R.ok(inspectionTaskService.addOrEditInspectionTask(inspectionTaskDto)); |
| | | } |
| | | |
| | | /** |
| | | * å·¡æ£ä»»å¡è¡¨å é¤ |
| | | */ |
| | | @DeleteMapping("/delInspectionTask") |
| | | @Operation(summary = "å·¡æ£ä»»å¡è¡¨å é¤") |
| | | @Transactional(rollbackFor = Exception.class) |
| | |
| | | return R.ok(inspectionTaskService.delByIds(ids)); |
| | | } |
| | | |
| | | @PutMapping("/complete/{id}") |
| | | @Operation(summary = "å·¡æ£å®æ") |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public R complete(@PathVariable Long id) { |
| | | return R.ok(inspectionTaskService.complete(id)); |
| | | } |
| | | |
| | | @PutMapping("/batchComplete") |
| | | @Operation(summary = "ä¸é®å·¡æ£å®æ") |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public R batchComplete(String dateStr) { |
| | | return R.ok(inspectionTaskService.batchComplete(dateStr)); |
| | | } |
| | | |
| | | } |
| | |
| | | @Schema(description = "å·¡æ£å°ç¹è¯¦ç»æè¿°") |
| | | private String inspectionLocation; |
| | | |
| | | @Schema(description = "ç¶æ 0=å¾
å·¡æ£, 1=已宿") |
| | | private Integer status; |
| | | |
| | | @Schema(description = "软å 餿 å¿ï¼0=æªå é¤ï¼1=å·²å é¤") |
| | | private Integer deleted; |
| | | |
| | |
| | | import com.ruoyi.inspectiontask.dto.InspectionTaskDto; |
| | | import com.ruoyi.inspectiontask.pojo.InspectionTask; |
| | | |
| | | /** |
| | | * @author :yys |
| | | * @date : 2025/9/19 10:49 |
| | | */ |
| | | public interface InspectionTaskService extends IService<InspectionTask> { |
| | | |
| | | IPage<InspectionTaskDto> selectInspectionTaskList(Page<InspectionTask> page, InspectionTaskDto inspectionTaskDto); |
| | |
| | | int addOrEditInspectionTask(InspectionTaskDto inspectionTaskDto); |
| | | |
| | | int delByIds(Long[] ids); |
| | | |
| | | int complete(Long id); |
| | | |
| | | int batchComplete(String dateStr); |
| | | } |
| | |
| | | // ä¿åæä»¶ï¼å段ä¸ä¼ åä¿çåå²ï¼ |
| | | saveInspectionAttachments(inspectionTask.getId(), inspectionTaskDto); |
| | | |
| | | // å·¡æ£ç»æè®¾ç½®åï¼èªå¨æ è®°ä¸ºå·²å®æ |
| | | if (StringUtils.isNotBlank(inspectionTaskDto.getInspectionResult())) { |
| | | InspectionTask statusUpdate = new InspectionTask(); |
| | | statusUpdate.setId(inspectionTask.getId()); |
| | | statusUpdate.setStatus(1); |
| | | inspectionTaskMapper.updateById(statusUpdate); |
| | | } |
| | | |
| | | return i; |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public int complete(Long id) { |
| | | InspectionTask task = inspectionTaskMapper.selectById(id); |
| | | if (task == null) { |
| | | throw new IllegalArgumentException("å·¡æ£ä»»å¡ä¸åå¨"); |
| | | } |
| | | if (task.getStatus() != null && task.getStatus() == 1) { |
| | | throw new IllegalArgumentException("该巡æ£ä»»å¡å·²å®æ"); |
| | | } |
| | | task.setStatus(1); |
| | | if (task.getInspectionResult() == null) { |
| | | task.setInspectionResult("1"); |
| | | } |
| | | return inspectionTaskMapper.updateById(task); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public int batchComplete(String dateStr) { |
| | | if (StringUtils.isBlank(dateStr)) { |
| | | throw new IllegalArgumentException("æ¥æåæ°ä¸è½ä¸ºç©º"); |
| | | } |
| | | java.time.LocalDate date = java.time.LocalDate.parse(dateStr); |
| | | java.time.LocalDateTime startOfDay = date.atStartOfDay(); |
| | | java.time.LocalDateTime endOfDay = date.atTime(java.time.LocalTime.MAX); |
| | | List<InspectionTask> tasks = inspectionTaskMapper.selectList( |
| | | new LambdaQueryWrapper<InspectionTask>() |
| | | .eq(InspectionTask::getStatus, 0) |
| | | .ge(InspectionTask::getCreateTime, startOfDay) |
| | | .le(InspectionTask::getCreateTime, endOfDay)); |
| | | if (tasks.isEmpty()) { |
| | | throw new IllegalArgumentException("è¯¥æ¥æä¸æ²¡æå¾
宿çå·¡æ£è®°å½"); |
| | | } |
| | | int count = 0; |
| | | for (InspectionTask task : tasks) { |
| | | task.setStatus(1); |
| | | if (task.getInspectionResult() == null) { |
| | | task.setInspectionResult("1"); |
| | | } |
| | | inspectionTaskMapper.updateById(task); |
| | | count++; |
| | | } |
| | | return count; |
| | | } |
| | | |
| | | private void validateInspectionInput(InspectionTaskDto inspectionTaskDto, InspectionTask oldInspectionTask) { |
| | | String inspectionResult = inspectionTaskDto.getInspectionResult(); |
| | | if (StringUtils.isBlank(inspectionResult) && oldInspectionTask != null) { |
| | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import com.ruoyi.measuringinstrumentledger.dto.SparePartsOutboundDto; |
| | | import com.ruoyi.measuringinstrumentledger.dto.SparePartsRequisitionRecordDto; |
| | | import com.ruoyi.measuringinstrumentledger.service.SparePartsRequisitionRecordService; |
| | | import io.swagger.v3.oas.annotations.tags.Tag; |
| | | import io.swagger.v3.oas.annotations.Operation; |
| | | import lombok.AllArgsConstructor; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | /** |
| | | * <p> |
| | | * å端æ§å¶å¨ |
| | | * </p> |
| | | * |
| | | * @author è¯å¯¼è½¯ä»¶ï¼æ±èï¼æéå
¬å¸ |
| | | * @since 2026-04-02 03:59:56 |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/sparePartsRequisitionRecord") |
| | | @Tag(name = "å¤ä»¶é¢ç¨è®°å½æ¥å£") |
| | |
| | | private SparePartsRequisitionRecordService sparePartsRequisitionRecordService; |
| | | |
| | | @GetMapping("/listPage") |
| | | @Operation(summary = "å¤ä»¶åç±»-å页æ¥è¯¢") |
| | | @Operation(summary = "å¤ä»¶é¢ç¨è®°å½-å页æ¥è¯¢") |
| | | public AjaxResult listPage(Page page, SparePartsRequisitionRecordDto sparePartsRequisitionRecordDto){ |
| | | IPage<SparePartsRequisitionRecordDto> listPage = sparePartsRequisitionRecordService.listPage(page, sparePartsRequisitionRecordDto); |
| | | return AjaxResult.success(listPage); |
| | | } |
| | | |
| | | @PostMapping("/outbound") |
| | | @Operation(summary = "å¤ä»¶ç¬ç«åºåº") |
| | | public AjaxResult outbound(@RequestBody SparePartsOutboundDto dto){ |
| | | sparePartsRequisitionRecordService.outbound(dto); |
| | | return AjaxResult.success(); |
| | | } |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.measuringinstrumentledger.dto; |
| | | |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.Data; |
| | | |
| | | @Data |
| | | @Schema(name = "å¤ä»¶åºåºè¯·æ±") |
| | | public class SparePartsOutboundDto { |
| | | |
| | | @Schema(description = "å¤ä»¶ID", requiredMode = Schema.RequiredMode.REQUIRED) |
| | | private Long sparePartsId; |
| | | |
| | | @Schema(description = "åºåºæ°é", requiredMode = Schema.RequiredMode.REQUIRED) |
| | | private Integer quantity; |
| | | |
| | | @Schema(description = "设å¤IDï¼å¯éï¼") |
| | | private Long deviceLedgerId; |
| | | |
| | | @Schema(description = "夿³¨ï¼å¯éï¼") |
| | | private String remark; |
| | | } |
| | |
| | | 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.measuringinstrumentledger.dto.SparePartsOutboundDto; |
| | | import com.ruoyi.measuringinstrumentledger.dto.SparePartsRequisitionRecordDto; |
| | | import com.ruoyi.measuringinstrumentledger.pojo.SparePartsRequisitionRecord; |
| | | |
| | | /** |
| | | * <p> |
| | | * æå¡ç±» |
| | | * </p> |
| | | * |
| | | * @author è¯å¯¼è½¯ä»¶ï¼æ±èï¼æéå
¬å¸ |
| | | * @since 2026-04-02 03:59:56 |
| | | */ |
| | | public interface SparePartsRequisitionRecordService extends IService<SparePartsRequisitionRecord> { |
| | | IPage<SparePartsRequisitionRecordDto> listPage(Page page, SparePartsRequisitionRecordDto sparePartsRequisitionRecordDto); |
| | | |
| | | void outbound(SparePartsOutboundDto dto); |
| | | } |
| | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.common.enums.SparePartsRequisitionRecordSourceTypeEnum; |
| | | import com.ruoyi.measuringinstrumentledger.dto.SparePartsOutboundDto; |
| | | import com.ruoyi.measuringinstrumentledger.dto.SparePartsRequisitionRecordDto; |
| | | import com.ruoyi.measuringinstrumentledger.mapper.SparePartsMapper; |
| | | import com.ruoyi.measuringinstrumentledger.mapper.SparePartsRequisitionRecordMapper; |
| | | import com.ruoyi.measuringinstrumentledger.pojo.SpareParts; |
| | | import com.ruoyi.measuringinstrumentledger.pojo.SparePartsRequisitionRecord; |
| | | import com.ruoyi.measuringinstrumentledger.service.SparePartsRequisitionRecordService; |
| | | import lombok.RequiredArgsConstructor; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | /** |
| | | * <p> |
| | | * æå¡å®ç°ç±» |
| | | * </p> |
| | | * |
| | | * @author è¯å¯¼è½¯ä»¶ï¼æ±èï¼æéå
¬å¸ |
| | | * @since 2026-04-02 03:59:56 |
| | | */ |
| | | import java.math.BigDecimal; |
| | | |
| | | @Service |
| | | @RequiredArgsConstructor |
| | | public class SparePartsRequisitionRecordServiceImpl extends ServiceImpl<SparePartsRequisitionRecordMapper, SparePartsRequisitionRecord> implements SparePartsRequisitionRecordService { |
| | | private final SparePartsRequisitionRecordMapper sparePartsRequisitionRecordMapper; |
| | | private final SparePartsMapper sparePartsMapper; |
| | | |
| | | @Override |
| | | public IPage<SparePartsRequisitionRecordDto> listPage(Page page, SparePartsRequisitionRecordDto sparePartsRequisitionRecordDto) { |
| | | IPage<SparePartsRequisitionRecordDto> result = sparePartsRequisitionRecordMapper.listPage(page, sparePartsRequisitionRecordDto); |
| | | // å¤çæ¥æºç±»åææ¬ |
| | | result.getRecords().forEach(record -> { |
| | | if (record.getSourceType() != null) { |
| | | record.setSourceText(SparePartsRequisitionRecordSourceTypeEnum.getByCode(record.getSourceType()).getValue()); |
| | | SparePartsRequisitionRecordSourceTypeEnum typeEnum = SparePartsRequisitionRecordSourceTypeEnum.getByCode(record.getSourceType()); |
| | | if (typeEnum != null) { |
| | | record.setSourceText(typeEnum.getValue()); |
| | | } |
| | | } |
| | | }); |
| | | return result; |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void outbound(SparePartsOutboundDto dto) { |
| | | SpareParts spareParts = sparePartsMapper.selectById(dto.getSparePartsId()); |
| | | if (spareParts == null) { |
| | | throw new IllegalArgumentException("å¤ä»¶ä¸åå¨"); |
| | | } |
| | | if (spareParts.getQuantity().compareTo(new BigDecimal(dto.getQuantity())) < 0) { |
| | | throw new IllegalArgumentException("å¤ä»¶ " + spareParts.getName() + " åºåä¸è¶³"); |
| | | } |
| | | // æ£ååºå |
| | | spareParts.setQuantity(spareParts.getQuantity().subtract(new BigDecimal(dto.getQuantity()))); |
| | | sparePartsMapper.updateById(spareParts); |
| | | // å建é¢ç¨è®°å½ |
| | | SparePartsRequisitionRecord record = new SparePartsRequisitionRecord(); |
| | | record.setSourceType(SparePartsRequisitionRecordSourceTypeEnum.SparePartsRequisitionRecordSourceTypeDirectOutbound.getCode()); |
| | | record.setSparePartsId(dto.getSparePartsId()); |
| | | record.setQuantity(dto.getQuantity()); |
| | | record.setDeviceLedgerId(dto.getDeviceLedgerId()); |
| | | this.save(record); |
| | | } |
| | | } |
| | |
| | | import com.ruoyi.procurementrecord.service.ReturnManagementService; |
| | | import com.ruoyi.procurementrecord.service.ReturnSaleProductService; |
| | | import com.ruoyi.procurementrecord.utils.StockUtils; |
| | | import com.ruoyi.sales.mapper.SalesLedgerMapper; |
| | | import com.ruoyi.sales.pojo.SalesLedger; |
| | | import com.ruoyi.sales.pojo.ShippingInfo; |
| | | import com.ruoyi.sales.service.ShippingInfoService; |
| | | import lombok.RequiredArgsConstructor; |
| | |
| | | private final ReturnManagementMapper returnManagementMapper; |
| | | private final ReturnSaleProductService returnSaleProductService; |
| | | private final ShippingInfoService shippingInfoService; |
| | | private final SalesLedgerMapper salesLedgerMapper; |
| | | private final SalesRefundAmountOrderService salesRefundAmountOrderService; |
| | | private final StockUtils stockUtils; |
| | | |
| | |
| | | public boolean handle(Long returnManagementId) { |
| | | ReturnManagement byId = this.getById(returnManagementId); |
| | | List<ReturnSaleProductDto> list = returnSaleProductService.listReturnSaleProduct(returnManagementId); |
| | | |
| | | // 1. è®¡ç®æ£ç¡®ç鿬¾æ»é¢ï¼éé¢=åä»·Ãæ°éï¼ |
| | | BigDecimal totalRefund = BigDecimal.ZERO; |
| | | byId.setStatus(1); |
| | | byId.setSettler(SecurityUtils.getLoginUser().getNickName()); |
| | | updateById(byId); |
| | | SalesRefundAmountOrderDto salesRefundAmountOrder = new SalesRefundAmountOrderDto(); |
| | | salesRefundAmountOrder.setReturnManagementId(returnManagementId); |
| | | salesRefundAmountOrder.setStatus(0); |
| | | salesRefundAmountOrder.setCreateTime(byId.getCreateTime()); |
| | | salesRefundAmountOrder.setCreateUserId(SecurityUtils.getUserId()); |
| | | BigDecimal bigDecimal = new BigDecimal(0); |
| | | for (ReturnSaleProductDto returnSaleProduct : list) { |
| | | BigDecimal itemAmount = returnSaleProduct.getAmount() != null |
| | | ? returnSaleProduct.getAmount() |
| | | : BigDecimal.ZERO; |
| | | totalRefund = totalRefund.add(itemAmount); |
| | | // æ¯å¦æè´¨éé®é¢ |
| | | bigDecimal = bigDecimal.add(returnSaleProduct.getPrice()); |
| | | salesRefundAmountOrder.setRefundedAmount(new BigDecimal(0)); |
| | | if (returnSaleProduct.getIsQuality() == 1) { |
| | | stockUtils.addUnStockWithBatchNo(returnSaleProduct.getProductModelId(), returnSaleProduct.getNum(), StockInQualifiedRecordTypeEnum.RETURN_UNSTOCK_IN.getCode(), returnSaleProduct.getId(), returnSaleProduct.getBatchNo()); |
| | | } else { |
| | | stockUtils.addStockWithBatchNo(returnSaleProduct.getProductModelId(), returnSaleProduct.getNum(), StockInQualifiedRecordTypeEnum.RETURN_HE_IN.getCode(), returnSaleProduct.getId(), returnSaleProduct.getBatchNo()); |
| | | } |
| | | } |
| | | |
| | | // 2. æ´æ°éè´§åç¶æå鿬¾æ»é¢ |
| | | byId.setStatus(1); |
| | | byId.setSettler(SecurityUtils.getLoginUser().getNickName()); |
| | | byId.setRefundAmount(totalRefund); |
| | | updateById(byId); |
| | | |
| | | // 3. æ´æ°éå®å°è´¦çå®é
ååéé¢ |
| | | if (byId.getShippingId() != null) { |
| | | ShippingInfo shippingInfo = shippingInfoService.getById(byId.getShippingId()); |
| | | if (shippingInfo != null && shippingInfo.getSalesLedgerId() != null) { |
| | | SalesLedger salesLedger = salesLedgerMapper.selectById(shippingInfo.getSalesLedgerId()); |
| | | if (salesLedger != null && salesLedger.getContractAmount() != null) { |
| | | BigDecimal baseAmount = salesLedger.getNetContractAmount() != null |
| | | ? salesLedger.getNetContractAmount() |
| | | : salesLedger.getContractAmount(); |
| | | salesLedger.setNetContractAmount(baseAmount.subtract(totalRefund)); |
| | | salesLedgerMapper.updateById(salesLedger); |
| | | } |
| | | } |
| | | } |
| | | salesRefundAmountOrder.setRefundAmount(bigDecimal); |
| | | salesRefundAmountOrder.setNotRefundedAmount(salesRefundAmountOrder.getRefundedAmount()); |
| | | return true; |
| | | } |
| | | |
| | |
| | | package com.ruoyi.purchase.controller; |
| | | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.account.service.purchase.AccountPurchasePaymentService; |
| | | import com.ruoyi.basic.service.ISupplierService; |
| | | import com.ruoyi.common.utils.poi.ExcelUtil; |
| | | import com.ruoyi.framework.aspectj.lang.annotation.Log; |
| | | import com.ruoyi.framework.aspectj.lang.enums.BusinessType; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import com.ruoyi.purchase.dto.SavePaymentDto; |
| | | import com.ruoyi.purchase.dto.VatDto; |
| | | import com.ruoyi.purchase.dto.VatSummaryDto; |
| | | import com.ruoyi.purchase.service.PurchaseReportService; |
| | | import com.ruoyi.purchase.vo.PurchaseReportVo; |
| | | import io.swagger.v3.oas.annotations.Operation; |
| | |
| | | import lombok.AllArgsConstructor; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | |
| | | |
| | | private final ISupplierService supplierService; |
| | | private final PurchaseReportService purchaseReportService; |
| | | |
| | | private final AccountPurchasePaymentService accountPurchasePaymentService; |
| | | |
| | | @GetMapping("/list") |
| | | @Log(title = "éè´æ¥è¡¨-项ç®å©æ¶¦", businessType = BusinessType.OTHER) |
| | | public R list(Page page, String customerName) { |
| | | return R.ok(purchaseReportService.list(page,customerName)); |
| | | return R.ok(purchaseReportService.list(page, customerName)); |
| | | } |
| | | |
| | | @Log(title = "éè´æ¥è¡¨-项ç®å©æ¶¦å¯¼åº", businessType = BusinessType.EXPORT) |
| | | @PostMapping("/export") |
| | | @Operation(summary = "éè´æ¥è¡¨-项ç®å©æ¶¦å¯¼åº") |
| | | public void export(HttpServletResponse response, String customerName) { |
| | | List<PurchaseReportVo> list = purchaseReportService.list(new Page(1,-1),customerName).getRecords(); |
| | | List<PurchaseReportVo> list = purchaseReportService.list(new Page(1, -1), customerName).getRecords(); |
| | | ExcelUtil<PurchaseReportVo> util = new ExcelUtil<>(PurchaseReportVo.class); |
| | | util.exportExcel(response, list , "项ç®å©æ¶¦"); |
| | | |
| | | util.exportExcel(response, list, "项ç®å©æ¶¦"); |
| | | } |
| | | |
| | | @Log(title = "éè´æ¥è¡¨-å¢å¼ç¨æ¯å¯¹", businessType = BusinessType.OTHER) |
| | | @GetMapping("/listVat") |
| | | public R listVat(Page page,String month) { |
| | | return R.ok(purchaseReportService.listVat(page,month)); |
| | | public R listVat(Page page, String month, String type) { |
| | | return R.ok(purchaseReportService.listVat(page, month, type)); |
| | | } |
| | | |
| | | @Log(title = "éè´æ¥è¡¨-å¢å¼ç¨æ¯å¯¹", businessType = BusinessType.EXPORT) |
| | | @PostMapping("/exportTwo") |
| | | @Operation(summary = "éè´æ¥è¡¨-å¢å¼ç¨æ¯å¯¹") |
| | | public void exportTwo(HttpServletResponse response,String month) { |
| | | List<VatDto> list = purchaseReportService.listVat(new Page(1,-1),month).getRecords(); |
| | | @Operation(summary = "éè´æ¥è¡¨-å¢å¼ç¨æ¯å¯¹å¯¼åº") |
| | | public void exportTwo(HttpServletResponse response, String month) { |
| | | List<VatDto> list = purchaseReportService.listVat(new Page(1, -1), month, null).getRecords(); |
| | | ExcelUtil<VatDto> util = new ExcelUtil<>(VatDto.class); |
| | | util.exportExcel(response, list , "å¢å¼ç¨æ¯å¯¹"); |
| | | util.exportExcel(response, list, "å¢å¼ç¨æ¯å¯¹"); |
| | | } |
| | | |
| | | @Log(title = "éè´æ¥è¡¨-å¢å¼ç¨å¾è¡¨æ°æ®", businessType = BusinessType.OTHER) |
| | | @GetMapping("/vatChart") |
| | | @Operation(summary = "å¢å¼ç¨è¿é项对æ¯å¾è¡¨æ°æ®") |
| | | public R vatChart(String year) { |
| | | List<VatSummaryDto> list = purchaseReportService.vatSummary(year); |
| | | return R.ok(list); |
| | | } |
| | | |
| | | @GetMapping("/listVatDetail") |
| | | @Operation(summary = "å¢å¼ç¨æç»-æå票/订åå±ç¤º") |
| | | public AjaxResult listVatDetail(Page page, String month) { |
| | | IPage<VatDto> result = purchaseReportService.listVatDetail(page, month); |
| | | return AjaxResult.success(result); |
| | | } |
| | | |
| | | @GetMapping("/supplierTransactions") |
| | | @Log(title = "ä¾åºå徿¥", businessType = BusinessType.OTHER) |
| | | @Operation(summary = "ä¾åºå徿¥") |
| | | public R supplierTransactions(Page page, String supplierName) { |
| | | return R.ok(supplierService.supplierTransactions(page,supplierName)); |
| | | return R.ok(supplierService.supplierTransactions(page, supplierName)); |
| | | } |
| | | |
| | | @GetMapping("/supplierTransactionsDetails") |
| | | @Log(title = "ä¾åºå徿¥æç»", businessType = BusinessType.OTHER) |
| | | @Operation(summary = "ä¾åºå徿¥æç»") |
| | | public R supplierTransactionsDetails(Page page, Long supplierId) { |
| | | return R.ok(supplierService.supplierTransactionsDetails(page,supplierId)); |
| | | return R.ok(supplierService.supplierTransactionsDetails(page, supplierId)); |
| | | } |
| | | |
| | | @PostMapping("/savePayment") |
| | | @Log(title = "æ°å¢ä»æ¬¾", businessType = BusinessType.INSERT) |
| | | @Operation(summary = "æ°å¢ä»æ¬¾") |
| | | public R savePayment(@RequestBody SavePaymentDto dto) { |
| | | return R.ok(accountPurchasePaymentService.savePayment(dto)); |
| | | } |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.purchase.dto; |
| | | |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.Data; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.time.LocalDate; |
| | | |
| | | /** |
| | | * éè´ç®¡ç--ä¾åºå徿¥ æ°å¢ä»æ¬¾è¯·æ±åæ° |
| | | */ |
| | | @Data |
| | | @Schema(name = "SavePaymentDto", description = "æ°å¢ä»æ¬¾è¯·æ±åæ°") |
| | | public class SavePaymentDto { |
| | | |
| | | @Schema(description = "ä¾åºåID") |
| | | private Long supplierId; |
| | | |
| | | @Schema(description = "éè´ååå·") |
| | | private String purchaseContractNumber; |
| | | |
| | | @Schema(description = "仿¬¾æ¥æ") |
| | | @JsonFormat(pattern = "yyyy-MM-dd") |
| | | private LocalDate paymentDate; |
| | | |
| | | @Schema(description = "仿¬¾éé¢") |
| | | private BigDecimal paymentAmount; |
| | | |
| | | @Schema(description = "仿¬¾æ¹å¼") |
| | | private String paymentMethod; |
| | | |
| | | @Schema(description = "夿³¨") |
| | | private String remark; |
| | | } |
| | |
| | | package com.ruoyi.purchase.dto; |
| | | |
| | | 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.LocalDate; |
| | | |
| | | @Data |
| | | @Schema(name = "VatDto", description = "管ç驾驶è±--å¢å¼ç¨æ¯å¯¹åæ°") |
| | | @Schema(name = "VatDto", description = "å¢å¼ç¨æ¯å¯¹æç»") |
| | | @ExcelIgnoreUnannotated |
| | | public class VatDto { |
| | | |
| | | @Excel(name = "ID") |
| | | @Schema(description = "å票ID") |
| | | private Long id; |
| | | |
| | | @Excel(name = "å票å·ç ") |
| | | @Schema(description = "å票å·ç ") |
| | | private String invoiceNumber; |
| | | |
| | | @Excel(name = "å¼ç¥¨æ¥æ") |
| | | @Schema(description = "å¼ç¥¨æ¥æ") |
| | | @JsonFormat(pattern = "yyyy-MM-dd") |
| | | private LocalDate issueDate; |
| | | |
| | | @Excel(name = "ç±»å") |
| | | @Schema(description = "ç±»å sales-é项 purchase-è¿é¡¹") |
| | | private String type; |
| | | |
| | | @Excel(name = "å票类å") |
| | | @Schema(description = "å票类å") |
| | | private String invoiceType; |
| | | |
| | | @Excel(name = "ç¨é¢") |
| | | @Schema(description = "ç¨é¢") |
| | | private BigDecimal taxAmount; |
| | | |
| | | @Excel(name = "ä»·ç¨å计") |
| | | @Schema(description = "ä»·ç¨å计") |
| | | private BigDecimal totalAmount; |
| | | |
| | | @Excel(name = "客æ·åç§°") |
| | | @Schema(description = "客æ·åç§°") |
| | | private String customerName; |
| | | |
| | | @Excel(name = "ä¾åºååç§°") |
| | | @Schema(description = "ä¾åºååç§°") |
| | | private String supplierName; |
| | | |
| | | @Excel(name = "æä»½") |
| | | @Schema(description = "æä»½") |
| | | private String month ; |
| | | private String month; |
| | | |
| | | @Excel(name = "é项ç¨é¢") |
| | | @Schema(description = "é项ç¨é¢") |
| | |
| | | @Schema(description = "è¿é¡¹ç¨é¢") |
| | | private BigDecimal xTaxAmount; |
| | | |
| | | @Excel(name = "é-è¿") |
| | | @Schema(description = "é-è¿") |
| | | private BigDecimal taxAmount; |
| | | // ========== æç»è§å¾å段 ========== |
| | | |
| | | @Excel(name = "å票å·") |
| | | @Schema(description = "å票å·") |
| | | private String invoiceNo; |
| | | |
| | | @Excel(name = "éå®ååå·") |
| | | @Schema(description = "éå®ååå·") |
| | | private String salesContractNo; |
| | | |
| | | @Excel(name = "订åç±»å") |
| | | @Schema(description = "ç±»å è¿é¡¹/é项") |
| | | private String orderType; |
| | | |
| | | @Excel(name = "å¼ç¥¨æ¥æ") |
| | | @Schema(description = "å¼ç¥¨æ¥æ") |
| | | @JsonFormat(pattern = "yyyy-MM-dd") |
| | | private LocalDate invoiceDate; |
| | | |
| | | @Excel(name = "ç¨ç") |
| | | @Schema(description = "ç¨ç") |
| | | private BigDecimal taxRate; |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.purchase.dto; |
| | | |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.Data; |
| | | |
| | | import java.math.BigDecimal; |
| | | |
| | | @Data |
| | | @Schema(description = "å¢å¼ç¨è¿éé¡¹æææ±æ»ï¼å¾è¡¨ç¨ï¼") |
| | | public class VatSummaryDto { |
| | | |
| | | @Schema(description = "æä»½") |
| | | private String month; |
| | | |
| | | @Schema(description = "é项ç¨é¢å计") |
| | | private BigDecimal jTaxAmount; |
| | | |
| | | @Schema(description = "è¿é¡¹ç¨é¢å计") |
| | | private BigDecimal xTaxAmount; |
| | | |
| | | @Schema(description = "å·®é¢ï¼é-è¿ï¼") |
| | | private BigDecimal taxAmount; |
| | | } |
| | |
| | | * ååéé¢ï¼äº§åå«ç¨æ»ä»·ï¼ |
| | | */ |
| | | private BigDecimal contractAmount; |
| | | |
| | | /** |
| | | * å®é
ååéé¢ï¼æ£åéè´§åï¼ |
| | | */ |
| | | @Schema(description = "å®é
ååéé¢") |
| | | private BigDecimal netContractAmount; |
| | | // |
| | | // /** |
| | | // * ä¸å¡å |
| | |
| | | package com.ruoyi.purchase.service; |
| | | |
| | | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.purchase.dto.VatDto; |
| | | import com.ruoyi.purchase.dto.VatSummaryDto; |
| | | import com.ruoyi.purchase.vo.PurchaseReportVo; |
| | | |
| | | import java.util.List; |
| | | |
| | | public interface PurchaseReportService { |
| | | |
| | | IPage<PurchaseReportVo> list(Page page, String customerName); |
| | | |
| | | IPage<VatDto> listVat(Page page, String month); |
| | | IPage<VatDto> listVat(Page page, String month, String type); |
| | | |
| | | List<VatSummaryDto> vatSummary(String year); |
| | | |
| | | IPage<VatDto> listVatDetail(Page page, String month); |
| | | } |
| | |
| | | purchaseLedger.setRecorderId(purchaseLedgerDto.getRecorderId()); |
| | | |
| | | purchaseLedger.setApprovalStatus(1); |
| | | // æ°å¢æ¶åå§åå®é
ååéé¢ |
| | | if (purchaseLedger.getId() == null) { |
| | | purchaseLedger.setNetContractAmount(purchaseLedger.getContractAmount()); |
| | | } |
| | | // 3. æ°å¢ææ´æ°ä¸»è¡¨ |
| | | if (purchaseLedger.getId() == null) { |
| | | if (!StringUtils.hasText(purchaseLedger.getPurchaseContractNumber())) { |
| | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.account.mapper.AccountStatementMapper; |
| | | import com.ruoyi.purchase.dto.VatDto; |
| | | import com.ruoyi.purchase.dto.VatSummaryDto; |
| | | import com.ruoyi.purchase.service.PurchaseReportService; |
| | | import com.ruoyi.purchase.vo.PurchaseReportVo; |
| | | import com.ruoyi.sales.mapper.SalesLedgerMapper; |
| | |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.List; |
| | | |
| | | @Service |
| | | @Slf4j |
| | |
| | | } |
| | | |
| | | @Override |
| | | public IPage<VatDto> listVat(Page page, String month) { |
| | | return accountStatementMapper.selectVatDtoPage(page, month); |
| | | public IPage<VatDto> listVat(Page page, String month, String type) { |
| | | return accountStatementMapper.selectVatDtoPage(page, month, type); |
| | | } |
| | | |
| | | @Override |
| | | public List<VatSummaryDto> vatSummary(String year) { |
| | | return accountStatementMapper.selectVatSummary(year); |
| | | } |
| | | |
| | | @Override |
| | | public IPage<VatDto> listVatDetail(Page page, String month) { |
| | | return accountStatementMapper.listVatDetail(page, month); |
| | | } |
| | | } |
| | |
| | | import com.ruoyi.purchase.mapper.PurchaseLedgerMapper; |
| | | import com.ruoyi.purchase.mapper.PurchaseReturnOrderProductsMapper; |
| | | import com.ruoyi.purchase.mapper.PurchaseReturnOrdersMapper; |
| | | import com.ruoyi.purchase.pojo.PurchaseLedger; |
| | | import com.ruoyi.purchase.pojo.PurchaseReturnOrderProducts; |
| | | import com.ruoyi.purchase.pojo.PurchaseReturnOrders; |
| | | import com.ruoyi.purchase.service.PurchaseReturnOrdersService; |
| | |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.util.List; |
| | | |
| | | /** |
| | |
| | | } |
| | | }else { |
| | | throw new RuntimeException("è¯·éæ©éè´§åå"); |
| | | } |
| | | |
| | | // æ´æ°éè´å°è´¦çå®é
ååéé¢ |
| | | if (purchaseReturnOrderDto.getPurchaseLedgerId() != null && purchaseReturnOrderDto.getTotalAmount() != null) { |
| | | PurchaseLedger purchaseLedger = purchaseLedgerMapper.selectById(purchaseReturnOrderDto.getPurchaseLedgerId()); |
| | | if (purchaseLedger != null) { |
| | | BigDecimal baseAmount = purchaseLedger.getNetContractAmount() != null |
| | | ? purchaseLedger.getNetContractAmount() |
| | | : purchaseLedger.getContractAmount(); |
| | | purchaseLedger.setNetContractAmount(baseAmount.subtract(purchaseReturnOrderDto.getTotalAmount())); |
| | | purchaseLedgerMapper.updateById(purchaseLedger); |
| | | } |
| | | } |
| | | return true; |
| | | } |
| | |
| | | package com.ruoyi.sales.controller; |
| | | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.account.service.sales.AccountSalesCollectionService; |
| | | import com.ruoyi.basic.service.ICustomerService; |
| | | import com.ruoyi.framework.aspectj.lang.annotation.Log; |
| | | import com.ruoyi.framework.aspectj.lang.enums.BusinessType; |
| | | import com.ruoyi.framework.web.controller.BaseController; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import com.ruoyi.sales.dto.SaveReceiptPaymentDto; |
| | | import com.ruoyi.sales.dto.StatisticsTableDto; |
| | | import com.ruoyi.sales.service.impl.MetricStatisticsServiceImpl; |
| | | import io.swagger.v3.oas.annotations.Operation; |
| | | import io.swagger.v3.oas.annotations.tags.Tag; |
| | | import lombok.AllArgsConstructor; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | |
| | | |
| | | private final MetricStatisticsServiceImpl metricStatisticsService; |
| | | private final ICustomerService customerService; |
| | | private final AccountSalesCollectionService accountSalesCollectionService; |
| | | |
| | | @Operation(summary = "头鍿»è®¡") |
| | | @GetMapping("/total") |
| | |
| | | return R.ok(customerService.customewTransactionsDetails(page,customerId)); |
| | | } |
| | | |
| | | @PostMapping("/saveReceiptPayment") |
| | | @Log(title = "æ°å¢å款", businessType = BusinessType.INSERT) |
| | | @Operation(summary = "æ°å¢å款") |
| | | public R saveReceiptPayment(@RequestBody SaveReceiptPaymentDto dto) { |
| | | return R.ok(accountSalesCollectionService.saveReceiptPayment(dto)); |
| | | } |
| | | |
| | | } |
| | |
| | | import com.ruoyi.framework.web.controller.BaseController; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import com.ruoyi.procurementrecord.service.ProcurementRecordService; |
| | | import com.ruoyi.procurementrecord.utils.StockUtils; |
| | | import com.ruoyi.purchase.dto.SimpleReturnOrderGroupDto; |
| | | import com.ruoyi.purchase.mapper.PurchaseReturnOrderProductsMapper; |
| | | import com.ruoyi.sales.pojo.SalesLedgerProduct; |
| | | import com.ruoyi.sales.service.ISalesLedgerProductService; |
| | | import jakarta.servlet.http.HttpServletResponse; |
| | | import lombok.RequiredArgsConstructor; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * 产åä¿¡æ¯Controller |
| | |
| | | public class SalesLedgerProductController extends BaseController |
| | | { |
| | | private final ISalesLedgerProductService salesLedgerProductService; |
| | | private final ProcurementRecordService procurementRecordService; |
| | | private final StockUtils stockUtils; |
| | | private final PurchaseReturnOrderProductsMapper purchaseReturnOrderProductsMapper; |
| | | |
| | | |
| | | /** |
| | |
| | | @GetMapping("/list") |
| | | public AjaxResult list(SalesLedgerProduct salesLedgerProduct) { |
| | | List<SalesLedgerProduct> list = salesLedgerProductService.selectSalesLedgerProductList(salesLedgerProduct); |
| | | if (CollUtil.isNotEmpty(list)) { |
| | | list.forEach(item -> { |
| | | if (item.getApproveStatus() != 2) { |
| | | if (item.getHasSufficientStock() == 0) { |
| | | item.setApproveStatus(0); |
| | | } else { |
| | | item.setApproveStatus(1); |
| | | } |
| | | } |
| | | java.math.BigDecimal returnQuantity = item.getReturnQuantity() == null |
| | | ? java.math.BigDecimal.ZERO |
| | | : item.getReturnQuantity(); |
| | | java.math.BigDecimal quantity = item.getQuantity() == null |
| | | ? java.math.BigDecimal.ZERO |
| | | : item.getQuantity(); |
| | | item.setReturnQuantity(returnQuantity); |
| | | item.setAvailableQuality(quantity.subtract(returnQuantity)); |
| | | }); |
| | | if (CollUtil.isEmpty(list)) { |
| | | return AjaxResult.success(list); |
| | | } |
| | | List<Long> productIds = list.stream().map(SalesLedgerProduct::getProductModelId).collect(Collectors.toList()); |
| | | List<SimpleReturnOrderGroupDto> groupListByProductIds = purchaseReturnOrderProductsMapper.getReturnOrderGroupListByProductIds(productIds); |
| | | Map<Long, BigDecimal> returnOrderGroupDtoMap = groupListByProductIds.stream().collect(Collectors.toMap(SimpleReturnOrderGroupDto::getProductModelId, item -> item.getSumReturnQuantity())); |
| | | |
| | | list.forEach(item -> { |
| | | if (item.getApproveStatus() != 2) { |
| | | if (item.getHasSufficientStock() == 0) { |
| | | item.setApproveStatus(0); |
| | | } else { |
| | | item.setApproveStatus(1); |
| | | } |
| | | } |
| | | // ç»è®¡éè´§æ°é |
| | | BigDecimal returnQuality = returnOrderGroupDtoMap.getOrDefault(item.getProductModelId(), BigDecimal.ZERO); |
| | | item.setReturnQuality(returnQuality); |
| | | item.setAvailableQuality(item.getQuantity().subtract(returnQuality)); |
| | | }); |
| | | return AjaxResult.success(list); |
| | | } |
| | | |
| | |
| | | private String salesContractNo; |
| | | private String customerContractNo; |
| | | private String projectName; |
| | | @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") |
| | | @JsonFormat(pattern = "yyyy-MM-dd") |
| | | private Date entryDate; |
| | | |
| | | private String entryDateStart; |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.sales.dto; |
| | | |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.Data; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.time.LocalDate; |
| | | |
| | | /** |
| | | * è¥é管ç--客æ·å¾æ¥ æ°å¢å款请æ±åæ° |
| | | */ |
| | | @Data |
| | | @Schema(name = "SaveReceiptPaymentDto", description = "æ°å¢å款请æ±åæ°") |
| | | public class SaveReceiptPaymentDto { |
| | | |
| | | @Schema(description = "客æ·ID") |
| | | private Long customerId; |
| | | |
| | | @Schema(description = "éå®ååå·") |
| | | private String salesContractNo; |
| | | |
| | | @Schema(description = "忬¾æ¥æ") |
| | | @JsonFormat(pattern = "yyyy-MM-dd") |
| | | private LocalDate paymentDate; |
| | | |
| | | @Schema(description = "忬¾éé¢") |
| | | private BigDecimal paymentAmount; |
| | | |
| | | @Schema(description = "忬¾æ¹å¼") |
| | | private String paymentMethod; |
| | | |
| | | @Schema(description = "夿³¨") |
| | | private String remark; |
| | | } |
| | |
| | | |
| | | List<Map<String, Object>> selectProductSalesAnalysis(); |
| | | |
| | | List<Map<String, Object>> selectProductSalesAnalysisByDate(@Param("startDate") String startDate, @Param("endDate") String endDate); |
| | | |
| | | List<Map<String, Object>> selectRawMaterialPurchaseAnalysis(); |
| | | |
| | | List<Map<String, Object>> selectRawMaterialPurchaseAnalysisByDate(@Param("startDate") String startDate, @Param("endDate") String endDate); |
| | | |
| | | int selectProductCountByTypeAndDate(@Param("type") Integer type, @Param("startDate") LocalDateTime startDate, @Param("endDate") LocalDateTime endDate); |
| | | |
| | | BigDecimal selectRawMaterialExpense(); |
| | |
| | | /** |
| | | * å½å
¥æ¥æ |
| | | */ |
| | | @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") |
| | | @JsonFormat(pattern = "yyyy-MM-dd") |
| | | @Excel(name = "å½å
¥æ¥æ", width = 30, dateFormat = "yyyy-MM-dd") |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd") |
| | | private Date entryDate; |
| | |
| | | |
| | | @Schema(description = "仿¬¾æ¹å¼") |
| | | private String paymentMethod; |
| | | |
| | | @Schema(description = "å®é
ååéé¢") |
| | | private BigDecimal netContractAmount; |
| | | |
| | | @TableField(exist = false) |
| | | @Schema(description = "çäº§ç¶æ") |
| | |
| | | @TableField(exist = false) |
| | | private Integer hasSufficientStock; |
| | | |
| | | // å¯ç¨æ°é quantity - returnQuantity |
| | | // éè´§æ°é |
| | | @TableField(exist = false) |
| | | private BigDecimal returnQuality; |
| | | |
| | | // å¯ç¨æ°é quantity - returnQuality |
| | | @TableField(exist = false) |
| | | private BigDecimal availableQuality; |
| | | @Schema(description = "åå»ºç¨æ·") |
| | |
| | | @TableField(exist = false) |
| | | @Schema(description = "å¾
åè´§æ°é") |
| | | private BigDecimal noQuantity; |
| | | |
| | | @TableField(exist = false) |
| | | @Schema(description = "éè´§æ°é") |
| | | private BigDecimal returnQuantity; |
| | | |
| | | @TableField(exist = false) |
| | | @Schema(description = "审æ¹ä¸æ°é") |
| | |
| | | List<SalesLedgerProduct> salesLedgerProducts = salesLedgerProductMapper.selectSalesLedgerProductList(salesLedgerProduct); |
| | | if(!CollectionUtils.isEmpty(salesLedgerProducts)){ |
| | | salesLedgerProducts.forEach(item -> { |
| | | // åè´§ä¿¡æ¯ï¼åææ°ä¸æ¡ï¼ |
| | | ShippingInfo latestShippingInfo = shippingInfoMapper.selectOne(new LambdaQueryWrapper<ShippingInfo>() |
| | | // åè´§ä¿¡æ¯ |
| | | ShippingInfo shippingInfo = shippingInfoMapper.selectOne(new LambdaQueryWrapper<ShippingInfo>() |
| | | .eq(ShippingInfo::getSalesLedgerProductId, item.getId()) |
| | | .orderByDesc(ShippingInfo::getCreateTime) |
| | | .last("limit 1")); |
| | | if(latestShippingInfo != null){ |
| | | item.setShippingDate(latestShippingInfo.getShippingDate()); |
| | | item.setExpressCompany(latestShippingInfo.getExpressCompany()); |
| | | item.setExpressNumber(latestShippingInfo.getExpressNumber()); |
| | | } |
| | | // 车çå·ï¼åææåè´§è®°å½ç车çå·ï¼éå·æ¼æ¥ |
| | | List<ShippingInfo> allShippingInfos = shippingInfoMapper.selectList(new LambdaQueryWrapper<ShippingInfo>() |
| | | .eq(ShippingInfo::getSalesLedgerProductId, item.getId()) |
| | | .orderByAsc(ShippingInfo::getCreateTime)); |
| | | if(!CollectionUtils.isEmpty(allShippingInfos)){ |
| | | String carNumbers = allShippingInfos.stream() |
| | | .map(ShippingInfo::getShippingCarNumber) |
| | | .filter(carNo -> carNo != null && !carNo.trim().isEmpty()) |
| | | .distinct() |
| | | .collect(Collectors.joining(",")); |
| | | item.setShippingCarNumber(carNumbers); |
| | | if(shippingInfo != null){ |
| | | item.setShippingDate(shippingInfo.getShippingDate()); |
| | | item.setShippingCarNumber(shippingInfo.getShippingCarNumber()); |
| | | item.setExpressCompany(shippingInfo.getExpressCompany()); |
| | | item.setExpressNumber(shippingInfo.getExpressNumber()); |
| | | } |
| | | }); |
| | | } |
| | |
| | | import com.ruoyi.project.system.domain.SysUser; |
| | | import com.ruoyi.project.system.mapper.SysDeptMapper; |
| | | import com.ruoyi.project.system.mapper.SysUserMapper; |
| | | import com.ruoyi.purchase.dto.SimpleReturnOrderGroupDto; |
| | | import com.ruoyi.purchase.mapper.PurchaseReturnOrderProductsMapper; |
| | | import com.ruoyi.quality.mapper.QualityInspectMapper; |
| | | import com.ruoyi.sales.dto.*; |
| | | import com.ruoyi.sales.mapper.CommonFileMapper; |
| | |
| | | @Autowired |
| | | private ProductionProductMainService productionProductMainService; |
| | | @Autowired |
| | | private PurchaseReturnOrderProductsMapper purchaseReturnOrderProductsMapper; |
| | | ; |
| | | @Autowired |
| | | private SysUserMapper sysUserMapper; |
| | | |
| | | @Override |
| | |
| | | productWrapper.eq(SalesLedgerProduct::getType, type.getCode()); |
| | | List<SalesLedgerProduct> salesLedgerProducts = salesLedgerProductMapper.selectList(productWrapper); |
| | | if (type.equals(SaleEnum.PURCHASE)) { |
| | | // æ¥è¯¢éè´§ä¿¡æ¯ |
| | | List<Long> productIds = salesLedgerProducts.stream().map(SalesLedgerProduct::getProductModelId).collect(Collectors.toList()); |
| | | List<SimpleReturnOrderGroupDto> groupListByProductIds = new ArrayList<>(); |
| | | if(CollectionUtils.isNotEmpty(productIds)){ |
| | | groupListByProductIds = purchaseReturnOrderProductsMapper.getReturnOrderGroupListByProductIds(productIds); |
| | | } |
| | | Map<Long, BigDecimal> returnOrderGroupDtoMap = groupListByProductIds.stream().collect(Collectors.toMap(SimpleReturnOrderGroupDto::getProductModelId, SimpleReturnOrderGroupDto::getSumReturnQuantity)); |
| | | salesLedgerProducts.forEach(item -> { |
| | | BigDecimal returnQuantity = item.getReturnQuantity() == null ? BigDecimal.ZERO : item.getReturnQuantity(); |
| | | item.setReturnQuantity(returnQuantity); |
| | | BigDecimal quantity = item.getQuantity() == null ? BigDecimal.ZERO : item.getQuantity(); |
| | | item.setAvailableQuality(quantity.subtract(returnQuantity)); |
| | | BigDecimal returnQuality = returnOrderGroupDtoMap.getOrDefault(item.getProductModelId(), BigDecimal.ZERO); |
| | | item.setReturnQuality(returnQuality); |
| | | item.setAvailableQuality(item.getQuantity().subtract(returnQuality)); |
| | | }); |
| | | } |
| | | return salesLedgerProducts; |
| | |
| | | ); |
| | | } |
| | | |
| | | // 5. å
åºï¼ç¡®ä¿å®é
ååé颿åå§å¼çäºååéé¢ |
| | | if (salesLedger.getNetContractAmount() == null) { |
| | | SalesLedger dbLedger = salesLedgerMapper.selectById(salesLedger.getId()); |
| | | if (dbLedger != null && dbLedger.getNetContractAmount() == null && dbLedger.getContractAmount() != null) { |
| | | SalesLedger updateEntity = new SalesLedger(); |
| | | updateEntity.setId(salesLedger.getId()); |
| | | updateEntity.setNetContractAmount(dbLedger.getContractAmount()); |
| | | salesLedgerMapper.updateById(updateEntity); |
| | | } |
| | | } |
| | | |
| | | // 6. ä¿åéå®å°è´¦éä»¶ |
| | | // 5. ä¿åéå®å°è´¦éä»¶ |
| | | fileUtil.saveStorageAttachment(ApplicationTypeEnum.FILE, RecordTypeEnum.SALES_LEDGER, salesLedger.getId(), salesLedgerDto.getStorageBlobDTOs()); |
| | | |
| | | return 1; |
| | |
| | | Field amountField = mainEntityClass.getDeclaredField("contractAmount"); |
| | | amountField.setAccessible(true); |
| | | amountField.set(entity, totalAmount); |
| | | |
| | | // å®é
ååéé¢åå§å¼çäºååéé¢ |
| | | try { |
| | | Field netAmountField = mainEntityClass.getDeclaredField("netContractAmount"); |
| | | netAmountField.setAccessible(true); |
| | | netAmountField.set(entity, totalAmount); |
| | | } catch (NoSuchFieldException ignored) { |
| | | // åç±»å¯è½æ²¡æè¯¥å段ï¼å¿½ç¥ |
| | | } |
| | | |
| | | mainMapper.updateById(entity); |
| | | } catch (Exception e) { |
| | |
| | | druid: |
| | | # ä¸»åºæ°æ®æº |
| | | master: |
| | | url: jdbc:mysql://localhost:3306/product-inventory-management-bdpro?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8 |
| | | url: jdbc:mysql://localhost:3306/product-inventory-management-new-pro?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8 |
| | | username: root |
| | | password: 123456 |
| | | # ä»åºæ°æ®æº |
| ÎļþÃû´Ó src/main/resources/application-xlgs.yml ÐÞ¸Ä |
| | |
| | | druid: |
| | | # ä¸»åºæ°æ®æº |
| | | master: |
| | | url: jdbc:mysql://172.17.0.1:3306/product-inventory-management-xlgs?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8 |
| | | url: jdbc:mysql://36.213.180.217:11101/product-inventory-management-ybkx?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8 |
| | | username: root |
| | | password: xd@123456.. |
| | | # ä»åºæ°æ®æº |
| | |
| | | # redis é
ç½® |
| | | data: |
| | | mongodb: |
| | | uri: mongodb://114.132.189.42:9028/chat_memory_db_xlgs |
| | | uri: mongodb://114.132.189.42:9028/chat_memory_db_ybkx |
| | | # redis é
ç½® |
| | | redis: |
| | | # å°å |
| | | # host: 127.0.0.1 |
| | | # host: 127.0.0.1 |
| | | host: 172.17.0.1 |
| | | # 端å£ï¼é»è®¤ä¸º6379 |
| | | port: 6379 |
| | | port: 11102 |
| | | # æ°æ®åºç´¢å¼ |
| | | database: 0 |
| | | # å¯ç |
| | |
| | | upload-dir: /javaWork/product-inventory-management/file/prod/uploads # æ£å¼ç®å½ |
| | | path: /javaWork/product-inventory-management/file # ä¸ä¼ ç®å½ |
| | | urlPrefix: /prod-api/common # 龿¥åç¼ |
| | | domain: http://1.15.17.182:9091 # åååç¼ |
| | | domain: http://36.213.180.217:9522 # åååç¼ |
| | | expired: 120 # è¿ææ¶é´(åä½:åé) |
| | | useLimit: 10 # ä½¿ç¨æ¬¡æ° |
| | | compress: true # æ¯å¦å缩 |
| | |
| | | ORDER BY lj.statement_month DESC |
| | | </select> |
| | | <select id="selectVatDtoPage" resultType="com.ruoyi.purchase.dto.VatDto"> |
| | | SELECT |
| | | month, |
| | | jTaxAmount, |
| | | xTaxAmount, |
| | | (jTaxAmount - xTaxAmount) AS taxAmount |
| | | FROM ( |
| | | SELECT * FROM ( |
| | | SELECT |
| | | asi.id, |
| | | asi.invoice_number AS invoiceNumber, |
| | | asi.issue_date AS issueDate, |
| | | 'sales' AS type, |
| | | asi.invoice_type AS invoiceType, |
| | | asi.tax_price AS taxAmount, |
| | | asi.tax_inclusive_price AS totalAmount, |
| | | c.customer_name AS customerName, |
| | | NULL AS supplierName, |
| | | DATE_FORMAT(asi.issue_date, '%Y-%m') AS month |
| | | FROM account_sales_invoice asi |
| | | LEFT JOIN customer c ON c.id = asi.customer_id |
| | | WHERE (asi.status IS NULL OR asi.status = 0) |
| | | UNION ALL |
| | | SELECT |
| | | api.id, |
| | | api.invoice_number AS invoiceNumber, |
| | | api.issue_date AS issueDate, |
| | | 'purchase' AS type, |
| | | api.invoice_type AS invoiceType, |
| | | api.tax_price AS taxAmount, |
| | | api.tax_inclusive_price AS totalAmount, |
| | | NULL AS customerName, |
| | | s.supplier_name AS supplierName, |
| | | DATE_FORMAT(api.issue_date, '%Y-%m') AS month |
| | | FROM account_purchase_invoice api |
| | | LEFT JOIN supplier_manage s ON s.id = api.supplier_id |
| | | WHERE (api.status IS NULL OR api.status = 0) |
| | | ) AS invoice_detail |
| | | <where> |
| | | <if test="month != null and month != ''"> |
| | | AND month = #{month} |
| | | </if> |
| | | <if test="type != null and type != ''"> |
| | | AND type = #{type} |
| | | </if> |
| | | </where> |
| | | ORDER BY issueDate DESC, type |
| | | </select> |
| | | |
| | | <select id="selectVatSummary" resultType="com.ruoyi.purchase.dto.VatSummaryDto"> |
| | | SELECT |
| | | month, |
| | | SUM(IF(type = 'purchase', tax_price, 0)) AS xTaxAmount, |
| | | SUM(IF(type = 'sales', tax_price, 0)) AS jTaxAmount |
| | | SUM(jTaxAmount) AS jTaxAmount, |
| | | SUM(xTaxAmount) AS xTaxAmount, |
| | | SUM(jTaxAmount) - SUM(xTaxAmount) AS taxAmount |
| | | FROM ( |
| | | SELECT |
| | | DATE_FORMAT(issue_date, '%Y-%m') AS month, |
| | | tax_price, |
| | | 'sales' AS type |
| | | SUM(tax_price) AS jTaxAmount, |
| | | 0 AS xTaxAmount |
| | | FROM account_sales_invoice |
| | | WHERE status != 1 |
| | | WHERE (status IS NULL OR status = 0) |
| | | <if test="year != null and year != ''"> |
| | | AND YEAR(issue_date) = #{year} |
| | | </if> |
| | | GROUP BY DATE_FORMAT(issue_date, '%Y-%m') |
| | | UNION ALL |
| | | SELECT |
| | | DATE_FORMAT(issue_date, '%Y-%m') AS month, |
| | | tax_price, |
| | | 'purchase' AS type |
| | | 0 AS jTaxAmount, |
| | | SUM(tax_price) AS xTaxAmount |
| | | FROM account_purchase_invoice |
| | | WHERE status != 1 |
| | | ) AS all_data |
| | | GROUP BY month |
| | | ) AS TT |
| | | <where> |
| | | <if test="month != null"> |
| | | and TT.month = #{month} |
| | | WHERE (status IS NULL OR status = 0) |
| | | <if test="year != null and year != ''"> |
| | | AND YEAR(issue_date) = #{year} |
| | | </if> |
| | | </where> |
| | | ORDER BY TT.month |
| | | GROUP BY DATE_FORMAT(issue_date, '%Y-%m') |
| | | ) t |
| | | GROUP BY month |
| | | ORDER BY month |
| | | </select> |
| | | |
| | | <select id="listVatDetail" resultType="com.ruoyi.purchase.dto.VatDto"> |
| | | SELECT * |
| | | FROM ( |
| | | -- è¿é¡¹ç¨æç»ï¼éè´è®¢åï¼ |
| | | SELECT |
| | | pl.purchase_contract_number AS invoiceNo, |
| | | pl.sales_contract_no AS salesContractNo, |
| | | pl.supplier_name AS supplierName, |
| | | NULL AS customerName, |
| | | 'è¿é¡¹' AS orderType, |
| | | pl.entry_date AS invoiceDate, |
| | | slp.tax_rate AS taxRate, |
| | | ROUND(SUM(slp.tax_inclusive_total_price - slp.tax_exclusive_total_price), 2) AS jTaxAmount, |
| | | 0 AS xTaxAmount, |
| | | ROUND(SUM(slp.tax_inclusive_total_price - slp.tax_exclusive_total_price), 2) AS taxAmount |
| | | FROM sales_ledger_product slp |
| | | LEFT JOIN purchase_ledger pl ON pl.id = slp.sales_ledger_id |
| | | WHERE slp.type = 2 |
| | | AND slp.tax_rate IS NOT NULL |
| | | AND slp.tax_rate > 0 |
| | | GROUP BY pl.id |
| | | |
| | | UNION ALL |
| | | |
| | | -- éé¡¹ç¨æç»ï¼éå®è®¢åï¼ |
| | | SELECT |
| | | sl.sales_contract_no AS invoiceNo, |
| | | sl.sales_contract_no AS salesContractNo, |
| | | NULL AS supplierName, |
| | | sl.customer_name AS customerName, |
| | | 'é项' AS orderType, |
| | | sl.entry_date AS invoiceDate, |
| | | slp.tax_rate AS taxRate, |
| | | 0 AS jTaxAmount, |
| | | ROUND(SUM(slp.tax_inclusive_total_price - slp.tax_exclusive_total_price), 2) AS xTaxAmount, |
| | | ROUND(SUM(slp.tax_inclusive_total_price - slp.tax_exclusive_total_price), 2) AS taxAmount |
| | | FROM sales_ledger_product slp |
| | | LEFT JOIN sales_ledger sl ON sl.id = slp.sales_ledger_id |
| | | WHERE slp.type = 1 |
| | | AND slp.tax_rate IS NOT NULL |
| | | AND slp.tax_rate > 0 |
| | | GROUP BY sl.id |
| | | ) a |
| | | <where> |
| | | <if test="month != null and month != ''"> |
| | | AND DATE_FORMAT(a.invoiceDate, '%Y-%m') = #{month} |
| | | </if> |
| | | </where> |
| | | ORDER BY a.invoiceDate DESC |
| | | </select> |
| | | </mapper> |
| | |
| | | GROUP BY dateStr |
| | | ORDER BY dateStr |
| | | </select> |
| | | <select id="selectStockInRecordIdsByPurchaseLedgerId" resultType="java.lang.Long"> |
| | | SELECT sir.id |
| | | FROM stock_in_record sir |
| | | LEFT JOIN quality_inspect qi ON sir.record_type = 10 AND sir.record_id = qi.id |
| | | WHERE sir.approval_status = 1 |
| | | AND sir.record_type IN ('7','10') |
| | | AND IF(sir.record_type = 7, sir.record_id, qi.purchase_ledger_id) = #{purchaseLedgerId} |
| | | </select> |
| | | |
| | | </mapper> |
| | |
| | | GROUP BY dateStr |
| | | ORDER BY dateStr |
| | | </select> |
| | | <select id="selectStockOutRecordIdsBySalesLedgerId" resultType="java.lang.Long"> |
| | | SELECT sor.id |
| | | FROM stock_out_record sor |
| | | JOIN shipping_info s ON sor.record_id = s.id |
| | | WHERE s.sales_ledger_id = #{salesLedgerId} |
| | | AND sor.record_type = '13' |
| | | AND sor.approval_status = 1 |
| | | </select> |
| | | |
| | | </mapper> |
| | |
| | | left join ( |
| | | select |
| | | sl.id, |
| | | sum(ascc.collection_amount) as receiptPaymentAmount |
| | | from account_sales_collection ascc |
| | | left join stock_out_record sor on FIND_IN_SET(sor.id, ascc.stock_out_record_ids) > 0 |
| | | left join shipping_info s on sor.record_id = s.id |
| | | LEFT JOIN sales_ledger sl ON s.sales_ledger_id = sl.id |
| | | WHERE sor.record_type='13' |
| | | and sor.approval_status=1 |
| | | group by sl.id |
| | | sum(t.collection_amount) as receiptPaymentAmount |
| | | from ( |
| | | select |
| | | ascc.collection_amount, |
| | | s.sales_ledger_id |
| | | from account_sales_collection ascc |
| | | left join stock_out_record sor on FIND_IN_SET(sor.id, ascc.stock_out_record_ids) > 0 |
| | | left join shipping_info s on sor.record_id = s.id |
| | | where sor.record_type='13' |
| | | and sor.approval_status=1 |
| | | group by ascc.id, s.sales_ledger_id |
| | | ) t |
| | | left join sales_ledger sl on t.sales_ledger_id = sl.id |
| | | group by sl.id |
| | | )T1 on T1.id = sl.id |
| | | left join ( |
| | | SELECT |
| | |
| | | left join ( |
| | | select |
| | | pl.id, |
| | | sum(app.payment_amount) as paymentAmount |
| | | from account_purchase_payment app |
| | | left join account_payment_application apa on app.account_payment_application_id = apa.id |
| | | left join stock_in_record sir on FIND_IN_SET(sir.id, apa.stock_in_record_ids) > 0 |
| | | -- 10 ç±»åæå
³èè´¨æ£è¡¨ |
| | | LEFT JOIN quality_inspect qi ON sir.record_type = 10 AND sir.record_id = qi.id |
| | | -- 卿å
³èéè´ï¼èªå¨éé
7 å 10ï¼ |
| | | LEFT JOIN purchase_ledger pl |
| | | ON pl.id = IF(sir.record_type = 7, sir.record_id, qi.purchase_ledger_id) |
| | | WHERE sir.approval_status = 1 |
| | | AND sir.record_type IN ('7','10') |
| | | sum(t.payment_amount) as paymentAmount |
| | | from ( |
| | | select |
| | | app.id, |
| | | app.payment_amount, |
| | | pl.id as purchase_ledger_id |
| | | from account_purchase_payment app |
| | | left join account_payment_application apa on app.account_payment_application_id = apa.id |
| | | left join stock_in_record sir on FIND_IN_SET(sir.id, apa.stock_in_record_ids) > 0 |
| | | -- 10 ç±»åæå
³èè´¨æ£è¡¨ |
| | | LEFT JOIN quality_inspect qi ON sir.record_type = 10 AND sir.record_id = qi.id |
| | | -- 卿å
³èéè´ï¼èªå¨éé
7 å 10ï¼ |
| | | LEFT JOIN purchase_ledger pl |
| | | ON pl.id = IF(sir.record_type = 7, sir.record_id, qi.purchase_ledger_id) |
| | | WHERE sir.approval_status = 1 |
| | | AND sir.record_type IN ('7','10') |
| | | group by app.id, pl.id |
| | | ) t |
| | | left join purchase_ledger pl on t.purchase_ledger_id = pl.id |
| | | group by pl.id |
| | | )T1 on T1.id = pl.id |
| | | left join ( |
| | |
| | | GROUP BY p.id, p.product_name |
| | | </select> |
| | | |
| | | <select id="productTurnoverDaysByDate" resultType="com.ruoyi.dto.MapDto"> |
| | | SELECT p.product_name AS name, |
| | | DATEDIFF(IFNULL(MAX(sor.create_time), NOW()), MAX(sir.create_time)) AS value |
| | | FROM product p |
| | | JOIN product_model pm ON p.id = pm.product_id |
| | | JOIN stock_in_record sir ON pm.id = sir.product_model_id |
| | | AND sir.create_time >= #{startDate} |
| | | AND sir.create_time <= #{endDate} |
| | | LEFT JOIN stock_out_record sor ON pm.id = sor.product_model_id |
| | | GROUP BY p.id, p.product_name |
| | | </select> |
| | | |
| | | <select id="selectPurchaseCategoryDistribution" resultType="com.ruoyi.dto.MapDto"> |
| | | SELECT p2.product_name AS name, |
| | | COUNT(DISTINCT slp.id) AS value |
| | | FROM sales_ledger_product slp |
| | | LEFT JOIN product p ON p.id = slp.product_category |
| | | LEFT JOIN product p2 ON p2.id = p.parent_id |
| | | WHERE slp.type = 2 |
| | | AND p.parent_id IS NOT NULL |
| | | GROUP BY p2.product_name |
| | | ORDER BY value DESC |
| | | </select> |
| | | |
| | | </mapper> |
| | |
| | | T1.attachment_materials, |
| | | T1.tenant_id, |
| | | T1.contract_amount, |
| | | T1.net_contract_amount, |
| | | T1.contract_amount AS noInvoiceAmountTotal, |
| | | T1.execution_date, |
| | | T2.nick_name AS entry_person_name, |
| | |
| | | ELSE 0 |
| | | END as has_sufficient_stock, |
| | | (IFNULL(T1.quantity, 0) - IFNULL(t3.shipped_quantity, 0) - IFNULL(t5.pending_approval_quantity, 0)) as no_quantity, |
| | | IFNULL(t6.return_quantity, 0) as return_quantity, |
| | | IFNULL(t5.pending_approval_quantity, 0) as pending_approval_quantity, |
| | | CASE |
| | | WHEN IFNULL(t3.shipped_quantity, 0) = 0 AND IFNULL(t5.pending_approval_quantity, 0) = 0 THEN 'å¾
åè´§' |
| | |
| | | )) |
| | | GROUP BY si.sales_ledger_product_id |
| | | ) t5 ON t5.sales_ledger_product_id = T1.id |
| | | LEFT JOIN ( |
| | | SELECT si.sales_ledger_product_id, IFNULL(SUM(rsp.num), 0) AS return_quantity |
| | | FROM return_management rm |
| | | INNER JOIN return_sale_product rsp ON rm.id = rsp.return_management_id |
| | | INNER JOIN shipping_info si ON rm.shipping_id = si.id |
| | | WHERE rm.status = 1 |
| | | GROUP BY si.sales_ledger_product_id |
| | | ) t6 ON t6.sales_ledger_product_id = T1.id |
| | | left join product_model pm ON T1.product_model_id = pm.id |
| | | left join product p ON pm.product_id = p.id |
| | | <where> |
| | |
| | | LIMIT 5 |
| | | </select> |
| | | |
| | | <select id="selectProductSalesAnalysisByDate" resultType="java.util.Map"> |
| | | SELECT |
| | | product_category as name, |
| | | SUM( tax_inclusive_total_price ) AS value |
| | | FROM |
| | | sales_ledger_product |
| | | WHERE |
| | | type = 1 |
| | | AND register_date >= #{startDate} |
| | | AND register_date <= #{endDate} |
| | | GROUP BY |
| | | product_category |
| | | ORDER BY |
| | | value DESC |
| | | LIMIT 5 |
| | | </select> |
| | | |
| | | <select id="selectRawMaterialPurchaseAnalysis" resultType="java.util.Map"> |
| | | WITH RECURSIVE raw_material_tree AS ( |
| | | SELECT id FROM product WHERE product_name = 'åææ' AND parent_id IS NULL |
| | | UNION ALL |
| | | SELECT p.id FROM product p INNER JOIN raw_material_tree rmt ON p.parent_id = rmt.id |
| | | ) |
| | | SELECT |
| | | pr.product_name AS name, |
| | | SUM( slp.tax_inclusive_total_price ) AS value |
| | |
| | | JOIN product pr ON slp.product_id = pr.id |
| | | WHERE |
| | | slp.type = 2 |
| | | AND pr.id IN (SELECT id FROM raw_material_tree) |
| | | GROUP BY |
| | | pr.id, |
| | | pr.product_name |
| | | ORDER BY |
| | | value DESC |
| | | LIMIT 5 |
| | | </select> |
| | | |
| | | <select id="selectRawMaterialPurchaseAnalysisByDate" resultType="java.util.Map"> |
| | | SELECT |
| | | pr.product_name AS name, |
| | | SUM( slp.tax_inclusive_total_price ) AS value |
| | | FROM |
| | | sales_ledger_product slp |
| | | JOIN product pr ON slp.product_id = pr.id |
| | | WHERE |
| | | slp.type = 2 |
| | | AND slp.register_date >= #{startDate} |
| | | AND slp.register_date <= #{endDate} |
| | | AND pr.parent_id = ( SELECT id FROM product WHERE product_name = 'åææ' ) |
| | | GROUP BY |
| | | pr.id, |
| | |
| | | <select id="selectRawMaterialExpense" resultType="java.math.BigDecimal"> |
| | | WITH RECURSIVE product_tree AS (SELECT id |
| | | FROM product |
| | | WHERE product_name = 'åææ' |
| | | WHERE product_name = 'åææ' AND parent_id IS NULL |
| | | |
| | | UNION ALL |
| | | |
| | |
| | | order by sor.id |
| | | </select> |
| | | <select id="getShippingInfoByCustomerName" resultType="com.ruoyi.sales.pojo.ShippingInfo"> |
| | | select distinct si.* from shipping_info si |
| | | select * from shipping_info si |
| | | left join sales_ledger sl on si.sales_ledger_id = sl.id |
| | | inner join stock_out_record sor on sor.record_id = si.id and sor.record_type = '13' and sor.approval_status = 1 |
| | | where sl.customer_name = #{customerName} and si.status = 'å®¡æ ¸éè¿' |
| | | where sl.customer_name = #{customerName} |
| | | </select> |
| | | </mapper> |