Преглед изворни кода

系统多个接口部门搜索替换成部门及下级部门

anderx пре 3 година
родитељ
комит
02eba96365
19 измењених фајлова са 209 додато и 127 уклоњено
  1. 2 0
      src/main/java/com/goafanti/admin/service/DepartmentService.java
  2. 24 5
      src/main/java/com/goafanti/admin/service/impl/DepartmentServiceImpl.java
  3. 0 12
      src/main/java/com/goafanti/common/mapper/NewOrderChangeMapper.xml
  4. 11 5
      src/main/java/com/goafanti/common/mapper/TOrderInvoiceMapper.xml
  5. 22 10
      src/main/java/com/goafanti/common/mapper/TOrderNewMapper.xml
  6. 10 4
      src/main/java/com/goafanti/common/mapper/TOrderTaskMapper.xml
  7. 47 41
      src/main/java/com/goafanti/common/mapper/ThirdPartyCompanyMapper.xml
  8. 26 18
      src/main/java/com/goafanti/common/mapper/UserFollowMapper.xml
  9. 6 0
      src/main/java/com/goafanti/order/service/impl/FundManagerOrderServiceImpl.java
  10. 7 3
      src/main/java/com/goafanti/order/service/impl/LegalAffairsServiceImpl.java
  11. 1 7
      src/main/java/com/goafanti/order/service/impl/OrderChangeServiceImpl.java
  12. 6 1
      src/main/java/com/goafanti/order/service/impl/OrderInvoiceServiceImpl.java
  13. 19 7
      src/main/java/com/goafanti/order/service/impl/OrderNewServiceImpl.java
  14. 5 2
      src/main/java/com/goafanti/order/service/impl/OrderProjectServiceImpl.java
  15. 0 4
      src/main/java/com/goafanti/organization/controller/ThirdPartyCompanyApiController.java
  16. 6 1
      src/main/java/com/goafanti/organization/service/impl/OrganizationServiceImpl.java
  17. 6 1
      src/main/java/com/goafanti/organization/service/impl/ThirdPartyCompanyServiceImpl.java
  18. 6 1
      src/main/java/com/goafanti/user/service/impl/UserFollowServiceImpl.java
  19. 5 5
      src/main/resources/props/config_local.properties

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

@@ -28,6 +28,8 @@ public interface DepartmentService {
 
 
 	List<Department> selectSubDeps(String subId);
+	List<Department> selectSubDeps(String subId,Integer type);
 
 
+	List<Department> getLowerDep(String depIds);
 }

+ 24 - 5
src/main/java/com/goafanti/admin/service/impl/DepartmentServiceImpl.java

@@ -1,6 +1,7 @@
 package com.goafanti.admin.service.impl;
 
 import java.util.ArrayList;
+import java.util.Arrays;
 import java.util.List;
 
 import com.goafanti.common.constant.AFTConstants;
@@ -70,19 +71,37 @@ public class DepartmentServiceImpl extends BaseMybatisDao<WorkingHoursMapper> im
 		else
 			return selectCurrentDep(TokenManager.getAdminId());
 	}
+	public List<Department> selectSubDeps(String subId) {
+		return selectSubDeps(subId,0);
+	}
 
 	@Override
-	public List<Department> selectSubDeps(String subId) {
+	public List<Department> selectSubDeps(String subId,Integer type) {
 		List<Department>  list =departmentMapper.selectSubDeps(subId);
 		List<Department>  all=new ArrayList<>();
-		all.add(departmentMapper.selectByPrimaryKey(subId));
-		all.addAll(list);
-		for (Department dep : list) {
-			all.addAll(selectSubDeps(dep.getId()));
+		if (type==0)all.add(departmentMapper.selectByPrimaryKey(subId));
+		if (!list.isEmpty()){
+			all.addAll(list);
+			for (Department dep : list) {
+				List<Department> l2=selectSubDeps(dep.getId(),1);
+				if(!l2.isEmpty()){
+					all.addAll(l2);
+				}
+			}
 		}
 		return all;
 	}
 
+	@Override
+	public List<Department> getLowerDep(String depIds) {
+		String[] ss=depIds.split(",");
+		List<Department> ls=new ArrayList<>();
+		Arrays.stream(ss).forEach(e ->{
+			ls.addAll(selectSubDeps(e));
+		});
+		return ls;
+	}
+
 	private List<Department> selectCurrentDep(String managerId){
 		List<Department> allData = new ArrayList<Department>();
 		List<Department> superData = departmentMapper.selectCurrentDeps(managerId);

+ 0 - 12
src/main/java/com/goafanti/common/mapper/NewOrderChangeMapper.xml

@@ -473,12 +473,6 @@ select
 	<if test="processState==0">
 	and b.salesman_id= #{aid}
 	</if>
-	<if test="processState==1">
-	and b.order_dep in
-  	<foreach close=")" collection="deps" item="deps" open="(" separator=",">
-	 #{deps.id}
-  	</foreach>
-	</if>
 	<if test="processState==2 and complete !=5">
 	and  x.aid=#{aid}  and a.process_state &gt;= 2
 	</if>
@@ -589,12 +583,6 @@ select
 	<if test="processState==0">
 	and b.salesman_id= #{aid}
 	</if>
-	<if test="processState==1">
-	and b.order_dep in
-  	<foreach close=")" collection="deps" item="deps" open="(" separator=",">
-	 #{deps.id}
-  	</foreach>
-	</if>
 	<if test="processState==2 and complete !=5">
 	and  x.aid=#{aid}  and a.process_state &gt;= 2
 	</if>

+ 11 - 5
src/main/java/com/goafanti/common/mapper/TOrderInvoiceMapper.xml

@@ -666,8 +666,11 @@
 	<if test="name !=null">
 	and c.name like CONCAT('%',#{name,jdbcType=VARCHAR},'%')
 	</if>
-	<if test="orderDep !=null">
-	and b.order_dep= #{orderDep,jdbcType=VARCHAR}
+	<if test="deps !=null">
+	and b.order_dep in
+      <foreach close=")" collection="deps" item="deps" open="(" separator=",">
+        #{deps.id}
+      </foreach>
 	</if>
 	<if test="status !=null">
 	and a.status= #{status,jdbcType=INTEGER}
@@ -712,9 +715,12 @@
 	<if test="name !=null">
 	and c.name like CONCAT('%',#{name,jdbcType=VARCHAR},'%')
 	</if>
-	<if test="orderDep !=null">
-	and b.order_dep= #{orderDep,jdbcType=VARCHAR}
-	</if>
+    <if test="deps !=null">
+      and b.order_dep in
+      <foreach close=")" collection="deps" item="deps" open="(" separator=",">
+        #{deps.id}
+      </foreach>
+    </if>
 	<if test="status !=null">
 	and a.status= #{status,jdbcType=INTEGER}
 	</if>

+ 22 - 10
src/main/java/com/goafanti/common/mapper/TOrderNewMapper.xml

@@ -765,8 +765,11 @@
   		<if test="o.orderStatus != null and o.orderStatus != &quot;&quot;">
 	  	and (o.order_status >=  #{o.orderStatus,jdbcType=INTEGER} or o.back_status=3)
 	  	</if>
-  		<if test="o.departmentId != null and o.departmentId != &quot;&quot;">
-	  	and o.order_dep = #{o.departmentId,jdbcType=INTEGER}
+  		<if test="deps !=null">
+	  	and o.order_dep in
+          <foreach close=")" collection="deps" item="deps" open="(" separator=",">
+            #{deps.id}
+          </foreach>
 	  	</if>
 	  	<if test="o.contractNo != null and o.contractNo != &quot;&quot;">
   		and o.contract_no like CONCAT('%',#{o.contractNo,jdbcType=VARCHAR},'%')
@@ -842,9 +845,12 @@ left join department d on o.order_dep = d.id   left join t_order_mid a on o.orde
   		<if test="o.orderStatus != null and o.orderStatus != &quot;&quot;">
 	  	and (o.order_status >=  #{o.orderStatus,jdbcType=INTEGER} or o.back_status=3)
 	  	</if>
-  		<if test="o.departmentId != null and o.departmentId != &quot;&quot;">
-	  	and o.order_dep = #{o.departmentId,jdbcType=INTEGER}
-	  	</if>
+        <if test="deps !=null">
+          and o.order_dep in
+          <foreach close=")" collection="deps" item="deps" open="(" separator=",">
+            #{deps.id}
+          </foreach>
+        </if>
 	  	<if test="o.contractNo != null and o.contractNo != &quot;&quot;">
   		and o.contract_no like CONCAT('%',#{o.contractNo,jdbcType=VARCHAR},'%')
   		</if>
@@ -1598,8 +1604,11 @@ left join department d on o.order_dep = d.id   left join t_order_mid a on o.orde
     <if test="contractNo != null">
       and b.contract_no like CONCAT('%',#{contractNo,jdbcType=VARCHAR},'%')
     </if>
-    <if test="depId != null">
-      and b.order_dep= #{depId,jdbcType=VARCHAR}
+    <if test="deps != null">
+      and b.order_dep in
+      <foreach close=")" collection="deps" item="deps" open="(" separator=",">
+        #{deps.id}
+      </foreach>
     </if>
     <if test="shiroType !=3 and aid != null">
       and b.salesman_id= #{aid,jdbcType=VARCHAR}
@@ -1638,10 +1647,13 @@ left join department d on o.order_dep = d.id   left join t_order_mid a on o.orde
     <if test="orderNo != null">
       and a.order_no like CONCAT('%',#{orderNo,jdbcType=VARCHAR},'%')
     </if>
-    <if test="depId != null">
-      and b.order_dep= #{depId,jdbcType=VARCHAR}
+    <if test="deps != null">
+      and b.order_dep in
+      <foreach close=")" collection="deps" item="deps" open="(" separator=",">
+        #{deps.id}
+      </foreach>
     </if>
-    <if test="aid != null">
+    <if test="shiroType !=3 and aid != null">
       and b.salesman_id= #{aid,jdbcType=VARCHAR}
     </if>
     <if test="starTime !=null and endTime !=null">

+ 10 - 4
src/main/java/com/goafanti/common/mapper/TOrderTaskMapper.xml

@@ -1786,8 +1786,11 @@
       <if test="userName != null">
       and c.buyer_name like concat('%',#{userName},'%')
       </if>
-    <if test="depId != null">
-      and b.order_dep = #{depId}
+    <if test="deps != null">
+      and b.order_dep in
+      <foreach close=")" collection="deps" item="deps" open="(" separator=",">
+        #{deps.id}
+      </foreach>
     </if>
     <if test="contractNo != null">
       and b.contract_no =#{contractNo}
@@ -1850,8 +1853,11 @@
       <if test="userName != null">
         and c.buyer_name like concat('%',#{userName},'%')
       </if>
-      <if test="depId != null">
-        and b.order_dep = #{depId}
+      <if test="deps != null">
+        and b.order_dep in
+        <foreach close=")" collection="deps" item="deps" open="(" separator=",">
+          #{deps.id}
+        </foreach>
       </if>
       <if test="contractNo != null">
         and b.contract_no =#{contractNo}

+ 47 - 41
src/main/java/com/goafanti/common/mapper/ThirdPartyCompanyMapper.xml

@@ -102,8 +102,8 @@
       This element is automatically generated by MyBatis Generator, do not modify.
       This element was generated on Thu Oct 22 16:26:31 CST 2020.
     -->
-    id, tid, company_name, unit_price, quantity, total_amount, material, urgent, audit, 
-    assets, income, remarks, create_time, cid, party_amount, type, patent_name_type, 
+    id, tid, company_name, unit_price, quantity, total_amount, material, urgent, audit,
+    assets, income, remarks, create_time, cid, party_amount, type, patent_name_type,
     official_amount, start_type, patent_type
   </sql>
   <select id="selectByExample" parameterType="com.goafanti.common.model.ThirdPartyCompanyExample" resultMap="BaseResultMap">
@@ -131,7 +131,7 @@
       This element is automatically generated by MyBatis Generator, do not modify.
       This element was generated on Thu Oct 22 16:26:31 CST 2020.
     -->
-    select 
+    select
     <include refid="Base_Column_List" />
     from third_party_company
     where id = #{id,jdbcType=INTEGER}
@@ -162,19 +162,19 @@
       This element is automatically generated by MyBatis Generator, do not modify.
       This element was generated on Thu Oct 22 16:26:31 CST 2020.
     -->
-    insert into third_party_company (id, tid, company_name, 
-      unit_price, quantity, total_amount, 
-      material, urgent, audit, 
-      assets, income, remarks, 
-      create_time, cid, party_amount, 
-      type, patent_name_type, official_amount, 
+    insert into third_party_company (id, tid, company_name,
+      unit_price, quantity, total_amount,
+      material, urgent, audit,
+      assets, income, remarks,
+      create_time, cid, party_amount,
+      type, patent_name_type, official_amount,
       start_type, patent_type)
-    values (#{id,jdbcType=INTEGER}, #{tid,jdbcType=INTEGER}, #{companyName,jdbcType=VARCHAR}, 
-      #{unitPrice,jdbcType=DECIMAL}, #{quantity,jdbcType=INTEGER}, #{totalAmount,jdbcType=DECIMAL}, 
-      #{material,jdbcType=INTEGER}, #{urgent,jdbcType=INTEGER}, #{audit,jdbcType=INTEGER}, 
-      #{assets,jdbcType=VARCHAR}, #{income,jdbcType=VARCHAR}, #{remarks,jdbcType=VARCHAR}, 
-      #{createTime,jdbcType=TIMESTAMP}, #{cid,jdbcType=INTEGER}, #{partyAmount,jdbcType=DECIMAL}, 
-      #{type,jdbcType=INTEGER}, #{patentNameType,jdbcType=INTEGER}, #{officialAmount,jdbcType=DECIMAL}, 
+    values (#{id,jdbcType=INTEGER}, #{tid,jdbcType=INTEGER}, #{companyName,jdbcType=VARCHAR},
+      #{unitPrice,jdbcType=DECIMAL}, #{quantity,jdbcType=INTEGER}, #{totalAmount,jdbcType=DECIMAL},
+      #{material,jdbcType=INTEGER}, #{urgent,jdbcType=INTEGER}, #{audit,jdbcType=INTEGER},
+      #{assets,jdbcType=VARCHAR}, #{income,jdbcType=VARCHAR}, #{remarks,jdbcType=VARCHAR},
+      #{createTime,jdbcType=TIMESTAMP}, #{cid,jdbcType=INTEGER}, #{partyAmount,jdbcType=DECIMAL},
+      #{type,jdbcType=INTEGER}, #{patentNameType,jdbcType=INTEGER}, #{officialAmount,jdbcType=DECIMAL},
       #{startType,jdbcType=INTEGER}, #{patentType,jdbcType=INTEGER})
   </insert>
   <insert id="insertSelective" parameterType="com.goafanti.common.model.ThirdPartyCompany">
@@ -524,26 +524,26 @@
 	 select a.id,a.tid,a.company_name companyName,a.unit_price unitPrice,a.quantity,a.total_amount totalAmount,a.material,a.urgent,
 	a.patent_name_type patentNameType,a.audit,a.assets,a.income,a.remarks,a.cid,b.cost_reduction costReduction,b.official_cost officialCost,
 	a.type,a.party_amount partyAmount ,op.amount officialUnitPrice,op.proportion85 reductionAmount,a.start_type startType,a.patent_type patentType
-	from third_party_company a left join t_order_task b on a.tid=b.id  left join official_fee_price op on b.patent_type =op.patent_type  and a.patent_name_type =op.`type` 
+	from third_party_company a left join t_order_task b on a.tid=b.id  left join official_fee_price op on b.patent_type =op.patent_type  and a.patent_name_type =op.`type`
  where tid= #{tid}
   </select>
 <!--   <select id="selectByTidPuls" resultType="com.goafanti.organization.bo.ProjectTypePuls">
  select a.id,a.official_cost officialCost,a.cost_reduction costReduction ,a.commodity_quantity quantity ,a.patent_type patentType,b.patent_name_type projectType,
  c.amount officialAmount,c.proportion85 from t_order_task a left join t_order_outsource b on a.id=b.tid
-left join official_fee_price c on a.patent_type =c.patent_type and b.patent_name_type =c.`type`  
+left join official_fee_price c on a.patent_type =c.patent_type and b.patent_name_type =c.`type`
 where a.id= #{tid}
   </select> -->
   <select id="selectByTidGetListDtails" resultType="com.goafanti.organization.bo.ProjectTypePuls">
  select a.id,a.official_cost officialCost,a.cost_reduction costReduction ,a.commodity_quantity quantity ,a.patent_type patentType,b.patent_name_type projectType,
  c.amount officialAmount,c.proportion85 from t_order_task x  left join t_order_task a  on x.order_no =a.order_no left join t_order_outsource b on a.id=b.tid
-left join official_fee_price c on a.patent_type =c.patent_type and b.patent_name_type =c.`type`  
+left join official_fee_price c on a.patent_type =c.patent_type and b.patent_name_type =c.`type`
 where x.id=  #{tid}
   </select>
-  
-  
+
+
    <select id="selectPaymentList" resultType="com.goafanti.organization.bo.outPaymentList">
 		    select a.id, c.contract_no contractNo,b.order_no orderNo,d.buyer_name userName, d.dep_name depName,f.party_amount costAmount,
-		a.choose_type chooseType,a.payment_amount paymentAmount,a.application_amount applicationAmount,a.tid,a.company_name companyName, 
+		a.choose_type chooseType,a.payment_amount paymentAmount,a.application_amount applicationAmount,a.tid,a.company_name companyName,
 		date_format(a.create_time,'%Y-%m-%d %H:%i:%S')createTime,a.aname,d.finance_name financeName,b.cname, b.commodity_name pname,
 		b.project_status projectStatus,a.status,bp.`type` projectType,b.cost_reduction costReduction ,b.official_cost  officialCost,c.total_amount totalAmount,
 		c.settlement_amount settlementAmount,a.process_status processStatus
@@ -572,8 +572,11 @@ where x.id=  #{tid}
 		<if test="userName !=null">
 		and d.buyer_name like concat('%', #{userName},'%')
 		</if>
-		<if test="depId !=null">
-		and c.order_dep= #{depId}
+		<if test="deps !=null">
+		and c.order_dep in
+          <foreach close=")" collection="deps" item="deps" open="(" separator=",">
+            #{deps.id}
+          </foreach>
 		</if>
 		<if test="aname !=null">
 		and a.aname like concat('%',#{aname},'%')
@@ -598,11 +601,11 @@ where x.id=  #{tid}
 				${page_sql}
 		</if>
   </select>
-  
+
    <select id="selectPaymentCount" resultType="java.lang.Integer">
 		select count(*)
 		from t_order_payment a left join t_order_task b on a.tid=b.id left join t_order_new c on b.order_no=c.order_no
-		left join t_order_mid d on b.order_no=d.order_no 
+		left join t_order_mid d on b.order_no=d.order_no
 		where 1=1
 		<if test="lvl==0">
 		and d.finance_id= #{aid}
@@ -625,8 +628,11 @@ where x.id=  #{tid}
 		<if test="userName !=null">
 		and d.buyer_name like concat('%', #{userName},'%')
 		</if>
-		<if test="depId !=null">
-		and c.order_dep= #{depId}
+		<if test="deps !=null">
+		and c.order_dep in
+          <foreach close=")" collection="deps" item="deps" open="(" separator=",">
+            #{deps.id}
+          </foreach>
 		</if>
 		<if test="aname !=null">
 		and a.aname like concat('%',#{aname},'%')
@@ -650,8 +656,8 @@ where x.id=  #{tid}
 	b.set_up_amount projectAmount,e.cost_amount costAmount,e.party_amount partyAmount,b.task_receiver,
 	c.liquidation_status liquidationStatus,a.dun_type dunType,a.project_type projectType,a.tid,
 	a.total_amount NodeAmount,date_format(a.start_time,'%Y-%m-%d %H:%i:%S')startTime,a.status
-	from payment_node a 
-	left join t_order_task b on a.tid=b.id 
+	from payment_node a
+	left join t_order_task b on a.tid=b.id
 	left join t_order_new c on b.order_no=c.order_no
 	left join t_order_mid d on b.order_no=d.order_no
 	left join t_task_mid e on b.id=e.tid
@@ -691,10 +697,10 @@ where x.id=  #{tid}
 				${page_sql}
 		</if>
 </select>
-  <select id="selectNodeCount" resultType="java.lang.Integer"> 
+  <select id="selectNodeCount" resultType="java.lang.Integer">
 	  select count(*)
-	from payment_node a 
-	left join t_order_task b on a.tid=b.id 
+	from payment_node a
+	left join t_order_task b on a.tid=b.id
 	left join t_order_new c on b.order_no=c.order_no
 	left join t_order_mid d on b.order_no=d.order_no
 	where 1=1
@@ -732,7 +738,7 @@ where x.id=  #{tid}
 
 <select id="softWritingPriceList" resultType="com.goafanti.common.model.SoftWritingPrice">
 	  select a.id,a.cid,b.company_name companyName,a.material,a.unit_price unitPrice,a.urgent,a.remarks,
-	a.status,date_format(a.create_time,'%Y-%m-%d %H:%i:%s')createTimes 
+	a.status,date_format(a.create_time,'%Y-%m-%d %H:%i:%s')createTimes
 	from soft_writing_price a left join company_library b on a.cid=b.id
 	where 1=1
 	<if test="s.companyName != null">
@@ -748,9 +754,9 @@ where x.id=  #{tid}
 	${page_sql}
 	</if>
   </select>
-  
+
     <select id="softWritingPriceCount" resultType="java.lang.Integer">
-	  select count(*) 
+	  select count(*)
 	from soft_writing_price a left join company_library b on a.cid=b.id
 	where 1=1
 	<if test="s.companyName != null">
@@ -763,7 +769,7 @@ where x.id=  #{tid}
 	and a.urgent= #{s.urgent}
 	</if>
   </select>
-  
+
   <select id="selectListOfficialFeePrice" resultType="com.goafanti.common.model.OfficialFeePrice">
   select id,type,patent_type patentType,amount,proportion85,remarks,date_format(create_time, '%Y-%m-%d %H:%i:%S') createTimes
 	 from official_fee_price where 1=1
@@ -778,7 +784,7 @@ where x.id=  #{tid}
 	${page_sql}
 	</if>
   </select>
-  
+
    <select id="countListOfficialFeePrice" resultType="java.lang.Integer" >
   select count(*)
 	  from official_fee_price where 1=1
@@ -790,9 +796,9 @@ where x.id=  #{tid}
 	 </if>
   </select>
      <delete id="deleteByTid" >
-	delete from third_party_company 
+	delete from third_party_company
  where tid= #{tid}
   </delete>
-  
-  
-</mapper>
+
+
+</mapper>

+ 26 - 18
src/main/java/com/goafanti/common/mapper/UserFollowMapper.xml

@@ -28,7 +28,7 @@
       WARNING - @mbg.generated
       This element is automatically generated by MyBatis Generator, do not modify.
     -->
-    id, `uid`, aid, paid, `result`, attachment_url, create_time, ocb_id, contact_type, 
+    id, `uid`, aid, paid, `result`, attachment_url, create_time, ocb_id, contact_type,
     effective, time_stamp, follow_count, guidance, guidance_time, guidance_aid, guidance_name
   </sql>
   <select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="BaseResultMap">
@@ -36,7 +36,7 @@
       WARNING - @mbg.generated
       This element is automatically generated by MyBatis Generator, do not modify.
     -->
-    select 
+    select
     <include refid="Base_Column_List" />
     from user_follow
     where id = #{id,jdbcType=VARCHAR}
@@ -54,17 +54,17 @@
       WARNING - @mbg.generated
       This element is automatically generated by MyBatis Generator, do not modify.
     -->
-    insert into user_follow (id, `uid`, aid, 
-      paid, `result`, attachment_url, 
-      create_time, ocb_id, contact_type, 
-      effective, time_stamp, follow_count, 
-      guidance, guidance_time, guidance_aid, 
+    insert into user_follow (id, `uid`, aid,
+      paid, `result`, attachment_url,
+      create_time, ocb_id, contact_type,
+      effective, time_stamp, follow_count,
+      guidance, guidance_time, guidance_aid,
       guidance_name,follow_name,follow_dep)
-    values (#{id,jdbcType=VARCHAR}, #{uid,jdbcType=VARCHAR}, #{aid,jdbcType=VARCHAR}, 
-      #{paid,jdbcType=VARCHAR}, #{result,jdbcType=VARCHAR}, #{attachmentUrl,jdbcType=VARCHAR}, 
-      #{createTime,jdbcType=TIMESTAMP}, #{ocbId,jdbcType=VARCHAR}, #{contactType,jdbcType=INTEGER}, 
-      #{effective,jdbcType=INTEGER}, #{timeStamp,jdbcType=TIMESTAMP}, #{followCount,jdbcType=INTEGER}, 
-      #{guidance,jdbcType=VARCHAR}, #{guidanceTime,jdbcType=TIMESTAMP}, #{guidanceAid,jdbcType=VARCHAR}, 
+    values (#{id,jdbcType=VARCHAR}, #{uid,jdbcType=VARCHAR}, #{aid,jdbcType=VARCHAR},
+      #{paid,jdbcType=VARCHAR}, #{result,jdbcType=VARCHAR}, #{attachmentUrl,jdbcType=VARCHAR},
+      #{createTime,jdbcType=TIMESTAMP}, #{ocbId,jdbcType=VARCHAR}, #{contactType,jdbcType=INTEGER},
+      #{effective,jdbcType=INTEGER}, #{timeStamp,jdbcType=TIMESTAMP}, #{followCount,jdbcType=INTEGER},
+      #{guidance,jdbcType=VARCHAR}, #{guidanceTime,jdbcType=TIMESTAMP}, #{guidanceAid,jdbcType=VARCHAR},
       #{guidanceName,jdbcType=VARCHAR},#{followName},#{followDep})
   </insert>
   <insert id="insertSelective" parameterType="com.goafanti.common.model.UserFollow">
@@ -275,6 +275,7 @@
       c.location_province province ,c.location_city city ,c.location_area area,
       c.intended_project intendedProject ,c.business_scope businessScope
       from user_follow a left join `user`b on a.uid =b.id left join organization_identity c on a.uid=c.uid
+      left join admin d on a.aid =d.id
       where 1=1
       <if test="shiroType == 0">
       and a.aid= #{aid}
@@ -315,8 +316,11 @@
         <if test="guidanceStartTime !=null and guidanceEndTime !=null">
 		and a.guidance_time between #{guidanceStartTime} and #{guidanceEndTime}
 		</if>
-        <if test="depId != null">
-            and a.follow_dep = #{depId}
+        <if test="deps != null">
+          and d.department_id in
+          <foreach close=")" collection="deps" item="deps" open="(" separator=",">
+            #{deps.id}
+          </foreach>
         </if>
 		order by  a.create_time desc
 		<if test="page_sql != null">
@@ -325,7 +329,8 @@
 	</select>
 	<select id="userFollowCount" resultType="java.lang.Integer">
 		select count(*)
-      from user_follow a left join `user`b on a.uid =b.id where 1=1
+      from user_follow a left join `user`b on a.uid =b.id
+      left join admin d on a.aid =d.id where 1=1
       <if test="shiroType == 0">
         and a.aid= #{aid}
       </if>
@@ -365,8 +370,11 @@
       <if test="guidanceStartTime !=null and guidanceEndTime !=null">
         and a.guidance_time between #{guidanceStartTime} and #{guidanceEndTime}
       </if>
-      <if test="depId != null">
-        and a.follow_dep = #{depId}
+      <if test="deps != null">
+        and d.department_id in
+        <foreach close=")" collection="deps" item="deps" open="(" separator=",">
+          #{deps.id}
+        </foreach>
       </if>
 	</select>
-</mapper>
+</mapper>

+ 6 - 0
src/main/java/com/goafanti/order/service/impl/FundManagerOrderServiceImpl.java

@@ -10,6 +10,7 @@ import java.util.Map;
 import java.util.UUID;
 
 
+import com.goafanti.admin.service.DepartmentService;
 import com.goafanti.common.dao.*;
 import com.goafanti.order.bo.TOrderTaskBo;
 import org.slf4j.Logger;
@@ -74,6 +75,8 @@ public class FundManagerOrderServiceImpl extends BaseMybatisDao<TOrderNewMapper>
 	@Autowired
 	private DepartmentMapper departmentMapper;
 	@Autowired
+	private DepartmentService departmentService;
+	@Autowired
 	private AsyncUtils	asyncUtils;
 
 
@@ -159,6 +162,9 @@ public class FundManagerOrderServiceImpl extends BaseMybatisDao<TOrderNewMapper>
 		}
 		if (order.getOutsource()==null)order.setOutsource(0);//默认非外包
 		params.put("o", order);
+		if (order.getDepartmentId()!=null){
+			params.put("deps", departmentService.getLowerDep(order.getDepartmentId()));
+		}
 		Pagination<OrderListBo> data = (Pagination<OrderListBo>)findPage("financeList", "financeCount", params, pageNo, pageSize);
 		result.put("pagination", data);
 		Map<String, Object> count = tOrderNewMapper.countTotalAndActually(order,fids);

+ 7 - 3
src/main/java/com/goafanti/order/service/impl/LegalAffairsServiceImpl.java

@@ -103,9 +103,13 @@ public class LegalAffairsServiceImpl extends BaseMybatisDao<TOrderMidMapper> imp
         Date date = new Date();
         for (OutOrderLegalAffairsListBo out : list) {
             if (out.getLegalAffairs()==0){
-                long start=out.getDunStartTime().getTime()+AFTConstants.DUN_START_LIMIT_MS;
-                int i= (int) ((start-date.getTime())/(3600*24*1000));
-                out.setDaysRemaining(i);
+                if (out.getDunStartTime()!=null){
+                    long start=out.getDunStartTime().getTime()+AFTConstants.DUN_START_LIMIT_MS;
+                    int i= (int) ((start-date.getTime())/(3600*24*1000));
+                    out.setDaysRemaining(i);
+                }else {
+                    out.setDaysRemaining(0);
+                }
             }else {
                 out.setDaysRemaining(0);
             }

+ 1 - 7
src/main/java/com/goafanti/order/service/impl/OrderChangeServiceImpl.java

@@ -508,12 +508,7 @@ public class OrderChangeServiceImpl extends BaseMybatisDao<NewOrderChangeMapper>
 		if (StringUtils.isNotBlank(startTime)) parameter.put("startTime", startTime);
 		if (StringUtils.isNotBlank(endTime)) parameter.put("endTime", endTime+" 23:59:59");
 		if (StringUtils.isNotBlank(depId)) {
-			String[] ss=depId.split(",");
-			List<Department> ls=new ArrayList<>();
-			Arrays.stream(ss).forEach(e ->{
-				ls.addAll(departmentService.selectSubDeps(e));
-			});
-			parameter.put("deps",ls);
+			parameter.put("deps",departmentService.getLowerDep(depId));
 		}
 		if (StringUtils.isNotBlank(salesmanName)) parameter.put("salesmanName", salesmanName);
 		if(processState==5&&TokenManager.hasRole(AFTConstants.FINANCE_MANAGER)) {
@@ -521,7 +516,6 @@ public class OrderChangeServiceImpl extends BaseMybatisDao<NewOrderChangeMapper>
 		}else {
 			parameter.put("aid", TokenManager.getAdminId());
 		}
-		parameter.put("deps", orderService.selectMyDeps());
 		Pagination<NewOderCahngeListBo> data = (Pagination<NewOderCahngeListBo>)findPage("selectOrderChangeList", "selectOrderChangeCount", parameter, pageNo, pageSize);
 		return data;
 	}

+ 6 - 1
src/main/java/com/goafanti/order/service/impl/OrderInvoiceServiceImpl.java

@@ -8,6 +8,7 @@ import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 
+import com.goafanti.admin.service.DepartmentService;
 import com.goafanti.common.dao.*;
 import com.goafanti.common.model.InvoiceLog;
 import com.goafanti.order.bo.*;
@@ -43,6 +44,8 @@ public class OrderInvoiceServiceImpl extends BaseMybatisDao<TOrderInvoiceMapper>
 	private TOrderMidMapper	tOrderMidMapper;
 	@Autowired
 	private InvoiceLogMapper invoiceLogMapper;
+	@Autowired
+	private DepartmentService departmentService;
 
 	@Override
 	public int createServiceOrder(TOrderInvoice o) {
@@ -137,7 +140,9 @@ public class OrderInvoiceServiceImpl extends BaseMybatisDao<TOrderInvoiceMapper>
 			aDep=adminMapper.selectDepIdWithSpuerId(TokenManager.getAdminId());
 			params.put("aDep", aDep);
 		}
-		if(StringUtils.isNotBlank(o.getOrderDep()))params.put("orderDep", o.getOrderDep());
+		if(StringUtils.isNotBlank(o.getOrderDep())){
+			params.put("deps", departmentService.getLowerDep(o.getOrderDep()));
+		}
 		if(o.getType()!=null)params.put("type", o.getType());
 		//营销管理员
 		if (TokenManager.hasRole(AFTConstants.SALESMAN_ADMIN)) {

+ 19 - 7
src/main/java/com/goafanti/order/service/impl/OrderNewServiceImpl.java

@@ -18,6 +18,7 @@ import java.util.UUID;
 
 import javax.mail.MessagingException;
 
+import com.goafanti.admin.service.DepartmentService;
 import com.goafanti.common.bo.Result;
 import com.goafanti.common.dao.*;
 import com.goafanti.common.model.*;
@@ -129,6 +130,8 @@ public class OrderNewServiceImpl extends BaseMybatisDao<TOrderNewMapper> impleme
 	private BusinessCategoryMapper businessCategoryMapper;
 	@Autowired
 	private OrderProjectService orderProjectService;
+	@Autowired
+	private DepartmentService departmentService;
 	@Value(value = "${upload.path}")
 	private String					uploadPath			= null;
 
@@ -614,10 +617,7 @@ public class OrderNewServiceImpl extends BaseMybatisDao<TOrderNewMapper> impleme
 			if(specially==4) {
 				params.put("distribution",distribution);
 			}
-			// 计算出所有本部门及所属部门的ID
-			if(specially==1||specially==5) {
-				params.put("deps", orderService.selectMyDeps());
-			}
+
 		}else if(specially==8){
 			if (StringUtils.isNotBlank(uid)) {
 				params.put("uid", uid);
@@ -631,9 +631,21 @@ public class OrderNewServiceImpl extends BaseMybatisDao<TOrderNewMapper> impleme
 		if (StringUtils.isNotBlank(name)) {
 			params.put("name", name);
 		}
-		if (StringUtils.isNotBlank(depId)) {
-			params.put("depId", depId);
+		// 计算出所有本部门及所属部门的ID
+		List<Department> deps = new ArrayList<>();
+		if(specially==1||specially==5) {
+			deps = orderService.selectMyDeps();
+			if (StringUtils.isNotBlank(depId)) {
+				if (deps.contains(depId)){
+					deps=departmentService.getLowerDep(depId);
+				}
+			}
+		}else {
+			if (StringUtils.isNotBlank(depId)) {
+				deps=departmentService.getLowerDep(depId);
+			}
 		}
+
 		if (StringUtils.isNotBlank(contractNo)) {
 			params.put("contractNo", contractNo);
 		}
@@ -1741,7 +1753,7 @@ public class OrderNewServiceImpl extends BaseMybatisDao<TOrderNewMapper> impleme
 			params.put("name", in.getName());
 		}
 		if (StringUtils.isNotBlank(in.getDepId())) {
-			params.put("depId", in.getDepId());
+			params.put("deps", departmentService.getLowerDep(in.getDepId()));
 		}
 		if (StringUtils.isNotBlank(in.getAdminName())) {
 			params.put("adminName", in.getAdminName());

+ 5 - 2
src/main/java/com/goafanti/order/service/impl/OrderProjectServiceImpl.java

@@ -14,6 +14,7 @@ import java.util.UUID;
 import javax.mail.MessagingException;
 
 import com.goafanti.admin.bo.AdminListBo;
+import com.goafanti.admin.service.DepartmentService;
 import com.goafanti.common.bo.*;
 import com.goafanti.common.bo.Error;
 import com.goafanti.common.dao.*;
@@ -83,7 +84,7 @@ public class OrderProjectServiceImpl extends BaseMybatisDao<TOrderTaskMapper> im
 	@Autowired
 	private NewOrderDunMapper	newOrderDunMapper;
 	@Autowired
-	private TOrderMidMapper	tOrderMidMapper;
+	private DepartmentService	departmentService;
 	@Autowired
 	private TArrearsDunMapper	tArrearsDunMapper;
 	@Autowired
@@ -1062,7 +1063,9 @@ public class OrderProjectServiceImpl extends BaseMybatisDao<TOrderTaskMapper> im
 	private void addParam(InputMemberList in, HashMap<String, Object> map) {
 		if(in.getOrderNo()!=null) map.put("orderNo", in.getOrderNo());
 		if(in.getUserName()!=null) map.put("userName", in.getUserName());
-		if(in.getDepId()!=null) map.put("depId", in.getDepId());
+		if(in.getDepId()!=null){
+			map.put("deps", departmentService.getLowerDep(in.getDepId()));
+		}
 		if(in.getContractNo()!=null) map.put("contractNo", in.getContractNo());
 		if(in.getSalesmanId()!=null) map.put("salesmanId", in.getSalesmanId());
 		if(in.getProjectName()!=null) map.put("projectName", in.getProjectName());

+ 0 - 4
src/main/java/com/goafanti/organization/controller/ThirdPartyCompanyApiController.java

@@ -420,7 +420,6 @@ public class ThirdPartyCompanyApiController extends BaseApiController{
 
 	/**
 	 * 付款列表
-	 * @param t
 	 * @return
 	 */
 	@RequestMapping(value = "/selectPaymentList" , method = RequestMethod.GET)
@@ -432,7 +431,6 @@ public class ThirdPartyCompanyApiController extends BaseApiController{
 
 	/**
 	 * 节点应收款列表
-	 * @param t
 	 * @return
 	 */
 	@RequestMapping(value = "/selectNodeList" , method = RequestMethod.GET)
@@ -444,7 +442,6 @@ public class ThirdPartyCompanyApiController extends BaseApiController{
 
 	/**
 	 *  新增软著价格表
-	 * @param t
 	 * @return
 	 */
 	@RequestMapping(value = "/addSoftWritingPrice" , method = RequestMethod.POST)
@@ -466,7 +463,6 @@ public class ThirdPartyCompanyApiController extends BaseApiController{
 
 	/**
 	 *  修改软著价格表
-	 * @param t
 	 * @return
 	 */
 	@RequestMapping(value = "/updateSoftWritingPrice" , method = RequestMethod.POST)

+ 6 - 1
src/main/java/com/goafanti/organization/service/impl/OrganizationServiceImpl.java

@@ -142,6 +142,9 @@ public class OrganizationServiceImpl extends BaseMybatisDao<DepartmentMapper> im
 		Date now=new Date();
 		Department dep=new Department();
 		String deps ="";
+		//如果是修改顶级则不触发下级修改
+		boolean flag=true;
+		if (name.contains("平台超管中心"))flag=false;
 		if (!use.getSuperId().equals(superId)){
 			if(!name.equals("平台超管中心")){
 				deps=getMaxDep(superDep);
@@ -150,6 +153,8 @@ public class OrganizationServiceImpl extends BaseMybatisDao<DepartmentMapper> im
 			}
 			dep.setDepNo(deps);
 			dep.setSuperId(superId);
+		}else {
+			flag=false;
 		}
 
 		dep.setLvl(superDep.getLvl()+1);
@@ -167,7 +172,7 @@ public class OrganizationServiceImpl extends BaseMybatisDao<DepartmentMapper> im
 		dep.setWorkingHoursType(workingHoursType);
 		tOrderMidMapper.updateFinanceId(id,financeId);
 		int x=departmentMapper.updateByPrimaryKeySelective(dep);
-		updateLowerLevelNo(dep.getId(),dep.getDepNo(),dep.getLvl());
+		if(flag)updateLowerLevelNo(dep.getId(),dep.getDepNo(),dep.getLvl());
 		return x;
 	}
 

+ 6 - 1
src/main/java/com/goafanti/organization/service/impl/ThirdPartyCompanyServiceImpl.java

@@ -12,6 +12,7 @@ import java.util.UUID;
 
 import javax.servlet.http.HttpServletResponse;
 
+import com.goafanti.admin.service.DepartmentService;
 import org.apache.commons.beanutils.BeanUtils;
 import org.apache.commons.collections4.map.HashedMap;
 import org.apache.commons.lang3.StringUtils;
@@ -108,6 +109,8 @@ public class ThirdPartyCompanyServiceImpl extends  BaseMybatisDao<ThirdPartyComp
 	@Autowired
 	private TOrderMidMapper	tOrderMidMapper;
 	@Autowired
+	private DepartmentService	departmentService;
+	@Autowired
 	private AsyncUtils	asyncUtils;
 
 
@@ -645,7 +648,9 @@ public class ThirdPartyCompanyServiceImpl extends  BaseMybatisDao<ThirdPartyComp
 		if (i.getContractNo()!=null)map.put("contractNo", i.getContractNo());
 		if (i.getOrderNo()!=null)map.put("orderNo", i.getOrderNo());
 		if (i.getUserName()!=null)map.put("userName", i.getUserName());
-		if (i.getDepId()!=null)map.put("depId", i.getDepId());
+		if (i.getDepId()!=null){
+			map.put("deps", departmentService.getLowerDep(i.getDepId()));
+		}
 		if (i.getAname()!=null)map.put("aname", i.getAname());
 		if (i.getFinanceName()!=null)map.put("financeName", i.getFinanceName());
 		if (i.getCname()!=null)map.put("cname", i.getCname());

+ 6 - 1
src/main/java/com/goafanti/user/service/impl/UserFollowServiceImpl.java

@@ -1,5 +1,6 @@
 package com.goafanti.user.service.impl;
 
+import com.goafanti.admin.service.DepartmentService;
 import com.goafanti.common.dao.AdminMapper;
 import com.goafanti.common.dao.PublicReleaseCountMapper;
 import com.goafanti.common.dao.UserFollowMapper;
@@ -30,6 +31,8 @@ public class UserFollowServiceImpl extends BaseMybatisDao<UserFollowMapper>  imp
     private AdminMapper adminMapper;
     @Autowired
     private PublicReleaseCountMapper publicReleaseCountMapper;
+    @Autowired
+    private DepartmentService departmentService;
 
 
     @Override
@@ -50,7 +53,9 @@ public class UserFollowServiceImpl extends BaseMybatisDao<UserFollowMapper>  imp
         if (in.getCreateEndTime()!=null) map.put("createEndTime", in.getCreateEndTime()+" 23:59:59");
         if (in.getGuidanceStartTime()!=null) map.put("guidanceStartTime", in.getGuidanceStartTime());
         if (in.getGuidanceEndTime()!=null) map.put("guidanceEndTime", in.getGuidanceEndTime()+" 23:59:59");
-        if (in.getDepId() != null) map.put("depId",in.getDepId());
+        if (in.getDepId() != null){
+            map.put("deps", departmentService.getLowerDep(in.getDepId()));
+        }
         if (in.getShiroType()!=null)map.put("shiroType",in.getShiroType());
         else map.put("shiroType",0);
         if(in.getShiroType()==0){

+ 5 - 5
src/main/resources/props/config_local.properties

@@ -1,12 +1,12 @@
 dev.name=local
 jdbc.driverClassName=com.mysql.jdbc.Driver
-jdbc.url=jdbc\:mysql://localhost:3306/aft20220318?useUnicode=true&characterEncoding=UTF-8&autoReconnect=true&useSSL=false
+#jdbc.url=jdbc\:mysql://localhost:3306/aft20220318?useUnicode=true&characterEncoding=UTF-8&autoReconnect=true&useSSL=false
 #jdbc.url=jdbc\:mysql://localhost:3306/aft?useUnicode=true&characterEncoding=UTF-8&autoReconnect=true&useSSL=false
-jdbc.username=root
-jdbc.password=123456
-#jdbc.url=jdbc:mysql://101.37.32.31:3306/aft?useUnicode=true&characterEncoding=UTF-8&autoReconnect=true&useSSL=false
 #jdbc.username=root
-#jdbc.password=aftdev
+#jdbc.password=123456
+jdbc.url=jdbc:mysql://101.37.32.31:3306/aft?useUnicode=true&characterEncoding=UTF-8&autoReconnect=true&useSSL=false
+jdbc.username=root
+jdbc.password=aftdev
 jdbc.validationQuery=SELECT 'x'
 jdbc.initialSize=3
 jdbc.maxActive=20