xucaiqin há 1 mês atrás
pai
commit
40c3582393

+ 2 - 1
sckw-modules/sckw-order/src/main/java/com/sckw/order/controller/KwoTradeOrderController.java

@@ -271,7 +271,8 @@ public class KwoTradeOrderController {
      * @return: com.sckw.core.web.response.HttpResult
      */
     @PostMapping(value = "/tradeOrderStatistic", produces = MediaType.APPLICATION_JSON_VALUE)
-    public HttpResult statistic(@RequestBody @Validated TradeOrderListStatisticParam params) {
+    @Operation(summary = "查询贸易订单统计信息")
+    public HttpResult statistic(@RequestBody @Validated TradeOrderListSelectParam params) {
         return HttpResult.ok(kwoTradeOrderService.tradeOrderStatistic(params));
     }
 

+ 4 - 6
sckw-modules/sckw-order/src/main/java/com/sckw/order/serivce/KwoTradeOrderService.java

@@ -1572,15 +1572,13 @@ public class KwoTradeOrderService {
         Map<Long, ContractCommonInfoResDto> contractMap = remoteContractService.queryContractBaseInfo(contracIdList);
         Map<String, Map<String, String>> dict = remoteSystemService.queryDictByType(List.of(DictTypeEnum.TORDER_STATUS.getType(), DictTypeEnum.TRADE_TYPE.getType(), DictTypeEnum.DELIVERY_TYPE.getType(), DictTypeEnum.PICKUP_TYPE.getType(), DictTypeEnum.TORDER_SOURCE.getType()));
         Map<String, SysDictResDto> unitType = remoteSystemService.queryDictMapByType(DictTypeEnum.UNIT_TYPE.getType());
-        Map<String, String> statusMap, tradeMap, deliveryMap, pickupMap, sourceMap;
+        Map<String, String> tradeMap, deliveryMap, pickupMap, sourceMap;
         if (CollUtil.isNotEmpty(dict)) {
-            statusMap = CollUtil.isNotEmpty(dict.get(DictTypeEnum.TORDER_STATUS.getType())) ? dict.get(DictTypeEnum.TORDER_STATUS.getType()) : new HashMap<>(Global.NUMERICAL_SIXTEEN);
             tradeMap = CollUtil.isNotEmpty(dict.get(DictTypeEnum.TRADE_TYPE.getType())) ? dict.get(DictTypeEnum.TRADE_TYPE.getType()) : new HashMap<>(Global.NUMERICAL_SIXTEEN);
             deliveryMap = CollUtil.isNotEmpty(dict.get(DictTypeEnum.DELIVERY_TYPE.getType())) ? dict.get(DictTypeEnum.DELIVERY_TYPE.getType()) : new HashMap<>(Global.NUMERICAL_SIXTEEN);
             pickupMap = CollUtil.isNotEmpty(dict.get(DictTypeEnum.PICKUP_TYPE.getType())) ? dict.get(DictTypeEnum.PICKUP_TYPE.getType()) : new HashMap<>(Global.NUMERICAL_SIXTEEN);
             sourceMap = CollUtil.isNotEmpty(dict.get(DictTypeEnum.TORDER_SOURCE.getType())) ? dict.get(DictTypeEnum.TORDER_SOURCE.getType()) : new HashMap<>(Global.NUMERICAL_SIXTEEN);
         } else {
-            statusMap = new HashMap<>(Global.NUMERICAL_SIXTEEN);
             tradeMap = new HashMap<>(Global.NUMERICAL_SIXTEEN);
             deliveryMap = new HashMap<>(Global.NUMERICAL_SIXTEEN);
             pickupMap = new HashMap<>(Global.NUMERICAL_SIXTEEN);
@@ -1608,7 +1606,7 @@ public class KwoTradeOrderService {
             UserCacheResDto userCache = userMap.get(e.getCreateBy());
 
             OrderListResVO vo = BeanUtil.copyProperties(e, OrderListResVO.class);
-            vo.setStatusLabel(statusMap.get(String.valueOf(e.getStatus())))
+            vo.setStatusLabel(TradeOrderStatusEnum.getMsg(e.getStatus()))
                     .setTradingLabel(tradeMap.get(e.getTrading()))
                     .setTrading(tradeMap.get(e.getTrading()))
                     .setDeliveryTypeLabel(deliveryMap.get(e.getDeliveryType()))
@@ -1717,7 +1715,7 @@ public class KwoTradeOrderService {
      * @author yzc
      * @date 2024/3/15 8:52
      */
-    public TableStatisticRes tradeOrderStatistic(TradeOrderListStatisticParam params) {
+    public TableStatisticRes tradeOrderStatistic(TradeOrderListSelectParam params) {
         TableStatisticRes res = new TableStatisticRes();
         TradeOrderListSelectDTO dto = buildSelectParam(params);
         dto.setStatus(null);
@@ -1728,7 +1726,7 @@ public class KwoTradeOrderService {
         }
         List<TableTop> list = new ArrayList<>();
         int count = 0;
-        for (OrderStatusEnum e : OrderStatusEnum.getSortList()) {
+        for (TradeOrderStatusEnum e : TradeOrderStatusEnum.getSortList()) {
             Integer value = e.getCode();
             int total = Objects.isNull(map.get(value)) ? 0 : map.get(value);
             TableTop tableTop = new TableTop();

+ 22 - 72
sckw-modules/sckw-order/src/main/resources/mapper/KwoTradeOrderMapper.xml

@@ -108,22 +108,9 @@
             <if test="query.saleEntId !=null">
                 and e.ent_id = #{query.saleEntId}
             </if>
-            --           状态匹配
             <if test="query.status != null">
                 and a.status = #{query.status}
-                <if test="query.status == 0">
-                    --          草稿状态只能创建订单的人能看
-                      and a.create_by = #{query.userId}
-                </if>
             </if>
-            <if test="query.status == null">
-                --           非草稿状态or草稿状态且是当前人
-                  and (
-                            a.status != 0
-                        or (a.status = 0 and a.create_by = #{query.userId})
-                    )
-            </if>
-            --          关键词匹配
             <if test="query.keywords != null and query.keywords != ''">
                 and (
                         a.t_order_no like concat('%', #{query.keywords}, '%')
@@ -453,71 +440,35 @@
                  LEFT JOIN kwo_trade_order_goods g ON a.id = g.t_order_id AND g.del_flag = 0
         <where>
             a.del_flag = 0
---             数据权限匹配
-            <if test="query.isMain == 0">
-                and (
-                <if test="query.orderType == 1">
-                    <if test="query.entId != null">
-                            d.top_ent_id = #{query.entId}
-                    </if>
-                    <if test="authUserIds != null and authUserIds.size() > 0">
-                        and d.contacts_id in
-                        <foreach collection="authUserIds" item="authUserId" open="(" close=")" separator=",">
-                            #{authUserId}
-                        </foreach>
-                        or d.create_by in
-                        <foreach collection="authUserIds" item="authUserId" open="(" close=")" separator=",">
-                            #{authUserId}
-                        </foreach>
-                    </if>
-                </if>
-                <if test="query.orderType == 2">
-                    <if test="query.entId != null">
-                        e.top_ent_id = #{query.entId}
+            <choose>
+                <when test="query.manager != null and !query.manager">
+                    <if test="query.isMain == 0">
+                        <if test="query.entList != null and query.entList.size() > 0">
+                            and (
+                            d.top_ent_id in
+                            <foreach collection="query.entList" item="authUserId" open="(" close=")" separator=",">
+                                #{authUserId}
+                            </foreach>
+                            )
+                        </if>
                     </if>
-                    <if test="authUserIds != null and authUserIds.size() > 0">
-                        and e.contacts_id in
-                        <foreach collection="authUserIds" item="authUserId" open="(" close=")" separator=",">
-                            #{authUserId}
-                        </foreach>
-                        or e.create_by in
-                        <foreach collection="authUserIds" item="authUserId" open="(" close=")" separator=",">
-                            #{authUserId}
-                        </foreach>
+                    <if test="query.isMain == 1">
+                        <if test="query.entId != null">
+                            and (d.top_ent_id = #{query.entId}
+                            )
+                        </if>
                     </if>
-                </if>
-                )
+                </when>
+            </choose>
+            <if test="query.buyEntId !=null">
+                and d.ent_id = #{query.buyEntId}
             </if>
-            <if test="query.isMain == 1">
-                and (
-                <if test="query.orderType == 1">
-                    <if test="query.entId != null">
-                        d.top_ent_id = #{query.entId}
-                    </if>
-                </if>
-                <if test="query.orderType == 2">
-                    <if test="query.entId != null">
-                        e.top_ent_id = #{query.entId}
-                    </if>
-                </if>
-                )
+            <if test="query.saleEntId !=null">
+                and e.ent_id = #{query.saleEntId}
             </if>
-            --             状态匹配
             <if test="query.status != null">
                 and a.status = #{query.status}
-                <if test="query.status == 0">
-                    --                     草稿状态只能创建订单的人能看
-                      and a.create_by = #{query.userId}
-                </if>
             </if>
-            <if test="query.status == null">
-                --                 非草稿状态or草稿状态且是当前人
-                  and (
-                            a.status != 0
-                        or (a.status = 0 and a.create_by = #{query.userId})
-                    )
-            </if>
-            --                      关键词匹配
             <if test="query.keywords != null and query.keywords != ''">
                 and (
                         a.t_order_no like concat('%', #{query.keywords}, '%')
@@ -628,7 +579,6 @@
                     and e.top_ent_id = #{query.entId}
                 </if>
             </if>
-            --             状态匹配
             <if test="statuses != null and statuses.size() > 0">
                 and a.status in
                 <foreach collection="statuses" item="item" open="(" close=")" separator=",">