Browse Source

查询BUG修改

anderx 3 years ago
parent
commit
16a99fa735

+ 1 - 0
src/main/java/com/goafanti/admin/service/DepartmentService.java

@@ -37,6 +37,7 @@ public interface DepartmentService {
 
 	 */
 	List<String> selectSubDeps(String  deps);
+	List<String> selectSubDeps(List<String>  deps);
 
 
 

+ 10 - 0
src/main/java/com/goafanti/admin/service/impl/DepartmentServiceImpl.java

@@ -101,6 +101,16 @@ public class DepartmentServiceImpl extends BaseMybatisDao<WorkingHoursMapper> im
 			}
 		return myAll;
 	}
+	public List<String> selectSubDeps(List<String>  deps) {
+		List<String> myAll=new ArrayList<>();
+		List<String> my=selectMyDeps();
+		for (String dep : deps) {
+			for (String dep2 : my) {
+				if (dep.equals(dep2))myAll.add(dep);
+			}
+		}
+		return myAll;
+	}
 
 	@Override
 	public 	List<Department> selectSubordinateDeps(String depId){

+ 10 - 16
src/main/java/com/goafanti/common/mapper/TOrderMidMapper.xml

@@ -440,12 +440,6 @@
     <if test="status != null">
       and b.legal_affairs_status = #{status}
     </if>
-    <if test="shiro==1">
-      and a.order_type in
-      <foreach close=")" collection="deps" item="dep" open="(" separator=",">
-        #{dep}
-      </foreach>
-    </if>
     <if test="shiro ==2">
       and  c.superior_id = #{sid}
     </if>
@@ -461,8 +455,11 @@
     <if test="aid != null">
       and b.salesman_id = #{aid}
     </if>
-    <if test="depId != null">
-      and a.order_dep = #{depId}
+    <if test="deps != null">
+      and a.order_dep in
+      <foreach close=")" collection="deps" item="dep" open="(" separator=",">
+        #{dep}
+      </foreach>
     </if>
     <if test="type==0">
       <if test="startTime != null and endTime != null">
@@ -496,12 +493,6 @@
     <if test="status != null">
       and b.legal_affairs_status = #{status}
     </if>
-    <if test="shiro==1">
-      and a.order_type in
-      <foreach close=")" collection="deps" item="dep" open="(" separator=",">
-        #{dep}
-      </foreach>
-    </if>
     <if test="shiro ==2">
       and  c.superior_id = #{sid}
     </if>
@@ -517,8 +508,11 @@
     <if test="aid != null">
       and b.salesman_id = #{aid}
     </if>
-    <if test="depId != null">
-      and a.order_dep = #{depId}
+    <if test="deps != null">
+      and a.order_dep in
+      <foreach close=")" collection="deps" item="dep" open="(" separator=",">
+        #{dep}
+      </foreach>
     </if>
     <if test="type==0">
       <if test="startTime != null and endTime != null">

+ 5 - 5
src/main/java/com/goafanti/order/bo/InputOrderListBo.java

@@ -5,7 +5,7 @@ public class InputOrderListBo {
     private Integer legalAffairs;
     private String contractNo;
     private String aid;
-    private String depId;
+    private String deps;
     private String depName;
     private String aName;
     private String startTime;
@@ -98,12 +98,12 @@ public class InputOrderListBo {
         this.aid = aid;
     }
 
-    public String getDepId() {
-        return depId;
+    public String getDeps() {
+        return deps;
     }
 
-    public void setDepId(String depId) {
-        this.depId = depId;
+    public void setDeps(String deps) {
+        this.deps = deps;
     }
 
     public Integer getPageSize() {

+ 14 - 2
src/main/java/com/goafanti/order/service/impl/LegalAffairsServiceImpl.java

@@ -1,5 +1,6 @@
 package com.goafanti.order.service.impl;
 
+import com.goafanti.admin.service.DepartmentService;
 import com.goafanti.common.bo.Result;
 import com.goafanti.common.constant.AFTConstants;
 import com.goafanti.common.dao.*;
@@ -33,6 +34,8 @@ public class LegalAffairsServiceImpl extends BaseMybatisDao<TOrderMidMapper> imp
     @Autowired
     private TOrderLegalAffairsMapper tOrderLegalAffairsMapper;
     @Autowired
+    private DepartmentService departmentService;
+    @Autowired
     private AdminMapper adminMapper;
     @Value(value = "${upload.path}")
     private String uploadPath = null;
@@ -75,7 +78,11 @@ public class LegalAffairsServiceImpl extends BaseMybatisDao<TOrderMidMapper> imp
             if (TokenManager.hasRole(AFTConstants.FINANCE)){
                 map.put("shiro",1);
                 List<String> deps=adminMapper.getFinanceDep(TokenManager.getAdminId());
-                map.put("deps",deps);
+                if (in.getDeps()==null){
+                    map.put("deps",deps);
+                }else {
+                    map.put("deps",departmentService.selectSubDeps(deps));
+                }
             }else if(TokenManager.hasRole(AFTConstants.SALESMAN_MANAGER)){
                 map.put("shiro",2);
                 map.put("sid", TokenManager.getAdminId());
@@ -92,8 +99,13 @@ public class LegalAffairsServiceImpl extends BaseMybatisDao<TOrderMidMapper> imp
             if(in.getAid()!=null) map.put("aid", in.getAid());
             if (in.getStatus()!=null) map.put("status",in.getStatus());
             map.put("type", in.getType());
+
+        }
+        if (!TokenManager.hasRole(AFTConstants.FINANCE)){
+            if(in.getDeps()!=null){
+                map.put("deps", departmentService.parseArray(in.getDeps()));
+            }
         }
-        if(in.getDepId()!=null) map.put("depId", in.getDepId());
         if(in.getUserName()!=null) map.put("userName", in.getUserName());
         if(in.getStartTime()!=null)map.put("startTime", in.getStartTime());
         if(in.getEndTime()!=null)map.put("endTime", in.getEndTime()+" 23:59:59");