Просмотр исходного кода

Merge branch 'dev-1.6.2' of province-qinghai/province-all into dev

李毅 1 год назад
Родитель
Сommit
bfc8117994
17 измененных файлов с 1070 добавлено и 0 удалено
  1. 165 0
      unis-plugin/unis-plugin-biz/src/main/java/com/unis/rotationPlan/info/modular/businessrpreport/controller/BusinessRpReportController.java
  2. 97 0
      unis-plugin/unis-plugin-biz/src/main/java/com/unis/rotationPlan/info/modular/businessrpreport/entity/BusinessRpReport.java
  3. 29 0
      unis-plugin/unis-plugin-biz/src/main/java/com/unis/rotationPlan/info/modular/businessrpreport/entity/vo/BusinessRpReportVO.java
  4. 34 0
      unis-plugin/unis-plugin-biz/src/main/java/com/unis/rotationPlan/info/modular/businessrpreport/enums/BusinessRpReportEnum.java
  5. 47 0
      unis-plugin/unis-plugin-biz/src/main/java/com/unis/rotationPlan/info/modular/businessrpreport/mapper/BusinessRpReportMapper.java
  6. 107 0
      unis-plugin/unis-plugin-biz/src/main/java/com/unis/rotationPlan/info/modular/businessrpreport/mapper/mapping/BusinessRpReportMapper.xml
  7. 74 0
      unis-plugin/unis-plugin-biz/src/main/java/com/unis/rotationPlan/info/modular/businessrpreport/param/BusinessRpReportAddParam.java
  8. 79 0
      unis-plugin/unis-plugin-biz/src/main/java/com/unis/rotationPlan/info/modular/businessrpreport/param/BusinessRpReportEditParam.java
  9. 38 0
      unis-plugin/unis-plugin-biz/src/main/java/com/unis/rotationPlan/info/modular/businessrpreport/param/BusinessRpReportIdParam.java
  10. 60 0
      unis-plugin/unis-plugin-biz/src/main/java/com/unis/rotationPlan/info/modular/businessrpreport/param/BusinessRpReportPageParam.java
  11. 85 0
      unis-plugin/unis-plugin-biz/src/main/java/com/unis/rotationPlan/info/modular/businessrpreport/service/BusinessRpReportService.java
  12. 185 0
      unis-plugin/unis-plugin-biz/src/main/java/com/unis/rotationPlan/info/modular/businessrpreport/service/impl/BusinessRpReportServiceImpl.java
  13. 15 0
      unis-plugin/unis-plugin-biz/src/main/java/com/unis/rotationPlan/info/modular/businessrpreport/util/Grain.java
  14. 13 0
      unis-plugin/unis-plugin-biz/src/main/java/com/unis/rotationPlan/info/modular/businessrpreport/util/OrgInfo.java
  15. 14 0
      unis-plugin/unis-plugin-biz/src/main/java/com/unis/rotationPlan/info/modular/businessrpreport/util/TableColumn.java
  16. 13 0
      unis-plugin/unis-plugin-biz/src/main/java/com/unis/rotationPlan/info/modular/businessrpreport/util/TableColumns.java
  17. 15 0
      unis-plugin/unis-plugin-biz/src/main/java/com/unis/rotationPlan/info/modular/businessrpreport/util/UnitInfo.java

+ 165 - 0
unis-plugin/unis-plugin-biz/src/main/java/com/unis/rotationPlan/info/modular/businessrpreport/controller/BusinessRpReportController.java

@@ -0,0 +1,165 @@
1
+/*
2
+ * Copyright [2022] [https://www.xiaonuo.vip]
3
+ *
4
+ * Snowy采用APACHE LICENSE 2.0开源协议,您在使用过程中,需要注意以下几点:
5
+ *
6
+ * 1.请不要删除和修改根目录下的LICENSE文件。
7
+ * 2.请不要删除和修改Snowy源码头部的版权声明。
8
+ * 3.本项目代码可免费商业使用,商业使用请保留源码和相关描述文件的项目出处,作者声明等。
9
+ * 4.分发源码时候,请注明软件出处 https://www.xiaonuo.vip
10
+ * 5.不可二次分发开源参与同类竞品,如有想法可联系团队xiaonuobase@qq.com商议合作。
11
+ * 6.若您的项目无法满足以上几点,需要更多功能代码,获取Snowy商业授权许可,请在官网购买授权,地址为 https://www.xiaonuo.vip
12
+ */
13
+package com.unis.rotationPlan.info.modular.businessrpreport.controller;
14
+
15
+import cn.dev33.satoken.annotation.SaCheckPermission;
16
+import com.baomidou.mybatisplus.core.metadata.IPage;
17
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
18
+import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
19
+import com.github.xiaoymin.knife4j.annotations.ApiSupport;
20
+import com.unis.rotationPlan.info.modular.businessrpreport.util.Grain;
21
+import io.swagger.annotations.Api;
22
+import io.swagger.annotations.ApiOperation;
23
+import org.springframework.validation.annotation.Validated;
24
+import org.springframework.web.bind.annotation.GetMapping;
25
+import org.springframework.web.bind.annotation.PostMapping;
26
+import org.springframework.web.bind.annotation.RequestBody;
27
+import org.springframework.web.bind.annotation.RestController;
28
+import com.unis.common.annotation.CommonLog;
29
+import com.unis.common.pojo.CommonResult;
30
+import com.unis.common.pojo.CommonValidList;
31
+import com.unis.rotationPlan.info.modular.businessrpreport.entity.BusinessRpReport;
32
+import com.unis.rotationPlan.info.modular.businessrpreport.param.BusinessRpReportAddParam;
33
+import com.unis.rotationPlan.info.modular.businessrpreport.param.BusinessRpReportEditParam;
34
+import com.unis.rotationPlan.info.modular.businessrpreport.param.BusinessRpReportIdParam;
35
+import com.unis.rotationPlan.info.modular.businessrpreport.param.BusinessRpReportPageParam;
36
+import com.unis.rotationPlan.info.modular.businessrpreport.service.BusinessRpReportService;
37
+
38
+import javax.annotation.Resource;
39
+import javax.validation.Valid;
40
+import javax.validation.constraints.NotEmpty;
41
+import java.util.List;
42
+import java.util.Map;
43
+
44
+/**
45
+ * 轮换计划-上报控制器
46
+ *
47
+ * @author ZeroLiYi
48
+ * @date  2024/05/14 18:05
49
+ */
50
+@Api(tags = "轮换计划-上报控制器")
51
+@ApiSupport(author = "UNIS_TEAM", order = 1)
52
+@RestController
53
+@Validated
54
+public class BusinessRpReportController {
55
+
56
+    @Resource
57
+    private BusinessRpReportService businessRpReportService;
58
+
59
+    /**
60
+     * 获取轮换计划-上报分页
61
+     *
62
+     * @author ZeroLiYi
63
+     * @date  2024/05/14 18:05
64
+     */
65
+    @ApiOperationSupport(order = 1)
66
+    @ApiOperation("获取轮换计划-上报分页")
67
+    @GetMapping("/rotationPlan.info/businessrpreport/page")
68
+    public CommonResult<IPage<Map<String,Object>>> page(BusinessRpReportPageParam businessRpReportPageParam) {
69
+        return CommonResult.data(businessRpReportService.page(businessRpReportPageParam));
70
+    }
71
+
72
+    /**
73
+     * 添加轮换计划-上报
74
+     *
75
+     * @author ZeroLiYi
76
+     * @date  2024/05/14 18:05
77
+     */
78
+    @ApiOperationSupport(order = 2)
79
+    @ApiOperation("添加轮换计划-上报")
80
+    @CommonLog("添加轮换计划-上报")
81
+    @SaCheckPermission("/rotationPlan.info/businessrpreport/add")
82
+    @PostMapping("/rotationPlan.info/businessrpreport/add")
83
+    public CommonResult<String> add(@RequestBody @Valid BusinessRpReportAddParam businessRpReportAddParam) {
84
+        businessRpReportService.add(businessRpReportAddParam);
85
+        return CommonResult.ok();
86
+    }
87
+
88
+    /**
89
+     * 编辑轮换计划-上报
90
+     *
91
+     * @author ZeroLiYi
92
+     * @date  2024/05/14 18:05
93
+     */
94
+    @ApiOperationSupport(order = 3)
95
+    @ApiOperation("编辑轮换计划-上报")
96
+    @CommonLog("编辑轮换计划-上报")
97
+    @SaCheckPermission("/rotationPlan.info/businessrpreport/edit")
98
+    @PostMapping("/rotationPlan.info/businessrpreport/edit")
99
+    public CommonResult<String> edit(@RequestBody @Valid BusinessRpReportEditParam businessRpReportEditParam) {
100
+        businessRpReportService.edit(businessRpReportEditParam);
101
+        return CommonResult.ok();
102
+    }
103
+
104
+    /**
105
+     * 删除轮换计划-上报
106
+     *
107
+     * @author ZeroLiYi
108
+     * @date  2024/05/14 18:05
109
+     */
110
+    @ApiOperationSupport(order = 4)
111
+    @ApiOperation("删除轮换计划-上报")
112
+    @CommonLog("删除轮换计划-上报")
113
+    @SaCheckPermission("/rotationPlan.info/businessrpreport/delete")
114
+    @PostMapping("/rotationPlan.info/businessrpreport/delete")
115
+    public CommonResult<String> delete(@RequestBody @Valid @NotEmpty(message = "集合不能为空")
116
+                                                   CommonValidList<BusinessRpReportIdParam> businessRpReportIdParamList) {
117
+        businessRpReportService.delete(businessRpReportIdParamList);
118
+        return CommonResult.ok();
119
+    }
120
+
121
+    /**
122
+     * 获取轮换计划-上报详情
123
+     *
124
+     * @author ZeroLiYi
125
+     * @date  2024/05/14 18:05
126
+     */
127
+    @ApiOperationSupport(order = 5)
128
+    @ApiOperation("获取轮换计划-上报详情")
129
+    @SaCheckPermission("/rotationPlan.info/businessrpreport/detail")
130
+    @GetMapping("/rotationPlan.info/businessrpreport/detail")
131
+    public CommonResult<List<Map<String,Object>>> detail(@Valid BusinessRpReportIdParam businessRpReportIdParam) {
132
+        return CommonResult.data(businessRpReportService.detail(businessRpReportIdParam));
133
+    }
134
+
135
+    /**
136
+     * 轮换计划制定(汇总)分页
137
+     *
138
+     * @author ZeroLiYi
139
+     * @date  2024/05/14 18:05
140
+     */
141
+//    @ApiOperationSupport(order = 1)
142
+//    @ApiOperation("轮换计划制定(汇总)分页")
143
+//    @GetMapping("/rotationPlan.info/businessrpreport/page")
144
+//    public CommonResult<IPage<Map<String,Object>>> findSumpage(BusinessRpReportPageParam businessRpReportPageParam) {
145
+//        return CommonResult.data(businessRpReportService.findSumpage(businessRpReportPageParam));
146
+//    }
147
+
148
+
149
+    /**
150
+     * 生成制定轮换计划
151
+     *
152
+     * @author ZeroLiYi
153
+     * @date  2024/05/14 18:05
154
+     */
155
+    @ApiOperationSupport(order = 5)
156
+    @ApiOperation("生成制定轮换计划")
157
+    @GetMapping("/rotationPlan.info/businessrpreport/createreport")
158
+    public CommonResult<Map<String,Object>> createreport(@Valid BusinessRpReportIdParam businessRpReportIdParam) {
159
+
160
+        Map<String,Object> map =businessRpReportService.createReport(businessRpReportIdParam);
161
+        return CommonResult.data(map);
162
+    }
163
+
164
+
165
+}

+ 97 - 0
unis-plugin/unis-plugin-biz/src/main/java/com/unis/rotationPlan/info/modular/businessrpreport/entity/BusinessRpReport.java

@@ -0,0 +1,97 @@
1
+/*
2
+ * Copyright [2022] [https://www.xiaonuo.vip]
3
+ *
4
+ * Snowy采用APACHE LICENSE 2.0开源协议,您在使用过程中,需要注意以下几点:
5
+ *
6
+ * 1.请不要删除和修改根目录下的LICENSE文件。
7
+ * 2.请不要删除和修改Snowy源码头部的版权声明。
8
+ * 3.本项目代码可免费商业使用,商业使用请保留源码和相关描述文件的项目出处,作者声明等。
9
+ * 4.分发源码时候,请注明软件出处 https://www.xiaonuo.vip
10
+ * 5.不可二次分发开源参与同类竞品,如有想法可联系团队xiaonuobase@qq.com商议合作。
11
+ * 6.若您的项目无法满足以上几点,需要更多功能代码,获取Snowy商业授权许可,请在官网购买授权,地址为 https://www.xiaonuo.vip
12
+ */
13
+package com.unis.rotationPlan.info.modular.businessrpreport.entity;
14
+
15
+import com.baomidou.mybatisplus.annotation.*;
16
+import io.swagger.annotations.ApiModelProperty;
17
+import lombok.Getter;
18
+import lombok.Setter;
19
+import java.math.BigDecimal;
20
+import java.util.Date;
21
+
22
+/**
23
+ * 轮换计划-上报实体
24
+ *
25
+ * @author ZeroLiYi
26
+ * @date  2024/05/14 18:05
27
+ **/
28
+@Getter
29
+@Setter
30
+@TableName("business_rp_report")
31
+public class BusinessRpReport {
32
+
33
+    /** 主键ID */
34
+    @TableId
35
+    @ApiModelProperty(value = "主键ID", position = 1)
36
+    private Integer id;
37
+
38
+    /** 创建时间 */
39
+    @ApiModelProperty(value = "创建时间", position = 2)
40
+    @TableField(fill = FieldFill.INSERT)
41
+    private Date createTime;
42
+
43
+    /** 创建用户 */
44
+    @ApiModelProperty(value = "创建用户", position = 3)
45
+    @TableField(fill = FieldFill.INSERT)
46
+    private String createUser;
47
+
48
+    /** 更新时间 */
49
+    @ApiModelProperty(value = "更新时间", position = 4)
50
+    @TableField(fill = FieldFill.UPDATE)
51
+    private Date updateTime;
52
+
53
+    /** 更新用户 */
54
+    @ApiModelProperty(value = "更新用户", position = 5)
55
+    @TableField(fill = FieldFill.UPDATE)
56
+    private String updateUser;
57
+
58
+    /** 企业id;province_all.biz_unit_info的id; */
59
+    @ApiModelProperty(value = "企业id;province_all.biz_unit_info的id;", position = 6)
60
+    private String unitInfoId;
61
+
62
+    /** 计划名称 */
63
+    @ApiModelProperty(value = "计划名称", position = 7)
64
+    private String planName;
65
+
66
+    /** 轮换年度 */
67
+    @ApiModelProperty(value = "轮换年度", position = 8)
68
+    private Date rotationYear;
69
+
70
+    /** 计划类型 1: 粮食轮换计划; 2: 油料轮换计划; */
71
+    @ApiModelProperty(value = "计划类型 1: 粮食轮换计划; 2: 油料轮换计划;", position = 9)
72
+    private Integer planType;
73
+
74
+    /** 计划年度 */
75
+    @ApiModelProperty(value = "计划年度", position = 10)
76
+    private Date planYear;
77
+
78
+    /** 申请人 */
79
+    @ApiModelProperty(value = "申请人", position = 11)
80
+    private String applicant;
81
+
82
+    /** 创建日期 */
83
+    @ApiModelProperty(value = "创建日期", position = 12)
84
+    private Date createDate;
85
+
86
+    /** 状态 0:保存;1:提交; */
87
+    @ApiModelProperty(value = "状态 0:保存;1:提交;", position = 13)
88
+    private Integer status;
89
+
90
+    /** 上报时间 */
91
+    @ApiModelProperty(value = "上报时间", position = 14)
92
+    private Date reportTime;
93
+
94
+    /** 轮换类型 1:静态轮换;2:动态轮换; */
95
+    @ApiModelProperty(value = "轮换类型 1:静态轮换;2:动态轮换;", position = 15)
96
+    private Integer type;
97
+}

+ 29 - 0
unis-plugin/unis-plugin-biz/src/main/java/com/unis/rotationPlan/info/modular/businessrpreport/entity/vo/BusinessRpReportVO.java

@@ -0,0 +1,29 @@
1
+package com.unis.rotationPlan.info.modular.businessrpreport.entity.vo;
2
+
3
+import com.unis.rotationPlan.info.modular.businessrpreport.entity.BusinessRpReport;
4
+import io.swagger.annotations.ApiModelProperty;
5
+import lombok.Getter;
6
+import lombok.Setter;
7
+
8
+@Setter
9
+@Getter
10
+public class BusinessRpReportVO{
11
+
12
+    private Integer orgId;
13
+
14
+    private String dwmc;//企业名称名称
15
+
16
+    private String orgName; //单位名称
17
+
18
+    private String grainVarietyName;//粮食品种
19
+
20
+    private String storehouseName;//仓房名称
21
+
22
+    private String warehouseName; //货位名称
23
+
24
+    private Double outboundQuantity;//轮出数量
25
+
26
+    private Double inboundQuantity;//轮入数量
27
+
28
+
29
+}

+ 34 - 0
unis-plugin/unis-plugin-biz/src/main/java/com/unis/rotationPlan/info/modular/businessrpreport/enums/BusinessRpReportEnum.java

@@ -0,0 +1,34 @@
1
+/*
2
+ * Copyright [2022] [https://www.xiaonuo.vip]
3
+ *
4
+ * Snowy采用APACHE LICENSE 2.0开源协议,您在使用过程中,需要注意以下几点:
5
+ *
6
+ * 1.请不要删除和修改根目录下的LICENSE文件。
7
+ * 2.请不要删除和修改Snowy源码头部的版权声明。
8
+ * 3.本项目代码可免费商业使用,商业使用请保留源码和相关描述文件的项目出处,作者声明等。
9
+ * 4.分发源码时候,请注明软件出处 https://www.xiaonuo.vip
10
+ * 5.不可二次分发开源参与同类竞品,如有想法可联系团队xiaonuobase@qq.com商议合作。
11
+ * 6.若您的项目无法满足以上几点,需要更多功能代码,获取Snowy商业授权许可,请在官网购买授权,地址为 https://www.xiaonuo.vip
12
+ */
13
+package com.unis.rotationPlan.info.modular.businessrpreport.enums;
14
+
15
+import lombok.Getter;
16
+
17
+/**
18
+ * 轮换计划-上报枚举
19
+ *
20
+ * @author ZeroLiYi
21
+ * @date  2024/05/14 18:05
22
+ **/
23
+@Getter
24
+public enum BusinessRpReportEnum {
25
+
26
+    /** 测试 */
27
+    TEST("TEST");
28
+
29
+    private final String value;
30
+
31
+    BusinessRpReportEnum(String value) {
32
+        this.value = value;
33
+    }
34
+}

+ 47 - 0
unis-plugin/unis-plugin-biz/src/main/java/com/unis/rotationPlan/info/modular/businessrpreport/mapper/BusinessRpReportMapper.java

@@ -0,0 +1,47 @@
1
+/*
2
+ * Copyright [2022] [https://www.xiaonuo.vip]
3
+ *
4
+ * Snowy采用APACHE LICENSE 2.0开源协议,您在使用过程中,需要注意以下几点:
5
+ *
6
+ * 1.请不要删除和修改根目录下的LICENSE文件。
7
+ * 2.请不要删除和修改Snowy源码头部的版权声明。
8
+ * 3.本项目代码可免费商业使用,商业使用请保留源码和相关描述文件的项目出处,作者声明等。
9
+ * 4.分发源码时候,请注明软件出处 https://www.xiaonuo.vip
10
+ * 5.不可二次分发开源参与同类竞品,如有想法可联系团队xiaonuobase@qq.com商议合作。
11
+ * 6.若您的项目无法满足以上几点,需要更多功能代码,获取Snowy商业授权许可,请在官网购买授权,地址为 https://www.xiaonuo.vip
12
+ */
13
+package com.unis.rotationPlan.info.modular.businessrpreport.mapper;
14
+
15
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
16
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
17
+import com.baomidou.mybatisplus.core.metadata.IPage;
18
+import com.baomidou.mybatisplus.core.toolkit.Constants;
19
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
20
+import com.unis.rotationPlan.info.modular.businessrpreport.entity.BusinessRpReport;
21
+import com.unis.rotationPlan.info.modular.businessrpreport.entity.vo.BusinessRpReportVO;
22
+import com.unis.rotationPlan.info.modular.businessrpreport.param.BusinessRpReportIdParam;
23
+import com.unis.rotationPlan.info.modular.rpBiweeklyReport.entity.RpBiweeklyReport;
24
+import org.apache.ibatis.annotations.Param;
25
+
26
+import java.util.List;
27
+import java.util.Map;
28
+
29
+/**
30
+ * 轮换计划-上报Mapper接口
31
+ *
32
+ * @author ZeroLiYi
33
+ * @date  2024/05/14 18:05
34
+ **/
35
+public interface BusinessRpReportMapper extends BaseMapper<BusinessRpReport> {
36
+
37
+    IPage<Map<String,Object>> selectMyMapsPage(Page<BusinessRpReport> p, @Param(Constants.WRAPPER) QueryWrapper<BusinessRpReport>queryWrapper);
38
+
39
+    /**
40
+     * 获取轮换计划上报详情
41
+     * @param id
42
+     * @return
43
+     */
44
+    List<Map<String,Object>> getDetail(@Param("id") Integer id);
45
+
46
+    List<BusinessRpReportVO> createReport(BusinessRpReportIdParam businessRpReportIdParam);
47
+}

+ 107 - 0
unis-plugin/unis-plugin-biz/src/main/java/com/unis/rotationPlan/info/modular/businessrpreport/mapper/mapping/BusinessRpReportMapper.xml

@@ -0,0 +1,107 @@
1
+<?xml version="1.0" encoding="UTF-8"?>
2
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
3
+<mapper namespace="com.unis.rotationPlan.info.modular.businessrpreport.mapper.BusinessRpReportMapper">
4
+
5
+    <select id="selectMyMapsPage" resultType="java.util.Map">
6
+        SELECT
7
+        b.dwmc AS dwmc,
8
+        SUM(bro.plan_quantity) AS plan_quantity,
9
+        SUM(bri.quantity) AS quantity,
10
+        brr.rotation_year AS rotationYear,
11
+        brr.report_time AS reportTime
12
+        FROM
13
+        depot_qh.business_rp_report brr
14
+        LEFT JOIN depot_qh.business_rp_outbound bro
15
+        ON bro.rp_report_id = brr.id
16
+        LEFT JOIN depot_qh.business_rp_inbound bri
17
+        ON bri.rp_report_id = brr.id
18
+        LEFT JOIN depot_qh.org_info oi
19
+        ON bro.org_id = oi.org_id -- 假设bro.org_id和bri.org_id应相同,否则需要额外处理
20
+        LEFT JOIN province_all.biz_unit_info b
21
+        ON brr.unit_info_id = b.id
22
+        <if test="ew.sqlSegment != null and ew.sqlSegment != ''">
23
+            where ${ew.sqlSegment}
24
+        </if>
25
+        GROUP BY
26
+        oi.org_name,
27
+        brr.rotation_year,
28
+        brr.report_time
29
+    </select>
30
+
31
+    <select id="getDetail" resultType="java.util.Map">
32
+        SELECT
33
+            brr.unit_info_id,
34
+            brr.plan_name,
35
+            brr.rotation_year,  -- 轮换年度
36
+            brr.plan_type,  -- 计划类型 1: 粮食轮换计划; 2: 油料轮换计划;
37
+            brr.plan_year,  -- 计划年度
38
+            brr.type,  -- 轮换类型
39
+            brr.applicant,  --  申请人
40
+            brr.create_date,  -- 创建日期
41
+            bro.*,
42
+            oi.org_name kqmc,
43
+            bri.*,
44
+            bro.sealing_quantity,
45
+            be1.enumName grainVarietyName,
46
+            be2.enumName grainNatureName,
47
+            be3.enumName grainGradeName,
48
+            bs.storehouse_name storehouseName,
49
+            bw.warehouse_name warehouseName
50
+
51
+        FROM
52
+            depot_qh.business_rp_report brr
53
+                LEFT JOIN depot_qh.business_rp_outbound bro ON bro.rp_report_id = brr.id
54
+                left JOIN depot_qh.org_info oi on bro.org_id=oi.org_id
55
+                LEFT JOIN depot_qh.basic_storehouse bs on bro.basic_storehouse_id=bs.storehouse_id
56
+                LEFT JOIN depot_qh.basic_warehouse bw on  bro.warehouse_id =bw.warehouse_id
57
+                LEFT JOIN depot_qh.basic_enum be1 on bro.grain_variety_id =be1.enumId
58
+                LEFT JOIN depot_qh.basic_enum be2 on bro.grain_nature_id =be2.enumId
59
+                LEFT JOIN depot_qh.basic_enum be3 on bro.grain_grade_id =be3.enumId
60
+                LEFT JOIN depot_qh.business_rp_inbound bri on bri.rp_report_id= brr.id
61
+        where brr.id =#{id}
62
+    </select>
63
+
64
+
65
+    <select id="createReport" resultType="com.unis.rotationPlan.info.modular.businessrpreport.entity.vo.BusinessRpReportVO">
66
+        SELECT
67
+            org_id orgId,
68
+            dwmc,
69
+            org_name orgName,
70
+            plan_year,
71
+            -- grain_variety_id ,
72
+            enumName grainVarietyName,
73
+            storehouse_name storehouseName,
74
+            warehouse_name warehouseName,
75
+            MAX(CASE WHEN grain_variety_id  THEN outbound_quantity ELSE NULL END) AS outboundQuantity,
76
+            MAX(CASE WHEN grain_variety_id  THEN inbound_quantity ELSE NULL END) AS inboundQuantity
77
+
78
+        FROM (
79
+                 SELECT
80
+                     bo.org_id,
81
+                     A.dwmc,
82
+                     A.org_name,
83
+                     bo.grain_variety_id,
84
+                     bw.warehouse_name,
85
+                     bs.storehouse_name,
86
+                     be1.enumName,
87
+                     bbo.plan_year,
88
+                     SUM(bo.plan_quantity) AS outbound_quantity,
89
+                     SUM(bi.quantity) AS inbound_quantity
90
+                 FROM
91
+                     depot_qh.business_rp_outbound bo
92
+                         LEFT JOIN depot_qh.business_rp_inbound bi ON bo.org_id = bi.org_id AND bo.grain_variety_id = bi.grain_variety_id
93
+                         left join  business_rp_report bbo on bbo.id=bo.rp_report_id
94
+                         LEFT JOIN depot_qh.basic_enum be1 on bo.grain_variety_id =be1.enumId
95
+                         left join (select o.org_id,bui.dwmc,o.org_name from province_all.biz_unit_info bui LEFT JOIN depot_qh.org_info o on  o.unit_info_id =bui.id)A
96
+                                   on bo.org_id=A.org_id
97
+                         LEFT JOIN depot_qh.basic_storehouse bs on bo.basic_storehouse_id=bs.storehouse_id
98
+                         LEFT JOIN depot_qh.basic_warehouse bw on  bo.warehouse_id =bw.warehouse_id
99
+                        where bbo.plan_year=#{}
100
+                     -- 替换为具体的org_id或省略以查询所有
101
+                 GROUP BY
102
+                     bo.org_id,
103
+                     bo.grain_variety_id,
104
+                     bbo.plan_year
105
+
106
+    </select>
107
+</mapper>

+ 74 - 0
unis-plugin/unis-plugin-biz/src/main/java/com/unis/rotationPlan/info/modular/businessrpreport/param/BusinessRpReportAddParam.java

@@ -0,0 +1,74 @@
1
+/*
2
+ * Copyright [2022] [https://www.xiaonuo.vip]
3
+ *
4
+ * Snowy采用APACHE LICENSE 2.0开源协议,您在使用过程中,需要注意以下几点:
5
+ *
6
+ * 1.请不要删除和修改根目录下的LICENSE文件。
7
+ * 2.请不要删除和修改Snowy源码头部的版权声明。
8
+ * 3.本项目代码可免费商业使用,商业使用请保留源码和相关描述文件的项目出处,作者声明等。
9
+ * 4.分发源码时候,请注明软件出处 https://www.xiaonuo.vip
10
+ * 5.不可二次分发开源参与同类竞品,如有想法可联系团队xiaonuobase@qq.com商议合作。
11
+ * 6.若您的项目无法满足以上几点,需要更多功能代码,获取Snowy商业授权许可,请在官网购买授权,地址为 https://www.xiaonuo.vip
12
+ */
13
+package com.unis.rotationPlan.info.modular.businessrpreport.param;
14
+
15
+import io.swagger.annotations.ApiModelProperty;
16
+import lombok.Getter;
17
+import lombok.Setter;
18
+
19
+import javax.validation.constraints.NotBlank;
20
+import javax.validation.constraints.NotNull;
21
+import java.math.BigDecimal;
22
+import java.util.Date;
23
+
24
+/**
25
+ * 轮换计划-上报添加参数
26
+ *
27
+ * @author ZeroLiYi
28
+ * @date  2024/05/14 18:05
29
+ **/
30
+@Getter
31
+@Setter
32
+public class BusinessRpReportAddParam {
33
+
34
+    /** 企业id;province_all.biz_unit_info的id; */
35
+    @ApiModelProperty(value = "企业id;province_all.biz_unit_info的id;", position = 6)
36
+    private String unitInfoId;
37
+
38
+    /** 计划名称 */
39
+    @ApiModelProperty(value = "计划名称", position = 7)
40
+    private String planName;
41
+
42
+    /** 轮换年度 */
43
+    @ApiModelProperty(value = "轮换年度", position = 8)
44
+    private Date rotationYear;
45
+
46
+    /** 计划类型 1: 粮食轮换计划; 2: 油料轮换计划; */
47
+    @ApiModelProperty(value = "计划类型 1: 粮食轮换计划; 2: 油料轮换计划;", position = 9)
48
+    private Integer planType;
49
+
50
+    /** 计划年度 */
51
+    @ApiModelProperty(value = "计划年度", position = 10)
52
+    private Date planYear;
53
+
54
+    /** 申请人 */
55
+    @ApiModelProperty(value = "申请人", position = 11)
56
+    private String applicant;
57
+
58
+    /** 创建日期 */
59
+    @ApiModelProperty(value = "创建日期", position = 12)
60
+    private Date createDate;
61
+
62
+    /** 状态 0:保存;1:提交; */
63
+    @ApiModelProperty(value = "状态 0:保存;1:提交;", position = 13)
64
+    private Integer status;
65
+
66
+    /** 上报时间 */
67
+    @ApiModelProperty(value = "上报时间", position = 14)
68
+    private Date reportTime;
69
+
70
+    /** 轮换类型 1:静态轮换;2:动态轮换; */
71
+    @ApiModelProperty(value = "轮换类型 1:静态轮换;2:动态轮换;", position = 15)
72
+    private Integer type;
73
+
74
+}

+ 79 - 0
unis-plugin/unis-plugin-biz/src/main/java/com/unis/rotationPlan/info/modular/businessrpreport/param/BusinessRpReportEditParam.java

@@ -0,0 +1,79 @@
1
+/*
2
+ * Copyright [2022] [https://www.xiaonuo.vip]
3
+ *
4
+ * Snowy采用APACHE LICENSE 2.0开源协议,您在使用过程中,需要注意以下几点:
5
+ *
6
+ * 1.请不要删除和修改根目录下的LICENSE文件。
7
+ * 2.请不要删除和修改Snowy源码头部的版权声明。
8
+ * 3.本项目代码可免费商业使用,商业使用请保留源码和相关描述文件的项目出处,作者声明等。
9
+ * 4.分发源码时候,请注明软件出处 https://www.xiaonuo.vip
10
+ * 5.不可二次分发开源参与同类竞品,如有想法可联系团队xiaonuobase@qq.com商议合作。
11
+ * 6.若您的项目无法满足以上几点,需要更多功能代码,获取Snowy商业授权许可,请在官网购买授权,地址为 https://www.xiaonuo.vip
12
+ */
13
+package com.unis.rotationPlan.info.modular.businessrpreport.param;
14
+
15
+import io.swagger.annotations.ApiModelProperty;
16
+import lombok.Getter;
17
+import lombok.Setter;
18
+
19
+import javax.validation.constraints.NotBlank;
20
+import javax.validation.constraints.NotNull;
21
+import java.math.BigDecimal;
22
+import java.util.Date;
23
+
24
+/**
25
+ * 轮换计划-上报编辑参数
26
+ *
27
+ * @author ZeroLiYi
28
+ * @date  2024/05/14 18:05
29
+ **/
30
+@Getter
31
+@Setter
32
+public class BusinessRpReportEditParam {
33
+
34
+    /** 主键ID */
35
+    @ApiModelProperty(value = "主键ID", required = true, position = 1)
36
+    @NotNull(message = "id不能为空")
37
+    private Integer id;
38
+
39
+    /** 企业id;province_all.biz_unit_info的id; */
40
+    @ApiModelProperty(value = "企业id;province_all.biz_unit_info的id;", position = 6)
41
+    private String unitInfoId;
42
+
43
+    /** 计划名称 */
44
+    @ApiModelProperty(value = "计划名称", position = 7)
45
+    private String planName;
46
+
47
+    /** 轮换年度 */
48
+    @ApiModelProperty(value = "轮换年度", position = 8)
49
+    private Date rotationYear;
50
+
51
+    /** 计划类型 1: 粮食轮换计划; 2: 油料轮换计划; */
52
+    @ApiModelProperty(value = "计划类型 1: 粮食轮换计划; 2: 油料轮换计划;", position = 9)
53
+    private Integer planType;
54
+
55
+    /** 计划年度 */
56
+    @ApiModelProperty(value = "计划年度", position = 10)
57
+    private Date planYear;
58
+
59
+    /** 申请人 */
60
+    @ApiModelProperty(value = "申请人", position = 11)
61
+    private String applicant;
62
+
63
+    /** 创建日期 */
64
+    @ApiModelProperty(value = "创建日期", position = 12)
65
+    private Date createDate;
66
+
67
+    /** 状态 0:保存;1:提交; */
68
+    @ApiModelProperty(value = "状态 0:保存;1:提交;", position = 13)
69
+    private Integer status;
70
+
71
+    /** 上报时间 */
72
+    @ApiModelProperty(value = "上报时间", position = 14)
73
+    private Date reportTime;
74
+
75
+    /** 轮换类型 1:静态轮换;2:动态轮换; */
76
+    @ApiModelProperty(value = "轮换类型 1:静态轮换;2:动态轮换;", position = 15)
77
+    private Integer type;
78
+
79
+}

+ 38 - 0
unis-plugin/unis-plugin-biz/src/main/java/com/unis/rotationPlan/info/modular/businessrpreport/param/BusinessRpReportIdParam.java

@@ -0,0 +1,38 @@
1
+/*
2
+ * Copyright [2022] [https://www.xiaonuo.vip]
3
+ *
4
+ * Snowy采用APACHE LICENSE 2.0开源协议,您在使用过程中,需要注意以下几点:
5
+ *
6
+ * 1.请不要删除和修改根目录下的LICENSE文件。
7
+ * 2.请不要删除和修改Snowy源码头部的版权声明。
8
+ * 3.本项目代码可免费商业使用,商业使用请保留源码和相关描述文件的项目出处,作者声明等。
9
+ * 4.分发源码时候,请注明软件出处 https://www.xiaonuo.vip
10
+ * 5.不可二次分发开源参与同类竞品,如有想法可联系团队xiaonuobase@qq.com商议合作。
11
+ * 6.若您的项目无法满足以上几点,需要更多功能代码,获取Snowy商业授权许可,请在官网购买授权,地址为 https://www.xiaonuo.vip
12
+ */
13
+package com.unis.rotationPlan.info.modular.businessrpreport.param;
14
+
15
+import io.swagger.annotations.ApiModelProperty;
16
+import lombok.Getter;
17
+import lombok.Setter;
18
+
19
+import javax.validation.constraints.NotBlank;
20
+import java.util.Date;
21
+
22
+/**
23
+ * 轮换计划-上报Id参数
24
+ *
25
+ * @author ZeroLiYi
26
+ * @date  2024/05/14 18:05
27
+ **/
28
+@Getter
29
+@Setter
30
+public class BusinessRpReportIdParam {
31
+
32
+    /** 主键ID */
33
+    @ApiModelProperty(value = "主键ID", required = true)
34
+    private Integer id;
35
+
36
+    @ApiModelProperty(value = "计划年度", position = 10)
37
+    private Date planYear;
38
+}

+ 60 - 0
unis-plugin/unis-plugin-biz/src/main/java/com/unis/rotationPlan/info/modular/businessrpreport/param/BusinessRpReportPageParam.java

@@ -0,0 +1,60 @@
1
+/*
2
+ * Copyright [2022] [https://www.xiaonuo.vip]
3
+ *
4
+ * Snowy采用APACHE LICENSE 2.0开源协议,您在使用过程中,需要注意以下几点:
5
+ *
6
+ * 1.请不要删除和修改根目录下的LICENSE文件。
7
+ * 2.请不要删除和修改Snowy源码头部的版权声明。
8
+ * 3.本项目代码可免费商业使用,商业使用请保留源码和相关描述文件的项目出处,作者声明等。
9
+ * 4.分发源码时候,请注明软件出处 https://www.xiaonuo.vip
10
+ * 5.不可二次分发开源参与同类竞品,如有想法可联系团队xiaonuobase@qq.com商议合作。
11
+ * 6.若您的项目无法满足以上几点,需要更多功能代码,获取Snowy商业授权许可,请在官网购买授权,地址为 https://www.xiaonuo.vip
12
+ */
13
+package com.unis.rotationPlan.info.modular.businessrpreport.param;
14
+
15
+import io.swagger.annotations.ApiModelProperty;
16
+import lombok.Getter;
17
+import lombok.Setter;
18
+import java.math.BigDecimal;
19
+import java.util.Date;
20
+
21
+/**
22
+ * 轮换计划-上报查询参数
23
+ *
24
+ * @author ZeroLiYi
25
+ * @date  2024/05/14 18:05
26
+ **/
27
+@Getter
28
+@Setter
29
+public class BusinessRpReportPageParam {
30
+
31
+    /** 当前页 */
32
+    @ApiModelProperty(value = "当前页码")
33
+    private Integer current;
34
+
35
+    /** 每页条数 */
36
+    @ApiModelProperty(value = "每页条数")
37
+    private Integer size;
38
+
39
+    /** 排序字段 */
40
+    @ApiModelProperty(value = "排序字段,字段驼峰名称,如:userName")
41
+    private String sortField;
42
+
43
+    /** 排序方式 */
44
+    @ApiModelProperty(value = "排序方式,升序:ASCEND;降序:DESCEND")
45
+    private String sortOrder;
46
+
47
+    /** 关键词 */
48
+    @ApiModelProperty(value = "关键词")
49
+    private String searchKey;
50
+
51
+    /** 企业名称 */
52
+    @ApiModelProperty(value = "企业名称")
53
+    private String unitName;
54
+
55
+
56
+    @ApiModelProperty(value = "轮换年度")
57
+    private Date rotationYear;
58
+
59
+
60
+}

+ 85 - 0
unis-plugin/unis-plugin-biz/src/main/java/com/unis/rotationPlan/info/modular/businessrpreport/service/BusinessRpReportService.java

@@ -0,0 +1,85 @@
1
+/*
2
+ * Copyright [2022] [https://www.xiaonuo.vip]
3
+ *
4
+ * Snowy采用APACHE LICENSE 2.0开源协议,您在使用过程中,需要注意以下几点:
5
+ *
6
+ * 1.请不要删除和修改根目录下的LICENSE文件。
7
+ * 2.请不要删除和修改Snowy源码头部的版权声明。
8
+ * 3.本项目代码可免费商业使用,商业使用请保留源码和相关描述文件的项目出处,作者声明等。
9
+ * 4.分发源码时候,请注明软件出处 https://www.xiaonuo.vip
10
+ * 5.不可二次分发开源参与同类竞品,如有想法可联系团队xiaonuobase@qq.com商议合作。
11
+ * 6.若您的项目无法满足以上几点,需要更多功能代码,获取Snowy商业授权许可,请在官网购买授权,地址为 https://www.xiaonuo.vip
12
+ */
13
+package com.unis.rotationPlan.info.modular.businessrpreport.service;
14
+
15
+import com.baomidou.mybatisplus.core.metadata.IPage;
16
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
17
+import com.baomidou.mybatisplus.extension.service.IService;
18
+import com.unis.rotationPlan.info.modular.businessrpreport.entity.BusinessRpReport;
19
+import com.unis.rotationPlan.info.modular.businessrpreport.param.BusinessRpReportAddParam;
20
+import com.unis.rotationPlan.info.modular.businessrpreport.param.BusinessRpReportEditParam;
21
+import com.unis.rotationPlan.info.modular.businessrpreport.param.BusinessRpReportIdParam;
22
+import com.unis.rotationPlan.info.modular.businessrpreport.param.BusinessRpReportPageParam;
23
+import com.unis.rotationPlan.info.modular.businessrpreport.util.Grain;
24
+
25
+import java.util.List;
26
+import java.util.Map;
27
+
28
+/**
29
+ * 轮换计划-上报Service接口
30
+ *
31
+ * @author ZeroLiYi
32
+ * @date  2024/05/14 18:05
33
+ **/
34
+public interface BusinessRpReportService extends IService<BusinessRpReport> {
35
+
36
+    /**
37
+     * 获取轮换计划-上报分页
38
+     *
39
+     * @author ZeroLiYi
40
+     * @date  2024/05/14 18:05
41
+     */
42
+    IPage<Map<String, Object>> page(BusinessRpReportPageParam businessRpReportPageParam);
43
+
44
+    /**
45
+     * 添加轮换计划-上报
46
+     *
47
+     * @author ZeroLiYi
48
+     * @date  2024/05/14 18:05
49
+     */
50
+    void add(BusinessRpReportAddParam businessRpReportAddParam);
51
+
52
+    /**
53
+     * 编辑轮换计划-上报
54
+     *
55
+     * @author ZeroLiYi
56
+     * @date  2024/05/14 18:05
57
+     */
58
+    void edit(BusinessRpReportEditParam businessRpReportEditParam);
59
+
60
+    /**
61
+     * 删除轮换计划-上报
62
+     *
63
+     * @author ZeroLiYi
64
+     * @date  2024/05/14 18:05
65
+     */
66
+    void delete(List<BusinessRpReportIdParam> businessRpReportIdParamList);
67
+
68
+    /**
69
+     * 获取轮换计划-上报详情
70
+     *
71
+     * @author ZeroLiYi
72
+     * @date  2024/05/14 18:05
73
+     */
74
+    List<Map<String,Object>> detail(BusinessRpReportIdParam businessRpReportIdParam);
75
+
76
+    /**
77
+     * 获取轮换计划-上报详情
78
+     *
79
+     * @author ZeroLiYi
80
+     * @date  2024/05/14 18:05
81
+     **/
82
+    BusinessRpReport queryEntity(Integer id);
83
+
84
+    Map<String,Object> createReport(BusinessRpReportIdParam businessRpReportIdParam);
85
+}

+ 185 - 0
unis-plugin/unis-plugin-biz/src/main/java/com/unis/rotationPlan/info/modular/businessrpreport/service/impl/BusinessRpReportServiceImpl.java

@@ -0,0 +1,185 @@
1
+/*
2
+ * Copyright [2022] [https://www.xiaonuo.vip]
3
+ *
4
+ * Snowy采用APACHE LICENSE 2.0开源协议,您在使用过程中,需要注意以下几点:
5
+ *
6
+ * 1.请不要删除和修改根目录下的LICENSE文件。
7
+ * 2.请不要删除和修改Snowy源码头部的版权声明。
8
+ * 3.本项目代码可免费商业使用,商业使用请保留源码和相关描述文件的项目出处,作者声明等。
9
+ * 4.分发源码时候,请注明软件出处 https://www.xiaonuo.vip
10
+ * 5.不可二次分发开源参与同类竞品,如有想法可联系团队xiaonuobase@qq.com商议合作。
11
+ * 6.若您的项目无法满足以上几点,需要更多功能代码,获取Snowy商业授权许可,请在官网购买授权,地址为 https://www.xiaonuo.vip
12
+ */
13
+package com.unis.rotationPlan.info.modular.businessrpreport.service.impl;
14
+
15
+import cn.hutool.core.bean.BeanUtil;
16
+import cn.hutool.core.collection.CollStreamUtil;
17
+import cn.hutool.core.util.ObjectUtil;
18
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
19
+import com.baomidou.mybatisplus.core.metadata.IPage;
20
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
21
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
22
+import com.fasterxml.jackson.databind.ObjectMapper;
23
+import com.unis.rotationPlan.info.modular.businessrpreport.entity.vo.BusinessRpReportVO;
24
+import com.unis.rotationPlan.info.modular.businessrpreport.util.*;
25
+import org.apache.commons.lang3.StringUtils;
26
+import org.springframework.stereotype.Service;
27
+import org.springframework.transaction.annotation.Transactional;
28
+import com.unis.common.exception.CommonException;
29
+import com.unis.rotationPlan.info.modular.businessrpreport.entity.BusinessRpReport;
30
+import com.unis.rotationPlan.info.modular.businessrpreport.mapper.BusinessRpReportMapper;
31
+import com.unis.rotationPlan.info.modular.businessrpreport.param.BusinessRpReportAddParam;
32
+import com.unis.rotationPlan.info.modular.businessrpreport.param.BusinessRpReportEditParam;
33
+import com.unis.rotationPlan.info.modular.businessrpreport.param.BusinessRpReportIdParam;
34
+import com.unis.rotationPlan.info.modular.businessrpreport.param.BusinessRpReportPageParam;
35
+import com.unis.rotationPlan.info.modular.businessrpreport.service.BusinessRpReportService;
36
+
37
+import javax.annotation.Resource;
38
+import java.util.*;
39
+
40
+/**
41
+ * 轮换计划-上报Service接口实现类
42
+ *
43
+ * @author ZeroLiYi
44
+ * @date  2024/05/14 18:05
45
+ **/
46
+@Service
47
+public class BusinessRpReportServiceImpl extends ServiceImpl<BusinessRpReportMapper, BusinessRpReport> implements BusinessRpReportService {
48
+
49
+    @Resource
50
+    private BusinessRpReportMapper businessRpReportMapper;
51
+
52
+    @Override
53
+    public IPage<Map<String, Object>> page(BusinessRpReportPageParam businessRpReportPageParam) {
54
+        //条形查询器
55
+        QueryWrapper<BusinessRpReport> queryWrapper = new QueryWrapper<>();
56
+        //分页相关
57
+        if(StringUtils.isNotBlank(businessRpReportPageParam.getUnitName())){
58
+            queryWrapper.like("b.dwmc",businessRpReportPageParam.getUnitName());
59
+        }
60
+        if(businessRpReportPageParam.getRotationYear()!=null){
61
+            queryWrapper.like(" brr.rotation_year",businessRpReportPageParam.getRotationYear());
62
+        }
63
+
64
+
65
+        Page<BusinessRpReport> p =new Page<>(businessRpReportPageParam.getCurrent(),businessRpReportPageParam.getSize());
66
+        IPage<Map<String,Object>> page = businessRpReportMapper.selectMyMapsPage(p,queryWrapper);
67
+        return page;
68
+    }
69
+
70
+    @Transactional(rollbackFor = Exception.class)
71
+    @Override
72
+    public void add(BusinessRpReportAddParam businessRpReportAddParam) {
73
+        BusinessRpReport businessRpReport = BeanUtil.toBean(businessRpReportAddParam, BusinessRpReport.class);
74
+        this.save(businessRpReport);
75
+    }
76
+
77
+    @Transactional(rollbackFor = Exception.class)
78
+    @Override
79
+    public void edit(BusinessRpReportEditParam businessRpReportEditParam) {
80
+        BusinessRpReport businessRpReport = this.queryEntity(businessRpReportEditParam.getId());
81
+        BeanUtil.copyProperties(businessRpReportEditParam, businessRpReport);
82
+        this.updateById(businessRpReport);
83
+    }
84
+
85
+    @Transactional(rollbackFor = Exception.class)
86
+    @Override
87
+    public void delete(List<BusinessRpReportIdParam> businessRpReportIdParamList) {
88
+        // 执行删除
89
+        this.removeByIds(CollStreamUtil.toList(businessRpReportIdParamList, BusinessRpReportIdParam::getId));
90
+    }
91
+
92
+    @Override
93
+    public List<Map<String,Object>> detail(BusinessRpReportIdParam businessRpReportIdParam) {
94
+
95
+        List<Map<String,Object>> details = businessRpReportMapper.getDetail(businessRpReportIdParam.getId());
96
+        if(ObjectUtil.isEmpty(details)) {
97
+            throw new CommonException("轮换计划-轮换半月报表不存在,id值为:{}", businessRpReportIdParam.getId());
98
+        }
99
+        return details;
100
+    }
101
+
102
+    @Override
103
+    public BusinessRpReport queryEntity(Integer id) {
104
+        BusinessRpReport businessRpReport = this.getById(id);
105
+        if(ObjectUtil.isEmpty(businessRpReport)) {
106
+            throw new CommonException("轮换计划-上报不存在,id值为:{}", id);
107
+        }
108
+        return businessRpReport;
109
+    }
110
+
111
+    @Override
112
+    public Map<String,Object> createReport(BusinessRpReportIdParam businessRpReportIdParam) {
113
+           List<BusinessRpReportVO> businessRpReports = businessRpReportMapper.createReport(businessRpReportIdParam);
114
+        List<TableColumns> list =new ArrayList<>();
115
+        TableColumns tb =new TableColumns();
116
+        Map<String,Object> tableColumnsMap = new HashMap<>();
117
+        UnitInfo unitInfo =new UnitInfo();
118
+        OrgInfo orgInfo=new OrgInfo();
119
+        Map<String, Grain> grainMap = new HashMap<>();
120
+        int index = 1; // Initialize index for dynamic indexing if needed
121
+
122
+        // Process the list to identify unique grain types and build grain objects with columns
123
+        for (BusinessRpReportVO report : businessRpReports) {
124
+
125
+            String grainType = safeGetGrainType(report.getGrainVarietyName()); // Safely get the grain type
126
+
127
+            if (grainType == null) {
128
+                continue; // Skip if grain type cannot be determined
129
+            }
130
+            if(report.getDwmc()!=null){
131
+                unitInfo.setTitle("单位名称");
132
+                unitInfo.setAlign("center");
133
+                unitInfo.setDataIndex("dwmc");
134
+            }
135
+            if(report.getOrgId()!=null){
136
+                orgInfo.setTitle("存储库点");
137
+                orgInfo.setAlign("center");
138
+                orgInfo.setDataIndex("orgName");
139
+            }
140
+
141
+
142
+            Grain grain = grainMap.computeIfAbsent(grainType, k -> {
143
+                Grain newGrain = new Grain();
144
+                newGrain.setAlign("center");
145
+                newGrain.setName("grainVarietyName");
146
+
147
+                newGrain.setColumns(new ArrayList<>());
148
+                return newGrain;
149
+            });
150
+
151
+            // Add columns only if there's corresponding quantity
152
+            if (report.getOutboundQuantity() != null) {
153
+                TableColumn outboundColumn = new TableColumn();
154
+                outboundColumn.setTitle("轮出数量");
155
+                outboundColumn.setAlign("center");
156
+                // Use dynamic indexing if required
157
+                outboundColumn.setDataIndex("outboundQuantity");
158
+                grain.getColumns().add(outboundColumn);
159
+            }
160
+            if (report.getInboundQuantity() != null) {
161
+                TableColumn inboundColumn = new TableColumn();
162
+                inboundColumn.setTitle("轮入数量");
163
+                inboundColumn.setAlign("center");
164
+                inboundColumn.setDataIndex("inboundQuantity");
165
+                grain.getColumns().add(inboundColumn);
166
+            }
167
+            tableColumnsMap.put("unitInfo",unitInfo);
168
+            tableColumnsMap.put("orgInfo",orgInfo);
169
+            tableColumnsMap.put("grainMap",grainMap);
170
+            tableColumnsMap.put("businessRpReports",businessRpReports);
171
+
172
+        }
173
+
174
+        return tableColumnsMap;
175
+    }
176
+
177
+    private static String safeGetGrainType(String varietyName) {
178
+        return varietyName != null ? varietyName.split("及")[0] : null;
179
+    }
180
+
181
+    // Simulated method to fetch reports, replace with your actual method
182
+    private static List<BusinessRpReportVO> fetchReportsFromDatabase() {
183
+        return Collections.emptyList(); // Return actual data here
184
+    }
185
+}

+ 15 - 0
unis-plugin/unis-plugin-biz/src/main/java/com/unis/rotationPlan/info/modular/businessrpreport/util/Grain.java

@@ -0,0 +1,15 @@
1
+package com.unis.rotationPlan.info.modular.businessrpreport.util;
2
+
3
+import lombok.Getter;
4
+import lombok.Setter;
5
+
6
+import java.util.List;
7
+
8
+@Setter
9
+@Getter
10
+public class Grain {
11
+    String name;
12
+    private String align;
13
+    List<TableColumn> columns; // Contains '轮出数量' and '轮入数量'
14
+    public Grain() {}
15
+}

+ 13 - 0
unis-plugin/unis-plugin-biz/src/main/java/com/unis/rotationPlan/info/modular/businessrpreport/util/OrgInfo.java

@@ -0,0 +1,13 @@
1
+package com.unis.rotationPlan.info.modular.businessrpreport.util;
2
+
3
+import lombok.Getter;
4
+import lombok.Setter;
5
+
6
+@Setter
7
+@Getter
8
+public class OrgInfo {
9
+
10
+    private String title;
11
+    private String align;
12
+    private String dataIndex;
13
+}

+ 14 - 0
unis-plugin/unis-plugin-biz/src/main/java/com/unis/rotationPlan/info/modular/businessrpreport/util/TableColumn.java

@@ -0,0 +1,14 @@
1
+package com.unis.rotationPlan.info.modular.businessrpreport.util;
2
+
3
+import lombok.Getter;
4
+import lombok.Setter;
5
+
6
+@Setter
7
+@Getter
8
+public class TableColumn {
9
+    private String title;
10
+    private String align;
11
+    private String dataIndex;
12
+
13
+
14
+}

+ 13 - 0
unis-plugin/unis-plugin-biz/src/main/java/com/unis/rotationPlan/info/modular/businessrpreport/util/TableColumns.java

@@ -0,0 +1,13 @@
1
+package com.unis.rotationPlan.info.modular.businessrpreport.util;
2
+
3
+import lombok.Getter;
4
+import lombok.Setter;
5
+
6
+@Setter
7
+@Getter
8
+public class TableColumns {
9
+    private UnitInfo unitInfo;
10
+    private OrgInfo orgInfo;
11
+    private Grain grain;
12
+
13
+}

+ 15 - 0
unis-plugin/unis-plugin-biz/src/main/java/com/unis/rotationPlan/info/modular/businessrpreport/util/UnitInfo.java

@@ -0,0 +1,15 @@
1
+package com.unis.rotationPlan.info.modular.businessrpreport.util;
2
+
3
+import lombok.Getter;
4
+import lombok.Setter;
5
+
6
+@Setter
7
+@Getter
8
+public class UnitInfo {
9
+
10
+    private String title;
11
+    private String align;
12
+    private String dataIndex;
13
+
14
+
15
+}