ソースを参照

订单查询修改

785834757 2 年 前
コミット
37ed693786

+ 1 - 1
src/main/java/com/ydtech/modules/order/controller/InsOrdersController.java

@@ -83,7 +83,7 @@ public class InsOrdersController extends BaseController {
     @PostMapping("/queryPageOrder")
     @ApiOperation(value = "[1]分页查询订单接口")
     public HttpResult<BasePageResult<InsOrders>> queryPageOrder(@RequestBody @Valid OrderQueryVo orderQueryVo) {
-        BasePageResult<InsOrders> quoteResult = this.insOrdersService.queryPageOrder(orderQueryVo);
+        BasePageResult<InsOrders> quoteResult = this.insOrdersService.newQueryPageOrder(orderQueryVo);
         return HttpResult.ok("success", quoteResult);
     }
 

+ 4 - 0
src/main/java/com/ydtech/modules/order/dao/InsOrdersMapper.java

@@ -1,10 +1,12 @@
 package com.ydtech.modules.order.dao;
 
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.ydtech.modules.order.entity.InsOrders;
 import com.ydtech.modules.order.entity.vo.OrderQueryVo;
 import com.ydtech.modules.order.entity.vo.OrderVo;
 import com.ydtech.modules.order.entity.vo.VerifyOrdersVo;
+import org.apache.ibatis.annotations.Param;
 
 import java.util.List;
 
@@ -20,5 +22,7 @@ public interface InsOrdersMapper extends BaseMapper<InsOrders> {
 
     InsOrders getByUseridAndLicenseNo(VerifyOrdersVo verifyOrdersVo);
 
+    Page<InsOrders> queryPageOrder(@Param("page") Page page,@Param("orderQueryVo") OrderQueryVo orderQueryVo,
+                                   @Param("isTeamLeader") Boolean isTeamLeader,@Param("isCdy")Boolean isCdy);
 
 }

+ 3 - 0
src/main/java/com/ydtech/modules/order/service/InsOrdersService.java

@@ -60,6 +60,9 @@ public interface InsOrdersService extends IService<InsOrders> {
      */
     InsOrders generateOrder(String userId, BaseQuoteInfoVo quoteInfoVo);
 
+
+    BasePageResult<InsOrders> newQueryPageOrder(OrderQueryVo orderQueryVo);
+
     /**
      * 查询订单接口
      *

+ 33 - 1
src/main/java/com/ydtech/modules/order/service/impl/InsOrdersServiceImpl.java

@@ -259,6 +259,32 @@ public class InsOrdersServiceImpl extends ServiceImpl<InsOrdersMapper, InsOrders
         return insOrders;
     }
 
+    /**
+     * 新的查询分页接口
+     * @param orderQueryVo
+     * @return
+     */
+    @Override
+    public BasePageResult<InsOrders> newQueryPageOrder(OrderQueryVo orderQueryVo) {
+        Page<InsOrders> page = new Page<>(orderQueryVo.getPageNum(), orderQueryVo.getPageSize());
+        // 领导标志
+        boolean isTeamLeader = false;
+        //是否出单员标志
+        boolean isCdy = false;
+        if (StringUtils.isNotEmpty(orderQueryVo.getUserId())) {
+            SysUserRole userRole = sysUserRoleService.selectByUserId(orderQueryVo.getUserId());
+            if (Arrays.asList(SystemConstant.getSysRoleTeamLeader()).contains(userRole.getRoleId().toString())) { //团队长可查询下面所有人员订单
+                isTeamLeader = true;
+            }
+            if (19 == userRole.getRoleId()) {
+                isCdy = true;
+            }
+        }
+        Page<InsOrders> orderVoPage = baseMapper.queryPageOrder(page,orderQueryVo,isTeamLeader,isCdy);
+        return new BasePageResult<>(orderQueryVo.getPageNum(), orderQueryVo.getPageSize(), orderVoPage.getTotal(),
+                orderVoPage.getPages(), orderVoPage.getRecords());
+    }
+
 
     @Override
     public BasePageResult<InsOrders> queryPageOrder(OrderQueryVo orderQueryVo) {
@@ -315,7 +341,10 @@ public class InsOrdersServiceImpl extends ServiceImpl<InsOrdersMapper, InsOrders
                     .list();
             List<String> collect =
                     list.stream().map(InsAreaCompany::getOrderno).distinct().collect(Collectors.toList());
-            wrapper.in(InsOrders::getOrderno, collect);
+            if(!collect.isEmpty()){
+                wrapper.in(InsOrders::getOrderno, collect);
+            }
+
         }
 
         if (StringUtils.isNotEmpty(orderQueryVo.getAuditStatus())
@@ -343,10 +372,13 @@ public class InsOrdersServiceImpl extends ServiceImpl<InsOrdersMapper, InsOrders
         }
 
         Page<InsOrders> insOrdersPage = page(page, wrapper);
+
         return new BasePageResult<>(orderQueryVo.getPageNum(), page.getSize(), insOrdersPage.getTotal(),
                 page.getPages(), insOrdersPage.getRecords());
     }
 
+
+
     @Override
     public List<InsAreaCompanyQueryDto> querySuborder(String orderNo) {
         return insAreaCompanyService.getByOrderNo(orderNo);

+ 43 - 0
src/main/resources/mapper/modules/order/InsOrdersMapper.xml

@@ -213,4 +213,47 @@
           and createtime > DATE_SUB(CURDATE(), INTERVAL 6 MONTH)
     </select>
 
+    <select id="queryPageOrder" resultType="com.ydtech.modules.order.entity.InsOrders">
+        select  io.*,ifa.auditstatus,ifa.audittime from
+            ins_orders io
+                left JOIN ins_area_company iac on iac.orderno = io.orderno
+                left JOIN ins_fee_audit ifa on ifa.orderno = iac.orderno
+        <where>
+            <if test="orderQueryVo.orderNo != null and orderQueryVo.orderNo != ''">
+                and io.orderno = #{orderNo}
+            </if>
+            <if test="orderQueryVo.deptId != null and orderQueryVo.deptId != '' and isTeamLeader">
+                and io.deptid like "${orderQueryVo.deptId}%"
+            </if>
+            <if test="orderQueryVo.orderStatus != null and orderQueryVo.orderStatus != ''">
+                and io.orderstatus = #{orderQueryVo.orderStatus}
+            </if>
+            <if test="orderQueryVo.frameNo != null and orderQueryVo.frameNo != ''">
+                and io.frameno = #{orderQueryVo.frameNo}
+            </if>
+            <if test="orderQueryVo.insuredName != null and orderQueryVo.insuredName != ''">
+                and io.licenseno = #{orderQueryVo.licenseNo}
+            </if>
+            <if test="orderQueryVo.insuredName != null and orderQueryVo.insuredName != ''">
+                and io.insuredname = #{orderQueryVo.insuredName}
+            </if>
+            <if test="orderQueryVo.startDate != null and orderQueryVo.endDate != null">
+                and io.createtime between #{orderQueryVo.startDate} AND #{orderQueryVo.endDate}
+            </if>
+            <if test="orderQueryVo.companyId != null and orderQueryVo.companyId != ''">
+                and io.company_id = #{orderQueryVo.companyId}
+            </if>
+            <if test="orderQueryVo.auditStatus != null and orderQueryVo.auditStatus != ''">
+                and ifa.auditstatus = #{orderQueryVo.auditStatus}
+            </if>
+            <if test="orderQueryVo.userId != null and orderQueryVo.userId != '' and isCdy">
+                and io.operatorid = #{orderQueryVo.userId}
+            </if>
+            <if test="orderQueryVo.userId != null and orderQueryVo.userId != '' and isTeamLeader">
+                and io.userid = #{orderQueryVo.userId}
+            </if>
+        </where>
+        group by orderno
+    </select>
+
 </mapper>