中扬CRM客户关系管理系统
#
LSH
2023-08-14 25f51717cce32d8260ead3247d47883ef8a3070d
#
1个文件已添加
1个文件已修改
72 ■■■■ 已修改文件
src/main/java/com/zy/crm/common/web/DatavController.java 55 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/resources/datav/sql/product.sql 17 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/crm/common/web/DatavController.java
@@ -8,6 +8,7 @@
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.PostConstruct;
import java.io.IOException;
import java.io.InputStream;
import java.util.List;
@@ -20,22 +21,56 @@
@SuppressWarnings("all")
public class DatavController {
    private String 生产订单;
    private String 销售订单;
    private String product = "select\n" +
            "A5.NAME AS 所属组织,\n" +
            "A.DocNo as 单号,A3.Code as 项目号,a7.Name as 单据类型,\n" +
            "A.StartDate as 计划开工日,\n" +
            "A.CompleteDate as 计划完工日,A2.Code as 料号,A2.name as 品名,A2.SPECS as 规格 , a.ProductQty as 生产数量,TotalCompleteQty as 完工数量\n" +
            "from MO_MO as A\n" +
            "left join CBO_ItemMaster as A2 on (A.ItemMaster = A2.ID)\n" +
            "left join CBO_Project as A3 on (A.Project = A3.ID)\n" +
            "left join Base_Organization as A4 on (A.Org = A4.ID)\n" +
            "left join Base_Organization_Trl as a5 on (a4.ID = a5.ID)\n" +
            "left join MO_MODocType as a6 on (a.MODocType=a6.ID)\n" +
            "left join MO_MODocType_Trl as a7 on (a6.id=a7.ID)\n" +
            "where A7.NAME != '研发项目'  --过滤内部研发项目\n" +
            "and A.IsWBSTask!=1                 --过滤现场施工任务\n" +
            "and A.DocState != '3'              --过滤完工状态的订单\n" +
            "and (A7.NAME IS NOT NULL AND A7.NAME !='')\n" +
            "ORDER BY A.CompleteDate";
    private String sale = "select sum(total) as sum, month\n" +
            "from\n" +
            "(\n" +
            "\tselect A.DOCNO as 项目号,a.TotalMoneyTC as total,a.CreatedOn as 创建日期,a3.PersonName_DisplayName as 业务员,\n" +
            "\ta7.Name as 项目类型,A6.Name as 客户名称,A9.name AS 所属组织,Month(a.CreatedOn) as month\n" +
            "\tfrom SM_SO as A\n" +
            "\tleft join CBO_Operators as A2 on(A.Seller = A2.ID)\n" +
            "\tleft join Base_Contact as A3 on (a2.Contact=a3.ID)\n" +
            "\tleft join SM_SODocType as A4 on (A.DocumentType = a4.ID)\n" +
            "\tleft join SM_SODocType_Trl as A7 ON (A4.ID=A7.ID)\n" +
            "\tleft join CBO_Customer as A5 on(A.OrderBy_Customer = A5.ID)\n" +
            "\tleft join CBO_Customer_Trl as A6 on (A5.ID=A6.ID) AND (A6.SysMLFlag = 'zh-CN')\n" +
            "\tleft join Base_Organization as A8 on (A.Org = A8.ID)\n" +
            "\tleft join Base_Organization_Trl as a9 on (a8.ID = a9.ID)\n" +
            "\twhere A5.CODE not in ('S-00002','S-00003')  --过滤内部交易的订单\n" +
            ") a\n" +
            "group by month\n" +
            "order by month asc\n";
    {
        try {
            this.生产订单 = read(new ClassPathResource("datav/sql/生产订单.sql").getInputStream());
            this.销售订单 = read(new ClassPathResource("datav/sql/销售订单.sql").getInputStream());
        } catch (IOException ignore) {}
    }
//    {
//        try {
//            this.product = read(new ClassPathResource("datav/sql/product.sql").getInputStream());
//            this.销售订单 = read(new ClassPathResource("datav/sql/销售订单.sql").getInputStream());
//        } catch (IOException ignore) {}
//    }
//
    @Autowired
    private DbSqlServer dbSqlServer;
    @GetMapping("/data1")
    public R data1() {
        List<Map<String, Object>> res = dbSqlServer.select(this.生产订单);
        List<Map<String, Object>> res = dbSqlServer.select(this.product);
        if (Cools.isEmpty(res)) {
            return R.ok();
        }
@@ -48,7 +83,7 @@
    @GetMapping("/data3")
    public R data3() {
        List<Map<String, Object>> res = dbSqlServer.select(this.销售订单);
        List<Map<String, Object>> res = dbSqlServer.select(this.sale);
        if (Cools.isEmpty(res)) {
            return R.ok();
        }
src/main/resources/datav/sql/product.sql
New file
@@ -0,0 +1,17 @@
select
A5.NAME AS 所属组织,
A.DocNo as 单号,A3.Code as 项目号,a7.Name as 单据类型,
A.StartDate as 计划开工日,
A.CompleteDate as 计划完工日,A2.Code as 料号,A2.name as 品名,A2.SPECS as 规格 , a.ProductQty as 生产数量,TotalCompleteQty as 完工数量
from MO_MO as A
left join CBO_ItemMaster as A2 on (A.ItemMaster = A2.ID)
left join CBO_Project as A3 on (A.Project = A3.ID)
left join Base_Organization as A4 on (A.Org = A4.ID)
left join Base_Organization_Trl as a5 on (a4.ID = a5.ID)
left join MO_MODocType as a6 on (a.MODocType=a6.ID)
left join MO_MODocType_Trl as a7 on (a6.id=a7.ID)
where A7.NAME != '研发项目'  --过滤内部研发项目
and A.IsWBSTask!=1                 --过滤现场施工任务
and A.DocState != '3'              --过滤完工状态的订单
and (A7.NAME IS NOT NULL AND A7.NAME !='')
ORDER BY A.CompleteDate