zss
2 天以前 b9a985fea44086bb07069b1913835bbfaf0ed44a
Merge remote-tracking branch 'origin/dev_New' into dev_New
已修改8个文件
151 ■■■■■ 文件已修改
src/main/java/com/ruoyi/project/system/controller/SysNoticeController.java 17 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/ruoyi/project/system/domain/SysNotice.java 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/ruoyi/project/system/service/ISysNoticeService.java 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/ruoyi/project/system/service/impl/SysNoticeServiceImpl.java 17 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/ruoyi/project/system/service/impl/UnipushService.java 24 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/ruoyi/sales/controller/SalesLedgerProductController.java 23 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/resources/mapper/purchase/PurchaseLedgerMapper.xml 50 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/resources/mapper/sales/SalesLedgerProductMapper.xml 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/ruoyi/project/system/controller/SysNoticeController.java
@@ -5,17 +5,11 @@
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ruoyi.framework.web.domain.R;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
import com.ruoyi.framework.aspectj.lang.annotation.Log;
import com.ruoyi.framework.aspectj.lang.enums.BusinessType;
import com.ruoyi.framework.web.controller.BaseController;
@@ -99,4 +93,11 @@
    {
        return toAjax(noticeService.readAll());
    }
    @PostMapping("appReadNotice")
    @ApiOperation("移动端根据消息ID进行已读")
    public AjaxResult appReadNotice(@RequestParam("noticeId") Long noticeId) {
        boolean result = noticeService.appReadNotice(noticeId);
        return toAjax(result);
    }
}
src/main/java/com/ruoyi/project/system/domain/SysNotice.java
@@ -3,8 +3,7 @@
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.Size;
import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.*;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import org.apache.commons.lang3.builder.ToStringBuilder;
@@ -20,11 +19,13 @@
 * @author ruoyi
 */
@Data
@TableName("sys_notice")
public class SysNotice
{
    private static final long serialVersionUID = 1L;
    /** 公告ID */
    @TableId(value = "notice_id", type = IdType.AUTO)
    private Long noticeId;
    /** 公告标题 */
src/main/java/com/ruoyi/project/system/service/ISysNoticeService.java
@@ -82,4 +82,11 @@
     */
    void simpleNoticeAll(final String title, final String message,final String jumpPath);
    /**
     * APP点击推送消息更改为已读状态
     *
     * @param noticeId 消息ID
     * @return 失败/成功
     */
    boolean appReadNotice(Long noticeId);
}
src/main/java/com/ruoyi/project/system/service/impl/SysNoticeServiceImpl.java
@@ -28,6 +28,7 @@
import com.ruoyi.project.system.domain.SysNotice;
import com.ruoyi.project.system.mapper.SysNoticeMapper;
import com.ruoyi.project.system.service.ISysNoticeService;
import org.springframework.transaction.annotation.Transactional;
/**
 * 公告 服务层实现
@@ -230,4 +231,20 @@
        return sysNotice;
    }
    @Override
    @Transactional(rollbackFor = Exception.class)
    public boolean appReadNotice(Long noticeId) {
        if (noticeId == null) {
            return false;
        }
        SysNotice sysNotice = noticeMapper.selectNoticeById(noticeId);
        if (sysNotice == null) {
            return false;
        }
        sysNotice.setStatus("1");
        return noticeMapper.update(null, Wrappers.<SysNotice>lambdaUpdate()
                .eq(SysNotice::getNoticeId, noticeId)
                .eq(SysNotice::getStatus, "0")
                .set(SysNotice::getStatus, "1")) > 0;
    }
}
src/main/java/com/ruoyi/project/system/service/impl/UnipushService.java
@@ -1,5 +1,6 @@
package com.ruoyi.project.system.service.impl;
import com.alibaba.fastjson2.JSON;
import com.getui.push.v2.sdk.ApiHelper;
import com.getui.push.v2.sdk.GtApiConfiguration;
import com.getui.push.v2.sdk.api.PushApi;
@@ -25,6 +26,7 @@
import org.springframework.stereotype.Component;
import javax.annotation.PostConstruct;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@@ -84,6 +86,7 @@
            // 推送
            sendRoutingPush(
                    sysNotice.getNoticeId(),
                    client.getCid(),
                    sysNotice.getNoticeTitle(),
                    sysNotice.getRemark() != null ? sysNotice.getRemark() : sysNotice.getNoticeContent(),
@@ -139,18 +142,23 @@
    /**
     * 发送单人路由推送
     */
    private void sendRoutingPush(String cid, String title, String content, String targetPath) {
        log.info("准备推送消息: CID={}, Title={}, TargetPath={}", cid, title, targetPath);
    private void sendRoutingPush(Long noticeId, String cid, String title, String content, String targetPath) {
        log.info("准备推送消息:NoticeId={}, CID={}, Title={}, TargetPath={}", noticeId, cid, title, targetPath);
        PushDTO<Audience> pushDTO = new PushDTO<>();
        pushDTO.setRequestId("REQ_" + System.currentTimeMillis());
        // 在线透传内容
        PushMessage pushMessage = new PushMessage();
        String transmissionContent = String.format(
                "{\"title\":\"%s\",\"content\":\"%s\",\"payload\":\"%s\"}",
                title, content, targetPath
        );
        Map<String, Object> pushMessageMap = new HashMap<>();
        Map<String, Object> payloadMap = new HashMap<>();
        pushMessageMap.put("title", title);
        pushMessageMap.put("content", content);
        payloadMap.put("url", targetPath);
        payloadMap.put("noticeId", noticeId);
        pushMessageMap.put("payload", JSON.toJSONString(payloadMap));
        String transmissionContent = JSON.toJSONString(pushMessageMap);
        pushMessage.setTransmission(transmissionContent);
        pushDTO.setPushMessage(pushMessage);
@@ -160,7 +168,7 @@
        pushDTO.setAudience(audience);
        // 离线推送通道
        pushDTO.setPushChannel(getPushChannel(title, content, targetPath));
//        pushDTO.setPushChannel(getPushChannel(noticeId, title, content, targetPath));
        try {
            ApiResult<Map<String, Map<String, String>>> result = pushApi.pushToSingleByCid(pushDTO);
@@ -175,7 +183,7 @@
    }
    @NotNull
    private PushChannel getPushChannel(String title, String content, String targetPath) {
    private PushChannel getPushChannel(Long noticeId, String title, String content, String targetPath) {
        PushChannel pushChannel = new PushChannel();
        AndroidDTO androidDTO = new AndroidDTO();
        Ups ups = new Ups();
src/main/java/com/ruoyi/sales/controller/SalesLedgerProductController.java
@@ -72,15 +72,14 @@
     * 查询产品信息列表
     */
    @GetMapping("/list")
    public AjaxResult list(SalesLedgerProduct salesLedgerProduct)
    {
    public AjaxResult list(SalesLedgerProduct salesLedgerProduct) {
        List<SalesLedgerProduct> list = salesLedgerProductService.selectSalesLedgerProductList(salesLedgerProduct);
        list.forEach(item -> {
                if (item.getFutureTickets().compareTo(BigDecimal.ZERO) == 0) {
                    item.setFutureTickets(item.getQuantity());
                }
            if (item.getFutureTickets().compareTo(BigDecimal.ZERO) == 0) {
                item.setFutureTickets(BigDecimal.ZERO);
            }
            if (item.getFutureTicketsAmount().compareTo(BigDecimal.ZERO) == 0) {
                item.setFutureTicketsAmount(item.getTaxInclusiveTotalPrice());
                item.setFutureTicketsAmount(BigDecimal.ZERO);
            }
//            ProcurementPageDto procurementDto = new ProcurementPageDto();
//            procurementDto.setSalesLedgerProductId(item.getId());
@@ -89,13 +88,13 @@
//            BigDecimal stockQuantity = stockUtils.getStockQuantity(item.getProductModelId()).get("stockQuantity");
//                ProcurementPageDtoCopy procurementDtoCopy = result.getRecords().get(0);
                if (item.getApproveStatus() != 2) {
                    if (item.getHasSufficientStock() == 0) {
                        item.setApproveStatus(0);
                    }else {
                        item.setApproveStatus(1);
                    }
            if (item.getApproveStatus() != 2) {
                if (item.getHasSufficientStock() == 0) {
                    item.setApproveStatus(0);
                } else {
                    item.setApproveStatus(1);
                }
            }
        });
        return AjaxResult.success(list);
    }
src/main/resources/mapper/purchase/PurchaseLedgerMapper.xml
@@ -9,17 +9,18 @@
        SET contract_amount = #{totalTaxInclusiveAmount}
        WHERE id = #{id}
    </update>
    <select id="selectPurchaseLedgerListPage" resultType="com.ruoyi.purchase.dto.PurchaseLedgerDto">
        select
        SELECT
        pl.id,
        pl.purchase_contract_number ,
        pl.purchase_contract_number,
        pl.sales_contract_no,
        pl.supplier_id,
        pl.supplier_name,
        pl.project_name,
        pl.contract_amount,
        IFNULL(sum(tr.invoice_amount),0) as receipt_payment_amount,
        pl.contract_amount-IFNULL(sum(tr.invoice_amount),0) AS unReceipt_payment_amount,
        IFNULL(tr_sum.total_invoice_amount, 0) AS receipt_payment_amount,
        pl.contract_amount - IFNULL(tr_sum.total_invoice_amount, 0) AS unReceipt_payment_amount,
        pl.entry_date,
        pl.execution_date,
        pl.recorder_id,
@@ -30,42 +31,41 @@
        pl.approval_status,
        pl.payment_method,
        pl.remarks
        from purchase_ledger pl
        left join sales_ledger_product slp on slp.sales_ledger_id = pl.id and slp.type=2
        left join product_record pr on pl.id = pr.purchase_ledger_id
        left join ticket_registration tr on tr.id = pr.ticket_registration_id
        left join supplier_manage sm on pl.supplier_id = sm.id
        FROM purchase_ledger pl
        LEFT JOIN (
        SELECT
        purchase_ledger_id,
        SUM(invoice_amount) AS total_invoice_amount
        FROM ticket_registration
        GROUP BY purchase_ledger_id
        ) tr_sum ON pl.id = tr_sum.purchase_ledger_id
        LEFT JOIN supplier_manage sm ON pl.supplier_id = sm.id
        <where>
            1 = 1
            <if test="c.purchaseContractNumber != null and c.purchaseContractNumber != ''">
               and pl.purchase_contract_number like concat('%',#{c.purchaseContractNumber},'%')
                AND pl.purchase_contract_number LIKE CONCAT('%', #{c.purchaseContractNumber}, '%')
            </if>
            <if test="c.approvalStatus != null and c.approvalStatus != ''">
                and pl.approval_status = #{c.approvalStatus}
                AND pl.approval_status = #{c.approvalStatus}
            </if>
            <if test="c.supplierName != null and c.supplierName != ''">
                and pl.supplier_name like concat('%',#{c.supplierName},'%')
                AND pl.supplier_name LIKE CONCAT('%', #{c.supplierName}, '%')
            </if>
            <if test="c.salesContractNo != null and c.salesContractNo != ''">
                and pl.sales_contract_no like concat('%',#{c.salesContractNo},'%')
                AND pl.sales_contract_no LIKE CONCAT('%', #{c.salesContractNo}, '%')
            </if>
            <if test="c.projectName != null and c.projectName != ''">
                and pl.project_name like concat('%',#{c.projectName},'%')
                AND pl.project_name LIKE CONCAT('%', #{c.projectName}, '%')
            </if>
            <if test="c.entryDateStart != null and c.entryDateStart != '' ">
                AND pl.entry_date &gt;= DATE_FORMAT(#{c.entryDateStart},'%Y-%m-%d')
            <if test="c.entryDateStart != null and c.entryDateStart != ''">
                AND pl.entry_date &gt;= #{c.entryDateStart}
            </if>
            <if test="c.entryDateEnd != null and c.entryDateEnd != '' ">
                AND  pl.entry_date &lt;= DATE_FORMAT(#{c.entryDateEnd},'%Y-%m-%d')
            <if test="c.entryDateEnd != null and c.entryDateEnd != ''">
                AND pl.entry_date &lt;= #{c.entryDateEnd}
            </if>
        </where>
        group by pl.id, pl.purchase_contract_number, pl.sales_contract_no, pl.supplier_name,
        pl.project_name,pl.entry_date,
        pl.recorder_name,
        pl.contract_amount
        order by pl.entry_date desc
        ORDER BY pl.entry_date DESC
    </select>
    <select id="getPaymentRegistrationDtoById" resultType="com.ruoyi.purchase.dto.PaymentRegistrationDto">
        SELECT
            T1.id,
src/main/resources/mapper/sales/SalesLedgerProductMapper.xml
@@ -8,23 +8,23 @@
        SELECT
        T1.*,
        CASE
        WHEN t2.qualitity-t2.locked_quantity >= T1.quantity THEN 1
        WHEN (IFNULL(t2.qualitity, 0) - IFNULL(t2.locked_quantity, 0)) >= IFNULL(T1.quantity, 0) THEN 1
        ELSE 0
        END as has_sufficient_stock
        FROM
        sales_ledger_product T1
        LEFT JOIN stock_inventory t2 ON T1.product_model_id = t2.product_model_id
        <where>
            1=1
            <if test="salesLedgerProduct.salesLedgerId != null and salesLedgerProduct.salesLedgerId != '' ">
            <if test="salesLedgerProduct.salesLedgerId != null">
                AND T1.sales_ledger_id = #{salesLedgerProduct.salesLedgerId}
            </if>
            <if test="salesLedgerProduct.type != null and salesLedgerProduct.type != '' ">
            <if test="salesLedgerProduct.type != null">
                AND T1.type = #{salesLedgerProduct.type}
            </if>
        </where>
        ORDER BY T1.register_date DESC
    </select>
    <select id="selectSalesLedgerProductByMainId" resultType="com.ruoyi.sales.pojo.SalesLedgerProduct">
        select slp.*
        from quality_inspect qi