Przeglądaj źródła

Merge branch 'test' of jishutao/kede-server into prod

anderx 3 lat temu
rodzic
commit
e7af427cff
35 zmienionych plików z 968 dodań i 291 usunięć
  1. 1 1
      .idea/artifacts/kede_server_war_exploded.xml
  2. 1 0
      .idea/compiler.xml
  3. 2 1
      .idea/encodings.xml
  4. 0 13
      .idea/libraries/Maven__com_alibaba_druid_1_0_25.xml
  5. 1 1
      kede-server.iml
  6. 11 11
      pom.xml
  7. 2 0
      src/main/java/com/goafanti/common/constant/AFTConstants.java
  8. 1 3
      src/main/java/com/goafanti/common/dao/PublicReleaseLogMapper.java
  9. 5 0
      src/main/java/com/goafanti/common/dao/PublicReleaseMapper.java
  10. 133 12
      src/main/java/com/goafanti/common/mapper/PublicReleaseMapper.xml
  11. 21 1
      src/main/java/com/goafanti/common/mapper/TOrderNewMapper.xml
  12. 2 2
      src/main/java/com/goafanti/common/mapper/TOrderTaskMapper.xml
  13. 22 4
      src/main/java/com/goafanti/common/mapper/UserMapperExt.xml
  14. 67 2
      src/main/java/com/goafanti/common/model/PublicRelease.java
  15. 26 1
      src/main/java/com/goafanti/common/model/PublicReleaseLog.java
  16. 2 1
      src/main/java/com/goafanti/common/task/OrderDunTask.java
  17. 14 15
      src/main/java/com/goafanti/common/utils/WeChatUtils.java
  18. 17 4
      src/main/java/com/goafanti/customer/service/impl/CustomerServiceImpl.java
  19. 23 5
      src/main/java/com/goafanti/order/bo/OrderListBo.java
  20. 21 3
      src/main/java/com/goafanti/order/bo/TOrderTaskListBo.java
  21. 17 62
      src/main/java/com/goafanti/organization/controller/AdminOrganizationController.java
  22. 8 8
      src/main/java/com/goafanti/organization/service/OrganizationService.java
  23. 58 73
      src/main/java/com/goafanti/organization/service/impl/OrganizationServiceImpl.java
  24. 6 7
      src/main/java/com/goafanti/organization/service/impl/ThirdPartyCompanyServiceImpl.java
  25. 19 1
      src/main/java/com/goafanti/weChat/bo/InputPublicDtails.java
  26. 18 6
      src/main/java/com/goafanti/weChat/bo/InputPublicReleaseList.java
  27. 32 2
      src/main/java/com/goafanti/weChat/bo/OutPublicDtails.java
  28. 129 0
      src/main/java/com/goafanti/weChat/bo/OutPublicDtailsFinance.java
  29. 13 0
      src/main/java/com/goafanti/weChat/bo/OutPublicRelease.java
  30. 54 0
      src/main/java/com/goafanti/weChat/bo/OutPublicReleaseList.java
  31. 44 11
      src/main/java/com/goafanti/weChat/controller/AdminReleaseApiController.java
  32. 4 0
      src/main/java/com/goafanti/weChat/service/PublicReleaseService.java
  33. 181 28
      src/main/java/com/goafanti/weChat/service/impl/PublicReleaseServiceImpl.java
  34. 9 9
      src/main/resources/props/config_local.properties
  35. 4 4
      src/main/resources/props/config_test.properties

+ 1 - 1
.idea/artifacts/kede_server_war_exploded.xml

@@ -45,7 +45,7 @@
           <element id="library" level="project" name="Maven: org.apache.commons:commons-pool2:2.4.2" />
           <element id="library" level="project" name="Maven: org.mybatis:mybatis:3.2.8" />
           <element id="library" level="project" name="Maven: org.mybatis:mybatis-spring:1.2.2" />
-          <element id="library" level="project" name="Maven: com.alibaba:druid:1.0.25" />
+          <element id="library" level="project" name="Maven: com.alibaba:druid:1.1.20" />
           <element id="library" level="project" name="Maven: com.fasterxml.jackson.core:jackson-databind:2.8.2" />
           <element id="library" level="project" name="Maven: com.fasterxml.jackson.core:jackson-annotations:2.8.0" />
           <element id="library" level="project" name="Maven: com.fasterxml.jackson.core:jackson-core:2.8.2" />

+ 1 - 0
.idea/compiler.xml

@@ -14,6 +14,7 @@
     </bytecodeTargetLevel>
   </component>
   <component name="JavacSettings">
+    <option name="ADDITIONAL_OPTIONS_STRING" value="-enciding=UTF-8" />
     <option name="ADDITIONAL_OPTIONS_OVERRIDE">
       <module name="kede-server" options="-Xlint:all" />
     </option>

+ 2 - 1
.idea/encodings.xml

@@ -1,7 +1,8 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <project version="4">
-  <component name="Encoding">
+  <component name="Encoding" native2AsciiForPropertiesFiles="true" defaultCharsetForPropertiesFiles="UTF-8">
     <file url="file://$PROJECT_DIR$/src/main/java" charset="UTF-8" />
     <file url="file://$PROJECT_DIR$/src/main/resources" charset="UTF-8" />
+    <file url="PROJECT" charset="UTF-8" />
   </component>
 </project>

+ 0 - 13
.idea/libraries/Maven__com_alibaba_druid_1_0_25.xml

@@ -1,13 +0,0 @@
-<component name="libraryTable">
-  <library name="Maven: com.alibaba:druid:1.0.25">
-    <CLASSES>
-      <root url="jar://$MAVEN_REPOSITORY$/com/alibaba/druid/1.0.25/druid-1.0.25.jar!/" />
-    </CLASSES>
-    <JAVADOC>
-      <root url="jar://$MAVEN_REPOSITORY$/com/alibaba/druid/1.0.25/druid-1.0.25-javadoc.jar!/" />
-    </JAVADOC>
-    <SOURCES>
-      <root url="jar://$MAVEN_REPOSITORY$/com/alibaba/druid/1.0.25/druid-1.0.25-sources.jar!/" />
-    </SOURCES>
-  </library>
-</component>

+ 1 - 1
kede-server.iml

@@ -62,7 +62,7 @@
     <orderEntry type="library" name="Maven: org.apache.commons:commons-pool2:2.4.2" level="project" />
     <orderEntry type="library" name="Maven: org.mybatis:mybatis:3.2.8" level="project" />
     <orderEntry type="library" name="Maven: org.mybatis:mybatis-spring:1.2.2" level="project" />
-    <orderEntry type="library" name="Maven: com.alibaba:druid:1.0.25" level="project" />
+    <orderEntry type="library" name="Maven: com.alibaba:druid:1.1.20" level="project" />
     <orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-databind:2.8.2" level="project" />
     <orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-annotations:2.8.0" level="project" />
     <orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-core:2.8.2" level="project" />

+ 11 - 11
pom.xml

@@ -72,17 +72,17 @@
 			<artifactId>spring-web</artifactId>
 			<version>${org.springframework-version}</version>
 		</dependency>
-	<!-- Javax Annotation -->  
+	<!-- Javax Annotation -->
 <dependency>
      <groupId>javax.xml.bind</groupId>
      <artifactId>jaxb-api</artifactId>
      <version>2.3.0</version>
- </dependency>    
- <!-- Javax Annotation -->  
-        <dependency>  
-            <groupId>javax.annotation</groupId>  
-            <artifactId>jsr250-api</artifactId>  
-            <version>1.0</version>  
+ </dependency>
+ <!-- Javax Annotation -->
+        <dependency>
+            <groupId>javax.annotation</groupId>
+            <artifactId>jsr250-api</artifactId>
+            <version>1.0</version>
         </dependency>
 		<dependency>
 			<groupId>org.springframework</groupId>
@@ -159,7 +159,7 @@
 		<dependency>
 			<groupId>com.alibaba</groupId>
 			<artifactId>druid</artifactId>
-			<version>1.0.25</version>
+			<version>1.1.20</version>
 			<exclusions>
 				<exclusion>
 					<groupId>com.alibaba</groupId>
@@ -334,13 +334,13 @@
 			<artifactId>json-simple</artifactId>
 			<version>1.1.1</version>
 		</dependency>
-		
+
 		    <dependency>
            <groupId>org.apache.poi</groupId>
            <artifactId>poi</artifactId>
            <version>3.17</version>
        </dependency>
-       
+
 		<dependency>
 			<groupId>org.apache.poi</groupId>
 			<artifactId>poi-ooxml</artifactId>
@@ -502,4 +502,4 @@
 			</snapshots>
 		</pluginRepository>
 	</pluginRepositories>
-</project>
+</project>

+ 2 - 0
src/main/java/com/goafanti/common/constant/AFTConstants.java

@@ -25,6 +25,8 @@ public class AFTConstants {
 	public static final String	CED_ASSISTANT						= "99988";
 	/**	集团副总 */
 	public static final String	VICE_CEO							= "99997";
+	/** 技术财税管理员 */
+	public static final String  TECH_FINANCE_DIRECTOR                = "9994";
 	/** 技术管理员 */
 	public static final String  TECH_ADMIN                          = "9998";
 	/**	技术经理 */

+ 1 - 3
src/main/java/com/goafanti/common/dao/PublicReleaseLogMapper.java

@@ -53,7 +53,5 @@ public interface PublicReleaseLogMapper {
 
 	List<outPublicReleaseLog> listPublicReleaseLog(@Param ("id")Integer id,@Param ("ufid")String ufid);
 
-	void updateNoRead();
 
-	List<outPublicReleaseLog> unreadPublicReleaseLog(String aid);
-}
+}

+ 5 - 0
src/main/java/com/goafanti/common/dao/PublicReleaseMapper.java

@@ -44,4 +44,9 @@ public interface PublicReleaseMapper {
     List<OutPublicReleaseCount > getTimeUserFollow(@Param("date")Date date, @Param("now")Date now);
 
     List<OutPublicRelease> publicByOrder(String orderNo);
+
+    List<PublicRelease> selectByMainId(Integer mainId);
+
+
+    void updateStatusByMainId(@Param("status") Integer status, @Param("mainId") Integer mainId);
 }

+ 133 - 12
src/main/java/com/goafanti/common/mapper/PublicReleaseMapper.xml

@@ -34,12 +34,18 @@
     <result column="order_no" jdbcType="VARCHAR" property="orderNo" />
     <result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
     <result column="update_status" jdbcType="INTEGER" property="updateStatus" />
+    <result column="assist" jdbcType="INTEGER" property="assist" />
+    <result column="assist_aid" jdbcType="VARCHAR" property="assistAid" />
+    <result column="assist_aid_name" jdbcType="VARCHAR" property="assistAidName" />
+    <result column="main_id" jdbcType="INTEGER" property="mainId" />
+    <result column="main_name" jdbcType="VARCHAR" property="mainName" />
   </resultMap>
   <sql id="Base_Column_List">
     id, `uid`, aid, release_start, release_end, remarks, annex_url, user_name, longitude,
     latitude, `status`, create_time, clock_in, clock_in_time, photo_url, pid, pname,
     ufid, duration, valid_date, new_user, sign_sum, main_status, supplement, audit_info,
-    `plan`, expected_effect, next_plan, `type`, order_no, update_time, update_status
+    `plan`, expected_effect, next_plan, `type`, order_no, update_time, update_status,
+    assist, assist_aid, assist_aid_name, main_id, main_name
   </sql>
   <select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
     select
@@ -51,7 +57,8 @@
     delete from public_release
     where id = #{id,jdbcType=INTEGER}
   </delete>
-  <insert id="insert" parameterType="com.goafanti.common.model.PublicRelease">
+
+  <insert id="insert" keyColumn="id" keyProperty="id" parameterType="com.goafanti.common.model.PublicRelease" useGeneratedKeys="true">
     insert into public_release (id, `uid`, aid,
       release_start, release_end, remarks,
       annex_url, user_name, longitude,
@@ -62,7 +69,9 @@
       main_status, supplement, audit_info,
       `plan`, expected_effect, next_plan,
       `type`, order_no, update_time,
-      update_status)
+      update_status, assist, assist_aid,
+      assist_aid_name, main_id, main_name
+      )
     values (#{id,jdbcType=INTEGER}, #{uid,jdbcType=VARCHAR}, #{aid,jdbcType=VARCHAR},
       #{releaseStart,jdbcType=TIMESTAMP}, #{releaseEnd,jdbcType=TIMESTAMP}, #{remarks,jdbcType=VARCHAR},
       #{annexUrl,jdbcType=VARCHAR}, #{userName,jdbcType=VARCHAR}, #{longitude,jdbcType=VARCHAR},
@@ -73,7 +82,9 @@
       #{mainStatus,jdbcType=INTEGER}, #{supplement,jdbcType=VARCHAR}, #{auditInfo,jdbcType=VARCHAR},
       #{plan,jdbcType=VARCHAR}, #{expectedEffect,jdbcType=VARCHAR}, #{nextPlan,jdbcType=VARCHAR},
       #{type,jdbcType=INTEGER}, #{orderNo,jdbcType=VARCHAR}, #{updateTime,jdbcType=TIMESTAMP},
-      #{updateStatus,jdbcType=INTEGER})
+      #{updateStatus,jdbcType=INTEGER}, #{assist,jdbcType=INTEGER}, #{assistAid,jdbcType=VARCHAR},
+      #{assistAidName,jdbcType=VARCHAR}, #{mainId,jdbcType=INTEGER}, #{mainName,jdbcType=VARCHAR}
+      )
   </insert>
 
   <insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="com.goafanti.common.model.PublicRelease" useGeneratedKeys="true">
@@ -175,6 +186,21 @@
       <if test="updateStatus != null">
         update_status,
       </if>
+      <if test="assist != null">
+        assist,
+      </if>
+      <if test="assistAid != null">
+        assist_aid,
+      </if>
+      <if test="assistAidName != null">
+        assist_aid_name,
+      </if>
+      <if test="mainId != null">
+        main_id,
+      </if>
+      <if test="mainName != null">
+        main_name,
+      </if>
     </trim>
     <trim prefix="values (" suffix=")" suffixOverrides=",">
       <if test="id != null">
@@ -273,6 +299,21 @@
       <if test="updateStatus != null">
         #{updateStatus,jdbcType=INTEGER},
       </if>
+      <if test="assist != null">
+        #{assist,jdbcType=INTEGER},
+      </if>
+      <if test="assistAid != null">
+        #{assistAid,jdbcType=VARCHAR},
+      </if>
+      <if test="assistAidName != null">
+        #{assistAidName,jdbcType=VARCHAR},
+      </if>
+      <if test="mainId != null">
+        #{mainId,jdbcType=INTEGER},
+      </if>
+      <if test="mainName != null">
+        #{mainName,jdbcType=VARCHAR},
+      </if>
     </trim>
   </insert>
   <update id="updateByPrimaryKeySelective" parameterType="com.goafanti.common.model.PublicRelease">
@@ -371,6 +412,21 @@
       <if test="updateStatus != null">
         update_status = #{updateStatus,jdbcType=INTEGER},
       </if>
+      <if test="assist != null">
+        assist = #{assist,jdbcType=INTEGER},
+      </if>
+      <if test="assistAid != null">
+        assist_aid = #{assistAid,jdbcType=VARCHAR},
+      </if>
+      <if test="assistAidName != null">
+        assist_aid_name = #{assistAidName,jdbcType=VARCHAR},
+      </if>
+      <if test="mainId != null">
+        main_id = #{mainId,jdbcType=INTEGER},
+      </if>
+      <if test="mainName != null">
+        main_name = #{mainName,jdbcType=VARCHAR},
+      </if>
     </set>
     where id = #{id,jdbcType=INTEGER}
   </update>
@@ -406,7 +462,12 @@
       `type` = #{type,jdbcType=INTEGER},
       order_no = #{orderNo,jdbcType=VARCHAR},
       update_time = #{updateTime,jdbcType=TIMESTAMP},
-      update_status = #{updateStatus,jdbcType=INTEGER}
+      update_status = #{updateStatus,jdbcType=INTEGER},
+      assist = #{assist,jdbcType=INTEGER},
+      assist_aid = #{assistAid,jdbcType=VARCHAR},
+      assist_aid_name = #{assistAidName,jdbcType=VARCHAR},
+      main_id = #{mainId,jdbcType=INTEGER},
+      main_name = #{mainName,jdbcType=VARCHAR}
     where id = #{id,jdbcType=INTEGER}
   </update>
 
@@ -417,24 +478,46 @@
     where a.aid =#{aid} and a.uid =#{uid} and a.main_status =1 and a.create_time =b.create_time
   </update>
 
+
   <select id="listPublicRelease" resultType="com.goafanti.weChat.bo.OutPublicReleaseList">
-  select  a.id,b.nickname ,c.name  aname,date_format(a.release_start,'%Y-%m-%d %H:%i:%S') releaseStarts,a.user_name userName,
+  select  a.id,b.nickname ,c.name  aname,date_format(a.release_start,'%Y-%m-%d %H:%i:%S') releaseStarts,a.user_name userName,a.aid,
   date_format(a.release_end ,'%Y-%m-%d %H:%i:%S') releaseEnds,date_format(a.create_time ,'%Y-%m-%d %H:%i:%S') createTimes,a.status,
-  a.latitude ,a.longitude ,a.clock_in clockIn,date_format(a.update_time ,'%Y-%m-%d %H:%i:%S') updateTimes,a.update_status updateStatus
+  a.latitude ,a.longitude ,a.clock_in clockIn,date_format(a.update_time ,'%Y-%m-%d %H:%i:%S') updateTimes,a.update_status updateStatus,
+a.assist,a.assist_aid assistAid,a.assist_aid_name assistAidName,a.type,a.main_name mainName
   from public_release a left join `user` b on a.uid =b.id left join admin c on a.aid =c.id
   <if test="type==2">
     left join department d on c.department_id =d.id
   </if>
       where 1=1
-	<if test="type==0">
-	and a.aid= #{aid}
+    <if test="type==0">
+        <if test="assist == 2">
+          and a.assist    =2
+        </if>
+        <if test="assist !=2 and assistType !=1">
+          and a.assist in(0,1)
+        </if>
+      <if test="assistType ==1">
+        and a.assist in(0,1,2)
+      </if>
+        <if test="aid !=null">
+        and a.aid= #{aid}
+        </if>
 	</if>
 	<if test="type==1">
+      and a.assist in(0,1)
 	and c.reviewer = #{aid}
 	</if>
     <if test="type==2">
+      and a.assist in(0,1)
       and d.manager_id = #{aid}
     </if>
+    <if test="type==3">
+        and a.assist=2
+        <if test="aid !=null">
+        and a.aid= #{aid}
+        </if>
+      and a.type = #{type}
+    </if>
 	<if test="clockTime !=null">
 	and a.release_start &lt; #{clockTime} and a.release_end &gt; #{clockTime}
 	</if>
@@ -463,14 +546,34 @@
     </if>
     where 1=1
     <if test="type==0">
-      and a.aid= #{aid}
+      <if test="assist == 2">
+        and a.assist    =2
+      </if>
+      <if test="assist !=2 and assistType !=1">
+        and a.assist in(0,1)
+      </if>
+      <if test="assistType ==1">
+        and a.assist in(0,1,2)
+      </if>
+      <if test="aid !=null">
+        and a.aid= #{aid}
+      </if>
     </if>
     <if test="type==1">
+      and a.assist in(0,1)
       and c.reviewer = #{aid}
     </if>
     <if test="type==2">
+      and a.assist in(0,1)
       and d.manager_id = #{aid}
     </if>
+    <if test="type==3">
+      and a.assist=2
+      <if test="aid !=null">
+        and a.aid= #{aid}
+      </if>
+      and a.type = #{type}
+    </if>
 	<if test="clockTime !=null">
 	and a.release_start &lt; #{clockTime} and a.release_end &gt; #{clockTime}
 	</if>
@@ -493,7 +596,8 @@
     date_format(a.release_end ,'%Y-%m-%d %H:%i:%S') releaseEnds,date_format(a.create_time ,'%Y-%m-%d %H:%i:%S') createTimes,a.status,
     a.annex_url annexUrl ,a.remarks,a.duration ,a.valid_date validDate ,a.latitude ,a.longitude ,a.aid ,c.superior_id suprId,a.uid,
     a.clock_in clockIn ,a.plan ,a.expected_effect expectedEffect,a.next_plan nextPlan,c.reviewer,a.type,a.order_no orderNo,d.contract_no contractNo,
-    date_format(a.update_time ,'%Y-%m-%d %H:%i:%S') updateTimes,a.update_Status updateStatus
+    date_format(a.update_time ,'%Y-%m-%d %H:%i:%S') updateTimes,a.update_Status updateStatus,a.assist,a.assist_aid assistAid,a.assist_aid_name assistAidName,
+    a.main_name mainName
     from public_release a left join `user` b on a.uid =b.id left join admin c on a.aid =c.id
     left join t_order_new d on a.order_no=d.order_no
     where 1=1
@@ -553,7 +657,8 @@
     date_format(a.clock_in_time ,'%Y-%m-%d %H:%i:%S') clockInTimes,a.clock_in clockIn,a.remarks,a.supplement,a.type,
     date_format(a.create_time ,'%Y-%m-%d %H:%i:%S') createTimes,a.audit_info auditInfo,d.name sname,
     date_format(a.release_start,'%Y-%m-%d %H:%i:%S') releaseStarts,date_format(a.release_end ,'%Y-%m-%d %H:%i:%S') releaseEnds,
-    a.plan ,a.next_plan nextPlan ,a.expected_effect expectedEffect,a.update_status updateStatus
+    a.plan ,a.next_plan nextPlan ,a.expected_effect expectedEffect,a.update_status updateStatus,a.assist_aid_name assistAidName,
+    a.main_name mainName,a.assist
     from public_release a left join `user` b on a.uid=b.id left join admin c on a.aid =c.id
     left join admin d on b.aid=d.id where 1=1
     <if test="publicType != null">
@@ -580,6 +685,9 @@
 	<if test="releaseStart != null and releaseEnd != null">
 	and (a.release_start  between #{releaseStart} and #{releaseEnd} or a.release_end  between #{releaseStart} and #{releaseEnd})
 	</if>
+    <if test="createStart != null and createEnd != null">
+      and a.create_time  between #{createStart} and #{createEnd}
+    </if>
 	<if test="status != null">
 	and a.status = #{status}
 	</if>
@@ -621,6 +729,9 @@
     <if test="releaseStart != null and releaseEnd != null">
       and (a.release_start  between #{releaseStart} and #{releaseEnd} or a.release_end  between #{releaseStart} and #{releaseEnd})
     </if>
+    <if test="createStart != null and createEnd != null">
+      and a.create_time  between #{createStart} and #{createEnd}
+    </if>
     <if test="status != null">
       and a.status = #{status}
     </if>
@@ -651,4 +762,14 @@
                           left join admin c on a.aid =c.id
     where a.order_no = #{orderNo}
     </select>
+  <select id="selectByMainId" parameterType="java.lang.Integer" resultMap="BaseResultMap">
+    select
+    <include refid="Base_Column_List" />
+    from public_release
+    where main_id = #{mainId}
+  </select>
+  <update id="updateStatusByMainId">
+    update public_release set status= #{status}
+    where main_id= #{mainId}
+  </update>
 </mapper>

+ 21 - 1
src/main/java/com/goafanti/common/mapper/TOrderNewMapper.xml

@@ -742,7 +742,8 @@
 	o.buyer_id as buyerId, o.liquidation_status as liquidationStatus ,too.amount outsourceAmount, o.first_amount as signFirstPayment,
 	o.total_amount as signTotalAmount, date_format(o.create_time, '%Y-%m-%d %H:%i:%s') as createTime, too.company_name as outsourceName,
 	0 as companyId, d.name as departmentName, a.final_receivables finalReceivables ,a.invoice_amount invoiceAmount ,
-	date_format(a.`final_Receivables_time`, '%Y-%m-%d %H:%i:%s')finalReceivablesTime,a.order_receivables orderReceivables,a.order_arrears orderArrears
+    o.order_status orderStatus,a.project_type projectType,o.sales_type salesType,o.other ,o.delete_sign deleteSign,
+    date_format(a.`final_Receivables_time`, '%Y-%m-%d %H:%i:%s')finalReceivablesTime,a.order_receivables orderReceivables,a.order_arrears orderArrears
 	from t_order_new o left join department d on o.order_dep = d.id left join `user` u on o.buyer_id = u.id left join t_order_mid a on o.order_no=a.order_no
 	left join (select * from  t_order_outsource where type=0) too on o.order_no=too.order_no where delete_sign in(0,2) and approval in(0,1,2)
     and outsource=   #{o.outsource,jdbcType=INTEGER}
@@ -791,6 +792,12 @@
   		<if test="o.orderNo != null and o.orderNo != &quot;&quot;">
 	  	and o.order_no = #{o.orderNo,jdbcType=VARCHAR}
 	  	</if>
+        <if test="o.projectType != null and o.projectType != &quot;&quot;">
+          and a.project_type = #{o.projectType}
+        </if>
+        <if test="o.approval != null and o.approval != &quot;&quot;">
+          and o.approval = #{o.approval}
+        </if>
 	  	<if test="o.buyerName != null and o.buyerName != &quot;&quot;">
 	  	<bind name="n" value="'%' + o.buyerName + '%'" />
 	  	and u.nickname  like #{n,jdbcType=VARCHAR}
@@ -859,6 +866,12 @@ left join department d on o.order_dep = d.id   left join t_order_mid a on o.orde
   		<if test="o.orderNo != null and o.orderNo != &quot;&quot;">
 	  	and o.order_no = #{o.orderNo,jdbcType=VARCHAR}
 	  	</if>
+    <if test="o.projectType != null and o.projectType != &quot;&quot;">
+      and a.project_type = #{o.projectType}
+    </if>
+    <if test="o.approval != null and o.approval != &quot;&quot;">
+      and o.approval = #{o.approval}
+    </if>
 	  	<if test="o.buyerName != null and o.buyerName != &quot;&quot;">
 	  	<bind name="n" value="'%' + o.buyerName + '%'" />
 	  	and u.nickname  like #{n,jdbcType=VARCHAR}
@@ -1430,6 +1443,12 @@ left join department d on o.order_dep = d.id   left join t_order_mid a on o.orde
     <if test="o.orderNo != null and o.orderNo != &quot;&quot;">
       and o.order_no = #{o.orderNo,jdbcType=VARCHAR}
     </if>
+    <if test="o.projectType != null and o.projectType != &quot;&quot;">
+      and a.project_type = #{o.projectType}
+    </if>
+    <if test="o.approval != null and o.approval != &quot;&quot;">
+      and o.approval = #{o.approval}
+    </if>
     <if test="o.buyerName != null and o.buyerName != &quot;&quot;">
       <bind name="n" value="'%' + o.buyerName + '%'" />
       and u.nickname  like #{n,jdbcType=VARCHAR}
@@ -1638,6 +1657,7 @@ left join department d on o.order_dep = d.id   left join t_order_mid a on o.orde
   <select id="selectOrderByuid" resultType="java.util.Map">
     select order_no orderNo,contract_no contractNo
     from t_order_new  where delete_sign in (0,2) and  buyer_id = #{uid}
+    order by create_time desc
   </select>
   <select id="orderSalesSource" resultType="com.goafanti.order.bo.OutOrderSalesSource">
     select y.province,dg.name ,y.total_amount totalAmount,y.counts,y.dhxkf,y.dhxkf/y.counts dhxkfl,

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

@@ -1142,7 +1142,7 @@
     e.approval,l.refund_status outsourceStatus,l.start_type outsourceType,ttm.certificates_count  alreadyNumber,f.nickname as userName,h.name as depName, l.company_name as outsourceName ,
     ifnull(k.hours,0) hours,a.split_status splitStatus,a.split_super splitSuper, a.split_id splitId,b.`type` projectType,ttm.cost_amount costAmount,tm.salesman_name salesmanName ,
     ttm.party_amount  partyAmount,a.commodity_price commodityPrice,a.outsource,date_format(a.task_end_time,'%Y-%m-%d') taskEndTime,date_format(e.sign_time,'%Y-%m-%d') signTime,
-    date_format(e.create_time ,'%Y-%m-%d')creteTime
+    date_format(e.create_time ,'%Y-%m-%d')creteTime,a.patent_type  patentType
     from t_order_task a left join business_project b on a.commodity_id=b.id left join business_category c on b.cid=c.id
     left join t_order_new e on a.order_no=e.order_no left join user f on e.buyer_id=f.id left join t_order_mid tm on a.order_no =tm.order_no
     left join department h on e.order_dep=h.id  left join task_hours_count k on a.id=k.tid and a.task_receiver=k.aid left join t_order_outsource l
@@ -1502,7 +1502,7 @@
     select  a.id,a.commodity_name as taskName,a.order_no as orderNo,c.cname,d.name as receiverName,a.project_status as projectStatus,e.contract_no contractNo,a.task_receiver taskReceiver,
             a.task_status as taskStatus,date_format(a.task_distribution_time,'%Y-%m-%d') as taskDate, a.commodity_quantity as commodityQuantity,e.approval,l.refund_status outsourceStatus,
             ifnull(i.alreadyNumber,0) as alreadyNumber,f.nickname as userName,h.name as depName, j.name as outsourceName ,ifnull(k.hours,0) hours,a.split_status splitStatus,
-            a.split_super splitSuper,date_format(a.split_time,'%Y-%m-%d %H:%i:%S') splitTimes,ad.name splitAname,a.split_id splitId
+            a.split_super splitSuper,date_format(a.split_time,'%Y-%m-%d %H:%i:%S') splitTimes,ad.name splitAname,a.split_id splitId,a.patent_type  patentType
     from t_order_task a left join business_project b on a.commodity_id=b.id left join business_category c on b.cid=c.id
                         left join admin d on a.task_receiver=d.id left join t_order_new e on a.order_no=e.order_no left join user f on e.buyer_id=f.id
                         left join department h on e.order_dep=h.id left join (select task_id , sum(already_number) as alreadyNumber from task_progress

+ 22 - 4
src/main/java/com/goafanti/common/mapper/UserMapperExt.xml

@@ -346,7 +346,16 @@
 		left join admin d on a.aid = d.id
 		where a.type = 1 and a.status =0
 	<if test="role == 0">
-		and un.name = #{name}
+		and un.name
+		<if test="names == null">
+			is null
+		</if>
+		<if test="names !=null">
+		in <foreach close=")" collection="names" item="name" open="(" separator=",">
+			#{name}
+		</foreach>
+		</if>
+
 	</if>
 		<if test="role == 1 and name != null">
 		and un.name like concat('%', #{name},'%')
@@ -391,9 +400,18 @@
 		where department_id=#{departmentId,jdbcType=VARCHAR}) d on a.aid = d.id
 		</if>
 		where a.type = 1 and a.status =0
-		<if test="role == 0 and name !=null">
-		and un.name = #{name}
-	</if>
+		<if test="role == 0">
+			and un.name
+			<if test="names == null">
+				is null
+			</if>
+			<if test="names !=null">
+				in <foreach close=")" collection="names" item="name" open="(" separator=",">
+				#{name}
+			</foreach>
+			</if>
+
+		</if>
 	<if test="role == 1 and name != null">
 		and un.name like concat('%', #{name},'%')
 	</if>

+ 67 - 2
src/main/java/com/goafanti/common/model/PublicRelease.java

@@ -56,7 +56,7 @@ public class PublicRelease implements Serializable {
     private String latitude;
 
     /**
-     * 状态 0驳回 1发起 2同意 3打卡 4 撤销
+     * 状态 0驳回 1发起 2同意 3 撤销
      */
     private Integer status;
 
@@ -146,7 +146,7 @@ public class PublicRelease implements Serializable {
     private String nextPlan;
 
     /**
-     * 分类 0业务/行政 1技术
+     * 分类 0业务 1技术 2行政 3 协单
      */
     private Integer type;
 
@@ -165,6 +165,31 @@ public class PublicRelease implements Serializable {
      */
     private Integer updateStatus;
 
+    /**
+     * 0否 1主公出 2协助公出
+     */
+    private Integer assist;
+
+    /**
+     * 协单人员
+     */
+    private String assistAid;
+
+    /**
+     * 协单人员
+     */
+    private String assistAidName;
+
+    /**
+     * 主要公出编号
+     */
+    private Integer mainId;
+
+    /**
+     * 主要公出发起人
+     */
+    private String mainName;
+
     private static final long serialVersionUID = 1L;
 
     public Integer getId() {
@@ -422,4 +447,44 @@ public class PublicRelease implements Serializable {
     public void setUpdateStatus(Integer updateStatus) {
         this.updateStatus = updateStatus;
     }
+
+    public Integer getAssist() {
+        return assist;
+    }
+
+    public void setAssist(Integer assist) {
+        this.assist = assist;
+    }
+
+    public String getAssistAid() {
+        return assistAid;
+    }
+
+    public void setAssistAid(String assistAid) {
+        this.assistAid = assistAid;
+    }
+
+    public String getAssistAidName() {
+        return assistAidName;
+    }
+
+    public void setAssistAidName(String assistAidName) {
+        this.assistAidName = assistAidName;
+    }
+
+    public Integer getMainId() {
+        return mainId;
+    }
+
+    public void setMainId(Integer mainId) {
+        this.mainId = mainId;
+    }
+
+    public String getMainName() {
+        return mainName;
+    }
+
+    public void setMainName(String mainName) {
+        this.mainName = mainName;
+    }
 }

+ 26 - 1
src/main/java/com/goafanti/common/model/PublicReleaseLog.java

@@ -1,5 +1,8 @@
 package com.goafanti.common.model;
 
+import com.goafanti.common.enums.AdminFields;
+import org.springframework.beans.factory.annotation.Value;
+
 import java.io.Serializable;
 import java.util.Date;
 
@@ -185,4 +188,26 @@ public class PublicReleaseLog implements Serializable {
 		this.remarks=remarks;
 		this.createTime=date;
 	}
-}
+//状态 0驳回 1发起 2同意 3打卡 4 撤销 5修改
+	public enum states {
+		bh(0,"驳回"),
+		fq(1,"发起"),
+		ty(2,"同意"),
+		dk(3,"打卡"),
+		cx(4,"撤销"),
+		xg(5,"修改"),
+		sc(6,"删除");
+		Integer code;
+		String desc;
+
+	private states(Integer code, String desc) {
+		this.code = code;
+		this.desc = desc;
+	}
+
+	public Integer getCode() {
+		return this.code;
+	}
+
+}
+}

+ 2 - 1
src/main/java/com/goafanti/common/task/OrderDunTask.java

@@ -80,7 +80,8 @@ public class OrderDunTask {
 		Thread.sleep(2000);
 		updatePaymentNode();
 		Thread.sleep(2000);
-		pushLegalAffairs();
+//		暂时关闭服务移交
+//		pushLegalAffairs();
 	}
 
 	/**

+ 14 - 15
src/main/java/com/goafanti/common/utils/WeChatUtils.java

@@ -16,8 +16,8 @@ import com.goafanti.common.error.BusinessException;
 
 @Component
 public class WeChatUtils {
-	
-	
+
+
 	@Value(value = "${wx.appId}")
 	private String appId;
 	@Value(value = "${wx.appSecret}")
@@ -26,7 +26,7 @@ public class WeChatUtils {
 	private String wxState;
 	@Autowired
 	private RedisUtil redisUtil;
-	
+
 	//待审核通知
 	private static final String sptz="j7WH3EwQnxGxwuV2HwmJhryxySPE8vOiV5cVOpp-42I";
 	//审核结通知
@@ -34,14 +34,13 @@ public class WeChatUtils {
 	private static  String send_url="https://api.weixin.qq.com/cgi-bin/message/subscribe/send?access_token=ACCESS_TOKEN";
 
 
-	
+
 
 	/**
-	 * 
+	 *
 	 * @param openid
 	 * @param type 状态 0驳回 1发起 2同意
-	 * @param string 
-	 * @param date 
+	 * @param date
 	 */
 	public Integer addNotice(String openid ,Integer type,Integer id, Date date, String aname,String remarks) {
 		Map<String, Object> map=new HashMap<String, Object>();
@@ -66,7 +65,7 @@ public class WeChatUtils {
 		}else {
 			return 1;
 		}
-		
+
 	}
 	private Map<String, Object> getData(Integer type,Date date, String aname, String remarks) {
 		Map<String, Object> we=new HashMap<String, Object>();
@@ -97,13 +96,13 @@ public class WeChatUtils {
 			Map<String, Object> v3=new HashMap<String, Object>();
 			v3.put("value", remarks);
 			we.put("thing6", v3);
-		} 
+		}
 		return we;
 	}
-	
-	
 
-	
+
+
+
 	public String getAccessToken() {
 		Date date = new Date();
 		if (redisUtil.presence("access_token")||redisUtil.presence("expires_in")) {
@@ -118,14 +117,14 @@ public class WeChatUtils {
 				redisUtil.deleteString("expires_in");
 				return setSessionAccessToken(date);
 			}
-		
+
 		} else {
 			return setSessionAccessToken(date);
 		}
-		
+
 
 	}
-	
+
 
 
 	private String setSessionAccessToken(Date date) {

+ 17 - 4
src/main/java/com/goafanti/customer/service/impl/CustomerServiceImpl.java

@@ -210,13 +210,17 @@ public class CustomerServiceImpl extends BaseMybatisDao<UserMapper> implements C
 		Map<String, Object> params = disposeParams(cli);
 		if (TokenManager.hasRole(AFTConstants.SUPERADMIN)||TokenManager.hasRole(AFTConstants.APPROVAL_DECISION)) {
 			params.put("role", 1);
+			params.put("name", cli.getName());
 		} else {
-			params.put("role", 0);
 			//处理为空报错
-			if (StringUtils.isBlank(cli.getName())) params.put("name", "");
-
+			params.put("role", 0);
+			String [] names =pushNames(cli.getName());
+			if (names.length>1){
+				params.put("names", names);
+			}else {
+				return new Pagination<>();
+			}
 		}
-
 		Pagination<CustomerListOut> p = (Pagination<CustomerListOut>) findPage("selectOrganizationCustomerList",
 				"selectOrganizationCustomerCount", params, pageNo, pageSize);
 		List<CustomerListOut> l = (List<CustomerListOut>) p.getList();
@@ -233,6 +237,15 @@ public class CustomerServiceImpl extends BaseMybatisDao<UserMapper> implements C
 		return p;
 	}
 
+	private String[] pushNames(String name) {
+		if (name==null)name="";
+		String newstr1=name.replaceAll(" ",","); //先把所有空格替换成 逗号。
+		String newstr2=newstr1.replaceAll("\t",",");  //再把所有的制表符替换成逗号。
+		String newstr3=newstr2.replaceAll(",+", ","); //把所有重复的逗号合并成一个逗号。
+		String[] strings=newstr3.split(",");     //按逗号分解该字符串。
+		return strings;
+	}
+
 	@Override
 	public Pagination<CustomerListOut> listAllManageOrganizationCustomer(CustomerListIn cli, Integer pageNo,
 			Integer pageSize) {

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

@@ -52,8 +52,8 @@ public class OrderListBo {
 	private Integer approval;
 	/** 订单类型 **/
 	private Integer orderType;
-	/** 业务品类 **/
-	private String projectType;
+	@Excel(name="会员" ,readConverterExp = "0=否,1=是")
+	private Integer projectType;
 
 	/** 合同首付金额 **/
 	private BigDecimal signFirstPayment;
@@ -76,7 +76,7 @@ public class OrderListBo {
 	private Integer orderStage;
 	/** 项目阶段 **/
 	private Integer projectStage;
-	/** 删除、锁定 状态 **/
+	@Excel(name="状态" ,readConverterExp = "0=正常,1=作废,2=变更")
 	private Integer deleteSign;
 	/** 卖方 **/
 	private String buyerId;
@@ -116,8 +116,26 @@ public class OrderListBo {
 	/** 驳回位置*/
 	private Integer backStatus;
 
+	@Excel(name="销售类型" ,readConverterExp = "0=电话新开发,1=电话自带资源,2=网络,3=渠道,4=转介绍,5=其他,6=高新复购,7=其他复购")
+	private Integer salesType;
+	@Excel(name="销售说明")
+	private String other;
 
+	public Integer getSalesType() {
+		return salesType;
+	}
+
+	public void setSalesType(Integer salesType) {
+		this.salesType = salesType;
+	}
 
+	public String getOther() {
+		return other;
+	}
+
+	public void setOther(String other) {
+		this.other = other;
+	}
 
 	public BigDecimal getFinalReceivables() {
 		return finalReceivables;
@@ -149,10 +167,10 @@ public class OrderListBo {
 	public void setOrderType(Integer orderType) {
 		this.orderType = orderType;
 	}
-	public String getProjectType() {
+	public Integer getProjectType() {
 		return projectType;
 	}
-	public void setProjectType(String projectType) {
+	public void setProjectType(Integer projectType) {
 		this.projectType = projectType;
 	}
 	public String getCreateTime() {

+ 21 - 3
src/main/java/com/goafanti/order/bo/TOrderTaskListBo.java

@@ -4,10 +4,12 @@ import java.math.BigDecimal;
 import java.util.List;
 
 
+import com.goafanti.common.enums.OfficialPatentType;
 import com.goafanti.common.utils.excel.Excel;
 import com.goafanti.common.utils.excel.Excel.ColumnType;
 import com.goafanti.common.utils.excel.ExcelConstant;
 import com.goafanti.core.shiro.token.TokenManager;
+import com.goafanti.patent.enums.PatentType;
 
 public class TOrderTaskListBo {
 	@Excel(name = "项目编号")
@@ -68,6 +70,22 @@ public class TOrderTaskListBo {
 	private BigDecimal costAmount;
 	@Excel(name = "已付(万元)",scale = 6)
 	private BigDecimal partyAmount;
+	@Excel(name = "专利分类",readConverterExp = "0=申请,1=变更,2=复审,3=优先权,4=恢复请求权,5=无效宣告请求费,6=强制许可请求费,7=强制许可使用裁决请求费,8=登录、印刷费、印花税")
+	private Integer patentType;
+
+	public Integer getPatentType() {
+		return patentType;
+	}
+
+	public String getPatentTypeName() {
+		if (patentType!=null) return OfficialPatentType.getValueByCode(this.patentType);
+		return "";
+	}
+
+	public void setPatentType(Integer patentType) {
+		this.patentType = patentType;
+	}
+
 	public String getSplitSuper() {
 		return splitSuper;
 	}
@@ -189,7 +207,7 @@ public class TOrderTaskListBo {
 	public void setOutsourceName(String outsourceName) {
 		this.outsourceName = outsourceName;
 	}
-	
+
 	public String getTaskEndTime() {
 		return taskEndTime;
 	}
@@ -280,6 +298,6 @@ public class TOrderTaskListBo {
 	public void setOutsourceType(Integer outsourceType) {
 		this.outsourceType = outsourceType;
 	}
-	
-	
+
+
 }

+ 17 - 62
src/main/java/com/goafanti/organization/controller/AdminOrganizationController.java

@@ -28,7 +28,7 @@ public class AdminOrganizationController extends BaseApiController{
 			Integer pageSize){
 		Result res = new Result();
 		res.setData(organizationService.listOrganizationManagement(olo, pageNo, pageSize));
-		return res;		
+		return res;
 	}
 	/**部门组织管理上级组织查询 **/
 	@RequestMapping(value = "/selectSuperId" , method = RequestMethod.GET)
@@ -41,7 +41,7 @@ public class AdminOrganizationController extends BaseApiController{
 	@RequestMapping(value = "/selectSuperIdS" , method = RequestMethod.GET)
 	public Result selectsuperIdS(){
 		Result res = new Result();
-		
+
 		res.setData(organizationService.selectSuperId(1));
 		return res;
 	}
@@ -57,38 +57,16 @@ public class AdminOrganizationController extends BaseApiController{
 		if(olo!=null){
 			res.getError().add(buildError("","部门已存在"));
 			return res;
-		}		
+		}
 		String sdepNo=organizationManagementMapper.selectDepNo(superId);
-		int Count=organizationManagementMapper.selectDepNoCount(superId);
-		if((Count+1)>99){
+		int count=organizationManagementMapper.selectDepNoCount(superId);
+		if((count+1)>99){
 			res.getError().add(buildError("","每层最多存在99个子类"));
 			return res;
 		}
-		if(Count<10){
-			String dep=sdepNo+"0"+Count;
-			String sid=organizationManagementMapper.selectIdByDepNo(dep);
-			while(sid!=null){
-				Count=(Count+1)%100;				
-				if(Count>=10){
-					dep=sdepNo+Count;	
-				}else{
-					dep=sdepNo+"0"+Count;
-				}
-				sid=organizationManagementMapper.selectIdByDepNo(dep);				
-			}
-			organizationService.addOrganization(name, managerId, type, superId, remarks,dep,workingHoursType);
-		}
-		if(Count>=10){
-			String dep=sdepNo+Count;
-			String sid=organizationManagementMapper.selectIdByDepNo(dep);
-			while(sid!=null){
-				Count=(Count+1)%100;				
-				dep=sdepNo+Count;
-				sid=organizationManagementMapper.selectIdByDepNo(dep);				
-			}
-			organizationService.addOrganization(name, managerId, type, superId, remarks,dep,workingHoursType);
-		}
-		
+
+			organizationService.addOrganization(name, managerId, type, superId, remarks,sdepNo,count,workingHoursType);
+
 		return res;
 	}
 	/**负责人自动补全查询**/
@@ -115,43 +93,20 @@ public class AdminOrganizationController extends BaseApiController{
 				|| StringUtils.isBlank(status)|| StringUtils.isBlank(remarks)){
 			res.getError().add(buildError(ErrorConstants.PARAM_ERROR,""));
 			return res;
-		}		
+		}
 		String sdepNo=organizationManagementMapper.selectDepNo(superId);//No
-		int Count=organizationManagementMapper.selectDepNoCount(superId);//14
-		if((Count+1)>99){
+		int count=organizationManagementMapper.selectDepNoCount(superId);//14
+		if((count+1)>99){
 			res.getError().add(buildError("","每层最多存在99个子类"));
 			return res;
 		}
-		int i=0;
-		if(Count<10){
-			String dep=sdepNo+"0"+Count;
-			String sid=organizationManagementMapper.selectIdByDepNo(dep);
-			while(sid!=null){
-				Count=(Count+1)%100;				
-				if(Count>=10){
-					dep=sdepNo+Count;	
-				}else{
-					dep=sdepNo+"0"+Count;
-				}
-				sid=organizationManagementMapper.selectIdByDepNo(dep);				
-			}
-			i=organizationService.updateOrganization(name, type, managerId, superId, status, province,remarks,id,dep,abbreviation,financeId,workingHoursType);
-		}
-		if(Count>=10){
-			String dep=sdepNo+Count;
-			String sid=organizationManagementMapper.selectIdByDepNo(dep);
-			while(sid!=null){
-				Count=(Count+1)%100;				
-				dep=sdepNo+Count;
-				sid=organizationManagementMapper.selectIdByDepNo(dep);				
-			}
-			i=organizationService.updateOrganization(name, type, managerId, superId, status, province,remarks,id,dep,abbreviation,financeId,workingHoursType);
-		}
-		
+
+		int i=organizationService.updateOrganization(name, type, managerId, superId, status, province,remarks,id,
+				sdepNo,count,abbreviation,financeId,workingHoursType);
 		return res.data(i);
 	}
-	
-	
+
+
 	/**删除列表信息**/
 	@RequestMapping(value = "/deleteById" , method = RequestMethod.POST)
 	public Result deleteById(String id){
@@ -175,5 +130,5 @@ public class AdminOrganizationController extends BaseApiController{
 		organizationService.deleteById(id);
 		return res;
 	}
-	
+
 }

+ 8 - 8
src/main/java/com/goafanti/organization/service/OrganizationService.java

@@ -14,12 +14,12 @@ public interface OrganizationService {
 	 * @param pageSize
 	 * @return
 	 */
-	Pagination<OrganizationListOut> 
+	Pagination<OrganizationListOut>
 	listOrganizationManagement(OrganizationListOut olo,Integer pageNo, Integer pageSize);
 	/**组织名称查上级组织*/
 	List<OrganizationListOut> selectSuperId(Integer i);
 	/**
-	 * 
+	 *
 	 * @param name 组织名称
 	 * @param managerId 负责人ID
 	 * @param type 组织类型
@@ -27,19 +27,19 @@ public interface OrganizationService {
 	 * @param desc 组织职能说明
 	 * @return
 	 */
-	int addOrganization(String name,String managerId,String type,String superId,String desc,String dep,Integer workingHoursType);
+	int addOrganization(String name,String managerId,String type,String superId,String desc,String sdepNo,Integer count,Integer workingHoursType);
 	/**
 	 * 模糊查询负责人名称
 	 * @param name
 	 * @return
 	 */
 	List<AdminListBo> selectName(String name);
-	
+
 	OrganizationListOut selectAllById(String id);
-	
+
 	int deleteById(String id);
-	
+
 	int updateOrganization(String name,String type,String managerId,String superId,String status,Integer province,
-			String remarks,String id,String depn,String abbreviation,String financeId,Integer workingHoursType);
-	
+			String remarks,String id,String sdepNo,Integer count,String abbreviation,String financeId,Integer workingHoursType);
+
 }

+ 58 - 73
src/main/java/com/goafanti/organization/service/impl/OrganizationServiceImpl.java

@@ -26,7 +26,7 @@ public class OrganizationServiceImpl extends BaseMybatisDao<OrganizationManageme
 	private OrganizationManagementMapper organizationManagementMapper;
 	@Autowired
 	private TOrderMidMapper	tOrderMidMapper;
-	
+
 	@Override
 	public Pagination<OrganizationListOut> listOrganizationManagement(OrganizationListOut olo, Integer pageNo,
 			Integer pageSize) {
@@ -37,7 +37,7 @@ public class OrganizationServiceImpl extends BaseMybatisDao<OrganizationManageme
 		return p;
 	}
 	private Map<String,Object> disposeParams(OrganizationListOut olo){
-		Map<String,Object> params = new HashMap<String, Object>();		
+		Map<String,Object> params = new HashMap<String, Object>();
 		if(StringUtils.isNotBlank(olo.getId())) params.put("id", olo.getId());
 		if(StringUtils.isNotBlank(olo.getCreateId())) params.put("createId", olo.getCreateId());
 		if(StringUtils.isNotBlank(olo.getCreateTime())) params.put("createTime", olo.getCreateTime());
@@ -64,10 +64,11 @@ public class OrganizationServiceImpl extends BaseMybatisDao<OrganizationManageme
 	 *
 	 */
 	@Override
-	public int addOrganization( String name, String managerId, String type, String superId, String remarks,String dep,Integer workingHoursType) {
+	public int addOrganization( String name, String managerId, String type, String superId, String remarks,String sdepNo,Integer count,Integer workingHoursType) {
+
 		String id = UUID.randomUUID().toString();
 		Date now = new Date();
-		OrganizationManagement om=new OrganizationManagement(); 
+		OrganizationManagement om=new OrganizationManagement();
 		om.setId(id);
 		String createId =organizationManagementMapper.selectAdminNameById(TokenManager.getAdminId());
 		om.setCreateId(createId);
@@ -77,7 +78,7 @@ public class OrganizationServiceImpl extends BaseMybatisDao<OrganizationManageme
 		om.setName(name);
 		om.setType(type);
 		om.setManagerId(managerId);
-		om.setDepNo(dep);
+		om.setDepNo(countDepNo(sdepNo,count));
 	//	superId=organizationManagementMapper.selectIdByName(superId);
 		om.setSuperId(superId);
 		om.setRemarks(remarks);
@@ -104,17 +105,20 @@ public class OrganizationServiceImpl extends BaseMybatisDao<OrganizationManageme
 	}
 	@Override
 	public int updateOrganization(String name, String type, String managerId, String superId, String status,Integer province,
-			String remarks,String id,String depn,String abbreviation,String financeId,Integer workingHoursType) {
+			String remarks,String id,String sdepNo,Integer count,String abbreviation,String financeId,Integer workingHoursType) {
+
+		String dep = countDepNo(sdepNo,count);
+
 		Date now=new Date();
 		OrganizationManagement om=new OrganizationManagement();
 		om.setName(name);
-		om.setType(type);  
+		om.setType(type);
 		om.setUpdateTime(now);
 		om.setManagerId(managerId);
-		om.setDepNo(depn);
+		om.setDepNo(dep);
 		om.setSuperId(superId);
 		om.setStatus(status);
-		om.setRemarks(remarks); 
+		om.setRemarks(remarks);
 		om.setId(id);
 		om.setAbbreviation(abbreviation);
 		om.setFinanceId(financeId);
@@ -122,76 +126,57 @@ public class OrganizationServiceImpl extends BaseMybatisDao<OrganizationManageme
 		om.setWorkingHoursType(workingHoursType);
 		tOrderMidMapper.updateFinanceId(id,financeId);
 		int x=organizationManagementMapper.updateByPrimaryKeySelective(om);
-		//*******下级编号修改
-		int n=0;
-		List<OrganizationListOut> Nos =organizationManagementMapper.selectIDNBySuperId(om.getId());
-		for(OrganizationListOut i:Nos){			
-			String sdepNo=organizationManagementMapper.selectDepNoById(i.getSuperId());
-			if(n<10){
-				String dep=sdepNo+"0"+n;			
-				if(n>=10){
-					dep=sdepNo+n;	
+		updateLowerLevelNo(om.getId(),om.getDepNo());
+		return x;
+	}
+
+	private String countDepNo(String sdepNo, Integer count) {
+		String dep=null;
+		if(count<10){
+			dep=sdepNo+"0"+count;
+			String sid=organizationManagementMapper.selectIdByDepNo(dep);
+			while(sid!=null){
+				count=(count+1)%100;
+				if(count>=10){
+					dep=sdepNo+count;
 				}else{
-					dep=sdepNo+"0"+n;
-				}	
-				i.setDepNo(dep);
+					dep=sdepNo+"0"+count;
+				}
+				sid=organizationManagementMapper.selectIdByDepNo(dep);
 			}
-			if(n>=10){
-				String dep=sdepNo+n;			
-				dep=sdepNo+n;	
-				i.setDepNo(dep);
+		}else if(count>=10){
+			dep=sdepNo+count;
+			String sid=organizationManagementMapper.selectIdByDepNo(dep);
+			while(sid!=null){
+				count=(count+1)%100;
+				dep=sdepNo+count;
+				sid=organizationManagementMapper.selectIdByDepNo(dep);
 			}
-		organizationManagementMapper.updateByNumber(i);
-			n++;
-			
-			//*******下下级编号修改
-			int m=0;
-			List<OrganizationListOut> Noss =organizationManagementMapper.selectIDNBySuperId(i.getId());
-			//System.out.println("noss="+Noss);
-			for(OrganizationListOut o:Noss){			
-				sdepNo=organizationManagementMapper.selectDepNoById(o.getSuperId());
-				if(m<10){
-					String dep=sdepNo+"0"+m;			
-					if(m>=10){
-						dep=sdepNo+m;	
-					}else{
-						dep=sdepNo+"0"+m;
-					}	
-					o.setDepNo(dep);
-				}
-				if(m>=10){
-					String dep=sdepNo+m;			
-					dep=sdepNo+m;	
-					o.setDepNo(dep);
-				}
-				organizationManagementMapper.updateByNumber(o);
-				m++;
-				
-				//*******下下级编号修改
-				int z=0;
-				List<OrganizationListOut> Nosss =organizationManagementMapper.selectIDNBySuperId(o.getId());
-				for(OrganizationListOut p:Nosss){			
-					sdepNo=organizationManagementMapper.selectDepNoById(p.getSuperId());
-					if(z<10){
-						String dep=sdepNo+"0"+z;			
-						if(z>=10){
-							dep=sdepNo+z;	
-						}else{
-							dep=sdepNo+"0"+z;
-						}	
-						p.setDepNo(dep);
-					}
-					if(z>=10){
-						String dep=sdepNo+z;			
-						dep=sdepNo+z;	
-						p.setDepNo(dep);
-					}
-					organizationManagementMapper.updateByNumber(p);
-					z++;
+		}
+		return dep;
+	}
+
+	private void updateLowerLevelNo(String id,String depNo) {
+		List<OrganizationListOut> Nos =organizationManagementMapper.selectIDNBySuperId(id);
+		int i=1;
+		for (OrganizationListOut o : Nos) {
+			if(i<10){
+				String dep=depNo+"0"+i;
+				if(i>=10){
+					dep=depNo+i;
+				}else{
+					dep=depNo+"0"+i;
 				}
+				o.setDepNo(dep);
+			} else if(i>=10){
+				String dep=depNo+i;
+				dep=depNo+i;
+				o.setDepNo(dep);
 			}
+			organizationManagementMapper.updateByNumber(o);
+			updateLowerLevelNo(o.getId(),o.getDepNo());
+			i++;
 		}
-		return x;
 	}
 
 }

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

@@ -413,9 +413,12 @@ public class ThirdPartyCompanyServiceImpl extends  BaseMybatisDao<ThirdPartyComp
 			auditStr="审核驳回:";
 		}else if (p.getStatus()==3) {
 			type=NoticeStatus.PAYMENT_COMPLETE.getCode();
-			tp.setPaymentAmount(p.getPaymentAmount()!=null?p.getPaymentAmount():p.getApplicationAmount());
-
-			confirmPayment(p);
+			if (p.getPaymentAmount()==null||p.getPaymentAmount().compareTo(new BigDecimal(0))==0) {
+				tp.setPaymentAmount(p.getApplicationAmount());
+			}else {
+				tp.setPaymentAmount(p.getPaymentAmount());
+			}
+			confirmPayment(tp);
 			auditStr="审核完成";
 		}else if(p.getStatus()==4) {
 			auditStr="付款取消";
@@ -434,9 +437,6 @@ public class ThirdPartyCompanyServiceImpl extends  BaseMybatisDao<ThirdPartyComp
 			int flag=0;
 			TOrderPayment tp=tOrderPaymentMapper.selectByPrimaryKey(p.getId());
 			ThirdPartyCompany tpc=new ThirdPartyCompany();
-			if (p.getPaymentAmount()==null||p.getPaymentAmount().compareTo(new BigDecimal(0))==0) {
-				p.setPaymentAmount(tp.getApplicationAmount());
-			}
 			if(tp.getChooseType()==0){
 				tpc=thirdPartyCompanyMapper.selectByPrimaryKey(tp.getTpcId());
 			}else if (tp.getChooseType()==1) {
@@ -460,7 +460,6 @@ public class ThirdPartyCompanyServiceImpl extends  BaseMybatisDao<ThirdPartyComp
 				tpc.setPartyAmount(tpc.getPartyAmount().add(p.getPaymentAmount()));
 				thirdPartyCompanyMapper.updateByPrimaryKeySelective(tpc);
 			}
-			p.setPaymentAmount(tp.getApplicationAmount());
 			financialPaymentMapper.updateOrderCost(p.getId(),p.getPaymentAmount());
 	}
 

+ 19 - 1
src/main/java/com/goafanti/weChat/bo/InputPublicDtails.java

@@ -4,6 +4,8 @@ public class InputPublicDtails {
 
 	private String releaseStart;
 	private String releaseEnd;
+	private String createStart;
+	private String createEnd;
 	private String aid;
 	private String uid;
 	private Integer status;
@@ -15,12 +17,28 @@ public class InputPublicDtails {
 	private String sid;
 	private String depId;
 	/**
-	 * 0业务 1技术 2行政
+	 * 0业务 1技术 2行政 3协单
 	 */
 	private Integer publicType;
 	private Integer pageSize;
 	private Integer pageNo;
 
+	public String getCreateStart() {
+		return createStart;
+	}
+
+	public void setCreateStart(String createStart) {
+		this.createStart = createStart;
+	}
+
+	public String getCreateEnd() {
+		return createEnd;
+	}
+
+	public void setCreateEnd(String createEnd) {
+		this.createEnd = createEnd;
+	}
+
 	public Integer getPublicType() {
 		return publicType;
 	}

+ 18 - 6
src/main/java/com/goafanti/weChat/bo/InputPublicReleaseList.java

@@ -1,20 +1,32 @@
 package com.goafanti.weChat.bo;
 
 public class InputPublicReleaseList {
-	
+
 	private Integer pageSize;
 	private Integer pageNo;
+//	查看类型 0我的公出 1公出审核 2管理员 3协单(技术财税总监看全部)
 	private Integer type;
 	private String clockTime;
+	/**
+	 *  assist 字段意思0非协单 1主协单 2子协单
+	 *  此处 0是 非+主  1是所有 2是子协单
+	 */
+	private Integer assist;
 //	公出时间搜索,按公出名称搜索,按审核状态搜索(审核中、已撤销、已审核),按打卡状态搜索(已打卡、未打卡)
 	private String releaseStarts;
 	private String releaseEnds;
 	private String userName;
 	private String status;
 	private String clockIn;
-	
-	
-	
+
+	public Integer getAssist() {
+		return assist;
+	}
+
+	public void setAssist(Integer assist) {
+		this.assist = assist;
+	}
+
 	public String getUserName() {
 		return userName;
 	}
@@ -51,7 +63,7 @@ public class InputPublicReleaseList {
 	public void setType(Integer type) {
 		this.type = type;
 	}
-	
+
 	public String getClockTime() {
 		return clockTime;
 	}
@@ -70,6 +82,6 @@ public class InputPublicReleaseList {
 	public void setReleaseEnds(String releaseEnds) {
 		this.releaseEnds = releaseEnds;
 	}
-	
+
 
 }

+ 32 - 2
src/main/java/com/goafanti/weChat/bo/OutPublicDtails.java

@@ -2,7 +2,7 @@ package com.goafanti.weChat.bo;
 
 import com.goafanti.common.utils.excel.Excel;
 
-public class OutPublicDtails {
+public class OutPublicDtails  {
 
 	private Integer id;
 	@Excel(name = "客户名称")
@@ -12,7 +12,11 @@ public class OutPublicDtails {
 	@Excel(name = "跟单人")
 	private String sname;
 	@Excel(name = "公出申请人")
+	private String mainName;
+	@Excel(name = "公出打卡人")
 	private String aname;
+	@Excel(name = "协单人")
+	private String assistAidName;
 	@Excel(name = "公出时长",width = 8)
 	private String duration;
 	@Excel(name = "状态" ,readConverterExp = "0=驳回,1=待审核,2=同意,3=撤销",width = 8)
@@ -27,7 +31,7 @@ public class OutPublicDtails {
 	private String clockInTimes;
 	@Excel(name = "创建时间" )
 	private String createTimes;
-	@Excel(name = "公出类型",readConverterExp = "0=业务,1=技术,2=行政",width = 8)
+	@Excel(name = "公出类型",readConverterExp = "0=业务公出,1=技术公出,2=行政公出,3=技术协单",width = 8)
 	private Integer type;
 	@Excel(name = "公出目标" )
 	private String remarks;
@@ -46,6 +50,32 @@ public class OutPublicDtails {
 	@Excel(name = "修改标识",readConverterExp = "0=否,1=是",width = 8)
 	private Integer updateStatus;
 
+	private Integer assist;
+
+	public Integer getAssist() {
+		return assist;
+	}
+
+	public void setAssist(Integer assist) {
+		this.assist = assist;
+	}
+
+	public String getMainName() {
+		return mainName;
+	}
+
+	public void setMainName(String mainName) {
+		this.mainName = mainName;
+	}
+
+	public String getAssistAidName() {
+		return assistAidName;
+	}
+
+	public void setAssistAidName(String assistAidName) {
+		this.assistAidName = assistAidName;
+	}
+
 	public Integer getUpdateStatus() {
 		return updateStatus;
 	}

+ 129 - 0
src/main/java/com/goafanti/weChat/bo/OutPublicDtailsFinance.java

@@ -0,0 +1,129 @@
+package com.goafanti.weChat.bo;
+
+import com.goafanti.common.utils.excel.Excel;
+
+/**
+ * 财务导出公出列表
+ */
+public class OutPublicDtailsFinance {
+
+	private Integer id;
+	@Excel(name = "公出类型",readConverterExp = "0=业务公出,1=技术公出,2=行政公出,3=技术协单",width = 8)
+	private Integer type;
+	@Excel(name = "客户名称")
+	private String nickname;
+	@Excel(name = "公出地点")
+	private String userName;
+	@Excel(name = "跟单人")
+	private String sname;
+	@Excel(name = "公出人")
+	private String aname;
+	@Excel(name = "公出开始时间")
+	private String releaseStarts;
+	@Excel(name = "公出结束时间")
+	private String releaseEnds;
+	@Excel(name = "公出时长",width = 8)
+	private String duration;
+	@Excel(name = "打卡状态",readConverterExp = "0=未打卡,1=已打卡",width = 8)
+	private Integer clockIn;
+	@Excel(name = "审核状态" ,readConverterExp = "0=驳回,1=待审核,2=同意,3=撤销",width = 8)
+	private Integer status;
+	@Excel(name = "审核信息" )
+	private String auditInfo;
+
+	public Integer getId() {
+		return id;
+	}
+
+	public void setId(Integer id) {
+		this.id = id;
+	}
+
+	public Integer getType() {
+		return type;
+	}
+
+	public void setType(Integer type) {
+		this.type = type;
+	}
+
+	public String getNickname() {
+		return nickname;
+	}
+
+	public void setNickname(String nickname) {
+		this.nickname = nickname;
+	}
+
+	public String getUserName() {
+		return userName;
+	}
+
+	public void setUserName(String userName) {
+		this.userName = userName;
+	}
+
+	public String getSname() {
+		return sname;
+	}
+
+	public void setSname(String sname) {
+		this.sname = sname;
+	}
+
+	public String getAname() {
+		return aname;
+	}
+
+	public void setAname(String aname) {
+		this.aname = aname;
+	}
+
+	public String getReleaseStarts() {
+		return releaseStarts;
+	}
+
+	public void setReleaseStarts(String releaseStarts) {
+		this.releaseStarts = releaseStarts;
+	}
+
+	public String getReleaseEnds() {
+		return releaseEnds;
+	}
+
+	public void setReleaseEnds(String releaseEnds) {
+		this.releaseEnds = releaseEnds;
+	}
+
+	public String getDuration() {
+		return duration;
+	}
+
+	public void setDuration(String duration) {
+		this.duration = duration;
+	}
+
+	public Integer getClockIn() {
+		return clockIn;
+	}
+
+	public void setClockIn(Integer clockIn) {
+		this.clockIn = clockIn;
+	}
+
+	public Integer getStatus() {
+		return status;
+	}
+
+	public void setStatus(Integer status) {
+		this.status = status;
+	}
+
+	public String getAuditInfo() {
+		return auditInfo;
+	}
+
+	public void setAuditInfo(String auditInfo) {
+		this.auditInfo = auditInfo;
+	}
+}

+ 13 - 0
src/main/java/com/goafanti/weChat/bo/OutPublicRelease.java

@@ -29,6 +29,19 @@ public class OutPublicRelease extends PublicRelease {
 
 	private String updateTimes;
 
+	/**
+	 * 协单人员
+	 */
+	private String assistAidName;
+
+	public String getAssistAidName() {
+		return assistAidName;
+	}
+
+	public void setAssistAidName(String assistAidName) {
+		this.assistAidName = assistAidName;
+	}
+
 	public String getUpdateTimes() {
 		return updateTimes;
 	}

+ 54 - 0
src/main/java/com/goafanti/weChat/bo/OutPublicReleaseList.java

@@ -5,6 +5,7 @@ public class OutPublicReleaseList {
 	private String id;
 	private String nickname;
 	private String userName;
+	private String aid;
 	private String aname;
 	private String releaseStarts;
 	private String releaseEnds;
@@ -12,9 +13,62 @@ public class OutPublicReleaseList {
 	private String latitude;
 	private String longitude;
 	private Integer status;
+	private Integer type;
 	private Integer clockIn;
 	private String updateTimes;
 	private Integer updateStatus;
+	private Integer assist;
+	private String 	assistAid;
+	private String 	assistAidName;
+	private String	mainName;
+
+	public String getMainName() {
+		return mainName;
+	}
+
+	public void setMainName(String mainName) {
+		this.mainName = mainName;
+	}
+
+	public String getAid() {
+		return aid;
+	}
+
+	public void setAid(String aid) {
+		this.aid = aid;
+	}
+
+	public Integer getType() {
+		return type;
+	}
+
+	public void setType(Integer type) {
+		this.type = type;
+	}
+
+	public Integer getAssist() {
+		return assist;
+	}
+
+	public void setAssist(Integer assist) {
+		this.assist = assist;
+	}
+
+	public String getAssistAid() {
+		return assistAid;
+	}
+
+	public void setAssistAid(String assistAid) {
+		this.assistAid = assistAid;
+	}
+
+	public String getAssistAidName() {
+		return assistAidName;
+	}
+
+	public void setAssistAidName(String assistAidName) {
+		this.assistAidName = assistAidName;
+	}
 
 	public String getUpdateTimes() {
 		return updateTimes;

+ 44 - 11
src/main/java/com/goafanti/weChat/controller/AdminReleaseApiController.java

@@ -1,12 +1,17 @@
 package com.goafanti.weChat.controller;
 
 
+import java.lang.reflect.InvocationTargetException;
+import java.util.ArrayList;
 import java.util.List;
 
 import javax.annotation.Resource;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 
+import com.goafanti.common.error.BusinessException;
+import com.goafanti.weChat.bo.*;
+import org.apache.commons.beanutils.BeanUtils;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RequestMethod;
@@ -17,12 +22,6 @@ import com.goafanti.common.constant.ErrorConstants;
 import com.goafanti.common.controller.CertifyApiController;
 import com.goafanti.common.utils.StringUtils;
 import com.goafanti.common.utils.excel.NewExcelUtil;
-import com.goafanti.weChat.bo.InputPublicDtails;
-import com.goafanti.weChat.bo.InputPublicRelease;
-import com.goafanti.weChat.bo.InputPublicReleaseList;
-import com.goafanti.weChat.bo.InputPublicStatistics;
-import com.goafanti.weChat.bo.OutPublicDtails;
-import com.goafanti.weChat.bo.OutPublicStatistics;
 import com.goafanti.weChat.service.PublicReleaseService;
 
 @RestController
@@ -33,7 +32,7 @@ public class AdminReleaseApiController extends CertifyApiController{
 	private PublicReleaseService publicReleaseService;
 
 	@Value(value = "${upload.path}")
-	private String					uploadPath			= null;
+	private String		uploadPath			= null;
 
 
 
@@ -59,6 +58,10 @@ public class AdminReleaseApiController extends CertifyApiController{
 			res.getError().add(buildError("公出时段已经被使用!","公出时段已经被使用!"));
 			return res;
 		}
+		if (in.getAssist()==1&&in.getAssistAid()==null) {
+			res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR,"协单人员"));
+			return res;
+		}
 
 		res.setData(publicReleaseService.addPublicRelease(in));
 		return res;
@@ -198,10 +201,30 @@ public class AdminReleaseApiController extends CertifyApiController{
 	 * @return
 	 */
 	@RequestMapping(value = "/publicReleaseDtails/export", method = RequestMethod.GET)
-	public Result publicReleaseListDtailsExport(InputPublicDtails in ){
-		List<OutPublicDtails> list=publicReleaseService.publicReleaseListDtailsList(in);
-		NewExcelUtil<OutPublicDtails>excel=new NewExcelUtil<>(OutPublicDtails.class);
- 		 return  excel.exportExcel(list,"公出详细列表",uploadPath);
+	public Result publicReleaseListDtailsExport(InputPublicDtails in ,Integer exportType){
+		if (exportType==null)exportType=0;
+		List<OutPublicDtails> outList=publicReleaseService.publicReleaseListDtailsList(in);
+		if (exportType==0){
+			List<OutPublicDtails> list=outList;
+			NewExcelUtil<OutPublicDtails>excel=new NewExcelUtil<>(OutPublicDtails.class);
+			return  excel.exportExcel(list,"公出详细列表",uploadPath);
+		}else if (exportType==1){
+			List<OutPublicDtailsFinance> list = new ArrayList<>();
+			for (OutPublicDtails outPublicDtails : outList) {
+				OutPublicDtailsFinance of= new OutPublicDtailsFinance();
+				try {
+					BeanUtils.copyProperties( of,outPublicDtails);
+				} catch (Exception e) {
+					throw new BusinessException("数据转换异常");
+				}
+				list.add(of);
+			}
+			NewExcelUtil<OutPublicDtailsFinance>excel=new NewExcelUtil<>(OutPublicDtailsFinance.class);
+			return  excel.exportExcel(list,"公出详细列表",uploadPath);
+		}
+
+
+		return null;
 	}
 
 	/** 上传图片 **/
@@ -263,5 +286,15 @@ public class AdminReleaseApiController extends CertifyApiController{
 		return res;
 	}
 
+	/**
+	 * 打卡页面获取自己最新的打卡
+	 * @return
+	 */
+	@RequestMapping(value = "/getMyNewPublic",method = RequestMethod.GET)
+	public Result getMyNewPublic (){
+		Result res =new Result();
+		res.data(publicReleaseService.getMyNewPublic());
+		return res;
+	}
 
 }

+ 4 - 0
src/main/java/com/goafanti/weChat/service/PublicReleaseService.java

@@ -47,4 +47,8 @@ public interface PublicReleaseService {
     List<Map<String,Object>> selectOrderByUid(String uid);
 
 	List<OutPublicRelease> publicByOrder(String orderNo);
+
+    Object getMyNewPublic();
+
+
 }

+ 181 - 28
src/main/java/com/goafanti/weChat/service/impl/PublicReleaseServiceImpl.java

@@ -1,11 +1,7 @@
 package com.goafanti.weChat.service.impl;
 
 import java.text.ParseException;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.UUID;
+import java.util.*;
 
 
 import com.goafanti.common.dao.*;
@@ -79,7 +75,6 @@ public class PublicReleaseServiceImpl extends BaseMybatisDao<PublicReleaseMapper
 		Date date =new Date();
 		in.setCreateTime(date);
 		in.setStatus(1);
-
 		in.setAid(TokenManager.getAdminId());
 		in.setNewUser(0);
 		User u=userMapper.selectByPrimaryKey(in.getUid());
@@ -89,13 +84,30 @@ public class PublicReleaseServiceImpl extends BaseMybatisDao<PublicReleaseMapper
 		if (u.getAid().equals(TokenManager.getAdminId())){
 			in.setMainStatus(1);
 		}
-		publicReleaseMapper.insertSelective(in);
 		AdminListBo my = adminMapper.getDeptNameByAid(TokenManager.getAdminId());
+		if (in.getAssist()==1){
+			in.setAssistAidName(getAssistAidName(in.getAssistAid()));
+			in.setMainName(my.getName());
+		}
+		publicReleaseMapper.insertSelective(in);
+		Map<String, Object> map=addPublicReleaseLog(my, in,PublicReleaseLog.states.fq.getCode(),u.getNickname(),date);
+		return map;
+	}
+
+	/**
+	 *
+	 * @param my 我的相关人员
+	 * @param in 公出信息
+	 * @param logStatus 公出状态
+	 * @param nickname	客户名称
+	 * @param date	时间
+	 */
+	private Map<String, Object> addPublicReleaseLog(AdminListBo my,PublicRelease in,Integer logStatus,String nickname,Date date ) {
 		Admin a=adminMapper.selectByPrimaryKey(my.getReviewer());
-		PublicReleaseLog log=new PublicReleaseLog(in.getId(),TokenManager.getAdminId(),1,"发起外出申请",new Date());
+		PublicReleaseLog log=new PublicReleaseLog(in.getId(),TokenManager.getAdminId(),logStatus,"发起外出申请",new Date());
 		publicReleaseLogMapper.insertSelective(log);
 		String openid=a.getOpenId();
-		String str="["+my.getName()+"]发起["+u.getNickname()+"]的外出申请,请及时审核。";
+		String str="["+my.getName()+"]发起["+nickname+"]的外出申请,请及时审核。";
 		sendNoticeAndSoucket(a.getId(),NoticeStatus.PUBLIC_RELEASE_START.getCode(),str);
 		Map<String, Object>map=new HashMap<String, Object>();
 		map.put("data", publicReleaseMapper.selectDtails(in.getId(),null));
@@ -114,11 +126,16 @@ public class PublicReleaseServiceImpl extends BaseMybatisDao<PublicReleaseMapper
 		return map;
 	}
 
-
-
-
-
-
+	private String getAssistAidName(String assistAid) {
+		String [] ss=assistAid.split(",");
+		StringBuffer sb=new StringBuffer();
+		for (String s : ss) {
+			Admin a=adminMapper.selectByPrimaryKey(s);
+			if (a!=null&&a.getName()!=null)sb=sb.append(a.getName()).append(",");
+		}
+		if (sb.length()<1)return "";
+		return  sb.deleteCharAt(sb.length() - 1).toString();
+	}
 
 
 	private void sendNoticeAndSoucket(String id,Integer type,String content) {
@@ -144,6 +161,7 @@ public class PublicReleaseServiceImpl extends BaseMybatisDao<PublicReleaseMapper
 
 	@Override
 	public int updatePublicRelease(InputPublicRelease in) {
+		Date date = new Date();
 		try {
 			if(in.getReleaseStarts()!=null)in.setReleaseStart(DateUtils.parseDate(in.getReleaseStarts(), AFTConstants.YYYYMMDDHHMMSS));
 			if(in.getReleaseEnds()!=null)in.setReleaseEnd(DateUtils.parseDate(in.getReleaseEnds(), AFTConstants.YYYYMMDDHHMMSS));
@@ -159,14 +177,31 @@ public class PublicReleaseServiceImpl extends BaseMybatisDao<PublicReleaseMapper
 		if (u!=null&&u.getAid().equals(TokenManager.getAdminId())){
 			in.setMainStatus(1);
 		}
-		PublicReleaseLog log=new PublicReleaseLog(in.getId(),TokenManager.getAdminId(),null,in.getReason(),new Date());
+		PublicReleaseLog log=new PublicReleaseLog(in.getId(),TokenManager.getAdminId(),null,in.getReason(),date);
 		if(in.getStatus()==null||in.getStatus()!=3) {
 			in.setStatus(1);
-			log.setStatus(5);
+			log.setStatus(PublicReleaseLog.states.xg.getCode());
 			in.setUpdateStatus(1);
+			if(in.getAssist()==1){
+				in.setAssistAidName(getAssistAidName(in.getAssistAid()));
+			}else{
+				in.setAssistAidName("");
+
+			}
+			AdminListBo my = adminMapper.getDeptNameByAid(TokenManager.getAdminId());
+			addPublicReleaseLog(my,in,PublicReleaseLog.states.xg.getCode(),u.getNickname(),date);
+
 		}else {
-			log.setStatus(4);
+			log.setStatus(PublicReleaseLog.states.cx.getCode());
+			List<PublicRelease> list = publicReleaseMapper.selectByMainId(in.getId());
+			for (PublicRelease out : list) {
+				PublicReleaseLog log2 = new PublicReleaseLog(out.getId(), TokenManager.getAdminId(), PublicReleaseLog.states.sc.getCode(), "修改撤销协单", new Date());
+				publicReleaseLogMapper.insertSelective(log2);
+			}
+
 		}
+			publicReleaseMapper.updateStatusByMainId(in.getStatus(),in.getId());
+
 		publicReleaseLogMapper.insertSelective(log);
 		return publicReleaseMapper.updateByPrimaryKeySelective(in);
 	}
@@ -176,14 +211,21 @@ public class PublicReleaseServiceImpl extends BaseMybatisDao<PublicReleaseMapper
 	public Pagination<OutPublicReleaseList> listPublicRelease(InputPublicReleaseList in) {
 		Map<String,Object> map =new HashMap<String, Object>();
 		map.put("type", in.getType()==null?0:in.getType());
-		map.put("aid", TokenManager.getAdminId());
+		if (in.getType()==3) {
+			in.setAssist(2);
+			if (!TokenManager.hasRole(AFTConstants.TECH_FINANCE_DIRECTOR))map.put("aid",TokenManager.getAdminId());
+		}else{
+			map.put("aid",TokenManager.getAdminId());
+		}
 		if (StringUtils.isNotEmpty(in.getClockTime()))	map.put("clockTime", in.getClockTime());
 		if(StringUtils.isNotEmpty(in.getReleaseStarts()))	map.put("releaseStarts", in.getReleaseStarts());
 		if(StringUtils.isNotEmpty(in.getReleaseEnds()))	map.put("publicEnd", in.getReleaseEnds()+" 23:59:59");
 		if(StringUtils.isNotEmpty(in.getUserName()))	map.put("userName", in.getUserName());
 		if(in.getStatus()!=null)	map.put("status", in.getStatus());
 		if(in.getClockIn()!=null)	map.put("clockIn", in.getClockIn());
-		return (Pagination<OutPublicReleaseList>) findPage("listPublicRelease", "countPublicRelease", map, in.getPageNo(), in.getPageSize());
+		map.put("assist",in.getAssist()==null?0:in.getAssist());
+		Pagination<OutPublicReleaseList> p=(Pagination<OutPublicReleaseList>) findPage("listPublicRelease", "countPublicRelease", map, in.getPageNo(), in.getPageSize());
+		return p;
 	}
 
 	@Override
@@ -200,8 +242,18 @@ public class PublicReleaseServiceImpl extends BaseMybatisDao<PublicReleaseMapper
 		StringBuffer str=new StringBuffer();
 		Admin ad=adminMapper.selectByPrimaryKey(aid);
 		str=str.append("(").append(ad.getName()).append(")");
-		if (status==0){str=str.append("驳回,");}
-		else if(status==2){str=str.append("同意,");}
+		if (status==0){
+			str=str.append("驳回,");
+			publicReleaseMapper.updateStatusByMainId(status,use.getId());
+		}else if(status==2){
+			str=str.append("同意,");
+			//如果是协单公出主公出,在审核通过
+			if (use.getAssist()==1){
+				pushPublicReleaseAssist(use,status,date);
+			}else if (use.getAssist()==0){
+				publicReleaseMapper.updateStatusByMainId(3,use.getId());
+			}
+		}
 		str=str.append(remarks);
 		p.setAuditInfo(str.toString());
 		publicReleaseMapper.updateByPrimaryKeySelective(p);
@@ -234,6 +286,62 @@ public class PublicReleaseServiceImpl extends BaseMybatisDao<PublicReleaseMapper
 			return 1;
 	}
 
+	private void pushPublicReleaseAssist(PublicRelease use,Integer status,Date date) {
+		Integer useId=use.getId();
+		if (use.getAssistAid()!=null){
+			List<PublicRelease> list = publicReleaseMapper.selectByMainId(use.getId());
+			String []ss=use.getAssistAid().split(",");
+			//数据库与传入比对,如果不存在就标记撤销 ,如果存在就修改成
+			for (PublicRelease out : list) {
+				boolean flag=false;
+				for (String s : ss) {
+					if (out.getAid().equals(s)){
+						flag=true;
+					}
+				}
+				if (!flag){
+					PublicRelease in = new PublicRelease();
+					in.setId(out.getId());
+					in.setStatus(3);
+					publicReleaseMapper.updateByPrimaryKeySelective(in);
+					PublicReleaseLog log = new PublicReleaseLog(in.getId(), TokenManager.getAdminId(), PublicReleaseLog.states.sc.getCode(), "修改撤销协单", date);
+					publicReleaseLogMapper.insertSelective(log);
+				}else {
+					use.setId(out.getId());
+					use.setAid(out.getAid());
+					use.setMainId(null);
+					use.setClockIn(null);
+					use.setClockInTime(null);
+					use.setType(null);
+					use.setAssist(2);
+					use.setStatus(status);
+					publicReleaseMapper.updateByPrimaryKeySelective(use);
+					PublicReleaseLog log = new PublicReleaseLog(out.getId(), TokenManager.getAdminId(), PublicReleaseLog.states.xg.getCode(), "修改协单信息", date);
+					publicReleaseLogMapper.insertSelective(log);
+				}
+			}
+			for (String s : ss) {
+				boolean flag2 = false;
+				for (PublicRelease o : list) {
+					if (s.equals(o.getAid())) {
+						flag2 = true;
+					}
+				}
+				if (!flag2) {
+					use.setAssist(2);
+					use.setAid(s);
+					use.setStatus(2);
+					use.setType(3);
+					use.setMainId(useId);
+					use.setId(null);
+					publicReleaseMapper.insert(use);
+					PublicReleaseLog log = new PublicReleaseLog(use.getId(), TokenManager.getAdminId(), PublicReleaseLog.states.xg.getCode(), "修改协单信息", date);
+					publicReleaseLogMapper.insertSelective(log);
+				}
+			}
+		}
+	}
+
 	@Override
 	public List<outPublicReleaseLog> listPublicReleaseLog(Integer id,String ufid) {
 		List<outPublicReleaseLog> list=publicReleaseLogMapper.listPublicReleaseLog(id,ufid);
@@ -268,7 +376,7 @@ public class PublicReleaseServiceImpl extends BaseMybatisDao<PublicReleaseMapper
 		}else {
 			str="刷新打卡";
 		}
-		PublicReleaseLog log=new PublicReleaseLog(id,aid,3,str,new Date());
+		PublicReleaseLog log=new PublicReleaseLog(id,aid,PublicReleaseLog.states.dk.getCode(),str,new Date());
 		log.setPhotoUrl(photoUrl);
 		publicReleaseLogMapper.insertSelective(log);
 		publicReleaseMapper.updateByPrimaryKeySelective(p);
@@ -285,7 +393,8 @@ public class PublicReleaseServiceImpl extends BaseMybatisDao<PublicReleaseMapper
 			AdminListBo ab=adminMapper.getDeptNameByAid(out.getAid());
 			if (!TokenManager.getAdminId().equals( out.getAid())&&
 					!TokenManager.getAdminId().equals(out.getReviewer())&&
-					!TokenManager.getAdminId().equals(ab.getDepManager())){
+					!TokenManager.getAdminId().equals(ab.getDepManager())&&
+					!TokenManager.hasRole(AFTConstants.TECH_FINANCE_DIRECTOR)){
 				flag=true;
 			}
 			if(flag){
@@ -301,6 +410,8 @@ public class PublicReleaseServiceImpl extends BaseMybatisDao<PublicReleaseMapper
 		return out;
 	}
 
+
+
 	@Override
 	public OutPublicRelease followDtails(String id) {
 		return	publicReleaseMapper.selectDtails(null,id);
@@ -354,7 +465,6 @@ public class PublicReleaseServiceImpl extends BaseMybatisDao<PublicReleaseMapper
 	public Object publicReleaseListDtails(InputPublicDtails in) {
 		Map<String,Object> map =new HashMap<String, Object>();
 		addParams(in, map);
-		Date date = new Date();
 		Pagination<OutPublicDtails> page = (Pagination<OutPublicDtails>) findPage("listPublicDtails", "countPublicDtails", map, in.getPageNo(), in.getPageSize());
 		return page;
 	}
@@ -365,18 +475,23 @@ public class PublicReleaseServiceImpl extends BaseMybatisDao<PublicReleaseMapper
 		if(in.getDepId()!=null) map.put("depId", in.getDepId());
 		if(in.getReleaseStart()!=null) map.put("releaseStart", in.getReleaseStart());
 		if(in.getReleaseEnd()!=null) map.put("releaseEnd", in.getReleaseEnd()+" 23:59:59");
+		if(in.getCreateStart()!=null) map.put("createStart", in.getCreateStart());
+		if(in.getCreateEnd()!=null) map.put("createEnd", in.getCreateEnd()+" 23:59:59");
 		if(in.getUid()!=null) map.put("uid", in.getUid());
 		if(in.getStatus()!=null) map.put("status", in.getStatus());
 		if(in.getClockIn()!=null) map.put("clockIn", in.getClockIn());
 		if(in.getPublicType()!=null)map.put("publicType",in.getPublicType());
 		//type 0私有 1管理权限 2所有权限
 		if(TokenManager.hasRole(AFTConstants.SUPERADMIN)||TokenManager.hasRole(AFTConstants.APPROVAL_DECISION)
-				||TokenManager.hasRole(AFTConstants.CED_ASSISTANT )||TokenManager.hasRole(AFTConstants.PERSONNEL_AUDITOR)){
-			in.setType(2);}
-		else if(TokenManager.hasRole(AFTConstants.COMPANY_MANAGER)||TokenManager.hasRole(AFTConstants.SALESMAN_ADMIN)){
+				||TokenManager.hasRole(AFTConstants.CED_ASSISTANT )||TokenManager.hasRole(AFTConstants.PERSONNEL_AUDITOR)
+					||TokenManager.hasRole(AFTConstants.FINANCE_ADMIN)
+					||TokenManager.hasRole(AFTConstants.FINANCE)||TokenManager.hasRole(AFTConstants.FINANCE_MANAGER)){
+			//添加财务和财务经理。查看客户所有公出
+			in.setType(2);
+		}else if(TokenManager.hasRole(AFTConstants.COMPANY_MANAGER)||TokenManager.hasRole(AFTConstants.SALESMAN_ADMIN)){
 			in.setType(1);
 			map.put("deps", orderService.selectMyDeps());
-		} else{
+		}else{
 			in.setType(0);
 			if (in.getAid()==null) map.put("aid",TokenManager.getAdminId());
 		}
@@ -413,9 +528,12 @@ public class PublicReleaseServiceImpl extends BaseMybatisDao<PublicReleaseMapper
 			throw new BusinessException("转换异常");
 		}
 		List<Integer> is=publicReleaseMapper.checkTime(TokenManager.getAdminId(),in.getReleaseStart(),in.getReleaseEnd());
+		is.forEach(System.out::println);
+		System.out.println(in.getId());
 		if (is.size()>1) {
 			return true;
 		}else  if(is.size()==1){
+			System.out.println(is.get(0));
 			if (in.getId()!=null && !in.getId().equals(is.get(0))){
 				return true;
 			}
@@ -434,5 +552,40 @@ public class PublicReleaseServiceImpl extends BaseMybatisDao<PublicReleaseMapper
 		return publicReleaseMapper.publicByOrder(orderNo);
 	}
 
+	@Override
+	public Object getMyNewPublic() {
+		List<OutPublicReleaseList> myPublic = getMyPublic(0,1);
+		if (myPublic.isEmpty()){
+			List<OutPublicReleaseList> myPublic2 = getMyPublic(0,0);
+			if (!myPublic2.isEmpty()){
+				return myPublic2.get(0);
+			}
+		}else {
+			return myPublic.get(0);
+		}
+		return null;
+	}
+
+
+	/**
+	 *
+	 * @param type 查看类型 0我的公出 1公出审核 2管理员 3协单(技术财税总监看全部)
+	 * @param dateType 是否含打卡时间  0否 1是
+	 * @return
+	 */
+	public List<OutPublicReleaseList>getMyPublic(Integer type ,Integer dateType){
+		Map<String, Object> map = new HashMap<>();
+		if (type==null)type=0;
+		map.put("type",type);
+		if (dateType==1){
+			Date date = new Date();
+			String clockTime=DateUtils.formatDate(date,AFTConstants.YYYYMMDDHHMMSS);
+			map.put("clockTime",clockTime);
+		}
+		map.put("assistType",1);
+		map.put("aid",TokenManager.getAdminId());
+		List<OutPublicReleaseList> list = (List<OutPublicReleaseList>) findList("listPublicRelease",map,1,1);
+		return list;
+	}
 
 }

+ 9 - 9
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/aft?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.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.url=jdbc\:mysql://localhost:3306/aft20220318?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
@@ -40,20 +40,20 @@ app.name=AFT
 template.cacheable=false
 user.receive.max=10
 user.private.max=1000
-#提前提醒天数
+#\u63D0\u524D\u63D0\u9192\u5929\u6570
 user_remind_days=15
-#提前提醒天数
+#\u63D0\u524D\u63D0\u9192\u5929\u6570
 user_channel_days=90
 
 avatar.host=//static.jishutao.com
-static.host=//static.jishutao.com/1.2.15
+static.host=//static.jishutao.com/1.2.17
 #avatar.host=//172.16.0.255:3000
 #static.host=//172.16.0.255:3000/1.2.05
 #static.host=http://172.16.1.187/prod/1.2.05
 
 wx.appId=wxff2f5720ed7d7f63
 wx.appSecret=081744369d42405be58fe37f892631f7
-#developer为开发版;trial为体验版;formal为正式版;
+#developer\u4E3A\u5F00\u53D1\u7248\uFF1Btrial\u4E3A\u4F53\u9A8C\u7248\uFF1Bformal\u4E3A\u6B63\u5F0F\u7248\uFF1B
 wx.state=trial
 wx.clockInRange=1000
 

+ 4 - 4
src/main/resources/props/config_test.properties

@@ -38,19 +38,19 @@ app.name=AFT
 template.cacheable=false
 user.receive.max=10
 user.private.max=1000
-#提前提醒天数
+#\u63D0\u524D\u63D0\u9192\u5929\u6570
 user_remind_days=15
-#提前提醒天数
+#\u63D0\u524D\u63D0\u9192\u5929\u6570
 user_channel_days=90
 
-static.host=//static.jishutao.com/1.2.15
+static.host=//static.jishutao.com/1.2.17
 portal.host=//static.jishutao.com/portal/2.0.6
 avatar.host=//static.jishutao.com
 avatar.upload.host=//static.jishutao.com/upload
 
 wx.appId=wxff2f5720ed7d7f63
 wx.appSecret=081744369d42405be58fe37f892631f7
-#developer为开发版;trial为体验版;formal为正式版;
+#developer\u4E3A\u5F00\u53D1\u7248\uFF1Btrial\u4E3A\u4F53\u9A8C\u7248\uFF1Bformal\u4E3A\u6B63\u5F0F\u7248\uFF1B
 wx.state=trial
 wx.clockInRange=1000