Przeglądaj źródła

Merge branch 'master' into test

anderx 3 lat temu
rodzic
commit
ffadce95cb
41 zmienionych plików z 1764 dodań i 638 usunięć
  1. 34 4
      src/main/java/com/goafanti/admin/service/impl/AdminServiceImpl.java
  2. 4 0
      src/main/java/com/goafanti/common/dao/AdminMapper.java
  3. 33 0
      src/main/java/com/goafanti/common/dao/PublicReleaseDetailsMapper.java
  4. 4 1
      src/main/java/com/goafanti/common/dao/PublicReleaseMapper.java
  5. 4 2
      src/main/java/com/goafanti/common/dao/TOrderNewMapper.java
  6. 4 1
      src/main/java/com/goafanti/common/dao/UserMapper.java
  7. 16 3
      src/main/java/com/goafanti/common/mapper/AdminMapper.xml
  8. 11 9
      src/main/java/com/goafanti/common/mapper/DepartmentMapper.xml
  9. 263 0
      src/main/java/com/goafanti/common/mapper/PublicReleaseDetailsMapper.xml
  10. 10 7
      src/main/java/com/goafanti/common/mapper/PublicReleaseLogMapper.xml
  11. 187 240
      src/main/java/com/goafanti/common/mapper/PublicReleaseMapper.xml
  12. 21 3
      src/main/java/com/goafanti/common/mapper/TOrderNewMapper.xml
  13. 36 1
      src/main/java/com/goafanti/common/mapper/UserMapperExt.xml
  14. 65 143
      src/main/java/com/goafanti/common/model/PublicRelease.java
  15. 217 0
      src/main/java/com/goafanti/common/model/PublicReleaseDetails.java
  16. 6 1
      src/main/java/com/goafanti/common/utils/AsyncUtils.java
  17. 2 2
      src/main/java/com/goafanti/core/cache/serializer/FastJsonRedisSerializer.java
  18. 4 2
      src/main/java/com/goafanti/customer/service/impl/CustomerServiceImpl.java
  19. 1 1
      src/main/java/com/goafanti/order/bo/InputStatistics.java
  20. 4 4
      src/main/java/com/goafanti/order/bo/outProvinceStatisticsList.java
  21. 15 4
      src/main/java/com/goafanti/order/bo/outStatisticsList.java
  22. 78 0
      src/main/java/com/goafanti/order/bo/StatisOrderList.java
  23. 32 7
      src/main/java/com/goafanti/order/controller/AdminNewOrderApiController.java
  24. 6 6
      src/main/java/com/goafanti/order/controller/AdminNewOrderDunApiController.java
  25. 2 2
      src/main/java/com/goafanti/order/service/OrderNewService.java
  26. 81 17
      src/main/java/com/goafanti/order/service/impl/OrderNewServiceImpl.java
  27. 1 0
      src/main/java/com/goafanti/order/service/impl/OrderProjectServiceImpl.java
  28. 1 1
      src/main/java/com/goafanti/order/service/impl/UserStatisticsServiceImpl.java
  29. 1 2
      src/main/java/com/goafanti/organization/service/impl/OrganizationServiceImpl.java
  30. 9 0
      src/main/java/com/goafanti/weChat/bo/InputPublicDtails.java
  31. 133 5
      src/main/java/com/goafanti/weChat/bo/InputPublicRelease.java
  32. 17 6
      src/main/java/com/goafanti/weChat/bo/OutPublicDtails.java
  33. 19 0
      src/main/java/com/goafanti/weChat/bo/OutPublicRelease.java
  34. 25 0
      src/main/java/com/goafanti/weChat/bo/OutPublicReleaseAndDetails.java
  35. 31 0
      src/main/java/com/goafanti/weChat/bo/OutPublicReleaseDetails.java
  36. 33 8
      src/main/java/com/goafanti/weChat/bo/OutPublicReleaseList.java
  37. 32 9
      src/main/java/com/goafanti/weChat/controller/AdminReleaseApiController.java
  38. 5 10
      src/main/java/com/goafanti/weChat/service/PublicReleaseService.java
  39. 313 133
      src/main/java/com/goafanti/weChat/service/impl/PublicReleaseServiceImpl.java
  40. 3 3
      src/main/resources/props/config_local.properties
  41. 1 1
      src/main/resources/props/config_test.properties

+ 34 - 4
src/main/java/com/goafanti/admin/service/impl/AdminServiceImpl.java

@@ -9,11 +9,9 @@ import com.goafanti.admin.service.NewAdminService;
 import com.goafanti.common.dao.*;
 import com.goafanti.common.error.BusinessException;
 import com.goafanti.common.model.Department;
-import com.goafanti.common.model.Role;
 import com.goafanti.common.utils.RedisUtil;
 import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.cache.annotation.Cacheable;
 import org.springframework.stereotype.Service;
 
 import com.goafanti.admin.bo.AdminContacts;
@@ -48,6 +46,8 @@ public class AdminServiceImpl extends BaseMybatisDao<AdminMapper> implements Adm
 	@Autowired
 	private UserBusinessMapper	userBusinessMapper;
 	@Autowired
+	private UserMapper	userMapper;
+	@Autowired
 	private DepartmentMapper departmentMapper;
 	@Autowired
 	private DepartmentService departmentService;
@@ -385,7 +385,6 @@ public class AdminServiceImpl extends BaseMybatisDao<AdminMapper> implements Adm
 			if(TokenManager.hasRole(AFTConstants.OPERATION_MANAGER)){
 				List<String> myShiroDep = departmentService.selectMyDeps();
 				if (!myShiroDep.contains(depId))throw new BusinessException("无权查看此部门信息");
-
 			}
 			depIds =departmentService.selectSubordinateDeps(depId);
 			Department department = new Department();
@@ -393,7 +392,11 @@ public class AdminServiceImpl extends BaseMybatisDao<AdminMapper> implements Adm
 			depIds.add(department);
 			deps=departmentMapper.selectBysuperId(oo.getId());
 		}
-		List<AdminCustomerBo> list =departmentMapper.AlldepCount(depIds,startTime,  endTime);
+		List<AdminCustomerBo> list =null;
+		//原sql计算
+//		list=departmentMapper.AlldepCount(depIds,startTime,  endTime);
+		//新java计算
+		list=AllDepCount(depIds,startTime,endTime);
 		for (AdminCustomerBo ad : list) {
 			if (acb.getId().equals(ad.getDepId())){
 				acb.getaList().add(ad);
@@ -413,6 +416,33 @@ public class AdminServiceImpl extends BaseMybatisDao<AdminMapper> implements Adm
 		return acb;
 	}
 
+	private List<AdminCustomerBo> AllDepCount(List<Department> depIds, String startTime, String endTime) {
+		List<AdminCustomerBo> admins = adminMapper.selectByDeps(depIds);
+		List<AdminCustomerBo> users = 	userMapper.selectNoChannelByaids(admins,startTime,endTime);
+		List<AdminCustomerBo> users2 = 	userMapper.selectChannelByaids(admins,startTime,endTime);
+		for (AdminCustomerBo admin : admins) {
+			for (AdminCustomerBo user : users) {
+					if (admin.getAid().equals(user.getAid())){
+						admin.setUserCount(user.getUserCount());
+						admin.setChannelCount(user.getChannelCount());
+						admin.setSignCount(user.getSignCount());
+						admin.setNewCount(user.getNewCount());
+						admin.setChannelNewCount(user.getChannelNewCount());
+						admin.setReceiveCount(user.getReceiveCount());
+						break;
+					}
+			}
+			for (AdminCustomerBo user : users2) {
+				if (admin.getAid().equals(user.getAid())){
+					admin.setCompleteCount(user.getCompleteCount());
+					admin.setChannelCompleteCount(user.getChannelCompleteCount());
+					break;
+				}
+			}
+		}
+		return admins;
+	}
+
 	//迭代获取所有部门与部门员工并计算出部门数量
 	public List<DepCountBo> iterationDeps(String id,List<AdminCustomerBo> list) {
 		List<DepCountBo>  deps =departmentMapper.selectBysuperId(id);

+ 4 - 0
src/main/java/com/goafanti/common/dao/AdminMapper.java

@@ -1,8 +1,10 @@
 package com.goafanti.common.dao;
 
 import com.goafanti.admin.bo.AdminContacts;
+import com.goafanti.admin.bo.AdminCustomerBo;
 import com.goafanti.admin.bo.AdminListBo;
 import com.goafanti.common.model.Admin;
+import com.goafanti.common.model.Department;
 import com.goafanti.common.model.Role;
 import org.apache.ibatis.annotations.Param;
 
@@ -161,4 +163,6 @@ public interface AdminMapper {
     int selectByAmbIdCount(String id);
 
     List<Admin> selectAdminByRoleType(@Param("roleType") String roleType);
+
+    List<AdminCustomerBo > selectByDeps(@Param("depIds") List<Department> depIds);
 }

+ 33 - 0
src/main/java/com/goafanti/common/dao/PublicReleaseDetailsMapper.java

@@ -0,0 +1,33 @@
+package com.goafanti.common.dao;
+
+import com.goafanti.common.model.PublicReleaseDetails;
+import com.goafanti.weChat.bo.InputPublicRelease;
+import com.goafanti.weChat.bo.OutPublicRelease;
+import com.goafanti.weChat.bo.OutPublicReleaseDetails;
+
+import java.util.List;
+
+public interface PublicReleaseDetailsMapper {
+    int deleteByPrimaryKey(Integer id);
+
+    int insert(PublicReleaseDetails record);
+
+    int insertSelective(PublicReleaseDetails record);
+
+    PublicReleaseDetails selectByPrimaryKey(Integer id);
+
+    int updateByPrimaryKeySelective(PublicReleaseDetails record);
+
+    int updateByPrimaryKey(PublicReleaseDetails record);
+
+    List<OutPublicReleaseDetails> selectByPCid(Integer id);
+
+    void insertBatch(List<PublicReleaseDetails> list);
+
+    String getNamesByPrid(Integer id);
+
+    PublicReleaseDetails selectBypridAndUid(InputPublicRelease in);
+
+    void updateDistrictByPrid(InputPublicRelease in);
+
+}

+ 4 - 1
src/main/java/com/goafanti/common/dao/PublicReleaseMapper.java

@@ -4,6 +4,7 @@ import com.goafanti.common.model.OutPublicReleaseCount;
 import com.goafanti.common.model.PublicRelease;
 import com.goafanti.common.model.PublicReleaseCount;
 import com.goafanti.weChat.bo.OutPublicRelease;
+import com.goafanti.weChat.bo.OutPublicReleaseAndDetails;
 import org.apache.ibatis.annotations.Param;
 
 import java.util.Date;
@@ -23,7 +24,7 @@ public interface PublicReleaseMapper {
     int updateByPrimaryKey(PublicRelease record);
 
 
-    OutPublicRelease selectDtails(@Param("id") Integer id, @Param("ufid")String ufid);
+    OutPublicRelease selectDtails(@Param("id") Integer id);
 
     /**
      * 需要比对申请人其他公出时间,选择出重复的时间来判断是否生效。
@@ -47,4 +48,6 @@ public interface PublicReleaseMapper {
 
 
     void updateStatusByMainId(@Param("status") Integer status, @Param("type") Integer type,@Param("mainId") Integer mainId,@Param("aid") String aid);
+
+    OutPublicReleaseAndDetails selectDtailsByFid(@Param("ufid")String ufid);
 }

+ 4 - 2
src/main/java/com/goafanti/common/dao/TOrderNewMapper.java

@@ -49,9 +49,9 @@ public interface TOrderNewMapper {
 
     List<BigDecimal> selectByUidAndNewUser(@Param("uid")String uid,@Param("aid")String aid, @Param("newUser")Integer newUser, @Param("date") Date date, @Param("now")Date now);
 
-    List<outStatisticsList> statisticsList(InputStatistics in);
+    List<OutStatisticsList> statisticsList(InputStatistics in);
 
-    List<outProvinceStatisticsList> provinceStatisticsList(InputStatistics in);
+    List<OutProvinceStatisticsList> provinceStatisticsList(InputStatistics in);
 
     List<Map<String, Object>> selectOrderByuid(String uid);
 
@@ -77,4 +77,6 @@ public interface TOrderNewMapper {
 
 
     List<TOrderNewBo> selectByuidandAid(@Param("uid")String uid,@Param("aid") String aid);
+
+    List<StatisOrderList>  statisticsOrderList(InputStatistics in);
 }

+ 4 - 1
src/main/java/com/goafanti/common/dao/UserMapper.java

@@ -4,6 +4,7 @@ import java.util.Date;
 import java.util.List;
 import java.util.Map;
 
+import com.goafanti.admin.bo.AdminCustomerBo;
 import com.goafanti.customer.bo.*;
 import org.apache.ibatis.annotations.Param;
 
@@ -19,7 +20,6 @@ import com.goafanti.user.bo.UserDownLoadBo;
 import com.goafanti.user.bo.UserInterestBo;
 import com.goafanti.user.bo.UserPageHomeBo;
 import com.goafanti.user.bo.UserPartnerDetailBo;
-import com.goafanti.common.model.UserExample;
 import com.goafanti.report.bo.CountMarketingStatisticsBo;
 import com.goafanti.report.bo.marketingESBo;
 import com.goafanti.report.bo.userDataListBo;
@@ -238,4 +238,7 @@ public interface UserMapper {
 
 
     List<OutChannelListBo> channelUserList(Map<String, Object> params);
+
+    List<AdminCustomerBo> selectNoChannelByaids(@Param("admins")List<AdminCustomerBo> admins,@Param("startTime") String startTime,@Param("endTime") String endTime);
+    List<AdminCustomerBo> selectChannelByaids(@Param("admins")List<AdminCustomerBo> admins,@Param("startTime") String startTime,@Param("endTime") String endTime);
 }

+ 16 - 3
src/main/java/com/goafanti/common/mapper/AdminMapper.xml

@@ -359,7 +359,7 @@
   </select>
 
   <select id="selectRolesByPrimaryKey" parameterType="java.lang.String" resultType="com.goafanti.common.model.Role">
-    select r.name, r.id, r.type
+    select r.role_name name, r.id, r.role_type type
     from role r
            left join user_role ur on ur.rid=r.id
     where ur.uid = #{uid,jdbcType=VARCHAR}
@@ -982,7 +982,8 @@
     from user a left join (select uid,last_follow_time from user_mid where aid= #{aid}) b  on a.id=b.uid
     left join organization_identity c on a.id=c.uid
     <if test="type==5 or type==6">
-      left join (select aid,uid from public_release where clock_in =1
+      left join (select aid,uid from public_release a left join public_release_details b on a.id=b.prid
+      where b.clock_in =1
       and aid= #{aid,jdbcType=VARCHAR}
       <if test="startTime != null and endTime != null">
         and  clock_in_time between #{startTime,jdbcType=VARCHAR} and #{endTime,jdbcType=VARCHAR}
@@ -1033,7 +1034,8 @@
     select count(*)
     from user a
     <if test="type==5 or type==6">
-      left join (select aid,uid from public_release where clock_in =1
+      left join (select aid,uid from public_release a left join public_release_details b on a.id=b.prid
+      where b.clock_in =1
       and aid= #{aid,jdbcType=VARCHAR}
       <if test="startTime != null and endTime != null">
         and  clock_in_time between #{startTime,jdbcType=VARCHAR} and #{endTime,jdbcType=VARCHAR}
@@ -1154,4 +1156,15 @@
       and c.role_type  in (#{roleType})
     </if>
   </select>
+    <select id="selectByDeps" resultType="com.goafanti.admin.bo.AdminCustomerBo">
+      SELECT a.id aid,a.name aName,a.department_id depId,d.name depName
+      from admin a left join department d on a.department_id = d.id
+      where a.status =0 and a.`type` =1
+      <if test="depIds!= null">
+        and a.department_id in
+        <foreach close=")" collection="depIds" item="deps" open="(" separator=",">
+          #{deps.id}
+        </foreach>
+      </if>
+    </select>
 </mapper>

+ 11 - 9
src/main/java/com/goafanti/common/mapper/DepartmentMapper.xml

@@ -319,13 +319,13 @@
   <insert id="insert1" parameterType="com.goafanti.organization.bo.OrganizationListOut">
     insert into department(
       id,create_id,create_time,update_time,deleted_sign,
-      name,type,manager_id,dep_no,super_id,desc,status)
+      name,type,manager_id,dep_no,super_id,status)
     values(#{id,jdbcType=VARCHAR},#{createId,jdbcType=VARCHAR},
            #{createTime,jdbcType=VARCHAR},#{updateTime,jdbcType=VARCHAR},
            #{deletedSign,jdbcType=VARCHAR},#{name,jdbcType=VARCHAR},
            #{type,jdbcType=VARCHAR},#{managerId,jdbcType=VARCHAR},
            #{depNo,jdbcType=VARCHAR},#{superId,jdbcType=VARCHAR},
-           #{desc,jdbcType=VARCHAR},#{status,jdbcType=VARCHAR})
+           #{status,jdbcType=VARCHAR})
   </insert>
   <!-- 得到上级 -->
   <select id="selectDepNo" resultType="String">
@@ -495,10 +495,11 @@
       and  transfer_time  between #{startTime,jdbcType=VARCHAR} and #{endTime,jdbcType=VARCHAR}
     </if>
     group by aid)x left join (select a.aid,sum(if(b.channel=0,1,0))completeCount,
-    sum(if(b.channel=1,1,0))channelCompleteCount from public_release a left join `user` b on a.uid =b.id
-    where a.clock_in =1
+    sum(if(b.channel=1,1,0))channelCompleteCount from public_release a left join public_release_details prd on a.id=prd.id
+    left join `user` b on prd.uid =b.id
+    where prd.clock_in =1
     <if test="startTime != null and endTime != null">
-      and clock_in_time between #{startTime,jdbcType=VARCHAR} and #{endTime,jdbcType=VARCHAR}
+      and prd.clock_in_time between #{startTime,jdbcType=VARCHAR} and #{endTime,jdbcType=VARCHAR}
     </if>
     group by a.aid ) y on x.aid=y.aid)b on a.id=b.aid
     left join department d on a.department_id=d.id
@@ -526,11 +527,12 @@
       and  transfer_time  between #{startTime,jdbcType=VARCHAR} and #{endTime,jdbcType=VARCHAR}
     </if>
     group by aid)b on a.id=b.aid
-    left join (select a.aid,sum(if(b.channel=0,1,0))completeCount,
-    sum(if(b.channel=1,1,0))channelCompleteCount from public_release a left join `user` b on a.uid =b.id
-    where a.clock_in =1
+    left join (select a.aid,sum(if(c.channel=0,1,0))completeCount,
+    sum(if(c.channel=1,1,0))channelCompleteCount
+    from public_release a left join public_release_details b on a.id=b.prid left join `user` c on b.uid=c.id
+    where b.clock_in =1
     <if test="startTime != null and endTime != null">
-      and clock_in_time between #{startTime,jdbcType=VARCHAR} and #{endTime,jdbcType=VARCHAR}
+      and b.clock_in_time between #{startTime,jdbcType=VARCHAR} and #{endTime,jdbcType=VARCHAR}
     </if>
     group by a.aid ) y on a.id=y.aid
     left join department c on a.department_id =c.id

+ 263 - 0
src/main/java/com/goafanti/common/mapper/PublicReleaseDetailsMapper.xml

@@ -0,0 +1,263 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.goafanti.common.dao.PublicReleaseDetailsMapper">
+  <resultMap id="BaseResultMap" type="com.goafanti.common.model.PublicReleaseDetails">
+    <id column="id" jdbcType="INTEGER" property="id" />
+    <result column="prid" jdbcType="INTEGER" property="prid" />
+    <result column="uid" jdbcType="VARCHAR" property="uid" />
+    <result column="ufid" jdbcType="VARCHAR" property="ufid" />
+    <result column="new_user" jdbcType="INTEGER" property="newUser" />
+    <result column="sign_sum" jdbcType="INTEGER" property="signSum" />
+    <result column="longitude" jdbcType="VARCHAR" property="longitude" />
+    <result column="latitude" jdbcType="VARCHAR" property="latitude" />
+    <result column="clock_in" jdbcType="INTEGER" property="clockIn" />
+    <result column="clock_in_time" jdbcType="TIMESTAMP" property="clockInTime" />
+    <result column="photo_url" jdbcType="VARCHAR" property="photoUrl" />
+    <result column="district_name" jdbcType="VARCHAR" property="districtName" />
+    <result column="clock_in_remarks" jdbcType="VARCHAR" property="clockInRemarks" />
+    <result column="duration" jdbcType="DOUBLE" property="duration" />
+    <result column="main_status" jdbcType="INTEGER" property="mainStatus" />
+    <result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
+  </resultMap>
+  <sql id="Base_Column_List">
+    id, prid, `uid`, ufid, new_user, sign_sum, longitude, latitude, clock_in, clock_in_time,
+    photo_url, district_name, clock_in_remarks, duration, main_status, update_time
+  </sql>
+  <select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
+    select
+    <include refid="Base_Column_List" />
+    from public_release_details
+    where id = #{id,jdbcType=INTEGER}
+  </select>
+  <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
+    delete from public_release_details
+    where id = #{id,jdbcType=INTEGER}
+  </delete>
+  <insert id="insert" keyColumn="id" keyProperty="id" parameterType="com.goafanti.common.model.PublicReleaseDetails" useGeneratedKeys="true">
+    insert into public_release_details (prid, `uid`, ufid,
+      new_user, sign_sum, longitude,
+      latitude, clock_in, clock_in_time,
+      photo_url, district_name, clock_in_remarks,
+      duration, main_status, update_time
+      )
+    values (#{prid,jdbcType=INTEGER}, #{uid,jdbcType=VARCHAR}, #{ufid,jdbcType=VARCHAR},
+      #{newUser,jdbcType=INTEGER}, #{signSum,jdbcType=INTEGER}, #{longitude,jdbcType=VARCHAR},
+      #{latitude,jdbcType=VARCHAR}, #{clockIn,jdbcType=INTEGER}, #{clockInTime,jdbcType=TIMESTAMP},
+      #{photoUrl,jdbcType=VARCHAR}, #{districtName,jdbcType=VARCHAR}, #{clockInRemarks,jdbcType=VARCHAR},
+      #{duration,jdbcType=DOUBLE}, #{mainStatus,jdbcType=INTEGER}, #{updateTime,jdbcType=TIMESTAMP}
+      )
+  </insert>
+  <insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="com.goafanti.common.model.PublicReleaseDetails" useGeneratedKeys="true">
+    insert into public_release_details
+    <trim prefix="(" suffix=")" suffixOverrides=",">
+      <if test="prid != null">
+        prid,
+      </if>
+      <if test="uid != null">
+        `uid`,
+      </if>
+      <if test="ufid != null">
+        ufid,
+      </if>
+      <if test="newUser != null">
+        new_user,
+      </if>
+      <if test="signSum != null">
+        sign_sum,
+      </if>
+      <if test="longitude != null">
+        longitude,
+      </if>
+      <if test="latitude != null">
+        latitude,
+      </if>
+      <if test="clockIn != null">
+        clock_in,
+      </if>
+      <if test="clockInTime != null">
+        clock_in_time,
+      </if>
+      <if test="photoUrl != null">
+        photo_url,
+      </if>
+      <if test="districtName != null">
+        district_name,
+      </if>
+      <if test="clockInRemarks != null">
+        clock_in_remarks,
+      </if>
+      <if test="duration != null">
+        duration,
+      </if>
+      <if test="mainStatus != null">
+        main_status,
+      </if>
+      <if test="updateTime != null">
+        update_time,
+      </if>
+    </trim>
+    <trim prefix="values (" suffix=")" suffixOverrides=",">
+      <if test="prid != null">
+        #{prid,jdbcType=INTEGER},
+      </if>
+      <if test="uid != null">
+        #{uid,jdbcType=VARCHAR},
+      </if>
+      <if test="ufid != null">
+        #{ufid,jdbcType=VARCHAR},
+      </if>
+      <if test="newUser != null">
+        #{newUser,jdbcType=INTEGER},
+      </if>
+      <if test="signSum != null">
+        #{signSum,jdbcType=INTEGER},
+      </if>
+      <if test="longitude != null">
+        #{longitude,jdbcType=VARCHAR},
+      </if>
+      <if test="latitude != null">
+        #{latitude,jdbcType=VARCHAR},
+      </if>
+      <if test="clockIn != null">
+        #{clockIn,jdbcType=INTEGER},
+      </if>
+      <if test="clockInTime != null">
+        #{clockInTime,jdbcType=TIMESTAMP},
+      </if>
+      <if test="photoUrl != null">
+        #{photoUrl,jdbcType=VARCHAR},
+      </if>
+      <if test="districtName != null">
+        #{districtName,jdbcType=VARCHAR},
+      </if>
+      <if test="clockInRemarks != null">
+        #{clockInRemarks,jdbcType=VARCHAR},
+      </if>
+      <if test="duration != null">
+        #{duration,jdbcType=DOUBLE},
+      </if>
+      <if test="mainStatus != null">
+        #{mainStatus,jdbcType=INTEGER},
+      </if>
+      <if test="updateTime != null">
+        #{updateTime,jdbcType=TIMESTAMP},
+      </if>
+    </trim>
+  </insert>
+  <update id="updateByPrimaryKeySelective" parameterType="com.goafanti.common.model.PublicReleaseDetails">
+    update public_release_details
+    <set>
+      <if test="prid != null">
+        prid = #{prid,jdbcType=INTEGER},
+      </if>
+      <if test="uid != null">
+        `uid` = #{uid,jdbcType=VARCHAR},
+      </if>
+      <if test="ufid != null">
+        ufid = #{ufid,jdbcType=VARCHAR},
+      </if>
+      <if test="newUser != null">
+        new_user = #{newUser,jdbcType=INTEGER},
+      </if>
+      <if test="signSum != null">
+        sign_sum = #{signSum,jdbcType=INTEGER},
+      </if>
+      <if test="longitude != null">
+        longitude = #{longitude,jdbcType=VARCHAR},
+      </if>
+      <if test="latitude != null">
+        latitude = #{latitude,jdbcType=VARCHAR},
+      </if>
+      <if test="clockIn != null">
+        clock_in = #{clockIn,jdbcType=INTEGER},
+      </if>
+      <if test="clockInTime != null">
+        clock_in_time = #{clockInTime,jdbcType=TIMESTAMP},
+      </if>
+      <if test="photoUrl != null">
+        photo_url = #{photoUrl,jdbcType=VARCHAR},
+      </if>
+      <if test="districtName != null">
+        district_name = #{districtName,jdbcType=VARCHAR},
+      </if>
+      <if test="clockInRemarks != null">
+        clock_in_remarks = #{clockInRemarks,jdbcType=VARCHAR},
+      </if>
+      <if test="duration != null">
+        duration = #{duration,jdbcType=DOUBLE},
+      </if>
+      <if test="mainStatus != null">
+        main_status = #{mainStatus,jdbcType=INTEGER},
+      </if>
+      <if test="updateTime != null">
+        update_time = #{updateTime,jdbcType=TIMESTAMP},
+      </if>
+    </set>
+    where id = #{id,jdbcType=INTEGER}
+  </update>
+  <update id="updateByPrimaryKey" parameterType="com.goafanti.common.model.PublicReleaseDetails">
+    update public_release_details
+    set prid = #{prid,jdbcType=INTEGER},
+      `uid` = #{uid,jdbcType=VARCHAR},
+      ufid = #{ufid,jdbcType=VARCHAR},
+      new_user = #{newUser,jdbcType=INTEGER},
+      sign_sum = #{signSum,jdbcType=INTEGER},
+      longitude = #{longitude,jdbcType=VARCHAR},
+      latitude = #{latitude,jdbcType=VARCHAR},
+      clock_in = #{clockIn,jdbcType=INTEGER},
+      clock_in_time = #{clockInTime,jdbcType=TIMESTAMP},
+      photo_url = #{photoUrl,jdbcType=VARCHAR},
+      district_name = #{districtName,jdbcType=VARCHAR},
+      clock_in_remarks = #{clockInRemarks,jdbcType=VARCHAR},
+      duration = #{duration,jdbcType=DOUBLE},
+      main_status = #{mainStatus,jdbcType=INTEGER},
+      update_time = #{updateTime,jdbcType=TIMESTAMP}
+    where id = #{id,jdbcType=INTEGER}
+  </update>
+
+
+  <select id="selectByPCid" resultType="com.goafanti.weChat.bo.OutPublicReleaseDetails">
+    select
+      a.id,a.prid, a.`uid`, a.ufid, a.new_user newUser,a.longitude,a.latitude,b.nickname userName,
+      a.district_name districtName ,a.clock_in clockIn,date_format(a.clock_in_time, '%Y-%m-%d %H:%i:%S')  clockInTimes,a.photo_url photoUrl
+    from public_release_details a left join user b on a.uid=b.id
+    where prid = #{id,jdbcType=INTEGER} order by a.update_time desc
+  </select>
+
+  <insert id="insertBatch">
+    insert into public_release_details (prid, `uid`, ufid,
+    new_user, sign_sum, longitude,
+    latitude, clock_in, clock_in_time,
+    photo_url, district_name,duration,main_status)
+    values
+    <foreach  collection="list" item="prd"  separator=",">
+      (#{prd.prid,jdbcType=INTEGER}, #{prd.uid,jdbcType=VARCHAR}, #{prd.ufid,jdbcType=VARCHAR},
+      #{prd.newUser,jdbcType=INTEGER}, #{prd.signSum,jdbcType=INTEGER}, #{prd.longitude,jdbcType=VARCHAR},
+      #{prd.latitude,jdbcType=VARCHAR}, #{prd.clockIn,jdbcType=INTEGER}, #{prd.clockInTime,jdbcType=TIMESTAMP},
+      #{prd.photoUrl,jdbcType=VARCHAR}, #{prd.districtName,jdbcType=VARCHAR},#{prd.duration,jdbcType=DOUBLE},
+      #{prd.mainStatus,jdbcType=INTEGER})
+    </foreach>
+  </insert>
+
+  <select id="getNamesByPrid" resultType="java.lang.String">
+    select  GROUP_CONCAT(b.nickname)userNames
+    from public_release_details a left join user b on a.uid =b.id
+    where prid = #{id}
+    group by prid
+  </select>
+  <select id="selectBypridAndUid" resultType="com.goafanti.weChat.bo.OutPublicReleaseDetails">
+    select
+      a.id,a.prid, a.`uid`, a.ufid, a.new_user newUser,a.longitude,a.latitude,b.nickname userName,
+      a.district_name districtName ,a.clock_in clockIn,date_format(a.clock_in_time, '%Y-%m-%d %H:%i:%S')  clockInTimes,a.photo_url photoUrl
+    from public_release_details a left join user b on a.uid=b.id
+    where prid = #{id,jdbcType=INTEGER} and uid =#{uid}
+  </select>
+
+  <update id="updateDistrictByPrid">
+    update public_release_details
+    set longitude = #{longitude,jdbcType=VARCHAR},
+        latitude = #{latitude,jdbcType=VARCHAR},
+        district_name = #{districtName,jdbcType=VARCHAR}
+    where prid =#{id}
+  </update>
+</mapper>

+ 10 - 7
src/main/java/com/goafanti/common/mapper/PublicReleaseLogMapper.xml

@@ -44,7 +44,7 @@
       This element is automatically generated by MyBatis Generator, do not modify.
       This element was generated on Thu Jun 24 11:35:04 CST 2021.
     -->
-    select 
+    select
     <include refid="Base_Column_List" />
     ,
     <include refid="Blob_Column_List" />
@@ -66,11 +66,11 @@
       This element is automatically generated by MyBatis Generator, do not modify.
       This element was generated on Thu Jun 24 11:35:04 CST 2021.
     -->
-    insert into public_release_log (id, prid, aid, 
-      remarks, `status`, create_time, 
+    insert into public_release_log (id, prid, aid,
+      remarks, `status`, create_time,
       photo_url)
-    values (#{id,jdbcType=INTEGER}, #{prid,jdbcType=INTEGER}, #{aid,jdbcType=VARCHAR}, 
-      #{remarks,jdbcType=VARCHAR}, #{status,jdbcType=INTEGER}, #{createTime,jdbcType=TIMESTAMP}, 
+    values (#{id,jdbcType=INTEGER}, #{prid,jdbcType=INTEGER}, #{aid,jdbcType=VARCHAR},
+      #{remarks,jdbcType=VARCHAR}, #{status,jdbcType=INTEGER}, #{createTime,jdbcType=TIMESTAMP},
       #{photoUrl,jdbcType=LONGVARCHAR})
   </insert>
   <insert id="insertSelective" parameterType="com.goafanti.common.model.PublicReleaseLog">
@@ -190,14 +190,17 @@
 	date_format(a.create_time ,'%Y-%m-%d %H:%i:%S') createTimes
 	from public_release_log a left join admin b on a.aid =b.id
 	left  join public_release pr  on a.prid =pr.id
+    <if test="ufid !=null">
+  left join public_release_details prd on pr.id=prd.prid
+    </if>
 	where 1=1
 	<if test="id !=null">
 	and a.prid = #{id}
 	</if>
 	<if test="ufid !=null">
-	and pr.ufid  = #{ufid}
+	and prd.ufid  = #{ufid}
 	</if>
 	order by a.create_time desc
   </select>
 
-</mapper>
+</mapper>

+ 187 - 240
src/main/java/com/goafanti/common/mapper/PublicReleaseMapper.xml

@@ -3,27 +3,17 @@
 <mapper namespace="com.goafanti.common.dao.PublicReleaseMapper">
   <resultMap id="BaseResultMap" type="com.goafanti.common.model.PublicRelease">
     <id column="id" jdbcType="INTEGER" property="id" />
-    <result column="uid" jdbcType="VARCHAR" property="uid" />
     <result column="aid" jdbcType="VARCHAR" property="aid" />
     <result column="release_start" jdbcType="TIMESTAMP" property="releaseStart" />
     <result column="release_end" jdbcType="TIMESTAMP" property="releaseEnd" />
     <result column="remarks" jdbcType="VARCHAR" property="remarks" />
     <result column="annex_url" jdbcType="VARCHAR" property="annexUrl" />
-    <result column="user_name" jdbcType="VARCHAR" property="userName" />
-    <result column="longitude" jdbcType="VARCHAR" property="longitude" />
-    <result column="latitude" jdbcType="VARCHAR" property="latitude" />
     <result column="status" jdbcType="INTEGER" property="status" />
     <result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
-    <result column="clock_in" jdbcType="INTEGER" property="clockIn" />
-    <result column="clock_in_time" jdbcType="TIMESTAMP" property="clockInTime" />
-    <result column="photo_url" jdbcType="VARCHAR" property="photoUrl" />
     <result column="pid" jdbcType="VARCHAR" property="pid" />
     <result column="pname" jdbcType="VARCHAR" property="pname" />
-    <result column="ufid" jdbcType="VARCHAR" property="ufid" />
     <result column="duration" jdbcType="DOUBLE" property="duration" />
     <result column="valid_date" jdbcType="VARCHAR" property="validDate" />
-    <result column="new_user" jdbcType="INTEGER" property="newUser" />
-    <result column="sign_sum" jdbcType="INTEGER" property="signSum" />
     <result column="main_status" jdbcType="INTEGER" property="mainStatus" />
     <result column="supplement" jdbcType="VARCHAR" property="supplement" />
     <result column="audit_info" jdbcType="VARCHAR" property="auditInfo" />
@@ -39,20 +29,23 @@
     <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" />
-    <result column="clock_in_remarks" jdbcType="VARCHAR" property="clockInRemarks" />
     <result column="reject_name" jdbcType="VARCHAR" property="rejectName" />
     <result column="assistant_aid" jdbcType="VARCHAR" property="assistantAid" />
     <result column="assistant_name" jdbcType="VARCHAR" property="assistantName" />
     <result column="public_again" jdbcType="INTEGER" property="publicAgain" />
     <result column="audit_time" jdbcType="TIMESTAMP" property="auditTime" />
+    <result column="ufid" jdbcType="VARCHAR" property="ufid" />
+    <result column="new_user" jdbcType="VARCHAR" property="newUser" />
+    <result column="sign_sum" jdbcType="VARCHAR" property="signSum" />
+    <result column="user_names" jdbcType="VARCHAR" property="userNames" />
+    <result column="object_type" jdbcType="INTEGER" property="objectType" />
   </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,
-    assist, assist_aid, assist_aid_name, main_id, main_name, clock_in_remarks, reject_name,
-    assistant_aid, assistant_name, public_again, audit_time
+    id, aid, release_start, release_end, remarks, annex_url, `status`, create_time, pid,
+    pname, duration, valid_date, main_status, supplement, audit_info, `plan`, expected_effect,
+    next_plan, `type`, order_no, update_time, update_status, assist, assist_aid, assist_aid_name,
+    main_id, main_name, reject_name, assistant_aid, assistant_name, public_again, audit_time,
+    ufid, new_user, sign_sum, user_names, object_type
   </sql>
   <select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
     select
@@ -65,43 +58,36 @@
     where id = #{id,jdbcType=INTEGER}
   </delete>
   <insert id="insert" keyColumn="id" keyProperty="id" parameterType="com.goafanti.common.model.PublicRelease" useGeneratedKeys="true">
-    insert into public_release (`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, assist, assist_aid,
-      assist_aid_name, main_id, main_name,
-      clock_in_remarks, reject_name, assistant_aid,
-      assistant_name, public_again, audit_time
+    insert into public_release (aid, release_start, release_end,
+      remarks, annex_url, `status`,
+      create_time, pid, pname,
+      duration, valid_date, main_status,
+      supplement, audit_info, `plan`,
+      expected_effect, next_plan, `type`,
+      order_no, update_time, update_status,
+      assist, assist_aid, assist_aid_name,
+      main_id, main_name, reject_name,
+      assistant_aid, assistant_name, public_again,
+      audit_time, ufid, new_user,
+      sign_sum, user_names, object_type
       )
-    values (#{uid,jdbcType=VARCHAR}, #{aid,jdbcType=VARCHAR}, #{releaseStart,jdbcType=TIMESTAMP},
-      #{releaseEnd,jdbcType=TIMESTAMP}, #{remarks,jdbcType=VARCHAR}, #{annexUrl,jdbcType=VARCHAR},
-      #{userName,jdbcType=VARCHAR}, #{longitude,jdbcType=VARCHAR}, #{latitude,jdbcType=VARCHAR},
-      #{status,jdbcType=INTEGER}, #{createTime,jdbcType=TIMESTAMP}, #{clockIn,jdbcType=INTEGER},
-      #{clockInTime,jdbcType=TIMESTAMP}, #{photoUrl,jdbcType=VARCHAR}, #{pid,jdbcType=VARCHAR},
-      #{pname,jdbcType=VARCHAR}, #{ufid,jdbcType=VARCHAR}, #{duration,jdbcType=DOUBLE},
-      #{validDate,jdbcType=VARCHAR}, #{newUser,jdbcType=INTEGER}, #{signSum,jdbcType=INTEGER},
-      #{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}, #{assist,jdbcType=INTEGER}, #{assistAid,jdbcType=VARCHAR},
-      #{assistAidName,jdbcType=VARCHAR}, #{mainId,jdbcType=INTEGER}, #{mainName,jdbcType=VARCHAR},
-      #{clockInRemarks,jdbcType=VARCHAR}, #{rejectName,jdbcType=VARCHAR}, #{assistantAid,jdbcType=VARCHAR},
-      #{assistantName,jdbcType=VARCHAR}, #{publicAgain,jdbcType=INTEGER}, #{auditTime,jdbcType=TIMESTAMP}
+    values (#{aid,jdbcType=VARCHAR}, #{releaseStart,jdbcType=TIMESTAMP}, #{releaseEnd,jdbcType=TIMESTAMP},
+      #{remarks,jdbcType=VARCHAR}, #{annexUrl,jdbcType=VARCHAR}, #{status,jdbcType=INTEGER},
+      #{createTime,jdbcType=TIMESTAMP}, #{pid,jdbcType=VARCHAR}, #{pname,jdbcType=VARCHAR},
+      #{duration,jdbcType=DOUBLE}, #{validDate,jdbcType=VARCHAR}, #{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},
+      #{assist,jdbcType=INTEGER}, #{assistAid,jdbcType=VARCHAR}, #{assistAidName,jdbcType=VARCHAR},
+      #{mainId,jdbcType=INTEGER}, #{mainName,jdbcType=VARCHAR}, #{rejectName,jdbcType=VARCHAR},
+      #{assistantAid,jdbcType=VARCHAR}, #{assistantName,jdbcType=VARCHAR}, #{publicAgain,jdbcType=INTEGER},
+      #{auditTime,jdbcType=TIMESTAMP}, #{ufid,jdbcType=VARCHAR}, #{newUser,jdbcType=VARCHAR},
+      #{signSum,jdbcType=VARCHAR}, #{userNames,jdbcType=VARCHAR}, #{objectType,jdbcType=INTEGER}
       )
   </insert>
   <insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="com.goafanti.common.model.PublicRelease" useGeneratedKeys="true">
     insert into public_release
     <trim prefix="(" suffix=")" suffixOverrides=",">
-      <if test="uid != null">
-        `uid`,
-      </if>
       <if test="aid != null">
         aid,
       </if>
@@ -117,51 +103,24 @@
       <if test="annexUrl != null">
         annex_url,
       </if>
-      <if test="userName != null">
-        user_name,
-      </if>
-      <if test="longitude != null">
-        longitude,
-      </if>
-      <if test="latitude != null">
-        latitude,
-      </if>
       <if test="status != null">
         `status`,
       </if>
       <if test="createTime != null">
         create_time,
       </if>
-      <if test="clockIn != null">
-        clock_in,
-      </if>
-      <if test="clockInTime != null">
-        clock_in_time,
-      </if>
-      <if test="photoUrl != null">
-        photo_url,
-      </if>
       <if test="pid != null">
         pid,
       </if>
       <if test="pname != null">
         pname,
       </if>
-      <if test="ufid != null">
-        ufid,
-      </if>
       <if test="duration != null">
         duration,
       </if>
       <if test="validDate != null">
         valid_date,
       </if>
-      <if test="newUser != null">
-        new_user,
-      </if>
-      <if test="signSum != null">
-        sign_sum,
-      </if>
       <if test="mainStatus != null">
         main_status,
       </if>
@@ -207,9 +166,6 @@
       <if test="mainName != null">
         main_name,
       </if>
-      <if test="clockInRemarks != null">
-        clock_in_remarks,
-      </if>
       <if test="rejectName != null">
         reject_name,
       </if>
@@ -225,11 +181,23 @@
       <if test="auditTime != null">
         audit_time,
       </if>
+      <if test="ufid != null">
+        ufid,
+      </if>
+      <if test="newUser != null">
+        new_user,
+      </if>
+      <if test="signSum != null">
+        sign_sum,
+      </if>
+      <if test="userNames != null">
+        user_names,
+      </if>
+      <if test="objectType != null">
+        object_type,
+      </if>
     </trim>
     <trim prefix="values (" suffix=")" suffixOverrides=",">
-      <if test="uid != null">
-        #{uid,jdbcType=VARCHAR},
-      </if>
       <if test="aid != null">
         #{aid,jdbcType=VARCHAR},
       </if>
@@ -245,51 +213,24 @@
       <if test="annexUrl != null">
         #{annexUrl,jdbcType=VARCHAR},
       </if>
-      <if test="userName != null">
-        #{userName,jdbcType=VARCHAR},
-      </if>
-      <if test="longitude != null">
-        #{longitude,jdbcType=VARCHAR},
-      </if>
-      <if test="latitude != null">
-        #{latitude,jdbcType=VARCHAR},
-      </if>
       <if test="status != null">
         #{status,jdbcType=INTEGER},
       </if>
       <if test="createTime != null">
         #{createTime,jdbcType=TIMESTAMP},
       </if>
-      <if test="clockIn != null">
-        #{clockIn,jdbcType=INTEGER},
-      </if>
-      <if test="clockInTime != null">
-        #{clockInTime,jdbcType=TIMESTAMP},
-      </if>
-      <if test="photoUrl != null">
-        #{photoUrl,jdbcType=VARCHAR},
-      </if>
       <if test="pid != null">
         #{pid,jdbcType=VARCHAR},
       </if>
       <if test="pname != null">
         #{pname,jdbcType=VARCHAR},
       </if>
-      <if test="ufid != null">
-        #{ufid,jdbcType=VARCHAR},
-      </if>
       <if test="duration != null">
         #{duration,jdbcType=DOUBLE},
       </if>
       <if test="validDate != null">
         #{validDate,jdbcType=VARCHAR},
       </if>
-      <if test="newUser != null">
-        #{newUser,jdbcType=INTEGER},
-      </if>
-      <if test="signSum != null">
-        #{signSum,jdbcType=INTEGER},
-      </if>
       <if test="mainStatus != null">
         #{mainStatus,jdbcType=INTEGER},
       </if>
@@ -335,9 +276,6 @@
       <if test="mainName != null">
         #{mainName,jdbcType=VARCHAR},
       </if>
-      <if test="clockInRemarks != null">
-        #{clockInRemarks,jdbcType=VARCHAR},
-      </if>
       <if test="rejectName != null">
         #{rejectName,jdbcType=VARCHAR},
       </if>
@@ -353,14 +291,26 @@
       <if test="auditTime != null">
         #{auditTime,jdbcType=TIMESTAMP},
       </if>
+      <if test="ufid != null">
+        #{ufid,jdbcType=VARCHAR},
+      </if>
+      <if test="newUser != null">
+        #{newUser,jdbcType=VARCHAR},
+      </if>
+      <if test="signSum != null">
+        #{signSum,jdbcType=VARCHAR},
+      </if>
+      <if test="userNames != null">
+        #{userNames,jdbcType=VARCHAR},
+      </if>
+      <if test="objectType != null">
+        #{objectType,jdbcType=INTEGER},
+      </if>
     </trim>
   </insert>
   <update id="updateByPrimaryKeySelective" parameterType="com.goafanti.common.model.PublicRelease">
     update public_release
     <set>
-      <if test="uid != null">
-        `uid` = #{uid,jdbcType=VARCHAR},
-      </if>
       <if test="aid != null">
         aid = #{aid,jdbcType=VARCHAR},
       </if>
@@ -376,51 +326,24 @@
       <if test="annexUrl != null">
         annex_url = #{annexUrl,jdbcType=VARCHAR},
       </if>
-      <if test="userName != null">
-        user_name = #{userName,jdbcType=VARCHAR},
-      </if>
-      <if test="longitude != null">
-        longitude = #{longitude,jdbcType=VARCHAR},
-      </if>
-      <if test="latitude != null">
-        latitude = #{latitude,jdbcType=VARCHAR},
-      </if>
       <if test="status != null">
         `status` = #{status,jdbcType=INTEGER},
       </if>
       <if test="createTime != null">
         create_time = #{createTime,jdbcType=TIMESTAMP},
       </if>
-      <if test="clockIn != null">
-        clock_in = #{clockIn,jdbcType=INTEGER},
-      </if>
-      <if test="clockInTime != null">
-        clock_in_time = #{clockInTime,jdbcType=TIMESTAMP},
-      </if>
-      <if test="photoUrl != null">
-        photo_url = #{photoUrl,jdbcType=VARCHAR},
-      </if>
       <if test="pid != null">
         pid = #{pid,jdbcType=VARCHAR},
       </if>
       <if test="pname != null">
         pname = #{pname,jdbcType=VARCHAR},
       </if>
-      <if test="ufid != null">
-        ufid = #{ufid,jdbcType=VARCHAR},
-      </if>
       <if test="duration != null">
         duration = #{duration,jdbcType=DOUBLE},
       </if>
       <if test="validDate != null">
         valid_date = #{validDate,jdbcType=VARCHAR},
       </if>
-      <if test="newUser != null">
-        new_user = #{newUser,jdbcType=INTEGER},
-      </if>
-      <if test="signSum != null">
-        sign_sum = #{signSum,jdbcType=INTEGER},
-      </if>
       <if test="mainStatus != null">
         main_status = #{mainStatus,jdbcType=INTEGER},
       </if>
@@ -466,9 +389,6 @@
       <if test="mainName != null">
         main_name = #{mainName,jdbcType=VARCHAR},
       </if>
-      <if test="clockInRemarks != null">
-        clock_in_remarks = #{clockInRemarks,jdbcType=VARCHAR},
-      </if>
       <if test="rejectName != null">
         reject_name = #{rejectName,jdbcType=VARCHAR},
       </if>
@@ -484,32 +404,37 @@
       <if test="auditTime != null">
         audit_time = #{auditTime,jdbcType=TIMESTAMP},
       </if>
+      <if test="ufid != null">
+        ufid = #{ufid,jdbcType=VARCHAR},
+      </if>
+      <if test="newUser != null">
+        new_user = #{newUser,jdbcType=VARCHAR},
+      </if>
+      <if test="signSum != null">
+        sign_sum = #{signSum,jdbcType=VARCHAR},
+      </if>
+      <if test="userNames != null">
+        user_names = #{userNames,jdbcType=VARCHAR},
+      </if>
+      <if test="objectType != null">
+        object_type = #{objectType,jdbcType=INTEGER},
+      </if>
     </set>
     where id = #{id,jdbcType=INTEGER}
   </update>
   <update id="updateByPrimaryKey" parameterType="com.goafanti.common.model.PublicRelease">
     update public_release
-    set `uid` = #{uid,jdbcType=VARCHAR},
-      aid = #{aid,jdbcType=VARCHAR},
+    set aid = #{aid,jdbcType=VARCHAR},
       release_start = #{releaseStart,jdbcType=TIMESTAMP},
       release_end = #{releaseEnd,jdbcType=TIMESTAMP},
       remarks = #{remarks,jdbcType=VARCHAR},
       annex_url = #{annexUrl,jdbcType=VARCHAR},
-      user_name = #{userName,jdbcType=VARCHAR},
-      longitude = #{longitude,jdbcType=VARCHAR},
-      latitude = #{latitude,jdbcType=VARCHAR},
       `status` = #{status,jdbcType=INTEGER},
       create_time = #{createTime,jdbcType=TIMESTAMP},
-      clock_in = #{clockIn,jdbcType=INTEGER},
-      clock_in_time = #{clockInTime,jdbcType=TIMESTAMP},
-      photo_url = #{photoUrl,jdbcType=VARCHAR},
       pid = #{pid,jdbcType=VARCHAR},
       pname = #{pname,jdbcType=VARCHAR},
-      ufid = #{ufid,jdbcType=VARCHAR},
       duration = #{duration,jdbcType=DOUBLE},
       valid_date = #{validDate,jdbcType=VARCHAR},
-      new_user = #{newUser,jdbcType=INTEGER},
-      sign_sum = #{signSum,jdbcType=INTEGER},
       main_status = #{mainStatus,jdbcType=INTEGER},
       supplement = #{supplement,jdbcType=VARCHAR},
       audit_info = #{auditInfo,jdbcType=VARCHAR},
@@ -525,35 +450,43 @@
       assist_aid_name = #{assistAidName,jdbcType=VARCHAR},
       main_id = #{mainId,jdbcType=INTEGER},
       main_name = #{mainName,jdbcType=VARCHAR},
-      clock_in_remarks = #{clockInRemarks,jdbcType=VARCHAR},
       reject_name = #{rejectName,jdbcType=VARCHAR},
       assistant_aid = #{assistantAid,jdbcType=VARCHAR},
       assistant_name = #{assistantName,jdbcType=VARCHAR},
       public_again = #{publicAgain,jdbcType=INTEGER},
-      audit_time = #{auditTime,jdbcType=TIMESTAMP}
+      audit_time = #{auditTime,jdbcType=TIMESTAMP},
+      ufid = #{ufid,jdbcType=VARCHAR},
+      new_user = #{newUser,jdbcType=VARCHAR},
+      sign_sum = #{signSum,jdbcType=VARCHAR},
+      user_names = #{userNames,jdbcType=VARCHAR},
+      object_type = #{objectType,jdbcType=INTEGER}
     where id = #{id,jdbcType=INTEGER}
   </update>
 
   <update id="updateSignByAidAndUid">
-    update public_release a ,(select max(create_time)create_time from public_release
-      where aid= #{aid} and uid=#{uid} and main_status =1 group by aid,uid)b
+    update public_release_details a left join public_release b on a.prid =b.id
+      left join `user` c on a.uid=c.id
     set a.sign_sum =a.sign_sum +1
-    where a.aid =#{aid} and a.uid =#{uid} and a.main_status =1 and a.create_time =b.create_time
+    where a.uid=  #{uid} and a.main_status =1 and b.aid=  #{aid}
   </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,a.aid,
+    select  a.id ,c.name  aname,date_format(a.release_start,'%Y-%m-%d %H:%i:%S') releaseStarts,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,
+    date_format(a.update_time ,'%Y-%m-%d %H:%i:%S') updateTimes,a.update_status updateStatus,x.district_name districtName,
     a.assist,a.assist_aid assistAid,a.assist_aid_name assistAidName,a.type,a.main_name mainName,a.reject_name rejectName,
-    a.assistant_aid assistantAid ,a.assistant_name assistantName,a.public_again publicAgain
-    from public_release a left join `user` b on a.uid =b.id left join admin c on a.aid =c.id
+    a.assistant_aid assistantAid ,a.assistant_name assistantName,a.public_again publicAgain,a.user_names userNames
+    from public_release a  left join admin c on a.aid =c.id
+    left join (select min(prid)id,min(district_name)district_name from public_release_details group by prid )x on a.id=x.id
   <if test="type==2">
     left join department d on c.department_id =d.id
   </if>
       where 1=1
     <if test="type==0">
+      <if test="assist ==0">
+        and a.assist in(0,1)
+      </if>
       <if test="assist == 2">
         and a.assist    =2
       </if>
@@ -563,9 +496,6 @@
       <if test="assist ==4">
         and a.assist in (2,3)
       </if>
-        <if test="assist !=2 and assist !=3 and assist !=4 and assistType !=1">
-          and a.assist in(0,1)
-        </if>
         <if test="aid !=null">
         and a.aid= #{aid}
         </if>
@@ -594,15 +524,9 @@
 	<if test="releaseStarts != null and publicEnd != null">
 	and a.release_start  BETWEEN #{releaseStarts} and #{publicEnd}
 	</if>
-	<if test="userName !=null">
-	and b.nickname like CONCAT('%',#{userName},'%')
-	</if>
 	<if test="status !=null">
 	and a.status = #{status}
 	</if>
-	<if test="clockIn !=null">
-	and a.clock_in = #{clockIn}
-	</if>
     <if test="type==2">
       ORDER BY a.create_time desc
     </if>
@@ -617,12 +541,15 @@
   </select>
   <select id="countPublicRelease" resultType="java.lang.Integer">
   select  count(*)
-	from public_release a left join `user` b on a.uid =b.id left join admin c on a.aid =c.id
+	from public_release a  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">
+      <if test="assist ==0">
+        and a.assist in(0,1)
+      </if>
       <if test="assist == 2">
         and a.assist    =2
       </if>
@@ -632,9 +559,6 @@
       <if test="assist ==4">
         and a.assist in (2,3)
       </if>
-      <if test="assist !=2 and assist !=3 and assist !=4 and assistType !=1">
-        and a.assist in(0,1)
-      </if>
       <if test="assistType ==1">
         and a.assist in(0,1,2)
       </if>
@@ -666,52 +590,61 @@
 	<if test="releaseStarts != null and publicEnd != null">
 	and a.release_start  BETWEEN #{releaseStarts} and #{publicEnd}
 	</if>
-	<if test="userName !=null">
-	and b.nickname like CONCAT('%',#{userName},'%')
-	</if>
+
 	<if test="status !=null">
 	and a.status = #{status}
 	</if>
-	<if test="clockIn !=null">
-	and a.clock_in = #{clockIn}
-	</if>
   </select>
 
   <select id="selectDtails" resultType="com.goafanti.weChat.bo.OutPublicRelease">
-    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.update_time updateTime,
+    select  a.id,c.name  aname,date_format(a.release_start,'%Y-%m-%d %H:%i:%S') releaseStarts,a.update_time updateTime,a.user_names userNames,
     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,
+    a.annex_url annexUrl ,a.remarks,a.duration ,a.valid_date validDate ,a.aid ,c.superior_id suprId,
+    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,a.assist,a.assist_aid assistAid,a.assist_aid_name assistAidName,
-    a.main_name mainName,a.assistant_aid assistantAid,a.assistant_name assistantName,a.public_again publicAhain
-    from public_release a left join `user` b on a.uid =b.id left join admin c on a.aid =c.id
+    a.main_name mainName,a.assistant_aid assistantAid,a.assistant_name assistantName,a.public_again publicAhain,x.uids
+    from public_release a  left join admin c on a.aid =c.id
+    left join (select prid ,GROUP_CONCAT(uid)uids from public_release_details where prid= #{id} group by prid)x on a.id=x.prid
     left join t_order_new d on a.order_no=d.order_no
     where 1=1
 	<if test="id !=null">
 	and a.id= #{id}
 	</if>
-	<if test="ufid !=null">
-	and a.ufid= #{ufid}
-	</if>
-
+  </select>
+  <select id="selectDtailsByFid" resultType="com.goafanti.weChat.bo.OutPublicReleaseAndDetails">
+    select  a.id,c.name  aname,date_format(a.release_start,'%Y-%m-%d %H:%i:%S') releaseStarts,a.update_time updateTime,a.user_names userNames,
+    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.aid ,c.superior_id suprId,x.uid uids,x.district_name districtName ,u.nickname,
+    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,a.assist,a.assist_aid assistAid,a.assist_aid_name assistAidName,
+    a.main_name mainName,a.assistant_aid assistantAid,a.assistant_name assistantName,a.public_again publicAhain
+    from public_release a  left join admin c on a.aid =c.id
+    left join  public_release_details x on a.id=x.prid
+    left join user u on x.uid=u.id
+    left join t_order_new d on a.order_no=d.order_no
+    where 1=1
+    <if test="ufid !=null">
+      and x.ufid= #{ufid}
+    </if>
   </select>
 
   <select id="listPublicStatistics" resultType="com.goafanti.weChat.bo.OutPublicStatistics">
   	select y.aid,y.bh,y.dk,y.wsh,y.tg,y.duration,c.name from(select x.aid ,sum(x.bh)bh,sum(x.wsh)wsh,sum(x.tg)tg,sum(x.dk)dk,sum(x.duration)duration
-	from (select if(a.status=0,1,0)bh ,if(a.status=1,1,0)wsh,if(a.status=2,1,0)tg,if(a.clock_in=1,1,0) dk,a.aid
-  	,if(a.status=2,a.duration,0)duration    from  public_release a  left join admin b on a.aid=b.id
-	where 1=1
+	from (select a.aid, if(a.status=0,1,0)bh ,if(a.status=1,1,0)wsh,if(a.status=2,1,0)tg,b.dk ,if(a.status=2,a.duration,0)duration
+    from public_release a inner join (select prid ,sum(if(clock_in=1,1,0))dk from public_release_details where 1=1
+    <if test="clockStart != null and clockEnd != null">
+      and clock_in_time  between #{clockStart} and #{clockEnd}
+    </if>
+    group by prid ) b on a.id =b.prid
+    left join admin c on a.aid=c.id where 1=1
 	<if test="aid != null">
 	and a.aid= #{aid}
 	</if>
-	<if test="clockStart != null and clockEnd != null">
-	and a.clock_in_time  between #{clockStart} and #{clockEnd}
-	</if>
 	<if test="createStart != null and createEnd !=null">
 	and a.create_time  between #{createStart} and #{createEnd}
 	</if>
 	<if test="depId != null">
-	and b.department_id = #{depId}
+	and c.department_id = #{depId}
 	</if>
 	)x  group by x.aid)y left join admin c on c.id=y.aid
 	<if test="page_sql!=null">
@@ -721,42 +654,46 @@
 
 
   <select id="countPublicStatistics" resultType="java.lang.Integer">
-  	select count(*) from (select aid from public_release a  left join admin b on a.aid=b.id
+  	select count(*) from (select aid from public_release a
+    inner join (select prid ,sum(if(clock_in=1,1,0))dk from public_release_details where 1=1
+    <if test="clockStart != null and clockEnd != null">
+      and clock_in_time  between #{clockStart} and #{clockEnd}
+    </if>
+    group by prid ) b on a.id =b.prid
+  	    left join admin c on a.aid=c.id
 	where 1=1
 	<if test="aid != null">
 	and a.aid= #{aid}
 	</if>
-	<if test="clockStart != null and clockEnd != null">
-	and a.clock_in_time  between #{clockStart} and #{clockEnd}
-	</if>
 	<if test="createStart != null and createEnd !=null">
 	and a.create_time  between #{createStart} and #{createEnd}
 	</if>
 	<if test="depId != null">
-	and b.department_id = #{depId}
+	and c.department_id = #{depId}
 	</if>
 	group by aid)x
   </select>
 
   <select id="listPublicDtails" resultType="com.goafanti.weChat.bo.OutPublicDtails">
-    select a.id,b.nickname ,a.user_name userName,c.name aname,a.duration ,a.status,a.annex_url annexUrl,a.photo_url photoUrl,
-    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,date_format(a.audit_time ,'%Y-%m-%d %H:%i:%S') auditTimes,
-    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.assist_aid_name assistAidName,
-    a.main_name mainName,a.assist,a.assistant_aid assistantAid, a.assistant_name assistantName,e.contract_no contractNo,
-    e.total_amount  totalAmout
-    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 left join t_order_new e on a.order_no =e.order_no
+    select b.id,a.district_name districtName ,c.name aname,a.duration ,b.status ,b.annex_url annexUrl,a.photo_url photoUrl,d.nickname userName,
+    date_format(a.clock_in_time ,'%Y-%m-%d %H:%i:%S') clockInTimes,a.clock_in clockIn ,b.remarks ,b.supplement ,b.`type` ,b.object_type objectType ,
+    date_format(b.create_time ,'%Y-%m-%d %H:%i:%S') createTimes,b.audit_info auditInfo,date_format(b.audit_time ,'%Y-%m-%d %H:%i:%S') auditTimes,
+    date_format(b.release_start,'%Y-%m-%d %H:%i:%S') releaseStarts,date_format(b.release_end ,'%Y-%m-%d %H:%i:%S') releaseEnds,
+    b.plan ,b.next_plan nextPlan ,b.expected_effect expectedEffect,b.update_status updateStatus,b.assist_aid_name assistAidName,
+    b.main_name mainName,b.assist,b.assistant_aid assistantAid, b.assistant_name assistantName,f.contract_no contractNo,
+    e.name sname,f.total_amount  totalAmout
+    from public_release_details a left join public_release b on a.prid =b.id
+    left join admin c on b.aid =c.id left join t_order_new f on b.order_no =f.order_no
+    left join `user` d on a.uid =d.id  left join admin e on d.aid=e.id
     where 1=1
     <if test="publicType != null">
-      and a.type= #{publicType}
+      and b.type= #{publicType}
     </if>
     <if test="aid != null">
-      and a.aid= #{aid}
+      and b.aid= #{aid}
     </if>
     <if test="sid != null">
-      and d.id= #{sid}
+      and d.aid= #{sid}
     </if>
     <if test="deps !=null">
        and c.department_id in
@@ -768,18 +705,21 @@
 	and a.uid = #{uid}
 	</if>
 	<if test="releaseStart != null and releaseEnd != null">
-	and (a.release_start  between #{releaseStart} and #{releaseEnd} or a.release_end  between #{releaseStart} and #{releaseEnd})
+	and (b.release_start  between #{releaseStart} and #{releaseEnd} or b.release_end  between #{releaseStart} and #{releaseEnd})
 	</if>
     <if test="createStart != null and createEnd != null">
-      and a.create_time  between #{createStart} and #{createEnd}
+      and b.create_time  between #{createStart} and #{createEnd}
     </if>
 	<if test="status != null">
-	and a.status = #{status}
+	and b.status = #{status}
 	</if>
 	<if test="clockIn !=null">
 	and a.clock_in= #{clockIn}
 	</if>
-    order by a.status,a.create_time desc
+    <if test="contractNo !=null">
+    and f.contract_no like CONCAT('%',#{contractNo},'%')
+    </if>
+    order by b.status,b.create_time desc
 	<if test="page_sql!=null">
 			${page_sql}
 	</if>
@@ -787,19 +727,22 @@
 
   <select id="countPublicDtails" resultType="java.lang.Integer">
   select count(*)
-	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
+    from public_release_details a left join public_release b on a.prid =b.id
+    left join admin c on b.aid =c.id left join `user` d on a.uid =d.id
+    <if test="contractNo !=null">
+    left join t_order_new f on b.order_no =f.order_no
+    </if>
+    where 1=1
     <if test="publicType != null">
-      and a.type= #{publicType}
+      and b.type= #{publicType}
     </if>
     <if test="aid != null">
-      and a.aid= #{aid}
+      and b.aid= #{aid}
     </if>
     <if test="sid != null">
-      and d.id= #{sid}
+      and d.aid= #{sid}
     </if>
-    <if test=" deps !=null">
+    <if test="deps !=null">
       and c.department_id in
       <foreach close=")" collection="deps" item="dep" open="(" separator=",">
         #{dep}
@@ -809,17 +752,20 @@
       and a.uid = #{uid}
     </if>
     <if test="releaseStart != null and releaseEnd != null">
-      and (a.release_start  between #{releaseStart} and #{releaseEnd} or a.release_end  between #{releaseStart} and #{releaseEnd})
+      and (b.release_start  between #{releaseStart} and #{releaseEnd} or b.release_end  between #{releaseStart} and #{releaseEnd})
     </if>
     <if test="createStart != null and createEnd != null">
-      and a.create_time  between #{createStart} and #{createEnd}
+      and b.create_time  between #{createStart} and #{createEnd}
     </if>
     <if test="status != null">
-      and a.status = #{status}
+      and b.status = #{status}
     </if>
     <if test="clockIn !=null">
       and a.clock_in= #{clockIn}
     </if>
+    <if test="contractNo !=null">
+      and f.contract_no like CONCAT('%',#{contractNo},'%')
+    </if>
   </select>
 
   <select id="checkTime" resultType="java.lang.Integer">
@@ -829,20 +775,21 @@
   or  (release_start &lt; #{end} and release_end &gt; #{end}))
   </select>
   <select id="getTimeUserFollow" resultType="com.goafanti.common.model.OutPublicReleaseCount">
-    select e.id province,d.id depId,a.aid,a.uid,a.new_user newUser ,1 quantity from (select aid,uid,new_user from public_release
-     where main_status =1 and create_time between #{date} and #{now}
-     group by aid,uid,new_user)a left join admin c on a.aid=c.id
+    select e.id province,d.id depId,a.aid,a.uid,a.new_user newUser ,1 quantity from (select a.aid,b.uid,b.new_user from public_release a
+        left join public_release_details b on a.id=b.prid
+     where b.main_status =1 and a.create_time  between #{date} and #{now}
+        group by a.aid,b.uid,b.new_user)a left join admin c on a.aid=c.id
     left join department d on c.department_id =d.id left join district_glossory e on d.province =e.id
   </select>
   <select id="publicByOrder" resultType="com.goafanti.weChat.bo.OutPublicRelease">
-    select a.id,a.uid,a.aid,b.nickname ,c.name aname,a.duration ,a.user_name userName,
-           date_format(a.release_start,'%Y-%m-%d %H:%i:%S')releaseStarts,
-           date_format(a.release_end ,'%Y-%m-%d %H:%i:%S')releaseEnds,
+    select a.id,a.uid,b.aid,b.nickname ,c.name aname,a.duration ,a.district_name districtName,
+           date_format(pr.release_start,'%Y-%m-%d %H:%i:%S')releaseStarts,
+           date_format(pr.release_end ,'%Y-%m-%d %H:%i:%S')releaseEnds,
            date_format(a.clock_in_time ,'%Y-%m-%d %H:%i:%S')clockInTimes,
-           a.remarks
-    from public_release a left join user b on a.uid=b.id
-                          left join admin c on a.aid =c.id
-    where a.order_no = #{orderNo}
+           pr.remarks
+    from public_release_details a left join public_release pr on a.prid=pr.id
+        left join user b on a.uid=b.id left join admin c on pr.aid =c.id
+    where pr.order_no = #{orderNo}
     </select>
   <select id="selectByMainId" parameterType="java.lang.Integer" resultMap="BaseResultMap">
     select

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

@@ -1769,7 +1769,7 @@ left join department d on o.order_dep = d.id   left join t_order_mid a on o.orde
       and new_user = #{newUser}
       and create_time  between #{date} and #{now}
   </select>
-  <select id="statisticsList" resultType="com.goafanti.order.bo.outStatisticsList">
+  <select id="statisticsList" resultType="com.goafanti.order.bo.OutStatisticsList">
     select z.id,z.province,z.counts,z.quantity,z.total
     from (select y.id,y.province,count(aid)counts,sum(quantity)quantity,sum(total)total
     from (select x.id,x.province,x.aid,sum(quantity)quantity, sum(x.total)total
@@ -1804,7 +1804,7 @@ left join department d on o.order_dep = d.id   left join t_order_mid a on o.orde
     </if>
     desc
   </select>
-  <select id="provinceStatisticsList" resultType="com.goafanti.order.bo.outProvinceStatisticsList">
+  <select id="provinceStatisticsList" resultType="com.goafanti.order.bo.OutProvinceStatisticsList">
     select  z.depName,z.aid,z.name,z.quantity,z.total
     from ( select x.depName,x.aid,x.name,sum(quantity)quantity,sum(total)total
     from ( select c.name depName,a.order_no,b.id aid,b.name name,
@@ -2061,7 +2061,25 @@ left join department d on o.order_dep = d.id   left join t_order_mid a on o.orde
     from t_order_new
     where buyer_id=#{uid} and salesman_id=#{aid}
   </select>
-
+  <select id="statisticsOrderList" resultType="com.goafanti.order.bo.StatisOrderList">
+    select d.id,d.name province,c.name depName,a.order_no,a.salesman_id aid ,b.name aname,
+           if(a.total_amount>0.5,1,if(a.total_amount>0 and a.order_type=1,0.5,0))quantity, a.total_amount total
+    from t_order_new a left join admin b on a.salesman_id =b.id left join department c on b.department_id =c.id
+    left join district_glossory d on c.province =d.id
+    where a.process_status >4 and a.delete_sign in(0,2)
+    <if test="depId !=null">
+      and  b.department_id = #{depId}
+    </if>
+    <if test="province !=null">
+      and c.province = #{province}
+    </if>
+    <if test="startCreate !=null and endCreate !=null">
+      and a.create_time between #{startCreate} and #{endCreate}
+    </if>
+    <if test="startSign !=null and endSign !=null">
+      and a.sign_time  between #{startSign} and #{endSign}
+    </if>
+  </select>
 
 
 </mapper>

+ 36 - 1
src/main/java/com/goafanti/common/mapper/UserMapperExt.xml

@@ -688,7 +688,8 @@
 			,e.id as ufbId,e.follow_situation as followSituation,e.customer_status as customerStatus
 		</if>
 		from user_follow a left join user b on a.uid = b.id left join organization_contact_book c on a.ocb_id = c.id
-		left join admin d on a.aid = d.id left join public_release pr on a.id =pr.ufid
+		left join admin d on a.aid = d.id left join public_release_details prd on a.id =prd.ufid
+		left join public_release pr on prd.prid=pr.id
 		<if test="businessProjectId != null and businessProjectId != ''"><!--  客户甲项目A所有的跟进记录 -->
 			inner join user_follow_business e on a.id = e.follow_id
 		</if>
@@ -2300,4 +2301,38 @@ inner join(
 			and a.transfer_time between #{startDate} and #{endDate}
 		</if>
 	</select>
+
+
+	<select id="selectNoChannelByaids" resultType="com.goafanti.admin.bo.AdminCustomerBo">
+		select aid,sum(if( share_type=0 and channel=0,1,0))userCount,
+		sum(if(share_type=3 and channel=1,1,0))channelCount, sum(if( share_type=2 ,1,0))signCount,
+		sum(if(share_type=0 and source =1 and channel=0,1,0))newCount, sum(if(share_type=0 and source =1 and channel=1,1,0))channelNewCount,
+		sum(if(share_type=0 and source =2 and channel=0,1,0))receiveCount from `user` where `type` =1 and new_channel=0
+		<if test="startTime != null and endTime != null">
+			and  transfer_time  between #{startTime,jdbcType=VARCHAR} and #{endTime,jdbcType=VARCHAR}
+		</if>
+		<if test="admins!= null">
+			and aid in
+			<foreach close=")" collection="admins" item="ad" open="(" separator=",">
+				#{ad.aid}
+			</foreach>
+		</if>
+		group by aid
+	</select>
+
+	<select id="selectChannelByaids" resultType="com.goafanti.admin.bo.AdminCustomerBo">
+		select a.aid,sum(if(c.channel=0,1,0))completeCount, sum(if(c.channel=1,1,0))channelCompleteCount
+		from public_release a left join public_release_details b on a.id=b.prid left join `user` c on b.uid=c.id
+		where b.clock_in =1
+		<if test="startTime != null and endTime != null">
+			and  c.transfer_time  between #{startTime,jdbcType=VARCHAR} and #{endTime,jdbcType=VARCHAR}
+		</if>
+		<if test="admins!= null">
+			and a.aid in
+			<foreach close=")" collection="admins" item="ad" open="(" separator=",">
+				#{ad.aid}
+			</foreach>
+		</if>
+		group by a.aid
+	</select>
 </mapper>

+ 65 - 143
src/main/java/com/goafanti/common/model/PublicRelease.java

@@ -11,11 +11,6 @@ public class PublicRelease implements Serializable {
     private Integer id;
 
     /**
-     * 客户id
-     */
-    private String uid;
-
-    /**
      * 公出人
      */
     private String aid;
@@ -41,21 +36,6 @@ public class PublicRelease implements Serializable {
     private String annexUrl;
 
     /**
-     * 公出企业名称
-     */
-    private String userName;
-
-    /**
-     * 经度
-     */
-    private String longitude;
-
-    /**
-     * 纬度
-     */
-    private String latitude;
-
-    /**
      * 状态 0驳回 1发起 2同意 3 撤销 4技术驳回
      */
     private Integer status;
@@ -66,21 +46,6 @@ public class PublicRelease implements Serializable {
     private Date createTime;
 
     /**
-     * 打卡状态 1正常打卡 2异常打卡
-     */
-    private Integer clockIn;
-
-    /**
-     * 打卡时间
-     */
-    private Date clockInTime;
-
-    /**
-     * 照片
-     */
-    private String photoUrl;
-
-    /**
      * 项目编号
      */
     private String pid;
@@ -91,11 +56,6 @@ public class PublicRelease implements Serializable {
     private String pname;
 
     /**
-     * 跟进id
-     */
-    private String ufid;
-
-    /**
      * 时长
      */
     private Double duration;
@@ -106,16 +66,6 @@ public class PublicRelease implements Serializable {
     private String validDate;
 
     /**
-     * 客户类型 0新客户 1老客户
-     */
-    private Integer newUser;
-
-    /**
-     * 签单数
-     */
-    private Integer signSum;
-
-    /**
      * 0辅助根据 1主要跟进
      */
     private Integer mainStatus;
@@ -191,11 +141,6 @@ public class PublicRelease implements Serializable {
     private String mainName;
 
     /**
-     * 打卡说明
-     */
-    private String clockInRemarks;
-
-    /**
      * 驳回人员
      */
     private String rejectName;
@@ -220,6 +165,31 @@ public class PublicRelease implements Serializable {
      */
     private Date auditTime;
 
+    /**
+     * 跟进id
+     */
+    private String ufid;
+
+    /**
+     * 客户类型 0新客户 1老客户
+     */
+    private String newUser;
+
+    /**
+     * 签单数
+     */
+    private String signSum;
+
+    /**
+     * 公司名称
+     */
+    private String userNames;
+
+    /**
+     * 公出对象 0企业 1园区
+     */
+    private Integer objectType;
+
     private static final long serialVersionUID = 1L;
 
     public Integer getId() {
@@ -230,14 +200,6 @@ public class PublicRelease implements Serializable {
         this.id = id;
     }
 
-    public String getUid() {
-        return uid;
-    }
-
-    public void setUid(String uid) {
-        this.uid = uid;
-    }
-
     public String getAid() {
         return aid;
     }
@@ -278,30 +240,6 @@ public class PublicRelease implements Serializable {
         this.annexUrl = annexUrl;
     }
 
-    public String getUserName() {
-        return userName;
-    }
-
-    public void setUserName(String userName) {
-        this.userName = userName;
-    }
-
-    public String getLongitude() {
-        return longitude;
-    }
-
-    public void setLongitude(String longitude) {
-        this.longitude = longitude;
-    }
-
-    public String getLatitude() {
-        return latitude;
-    }
-
-    public void setLatitude(String latitude) {
-        this.latitude = latitude;
-    }
-
     public Integer getStatus() {
         return status;
     }
@@ -318,30 +256,6 @@ public class PublicRelease implements Serializable {
         this.createTime = createTime;
     }
 
-    public Integer getClockIn() {
-        return clockIn;
-    }
-
-    public void setClockIn(Integer clockIn) {
-        this.clockIn = clockIn;
-    }
-
-    public Date getClockInTime() {
-        return clockInTime;
-    }
-
-    public void setClockInTime(Date clockInTime) {
-        this.clockInTime = clockInTime;
-    }
-
-    public String getPhotoUrl() {
-        return photoUrl;
-    }
-
-    public void setPhotoUrl(String photoUrl) {
-        this.photoUrl = photoUrl;
-    }
-
     public String getPid() {
         return pid;
     }
@@ -358,14 +272,6 @@ public class PublicRelease implements Serializable {
         this.pname = pname;
     }
 
-    public String getUfid() {
-        return ufid;
-    }
-
-    public void setUfid(String ufid) {
-        this.ufid = ufid;
-    }
-
     public Double getDuration() {
         return duration;
     }
@@ -382,22 +288,6 @@ public class PublicRelease implements Serializable {
         this.validDate = validDate;
     }
 
-    public Integer getNewUser() {
-        return newUser;
-    }
-
-    public void setNewUser(Integer newUser) {
-        this.newUser = newUser;
-    }
-
-    public Integer getSignSum() {
-        return signSum;
-    }
-
-    public void setSignSum(Integer signSum) {
-        this.signSum = signSum;
-    }
-
     public Integer getMainStatus() {
         return mainStatus;
     }
@@ -518,14 +408,6 @@ public class PublicRelease implements Serializable {
         this.mainName = mainName;
     }
 
-    public String getClockInRemarks() {
-        return clockInRemarks;
-    }
-
-    public void setClockInRemarks(String clockInRemarks) {
-        this.clockInRemarks = clockInRemarks;
-    }
-
     public String getRejectName() {
         return rejectName;
     }
@@ -565,4 +447,44 @@ public class PublicRelease implements Serializable {
     public void setAuditTime(Date auditTime) {
         this.auditTime = auditTime;
     }
+
+    public String getUfid() {
+        return ufid;
+    }
+
+    public void setUfid(String ufid) {
+        this.ufid = ufid;
+    }
+
+    public String getNewUser() {
+        return newUser;
+    }
+
+    public void setNewUser(String newUser) {
+        this.newUser = newUser;
+    }
+
+    public String getSignSum() {
+        return signSum;
+    }
+
+    public void setSignSum(String signSum) {
+        this.signSum = signSum;
+    }
+
+    public String getUserNames() {
+        return userNames;
+    }
+
+    public void setUserNames(String userNames) {
+        this.userNames = userNames;
+    }
+
+    public Integer getObjectType() {
+        return objectType;
+    }
+
+    public void setObjectType(Integer objectType) {
+        this.objectType = objectType;
+    }
 }

+ 217 - 0
src/main/java/com/goafanti/common/model/PublicReleaseDetails.java

@@ -0,0 +1,217 @@
+package com.goafanti.common.model;
+
+import java.io.Serializable;
+import java.util.Date;
+
+/**
+ * public_release_details
+ * @author 
+ */
+public class PublicReleaseDetails implements Serializable {
+    private Integer id;
+
+    /**
+     * 公出编号
+     */
+    private Integer prid;
+
+    /**
+     * 客户id
+     */
+    private String uid;
+
+    /**
+     * 跟进id
+     */
+    private String ufid;
+
+    /**
+     * 客户类型 0新客户 1老客户
+     */
+    private Integer newUser;
+
+    /**
+     * 签单数
+     */
+    private Integer signSum;
+
+    /**
+     * 经度
+     */
+    private String longitude;
+
+    /**
+     * 纬度
+     */
+    private String latitude;
+
+    /**
+     * 打卡状态 1正常打卡 2异常打卡
+     */
+    private Integer clockIn;
+
+    /**
+     * 打卡时间
+     */
+    private Date clockInTime;
+
+    /**
+     * 照片
+     */
+    private String photoUrl;
+
+    /**
+     * 公出企业地址
+     */
+    private String districtName;
+
+    /**
+     * 打卡说明
+     */
+    private String clockInRemarks;
+
+    /**
+     * 时长
+     */
+    private Double duration;
+
+    /**
+     * 0辅助 1主要(根据客户是否是公出人判断)
+     */
+    private Integer mainStatus;
+
+    /**
+     * 修改时间
+     */
+    private Date updateTime;
+
+    private static final long serialVersionUID = 1L;
+
+    public Integer getId() {
+        return id;
+    }
+
+    public void setId(Integer id) {
+        this.id = id;
+    }
+
+    public Integer getPrid() {
+        return prid;
+    }
+
+    public void setPrid(Integer prid) {
+        this.prid = prid;
+    }
+
+    public String getUid() {
+        return uid;
+    }
+
+    public void setUid(String uid) {
+        this.uid = uid;
+    }
+
+    public String getUfid() {
+        return ufid;
+    }
+
+    public void setUfid(String ufid) {
+        this.ufid = ufid;
+    }
+
+    public Integer getNewUser() {
+        return newUser;
+    }
+
+    public void setNewUser(Integer newUser) {
+        this.newUser = newUser;
+    }
+
+    public Integer getSignSum() {
+        return signSum;
+    }
+
+    public void setSignSum(Integer signSum) {
+        this.signSum = signSum;
+    }
+
+    public String getLongitude() {
+        return longitude;
+    }
+
+    public void setLongitude(String longitude) {
+        this.longitude = longitude;
+    }
+
+    public String getLatitude() {
+        return latitude;
+    }
+
+    public void setLatitude(String latitude) {
+        this.latitude = latitude;
+    }
+
+    public Integer getClockIn() {
+        return clockIn;
+    }
+
+    public void setClockIn(Integer clockIn) {
+        this.clockIn = clockIn;
+    }
+
+    public Date getClockInTime() {
+        return clockInTime;
+    }
+
+    public void setClockInTime(Date clockInTime) {
+        this.clockInTime = clockInTime;
+    }
+
+    public String getPhotoUrl() {
+        return photoUrl;
+    }
+
+    public void setPhotoUrl(String photoUrl) {
+        this.photoUrl = photoUrl;
+    }
+
+    public String getDistrictName() {
+        return districtName;
+    }
+
+    public void setDistrictName(String districtName) {
+        this.districtName = districtName;
+    }
+
+    public String getClockInRemarks() {
+        return clockInRemarks;
+    }
+
+    public void setClockInRemarks(String clockInRemarks) {
+        this.clockInRemarks = clockInRemarks;
+    }
+
+    public Double getDuration() {
+        return duration;
+    }
+
+    public void setDuration(Double duration) {
+        this.duration = duration;
+    }
+
+    public Integer getMainStatus() {
+        return mainStatus;
+    }
+
+    public void setMainStatus(Integer mainStatus) {
+        this.mainStatus = mainStatus;
+    }
+
+    public Date getUpdateTime() {
+        return updateTime;
+    }
+
+    public void setUpdateTime(Date updateTime) {
+        this.updateTime = updateTime;
+    }
+}

+ 6 - 1
src/main/java/com/goafanti/common/utils/AsyncUtils.java

@@ -51,7 +51,7 @@ public class AsyncUtils {
 	@Autowired
 	private OrderChangeLogMapper orderChangeLogMapper;
 	@Autowired
-	private TChangeTaskMapper tChangeTaskMapper;
+	private TOrderMidMapper tOrderMidMapper;
 	@Autowired
 	private RoleMapper roleMapper;
 
@@ -567,4 +567,9 @@ public class AsyncUtils {
 		tOrderNewMapper.updateExamineById(id,ProcessStatus.YPCWZY.getCode());
 		newOrderChangeMapper.updateExamineById(id,OrderChangeProcess.CWZY.getCode());
 	}
+
+	public  void updateFinanceExamineAndDep(String id, String financeId){
+		updateFinanceExamine( id);
+		tOrderMidMapper.updateFinanceId(id,financeId);
+	}
 }

+ 2 - 2
src/main/java/com/goafanti/core/cache/serializer/FastJsonRedisSerializer.java

@@ -23,8 +23,8 @@ public class FastJsonRedisSerializer implements RedisSerializer<Object> {
 		pc.addAccept("com.goafanti.lecture.bo.BigShotLectureListBo");
 		pc.addAccept("com.goafanti.news.bo.NewsPortalList");
 		pc.addAccept("com.goafanti.common.model.Activity");
-		pc.addAccept("com.goafanti.order.bo.outStatisticsList");
-		pc.addAccept("com.goafanti.order.bo.outProvinceStatisticsList");
+		pc.addAccept("com.goafanti.order.bo.OutStatisticsList");
+		pc.addAccept("com.goafanti.order.bo.OutProvinceStatisticsList");
 		pc.addAccept("com.goafanti.weChat.bo.OutPublicStatistics");
 		pc.addAccept("com.goafanti.core.mybatis.page.Pagination");
 		pc.addAccept("com.goafanti.common.bo.Result");

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

@@ -197,8 +197,10 @@ public class CustomerServiceImpl extends BaseMybatisDao<UserMapper> implements C
 				"selectPrivateOrganizationCustomerList", "selectPrivateOrganizationCustomerCount", params, pageNo,
 				pageSize);
 		List<CustomerListOut> tmpList = (List<CustomerListOut>) list.getList();
-		setCustomerList(tmpList, 0, power);
-		list.setList(tmpList);
+		if(!tmpList.isEmpty()){
+			setCustomerList(tmpList, 0, power);
+			list.setList(tmpList);
+		}
 		return list;
 	}
 

+ 1 - 1
src/main/java/com/goafanti/order/bo/InputStatistics.java

@@ -10,7 +10,7 @@ public class InputStatistics {
     private String startSign;
     private String endSign;
     /**
-     * 0签单量 1签单人数 2年度完成率
+     * 0金额 1签单数 2人数
      */
     private Integer sort;
 

+ 4 - 4
src/main/java/com/goafanti/order/bo/outProvinceStatisticsList.java

@@ -4,7 +4,7 @@ import com.goafanti.common.utils.excel.Excel;
 
 import java.math.BigDecimal;
 
-public class outProvinceStatisticsList {
+public class OutProvinceStatisticsList {
 
     private  String aid;
     @Excel(name = "订单部门")
@@ -12,7 +12,7 @@ public class outProvinceStatisticsList {
     @Excel(name = "签单人")
     private String name;
     @Excel(name = "总单量(个)")
-    private Integer quantity;
+    private Double quantity;
     @Excel(name = "总签单额(万元)")
     private BigDecimal total;
 
@@ -40,11 +40,11 @@ public class outProvinceStatisticsList {
         this.name = name;
     }
 
-    public Integer getQuantity() {
+    public Double getQuantity() {
         return quantity;
     }
 
-    public void setQuantity(Integer quantity) {
+    public void setQuantity(Double quantity) {
         this.quantity = quantity;
     }
 

+ 15 - 4
src/main/java/com/goafanti/order/bo/outStatisticsList.java

@@ -4,7 +4,7 @@ import com.goafanti.common.utils.excel.Excel;
 
 import java.math.BigDecimal;
 
-public class outStatisticsList {
+public class OutStatisticsList {
 
     private  Integer id;
     @Excel(name = "省")
@@ -12,7 +12,7 @@ public class outStatisticsList {
     @Excel(name = "签单人数(人)")
     private Integer counts;
     @Excel(name = "总单量(个)")
-    private Integer quantity;
+    private Double quantity;
     @Excel(name = "总签单额(万元)")
     private BigDecimal total;
 
@@ -40,11 +40,11 @@ public class outStatisticsList {
         this.counts = counts;
     }
 
-    public Integer getQuantity() {
+    public Double getQuantity() {
         return quantity;
     }
 
-    public void setQuantity(Integer quantity) {
+    public void setQuantity(Double quantity) {
         this.quantity = quantity;
     }
 
@@ -55,4 +55,15 @@ public class outStatisticsList {
     public void setTotal(BigDecimal total) {
         this.total = total;
     }
+
+    @Override
+    public String toString() {
+        return "OutStatisticsList{" +
+                "id=" + id +
+                ", province='" + province + '\'' +
+                ", counts=" + counts +
+                ", quantity=" + quantity +
+                ", total=" + total +
+                '}';
+    }
 }

+ 78 - 0
src/main/java/com/goafanti/order/bo/StatisOrderList.java

@@ -0,0 +1,78 @@
+package com.goafanti.order.bo;
+
+import java.math.BigDecimal;
+
+public class StatisOrderList {
+    private Integer id;
+    private String province;
+    private String depName;
+    private String orderNo;
+    private String aid;
+    private String aname;
+    private Double quantity;
+    private BigDecimal total;
+
+    public String getDepName() {
+        return depName;
+    }
+
+    public void setDepName(String depName) {
+        this.depName = depName;
+    }
+
+    public String getAname() {
+        return aname;
+    }
+
+    public void setAname(String aname) {
+        this.aname = aname;
+    }
+
+    public Integer getId() {
+        return id;
+    }
+
+    public void setId(Integer id) {
+        this.id = id;
+    }
+
+    public String getProvince() {
+        return province;
+    }
+
+    public void setProvince(String province) {
+        this.province = province;
+    }
+
+    public String getOrderNo() {
+        return orderNo;
+    }
+
+    public void setOrderNo(String orderNo) {
+        this.orderNo = orderNo;
+    }
+
+    public String getAid() {
+        return aid;
+    }
+
+    public void setAid(String aid) {
+        this.aid = aid;
+    }
+
+    public Double getQuantity() {
+        return quantity;
+    }
+
+    public void setQuantity(Double quantity) {
+        this.quantity = quantity;
+    }
+
+    public BigDecimal getTotal() {
+        return total;
+    }
+
+    public void setTotal(BigDecimal total) {
+        this.total = total;
+    }
+}

+ 32 - 7
src/main/java/com/goafanti/order/controller/AdminNewOrderApiController.java

@@ -3,6 +3,7 @@ package com.goafanti.order.controller;
 
 
 import java.io.IOException;
+import java.util.Comparator;
 import java.util.List;
 
 import javax.servlet.http.HttpServletRequest;
@@ -640,7 +641,19 @@ public class AdminNewOrderApiController extends CertifyApiController {
 	 */
 	@RequestMapping(value = "/statisticsList", method = RequestMethod.GET)
 	public Result statisticsList(InputStatistics in){
-		return res().data(orderNewService.statisticsList(in));
+		List<OutStatisticsList> result = orderNewService.statisticsList(in);
+		ListSort(result,in.getSort());
+		return res().data(result);
+	}
+
+	private void ListSort(List<OutStatisticsList> result,Integer sort) {
+		if (sort==null||sort==0){
+			result.sort(Comparator.comparing(OutStatisticsList::getTotal).reversed());
+		}else if (sort==1){
+			result.sort(Comparator.comparing(OutStatisticsList::getQuantity).reversed());
+		} else {
+			result.sort(Comparator.comparing(OutStatisticsList::getCounts).reversed());
+		}
 	}
 
 	/**
@@ -649,8 +662,9 @@ public class AdminNewOrderApiController extends CertifyApiController {
 	 */
 	@RequestMapping(value = "/statisticsListExprot", method = RequestMethod.GET)
 	public Result statisticsListExprot(InputStatistics in){
-		List<outStatisticsList>  list =orderNewService.statisticsList(in);
-		NewExcelUtil<outStatisticsList> excelUtil=new NewExcelUtil<>(outStatisticsList.class);
+		List<OutStatisticsList>  list =orderNewService.statisticsList(in);
+		ListSort(list,in.getSort());
+		NewExcelUtil<OutStatisticsList> excelUtil=new NewExcelUtil<>(OutStatisticsList.class);
 		StringBuffer sb=new StringBuffer("搜索条件=》");
 		if (in.getDepName()!=null)sb=sb.append("部门:").append(in.getDepName()).append(",");
 		if(in.getProvinceName()!=null)sb=sb.append("省份:").append(in.getProvinceName()).append(",");
@@ -673,12 +687,22 @@ public class AdminNewOrderApiController extends CertifyApiController {
 	/**
 	 * 	省份签单统计表
 	 * 	a.total_amount>0.5,1,if(a.total_amount>0 and a.order_type=1,0.5,0)
-	 * 	签单金额大于1万计做一个订单,小于0.5,如果是科技项目计做0.5单,其他计算成0单
+	 * 	签单金额大于0.5万计做一个订单,小于0.5,如果是科技项目计做0.5单,其他计算成0单
 	 * @throws IOException
 	 */
 	@RequestMapping(value = "/provinceStatisticsList", method = RequestMethod.GET)
 	public Result provinceStatisticsList(InputStatistics in){
-		return res().data(orderNewService.provinceStatisticsList(in));
+		List<OutProvinceStatisticsList> out = orderNewService.provinceStatisticsList(in);
+		ProvinceListSort(out,in.getSort());
+		return res().data(out);
+	}
+
+	private void ProvinceListSort(List<OutProvinceStatisticsList> out, Integer sort) {
+		if (sort==null||sort==0){
+			out.sort(Comparator.comparing(OutProvinceStatisticsList::getTotal).reversed());
+		}else if (sort==1){
+			out.sort(Comparator.comparing(OutProvinceStatisticsList::getQuantity).reversed());
+		}
 	}
 
 	/**
@@ -687,8 +711,9 @@ public class AdminNewOrderApiController extends CertifyApiController {
 	 */
 	@RequestMapping(value = "/provinceStatisticsListExprot", method = RequestMethod.GET)
 	public Result provinceStatisticsListExprot(InputStatistics in){
-		List<outProvinceStatisticsList>  list =orderNewService.provinceStatisticsList(in);
-		NewExcelUtil<outProvinceStatisticsList> excelUtil=new NewExcelUtil<>(outProvinceStatisticsList.class);
+		List<OutProvinceStatisticsList>  list =orderNewService.provinceStatisticsList(in);
+		ProvinceListSort(list,in.getSort());
+		NewExcelUtil<OutProvinceStatisticsList> excelUtil=new NewExcelUtil<>(OutProvinceStatisticsList.class);
 		StringBuffer sb=new StringBuffer("搜索条件=》");
 		if (in.getDepName()!=null)sb=sb.append("部门:").append(in.getDepName()).append(",");
 		if(in.getProvinceName()!=null)sb=sb.append("省份:").append(in.getProvinceName()).append(",");

+ 6 - 6
src/main/java/com/goafanti/order/controller/AdminNewOrderDunApiController.java

@@ -5,7 +5,7 @@ import javax.annotation.Resource;
 import com.goafanti.common.utils.excel.NewExcelUtil;
 import com.goafanti.order.bo.OutSelectOrderDun;
 import com.goafanti.order.bo.OutSelectOrderDunAll;
-import com.goafanti.order.bo.outStatisticsList;
+import com.goafanti.order.bo.OutStatisticsList;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RequestMethod;
@@ -22,12 +22,12 @@ import java.util.List;
 @RestController
 @RequestMapping(value = "/api/admin/newOrderDun")
 public class AdminNewOrderDunApiController extends CertifyApiController {
-	
+
 	@Resource
 	private NewOrderDunService	newOrderDunService;
 	@Value(value = "${upload.path}")
 	private String	uploadPath			= null;
-	
+
 	/**
 	 * 创建催款信息
 	 * @return
@@ -45,7 +45,7 @@ public class AdminNewOrderDunApiController extends CertifyApiController {
 		}
 		res.data(newOrderDunService.createDun(ib));
 		return res;
-	}	
+	}
 	/**
 	 * 修改催款信息
 	 * @return
@@ -67,7 +67,7 @@ public class AdminNewOrderDunApiController extends CertifyApiController {
 		}
 		res.data(newOrderDunService.updateDun(ib));
 		return res;
-	}	
+	}
 	/**
 	 * 删除催款信息
 	 * @return
@@ -81,7 +81,7 @@ public class AdminNewOrderDunApiController extends CertifyApiController {
 		}
 		res.data(newOrderDunService.deleteDun( id));
 		return res;
-	}	
+	}
 	/**
 	 * 	查看催款信息
 	 * @return

+ 2 - 2
src/main/java/com/goafanti/order/service/OrderNewService.java

@@ -184,9 +184,9 @@ public interface OrderNewService {
 	boolean checkOfficialType(TOrderOutsource o);
 	void updateOrderCostAmount(Integer tid,Integer type);
 
-    List<outStatisticsList> statisticsList(InputStatistics in);
+    List<OutStatisticsList> statisticsList(InputStatistics in);
 
-	List<outProvinceStatisticsList> provinceStatisticsList(InputStatistics in);
+	List<OutProvinceStatisticsList> provinceStatisticsList(InputStatistics in);
 
 
 	/**

+ 81 - 17
src/main/java/com/goafanti/order/service/impl/OrderNewServiceImpl.java

@@ -6,14 +6,8 @@ import java.io.UnsupportedEncodingException;
 import java.math.BigDecimal;
 import java.text.ParseException;
 import java.text.SimpleDateFormat;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Calendar;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.UUID;
+import java.util.*;
+import java.util.stream.Collectors;
 
 
 import javax.mail.MessagingException;
@@ -1815,24 +1809,68 @@ public class OrderNewServiceImpl extends BaseMybatisDao<TOrderNewMapper> impleme
 
 	@Override
 	@Cacheable(cacheNames = "statisticsList#500",key = "'statisticsList:depId:'+#in.depId+'province:'+#in.province+" +
-			"'startCreate:'+#in.startCreate+'endCreate:'+#in.endCreate+'startSign:'+#in.startSign+'endSign:'+#in.endSign+'sort:'+#in.sort")
-	public List<outStatisticsList> statisticsList(InputStatistics in) {
-		if(in.getSort()==null) {
-			in.setSort(0);
-		}
+			"'startCreate:'+#in.startCreate+'endCreate:'+#in.endCreate+'startSign:'+#in.startSign+'endSign:'+#in.endSign")
+	public List<OutStatisticsList> statisticsList(InputStatistics in) {
 		if(in.getEndCreate()!=null) {
 			in.setEndCreate(in.getEndCreate()+" 23:59:59");
 		}
 		if(in.getEndSign()!=null) {
 			in.setEndSign(in.getEndSign()+" 23:59:59");
 		}
-		return tOrderNewMapper.statisticsList(in);
+		List<OutStatisticsList> outStatisticsLists =new ArrayList<>();
+		//原来sql计算
+//		outStatisticsLists=tOrderNewMapper.statisticsList(in);
+		//新java内部计算
+		outStatisticsLists= CountStatisticOrderList(in);
+
+		return outStatisticsLists;
+	}
+
+	private List<OutStatisticsList> CountStatisticOrderList(InputStatistics in) {
+		List<OutStatisticsList> result=new ArrayList<>();
+		List<StatisOrderList> statisOrderLists = tOrderNewMapper.statisticsOrderList(in);
+		Map<Integer,List<StatisOrderList>> classmap= statisOrderLists.stream().collect(Collectors.groupingBy(StatisOrderList::getId));
+		for (Integer key : classmap.keySet()) {
+			Integer id= key;
+			String name=classmap.get(key).get(0).getProvince();
+			Double quantity = classmap.get(key).stream().mapToDouble(StatisOrderList::getQuantity).sum();
+			BigDecimal total =CountStatisticOrderTotal(classmap.get(key));
+			Integer counts=CountStatisticOrderCount(classmap.get(key));
+			OutStatisticsList out =new OutStatisticsList();
+			out.setId(id);
+			out.setProvince(name);
+			out.setQuantity(quantity);
+			out.setTotal(total);
+			out.setCounts(counts);
+			result.add(out);
+		}
+		return result;
+	}
+
+	private Integer CountStatisticOrderCount(List<StatisOrderList> statisOrderLists) {
+		Integer result =0;
+		List<String> list=new ArrayList<>();
+		for (StatisOrderList statisOrderList : statisOrderLists) {
+			if (!list.contains(statisOrderList.getAid())){
+				list.add(statisOrderList.getAid());
+				result++;
+			}
+		}
+		return result;
+	}
+
+	private BigDecimal CountStatisticOrderTotal(List<StatisOrderList> statisOrderLists) {
+		BigDecimal result=new BigDecimal(0);
+		for (StatisOrderList out : statisOrderLists) {
+			result=result.add(out.getTotal());
+		}
+		return result;
 	}
 
 	@Override
 	@Cacheable(cacheNames = "provinceStatisticsList#500",key = "'provinceStatisticsList:depId:'+#in.depId+'province:'+#in.province+" +
-			"'startCreate:'+#in.startCreate+'endCreate:'+#in.endCreate+'startSign:'+#in.startSign+'endSign:'+#in.endSign+'sort:'+#in.sort")
-	public List<outProvinceStatisticsList> provinceStatisticsList(InputStatistics in) {
+			"'startCreate:'+#in.startCreate+'endCreate:'+#in.endCreate+'startSign:'+#in.startSign+'endSign:'+#in.endSign")
+	public List<OutProvinceStatisticsList> provinceStatisticsList(InputStatistics in) {
 		if(in.getSort()==null) {
 			in.setSort(0);
 		}
@@ -1842,7 +1880,33 @@ public class OrderNewServiceImpl extends BaseMybatisDao<TOrderNewMapper> impleme
 		if(in.getEndSign()!=null) {
 			in.setEndSign(in.getEndSign()+" 23:59:59");
 		}
-		return tOrderNewMapper.provinceStatisticsList(in);
+		List<OutProvinceStatisticsList> outProvinceStatisticsLists=null;
+		//原sql计算
+//		outProvinceStatisticsLists = tOrderNewMapper.provinceStatisticsList(in);
+		//java计算
+		outProvinceStatisticsLists= CountProvinceStatisticsOrder(in);
+		return outProvinceStatisticsLists;
+	}
+
+	private List<OutProvinceStatisticsList> CountProvinceStatisticsOrder(InputStatistics in) {
+		List<OutProvinceStatisticsList> result=new ArrayList<>();
+		List<StatisOrderList> statisOrderLists = tOrderNewMapper.statisticsOrderList(in);
+		Map<String,List<StatisOrderList>> classmap= statisOrderLists.stream().collect(Collectors.groupingBy(StatisOrderList::getAid));
+		for (String key : classmap.keySet()) {
+			String aid= key;
+			String name=classmap.get(key).get(0).getAname();
+			String depName=classmap.get(key).get(0).getDepName();
+			Double quantity = classmap.get(key).stream().mapToDouble(StatisOrderList::getQuantity).sum();
+			BigDecimal total =CountStatisticOrderTotal(classmap.get(key));
+			OutProvinceStatisticsList out =new OutProvinceStatisticsList();
+			out.setAid(aid);
+			out.setName(name);
+			out.setDepName(depName);
+			out.setQuantity(quantity);
+			out.setTotal(total);
+			result.add(out);
+		}
+		return result;
 	}
 
 	@SuppressWarnings("unchecked")

+ 1 - 0
src/main/java/com/goafanti/order/service/impl/OrderProjectServiceImpl.java

@@ -1279,6 +1279,7 @@ public class OrderProjectServiceImpl extends BaseMybatisDao<TOrderTaskMapper> im
 		tOrderTask.setCommodityQuantity(1);
 		tOrderTask.setTaskComment(taskComment);
 		tOrderTask.setMain(0);
+		if (i!=1)tOrderTask.setCommodityPrice(new BigDecimal(0));
 		tOrderTaskMapper.insertSelective(tOrderTask);
 		TTaskMember t = tTaskMemberMapper.selectByTid(tid);
 		TOrderTaskBo tb=new TOrderTaskBo();

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

@@ -68,7 +68,7 @@ public class UserStatisticsServiceImpl extends BaseMybatisDao<UserMidMapper> imp
 
 
 	private void addsignStatisticsParam(InputSignStatistics in, Map<String, Object> map) {
-		if (!in.getDeps().isEmpty()){
+		if (in.getDeps()!=null){
 			map.put("deps",departmentService.parseArray(in.getDeps()));
 		}
 		if (StringUtils.isNotBlank(in.getAid())) map.put("aid", in.getAid());

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

@@ -199,7 +199,6 @@ public class OrganizationServiceImpl extends BaseMybatisDao<DepartmentMapper> im
 		dep.setHideSign(hideSign);
 		dep.setWorkingHoursType(workingHoursType);
 		checkFinaceUpdate(id,financeId);
-
 		int x=departmentMapper.updateByPrimaryKeySelective(dep);
 		return x;
 	}
@@ -212,7 +211,7 @@ public class OrganizationServiceImpl extends BaseMybatisDao<DepartmentMapper> im
 	private void checkFinaceUpdate(String id, String financeId) {
 		Department dep = departmentMapper.selectByPrimaryKey(id);
 		if (financeId!=null&&financeId.equals(dep.getFinanceId())){
-			asyncUtils.updateFinanceExamine(financeId);
+			asyncUtils.updateFinanceExamineAndDep(id,financeId);
 		}
 	}
 

+ 9 - 0
src/main/java/com/goafanti/weChat/bo/InputPublicDtails.java

@@ -6,6 +6,7 @@ public class InputPublicDtails {
 	private String releaseEnd;
 	private String createStart;
 	private String createEnd;
+	private String contractNo;
 	private String aid;
 	private String uid;
 	private Integer status;
@@ -23,6 +24,14 @@ public class InputPublicDtails {
 	private Integer pageSize;
 	private Integer pageNo;
 
+	public String getContractNo() {
+		return contractNo;
+	}
+
+	public void setContractNo(String contractNo) {
+		this.contractNo = contractNo;
+	}
+
 	public String getCreateStart() {
 		return createStart;
 	}

+ 133 - 5
src/main/java/com/goafanti/weChat/bo/InputPublicRelease.java

@@ -2,22 +2,150 @@ package com.goafanti.weChat.bo;
 
 import com.goafanti.common.model.PublicRelease;
 
+import java.util.Date;
+
 public class InputPublicRelease extends PublicRelease {
 
 	/**
-	 * 
+	 *
 	 */
 	private static final long serialVersionUID = 1L;
-	
+
 	private String releaseStarts;
-	
+
 	private String releaseEnds;
-	
+
 	private String ocbId;
-	
+
 	private String reason;
 
+	private String uids;
+
+	/**
+	 * 经度
+	 */
+	private String longitude;
+
+	/**
+	 * 纬度
+	 */
+	private String latitude;
+
+	/**
+	 * 打卡状态 1正常打卡 2异常打卡
+	 */
+	private Integer clockIn;
+
+	/**
+	 * 打卡时间
+	 */
+	private Date clockInTime;
+
+	/**
+	 * 照片
+	 */
+	private String photoUrl;
+
+	/**
+	 * 公出企业地址
+	 */
+	private String districtName;
+
+	/**
+	 * 打卡说明
+	 */
+	private String clockInRemarks;
+
+
+	/**
+	 * 时长
+	 */
+	private Double duration;
+
+
+	private String uid;
+
+	public String getUid() {
+		return uid;
+	}
+
+	public void setUid(String uid) {
+		this.uid = uid;
+	}
 
+	public String getLongitude() {
+		return longitude;
+	}
+
+	public void setLongitude(String longitude) {
+		this.longitude = longitude;
+	}
+
+	public String getLatitude() {
+		return latitude;
+	}
+
+	public void setLatitude(String latitude) {
+		this.latitude = latitude;
+	}
+
+	public Integer getClockIn() {
+		return clockIn;
+	}
+
+	public void setClockIn(Integer clockIn) {
+		this.clockIn = clockIn;
+	}
+
+	public Date getClockInTime() {
+		return clockInTime;
+	}
+
+	public void setClockInTime(Date clockInTime) {
+		this.clockInTime = clockInTime;
+	}
+
+	public String getPhotoUrl() {
+		return photoUrl;
+	}
+
+	public void setPhotoUrl(String photoUrl) {
+		this.photoUrl = photoUrl;
+	}
+
+	public String getDistrictName() {
+		return districtName;
+	}
+
+	public void setDistrictName(String districtName) {
+		this.districtName = districtName;
+	}
+
+	public String getClockInRemarks() {
+		return clockInRemarks;
+	}
+
+	public void setClockInRemarks(String clockInRemarks) {
+		this.clockInRemarks = clockInRemarks;
+	}
+
+	@Override
+	public Double getDuration() {
+		return duration;
+	}
+
+	@Override
+	public void setDuration(Double duration) {
+		this.duration = duration;
+	}
+
+	public String getUids() {
+		return uids;
+	}
+
+	public void setUids(String uids) {
+		this.uids = uids;
+	}
 
 	public String getReleaseStarts() {
 		return releaseStarts;

+ 17 - 6
src/main/java/com/goafanti/weChat/bo/OutPublicDtails.java

@@ -8,9 +8,9 @@ public class OutPublicDtails  {
 
 	private Integer id;
 	@Excel(name = "客户名称")
-	private String nickname;
-	@Excel(name = "公出地点")
 	private String userName;
+	@Excel(name = "公出地点")
+	private String districtName;
 	@Excel(name = "跟单人")
 	private String sname;
 	@Excel(name = "公出申请人")
@@ -58,11 +58,19 @@ public class OutPublicDtails  {
 	@Excel(name = "协单助手" )
 	private String assistantName;
 	private Integer assist;
+	private Integer objectType;
 	@Excel(name = "合同编号" )
 	private String contractNo;
 	@Excel(name = "订单总金额" ,scale = 6)
 	private BigDecimal totalAmout;
 
+	public Integer getObjectType() {
+		return objectType;
+	}
+
+	public void setObjectType(Integer objectType) {
+		this.objectType = objectType;
+	}
 
 	public String getContractNo() {
 		return contractNo;
@@ -220,12 +228,15 @@ public class OutPublicDtails  {
 	public void setClockInTimes(String clockInTimes) {
 		this.clockInTimes = clockInTimes;
 	}
-	public String getNickname() {
-		return nickname;
+
+	public String getDistrictName() {
+		return districtName;
 	}
-	public void setNickname(String nickname) {
-		this.nickname = nickname;
+
+	public void setDistrictName(String districtName) {
+		this.districtName = districtName;
 	}
+
 	public String getUserName() {
 		return userName;
 	}

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

@@ -3,6 +3,7 @@ package com.goafanti.weChat.bo;
 import com.goafanti.common.model.PublicRelease;
 
 import java.util.Date;
+import java.util.List;
 
 public class OutPublicRelease extends PublicRelease {
 	/**
@@ -33,6 +34,24 @@ public class OutPublicRelease extends PublicRelease {
 	 * 协单人员
 	 */
 	private String assistAidName;
+	private String uids;
+	private List<OutPublicReleaseDetails> prdList;
+
+	public List<OutPublicReleaseDetails> getPrdList() {
+		return prdList;
+	}
+
+	public void setPrdList(List<OutPublicReleaseDetails> prdList) {
+		this.prdList = prdList;
+	}
+
+	public String getUids() {
+		return uids;
+	}
+
+	public void setUids(String uids) {
+		this.uids = uids;
+	}
 
 	public String getAssistAidName() {
 		return assistAidName;

+ 25 - 0
src/main/java/com/goafanti/weChat/bo/OutPublicReleaseAndDetails.java

@@ -0,0 +1,25 @@
+package com.goafanti.weChat.bo;
+
+public class OutPublicReleaseAndDetails extends  OutPublicRelease{
+
+    private String districtName;
+    private String nickname;
+
+    public String getDistrictName() {
+        return districtName;
+    }
+
+    public void setDistrictName(String districtName) {
+        this.districtName = districtName;
+    }
+
+    @Override
+    public String getNickname() {
+        return nickname;
+    }
+
+    @Override
+    public void setNickname(String nickname) {
+        this.nickname = nickname;
+    }
+}

+ 31 - 0
src/main/java/com/goafanti/weChat/bo/OutPublicReleaseDetails.java

@@ -0,0 +1,31 @@
+package com.goafanti.weChat.bo;
+
+import com.goafanti.common.model.PublicReleaseDetails;
+
+import java.io.Serializable;
+import java.util.Date;
+
+/**
+ * public_release_details
+ * @author
+ */
+public class OutPublicReleaseDetails extends PublicReleaseDetails {
+    private String userName;
+    private String clockInTimes;
+
+    public String getUserName() {
+        return userName;
+    }
+
+    public void setUserName(String userName) {
+        this.userName = userName;
+    }
+
+    public String getClockInTimes() {
+        return clockInTimes;
+    }
+
+    public void setClockInTimes(String clockInTimes) {
+        this.clockInTimes = clockInTimes;
+    }
+}

+ 33 - 8
src/main/java/com/goafanti/weChat/bo/OutPublicReleaseList.java

@@ -1,10 +1,14 @@
 package com.goafanti.weChat.bo;
 
+import com.goafanti.common.model.PublicReleaseDetails;
+
+import java.util.List;
+
 public class OutPublicReleaseList {
 
-	private String id;
+	private Integer id;
 	private String nickname;
-	private String userName;
+	private String districtName;
 	private String aid;
 	private String aname;
 	private String releaseStarts;
@@ -24,7 +28,25 @@ public class OutPublicReleaseList {
 	private String rejectName;
 	private String assistantAid;
 	private String assistantName;
+	private String userNames;
 	private Integer publicAgain;
+	private List<OutPublicReleaseDetails> prdList;
+
+	public List<OutPublicReleaseDetails> getPrdList() {
+		return prdList;
+	}
+
+	public void setPrdList(List<OutPublicReleaseDetails> prdList) {
+		this.prdList = prdList;
+	}
+
+	public String getUserNames() {
+		return userNames;
+	}
+
+	public void setUserNames(String userNames) {
+		this.userNames = userNames;
+	}
 
 	public Integer getPublicAgain() {
 		return publicAgain;
@@ -122,10 +144,10 @@ public class OutPublicReleaseList {
 		this.updateStatus = updateStatus;
 	}
 
-	public String getId() {
+	public Integer getId() {
 		return id;
 	}
-	public void setId(String id) {
+	public void setId(Integer id) {
 		this.id = id;
 	}
 	public String getNickname() {
@@ -164,12 +186,15 @@ public class OutPublicReleaseList {
 	public void setStatus(Integer status) {
 		this.status = status;
 	}
-	public String getUserName() {
-		return userName;
+
+	public String getDistrictName() {
+		return districtName;
 	}
-	public void setUserName(String userName) {
-		this.userName = userName;
+
+	public void setDistrictName(String districtName) {
+		this.districtName = districtName;
 	}
+
 	public String getLatitude() {
 		return latitude;
 	}

+ 32 - 9
src/main/java/com/goafanti/weChat/controller/AdminReleaseApiController.java

@@ -42,16 +42,16 @@ public class AdminReleaseApiController extends CertifyApiController{
 	@RequestMapping(value = "/addPublicRelease", method = RequestMethod.POST)
 	public Result addPublicRelease(InputPublicRelease in){
 		Result res = new Result();
-		if (StringUtils.isBlank(in.getUid())) {
-			res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR,"用户编号"));
+		if (StringUtils.isBlank(in.getUids())) {
+			res.getError().add(buildErrorMessageParams(ErrorConstants.PARAM_EMPTY_ERROR,"用户编号"));
 			return res;
 		}
 		if (StringUtils.isBlank(in.getReleaseStarts())) {
-			res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR,"公出时间"));
+			res.getError().add(buildErrorMessageParams(ErrorConstants.PARAM_EMPTY_ERROR,"公出时间"));
 			return res;
 		}
-		if (StringUtils.isBlank(in.getUserName())) {
-			res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR,"公出地点"));
+		if (StringUtils.isBlank(in.getDistrictName())) {
+			res.getError().add(buildErrorMessageParams(ErrorConstants.PARAM_EMPTY_ERROR,"公出地点"));
 			return res;
 		}
 		if (publicReleaseService.checkTime(in)) {
@@ -74,6 +74,10 @@ public class AdminReleaseApiController extends CertifyApiController{
 	@RequestMapping(value = "/updatePublicRelease", method = RequestMethod.POST)
 	public Result updatePublicRelease(InputPublicRelease in){
 		Result res = new Result();
+		if (in.getId()==null){
+			res.getError().add(buildErrorMessageParams(ErrorConstants.PARAM_EMPTY_ERROR,"编号"));
+			return res;
+		}
 		if (in.getStatus()!=3&&publicReleaseService.checkTime(in)) {
 			res.getError().add(buildError("公出时段已经被使用!","公出时段已经被使用!"));
 			return res;
@@ -83,13 +87,34 @@ public class AdminReleaseApiController extends CertifyApiController{
 	}
 
 	/**
+	 * 修改打卡地址
+	 * @param in
+	 * @return
+	 */
+	@RequestMapping(value = "/updateLocation", method = RequestMethod.POST)
+	public Result updateLocation(InputPublicRelease in){
+		Result res = new Result();
+		if (in.getId()==null||in.getUid()==null){
+			res.getError().add(buildErrorMessageParams(ErrorConstants.PARAM_EMPTY_ERROR,"编号"));
+			return res;
+		}
+		if (in.getLatitude()==null||in.getLongitude()==null||in.getDistrictName()==null){
+			res.getError().add(buildErrorMessageParams(ErrorConstants.PARAM_EMPTY_ERROR,"位置"));
+			return res;
+		}
+		res.setData(publicReleaseService.updateLocation(in));
+		return res;
+	}
+
+	/**
 	 * 外出打卡、公出打卡
 	 * @return
 	 */
 	@RequestMapping(value = "/publicReleaseClockIn", method = RequestMethod.POST)
-	public Result publicReleaseClockIn(Integer id,String photoUrl,Integer clockIn ,String clockInRemarks ){
+	public Result publicReleaseClockIn(Integer id,String photoUrl,Integer clockIn ,String clockInRemarks,String uid ){
 		Result res =new Result();
-		res.setData(publicReleaseService.pushPublicReleaseClockIn(id,photoUrl,clockIn,clockInRemarks));
+
+		res.setData(publicReleaseService.pushPublicReleaseClockIn(id,photoUrl,clockIn,clockInRemarks,uid));
 		return res;
 	}
 	/**
@@ -244,8 +269,6 @@ public class AdminReleaseApiController extends CertifyApiController{
 			NewExcelUtil<OutPublicDtailsFinance>excel=new NewExcelUtil<>(OutPublicDtailsFinance.class);
 			return  excel.exportExcel(list,"公出详细列表",uploadPath);
 		}
-
-
 		return null;
 	}
 

+ 5 - 10
src/main/java/com/goafanti/weChat/service/PublicReleaseService.java

@@ -3,14 +3,7 @@ package com.goafanti.weChat.service;
 import java.util.List;
 import java.util.Map;
 
-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.OutPublicRelease;
-import com.goafanti.weChat.bo.OutPublicStatistics;
-import com.goafanti.weChat.bo.outPublicReleaseLog;
+import com.goafanti.weChat.bo.*;
 
 public interface PublicReleaseService {
 
@@ -26,7 +19,7 @@ public interface PublicReleaseService {
 
 	int updatePublicRelease(InputPublicRelease in);
 
-	int pushPublicReleaseClockIn(Integer id,String photoUrl,Integer clockIn ,String clockInRemarks );
+	int pushPublicReleaseClockIn(Integer id,String photoUrl,Integer clockIn ,String clockInRemarks ,String uid);
 
 	OutPublicRelease dtails(Integer id);
 
@@ -34,7 +27,7 @@ public interface PublicReleaseService {
 
 	Object publicReleaseListDtails(InputPublicDtails in);
 
-	OutPublicRelease followDtails(String id);
+	OutPublicReleaseAndDetails followDtails(String id);
 
 	boolean checkTime(InputPublicRelease in);
 
@@ -59,4 +52,6 @@ public interface PublicReleaseService {
     boolean checkdeleteAssistant(Integer id, String aid);
 
 	boolean checkaddAssistant(Integer id, String aid);
+
+    int updateLocation(InputPublicRelease in);
 }

+ 313 - 133
src/main/java/com/goafanti/weChat/service/impl/PublicReleaseServiceImpl.java

@@ -5,10 +5,10 @@ import java.util.*;
 
 import com.goafanti.admin.service.DepartmentService;
 import com.goafanti.common.dao.*;
-import com.goafanti.order.service.OrderService;
+import com.goafanti.common.model.*;
+import com.goafanti.weChat.bo.*;
 import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.cache.annotation.Cacheable;
 import org.springframework.stereotype.Service;
 import org.springframework.web.socket.TextMessage;
 
@@ -17,12 +17,6 @@ import com.goafanti.common.bo.EmailBo;
 import com.goafanti.common.constant.AFTConstants;
 import com.goafanti.common.enums.NoticeStatus;
 import com.goafanti.common.error.BusinessException;
-import com.goafanti.common.model.Admin;
-import com.goafanti.common.model.Notice;
-import com.goafanti.common.model.OrganizationContactBook;
-import com.goafanti.common.model.PublicRelease;
-import com.goafanti.common.model.PublicReleaseLog;
-import com.goafanti.common.model.User;
 import com.goafanti.common.utils.AsyncUtils;
 import com.goafanti.common.utils.DateUtils;
 import com.goafanti.common.utils.SendEmailUtil;
@@ -32,15 +26,6 @@ import com.goafanti.core.mybatis.page.Pagination;
 import com.goafanti.core.shiro.token.TokenManager;
 import com.goafanti.customer.bo.FollowBusinessBo;
 import com.goafanti.customer.service.CustomerService;
-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.OutPublicRelease;
-import com.goafanti.weChat.bo.OutPublicReleaseList;
-import com.goafanti.weChat.bo.OutPublicStatistics;
-import com.goafanti.weChat.bo.outPublicReleaseLog;
 import com.goafanti.weChat.service.PublicReleaseService;
 import com.goafanti.core.websocket.SystemWebSocketHandler;
 
@@ -55,7 +40,7 @@ public class PublicReleaseServiceImpl extends BaseMybatisDao<PublicReleaseMapper
 	@Autowired
 	private CustomerService customerService;
 	@Autowired
-	private OrderService orderService;
+	private PublicReleaseDetailsMapper publicReleaseDetailsMapper;
 	@Autowired
 	private WeChatUtils weChatUtils;
 	@Autowired
@@ -80,25 +65,79 @@ public class PublicReleaseServiceImpl extends BaseMybatisDao<PublicReleaseMapper
 		in.setCreateTime(date);
 		in.setStatus(1);
 		in.setAid(TokenManager.getAdminId());
-		in.setNewUser(0);
-		User u=userMapper.selectByPrimaryKey(in.getUid());
-		if (u!=null&&u.getShareType()==2){
-			in.setNewUser(1);
-		}
-		if (u==null||StringUtils.isEmpty(u.getAid())||u.getAid().equals(TokenManager.getAdminId())){
-			in.setMainStatus(1);
-		}
 		AdminListBo my = adminMapper.getDeptNameByAid(TokenManager.getAdminId());
 		if (in.getAssist()==1){
-			in.setAssistAidName(getAssistAidName(in.getAssistAid()));
+//			in.setAssistAidName(getAssistAidName(in.getAssistAid()));
 			in.setMainName(my.getName());
 		}
 		publicReleaseMapper.insertSelective(in);
+		List<PublicReleaseDetails> prdList=new ArrayList<>();
+		StringBuffer str =new StringBuffer();
+		if (in.getUids()!=null){
+			List<String> split = Arrays.asList(in.getUids().split(","));
+			int userCount=split.size();
+			Double duration = in.getDuration();
+			//计算平均
+			double d = durationSum(duration, userCount);
+			Integer index=1;
+			for (String s : split) {
+				PublicReleaseDetails prd=new PublicReleaseDetails();
+				User u=userMapper.selectByPrimaryKey(s);
+				str.append(u.getNickname()).append(",");
+				if (u!=null&&u.getShareType()==2){
+					prd.setNewUser(1);
+				}else {
+					prd.setNewUser(0);
+				}
+				if (u.getAid().equals(in.getAid())){
+					prd.setMainStatus(1);
+				}else {
+					prd.setMainStatus(0);
+				}
+				prd.setPrid(in.getId());
+				prd.setUid(s);
+				prd.setSignSum(0);
+				prd.setClockIn(0);
+				prd.setDistrictName(in.getDistrictName());
+				prd.setLatitude(in.getLatitude());
+				prd.setLongitude(in.getLongitude());
+				if (index<userCount){
+					if (duration==0){
+						prd.setDuration(duration);
+					} else {
+						prd.setDuration(d);
+						duration=duration-d;
+					}
+					index++;
+				}else {
+					prd.setDuration(duration);
+				}
+				prdList.add(prd);
+			}
+			publicReleaseDetailsMapper.insertBatch(prdList);
+		}
+		String userNames=str.substring(0,str.length()-1);
+		PublicRelease upName=new PublicRelease();
+		upName.setId(in.getId());
+		upName.setUserNames(userNames);
+		publicReleaseMapper.updateByPrimaryKeySelective(upName);
 		addpublicLog(in.getId(), PublicReleaseLog.states.fq.getCode(), "发起外出申请");
-		Map<String, Object> map=addPublicReleaseLog(my, in,u.getNickname(),date);
+		Map<String, Object> map=addPublicReleaseLog(my, in,userNames,date);
 		return map;
 	}
 
+
+
+	private  double durationSum(Double duration, Integer sum) {
+			Double counts= Math.floor(duration/0.5);
+			//计算当前时间
+			Double my=Math.floor(counts/sum)*0.5;
+			if (my<0.5)return 0.5;
+			return my;
+	}
+
+
+
 	/**
 	 *
 	 * @param my 我的相关人员
@@ -112,7 +151,7 @@ public class PublicReleaseServiceImpl extends BaseMybatisDao<PublicReleaseMapper
 		String str="["+my.getName()+"]发起["+nickname+"]的外出申请,请及时审核。";
 		sendNoticeAndSoucket(a.getId(),1,str);
 		Map<String, Object>map=new HashMap<String, Object>();
-		map.put("data", publicReleaseMapper.selectDtails(in.getId(),null));
+		map.put("data", publicReleaseMapper.selectDtails(in.getId()));
 		if (openid!=null) {
 			Integer res= weChatUtils.addNotice(openid, in.getStatus(),in.getId(),date,my.getName(),"["+my.getName()+"]发起外出申请");
 			if (res!=0) {
@@ -181,16 +220,16 @@ public class PublicReleaseServiceImpl extends BaseMybatisDao<PublicReleaseMapper
 			e.printStackTrace();
 			throw new BusinessException("转换异常");
 		}
-		User u=userMapper.selectByPrimaryKey(in.getUid());
-
-		if (u!=null&&u.getShareType()==2){
-			in.setNewUser(1);
-		}
-		if (u!=null&&u.getAid().equals(TokenManager.getAdminId())){
-			in.setMainStatus(1);
+		PublicRelease use = publicReleaseMapper.selectByPrimaryKey(in.getId());
+		if (in.getUids()!=null){
+			List<String> split = Arrays.asList(in.getUids().split(","));
+			List<OutPublicReleaseDetails> prList = publicReleaseDetailsMapper.selectByPCid(in.getId());
+			pushPublicReleaseDetails(split,prList,use,in);
 		}
-		PublicReleaseLog log=new PublicReleaseLog(in.getId(),TokenManager.getAdminId(),null,in.getReason(),date);
 
+		String userNames=publicReleaseDetailsMapper.getNamesByPrid(in.getId());
+		PublicReleaseLog log=new PublicReleaseLog(in.getId(),TokenManager.getAdminId(),null,in.getReason(),date);
+		in.setUserNames(userNames);
 		if(in.getStatus()==null||in.getStatus()!=3) {
 			in.setStatus(1);
 			log.setStatus(PublicReleaseLog.states.xg.getCode());
@@ -198,7 +237,7 @@ public class PublicReleaseServiceImpl extends BaseMybatisDao<PublicReleaseMapper
 			AdminListBo my = adminMapper.getDeptNameByAid(TokenManager.getAdminId());
 			//新增修改日志
 			//重新发起
-			addPublicReleaseLog(my,in,u.getNickname(),date);
+			addPublicReleaseLog(my,in,in.getUserNames(),date);
 		}else {
 			List<PublicRelease> list = publicReleaseMapper.selectByMainId(in.getId(),3,null);
 			List<PublicRelease> list2 = publicReleaseMapper.selectByMainId(in.getId(),4,null);
@@ -214,10 +253,77 @@ public class PublicReleaseServiceImpl extends BaseMybatisDao<PublicReleaseMapper
 				out.setStatus(3);
 				publicReleaseMapper.updateByPrimaryKeySelective(out);
 			}
-
 		}
 		publicReleaseLogMapper.insertSelective(log);
-		return publicReleaseMapper.updateByPrimaryKeySelective(in);
+		publicReleaseMapper.updateByPrimaryKeySelective(in);
+		return 1;
+	}
+
+	private void pushPublicReleaseDetails(List<String> split, List<OutPublicReleaseDetails> prList, PublicRelease use, InputPublicRelease in) {
+		//先删除,再修改个,再新增,有利于减少计算
+		deletePRD(split,prList);
+		publicReleaseDetailsMapper.updateDistrictByPrid(in);
+		addPRD(split,prList,use);
+	}
+
+	private void deletePRD(List<String> split, List<OutPublicReleaseDetails> prdList) {
+		for (OutPublicReleaseDetails prd : prdList) {
+			boolean flag=true;
+			for (String s : split) {
+				if (prd.getUid().equals(s)){
+					flag=false;
+				}
+			}
+			if (flag){
+				publicReleaseDetailsMapper.deleteByPrimaryKey(prd.getId());
+			}
+		}
+	}
+
+	/**
+	 *  @param split 修改后客户集
+	 * @param prdList 修改前客户集
+	 * @param use 原订单信息
+	 */
+	private void  addPRD(List<String> split, List<OutPublicReleaseDetails> prdList, PublicRelease use) {
+		List<PublicReleaseDetails> addPrdList=new ArrayList<>();
+		for (String s : split) {
+			boolean flag=true;
+			Integer id=null;
+			String districtName=null,latitude=null,longitude=null;
+			for (OutPublicReleaseDetails prd : prdList) {
+				if (id==null)id=prd.getPrid();
+				if (districtName==null)districtName=prd.getDistrictName();
+				if (latitude==null)latitude=prd.getLatitude();
+				if (longitude==null)longitude=prd.getLongitude();
+				if (s.equals(prd.getUid())){
+					flag=false;
+				}
+			}
+			if (flag){
+				PublicReleaseDetails prd=new PublicReleaseDetails();
+				User u=userMapper.selectByPrimaryKey(s);
+				if (u!=null&&u.getShareType()==2){
+					prd.setNewUser(1);
+				}else {
+					prd.setNewUser(0);
+				}
+				if (u.getAid().equals(use.getAid())){
+					prd.setMainStatus(1);
+				}else {
+					prd.setMainStatus(0);
+				}
+				prd.setPrid(id);
+				prd.setUid(s);
+				prd.setSignSum(0);
+				prd.setDistrictName(districtName);
+				prd.setLatitude(latitude);
+				prd.setLongitude(longitude);
+				prd.setClockIn(0);
+				addPrdList.add(prd);
+			}
+		}
+		if (!addPrdList.isEmpty())publicReleaseDetailsMapper.insertBatch(addPrdList);
 	}
 
 	@SuppressWarnings("unchecked")
@@ -258,25 +364,24 @@ public class PublicReleaseServiceImpl extends BaseMybatisDao<PublicReleaseMapper
 		str=str.append("(").append(ad.getName()).append(")");
 		Integer type=0;
 		String content="";
-		User u=userMapper.selectByPrimaryKey(use.getUid());
 		Admin a=adminMapper.selectByPrimaryKey(use.getAid());
 		if (status==0){
 			str=str.append("驳回,");
 			if (use.getAssist()==2){
-				content="["+u.getNickname()+"]公司的外出申请,技术协单被["+ad.getName()+"]拒绝!";
+				content="["+use.getUserNames()+"]公司的外出申请,技术协单被["+ad.getName()+"]拒绝!";
 			}else {
-				content="["+u.getNickname()+"]公司的外出申请,未通过公出审核!";
+				content="["+use.getUserNames()+"]公司的外出申请,未通过公出审核!";
 			}
 		}else if(status==2){
 			str=str.append("同意,");
 			//如果是协单公出主公出,在审核通过
 			if (use.getAssist()==1){
-				pushPublicReleaseAssist(use,status,date,u,a);
+				pushPublicReleaseAssist(use,status,date,a);
 			}else if (use.getAssist()==0){
 				publicReleaseMapper.updateStatusByMainId(3,use.getId(),null,null);
 			}
 
-			content="["+u.getNickname()+"]公司的外出申请,已通过审核!";
+			content="["+use.getUserNames()+"]公司的外出申请,已通过审核!";
 		}
 		str=str.append(remarks);
 		p.setAuditInfo(str.toString());
@@ -361,14 +466,13 @@ public class PublicReleaseServiceImpl extends BaseMybatisDao<PublicReleaseMapper
 	 * @param use 原始公出信息
 	 * @param status 状态
 	 * @param date 时间
-	 * @param u 客户
 	 * @param a
 	 */
-	private void pushPublicReleaseAssist(PublicRelease use,Integer status,Date date,User u,Admin a) {
+	private void pushPublicReleaseAssist(PublicRelease use,Integer status,Date date,Admin a) {
 		if (use.getAssistAid()!=null){
-			updatePushassist(use, status, date,u,a);
+			updatePushassist(use, status, date,a);
 			if(use.getAssistantAid()!=null){
-				updatepushAssistant(use,u,a);
+				updatepushAssistant(use,a);
 			}
 
 		}
@@ -380,7 +484,7 @@ public class PublicReleaseServiceImpl extends BaseMybatisDao<PublicReleaseMapper
 	 * @param status
 	 * @param date
 	 */
-	private void updatePushassist(PublicRelease use, Integer status, Date date, User u,Admin a) {
+	private void updatePushassist(PublicRelease use, Integer status, Date date, Admin a) {
 		//协单
 		List<PublicRelease> list = publicReleaseMapper.selectByMainId(use.getId(),3,null);
 		String []ss= use.getAssistAid().split(",");
@@ -398,7 +502,7 @@ public class PublicReleaseServiceImpl extends BaseMybatisDao<PublicReleaseMapper
 				in.setId(out.getId());
 				in.setStatus(3);
 				publicReleaseMapper.updateByPrimaryKeySelective(in);
-				StringBuffer str = new StringBuffer("[").append(a.getName()).append("]取消公出").append("[").append(u.getUsername()).append("]。");
+				StringBuffer str = new StringBuffer("[").append(a.getName()).append("]取消公出").append("[").append(use.getUserNames()).append("]。");
 				PublicReleaseLog log = new PublicReleaseLog(in.getId(), TokenManager.getAdminId(), PublicReleaseLog.states.cx.getCode(), str.toString(), date);
 				publicReleaseLogMapper.insertSelective(log);
 				sendNoticeAndSoucket(out.getAid(),in.getStatus(),str.toString());
@@ -407,14 +511,13 @@ public class PublicReleaseServiceImpl extends BaseMybatisDao<PublicReleaseMapper
 				BeanUtils.copyProperties(use,np);
 				np.setId(out.getId());
 				np.setMainId(null);
-				np.setClockIn(null);
-				np.setClockInTime(null);
 				np.setType(null);
 				np.setAssist(2);
 				np.setStatus(status);
 				np.setAid(null);
 				publicReleaseMapper.updateByPrimaryKeySelective(np);
-				StringBuffer str = new StringBuffer("[").append(a.getName()).append("]修改了公出").append("[").append(u.getUsername()).append("]。");
+				updatePublicReleaseDtails(use,np.getId());
+				StringBuffer str = new StringBuffer("[").append(a.getName()).append("]修改了公出").append("[").append(use.getUserNames()).append("]。");
 				PublicReleaseLog log = new PublicReleaseLog(np.getId(), TokenManager.getAdminId(), PublicReleaseLog.states.xg.getCode(),str.toString(), date);
 				publicReleaseLogMapper.insertSelective(log);
 				sendNoticeAndSoucket(out.getAid(),np.getStatus(),str.toString());
@@ -437,7 +540,9 @@ public class PublicReleaseServiceImpl extends BaseMybatisDao<PublicReleaseMapper
 				np.setMainId(use.getId());
 				np.setId(null);
 				publicReleaseMapper.insertSelective(np);
-				StringBuffer str = new StringBuffer("[").append(a.getName()).append("]邀请你技术协单").append("[").append(u.getUsername()).append("]。");
+				//补充客户表
+				addpublicReleaseDtails(use,np.getId());
+				StringBuffer str = new StringBuffer("[").append(a.getName()).append("]邀请你技术协单").append("[").append(use.getUserNames()).append("]。");
 				PublicReleaseLog log = new PublicReleaseLog(np.getId(), TokenManager.getAdminId(), PublicReleaseLog.states.fq.getCode(), str.toString(), date);
 				sendNoticeAndSoucket(np.getAid(),np.getStatus(),str.toString());
 				publicReleaseLogMapper.insertSelective(log);
@@ -445,38 +550,75 @@ public class PublicReleaseServiceImpl extends BaseMybatisDao<PublicReleaseMapper
 		}
 	}
 
+	private void updatePublicReleaseDtails(PublicRelease use, Integer id) {
+		List<OutPublicReleaseDetails> list = publicReleaseDetailsMapper.selectByPCid(use.getId());
+		List<OutPublicReleaseDetails> list2 = publicReleaseDetailsMapper.selectByPCid(id);
+		//查找新增的
+		for (OutPublicReleaseDetails out : list) {
+			boolean flag=true;
+			for (OutPublicReleaseDetails out2 : list2) {
+				if (out.getUid().equals(out2.getUid())){
+					flag=false;
+				}
+			}
+			if (flag){
+				OutPublicReleaseDetails prd=new OutPublicReleaseDetails();
+				BeanUtils.copyProperties(out,prd);
+				prd.setPrid(id);
+				prd.setClockIn(0);
+				prd.setClockInTime(null);
+				prd.setClockInRemarks(null);
+				prd.setUfid(null);
+				publicReleaseDetailsMapper.insertSelective(prd);
+			}
+		}
+
+		for (OutPublicReleaseDetails out2 : list2) {
+			boolean flag=true;
+			for (OutPublicReleaseDetails out : list) {
+				if (out2.getUid().equals(out.getUid())){
+					flag=false;
+				}
+			}
+			if (flag){
+				publicReleaseDetailsMapper.deleteByPrimaryKey(out2.getId());
+			}
+		}
+
+	}
+
+	private void addpublicReleaseDtails(PublicRelease use, Integer id) {
+		List<OutPublicReleaseDetails> list = publicReleaseDetailsMapper.selectByPCid(use.getId());
+		for (OutPublicReleaseDetails out : list) {
+			OutPublicReleaseDetails prd=new OutPublicReleaseDetails();
+			BeanUtils.copyProperties(out,prd);
+			prd.setPrid(id);
+			prd.setClockIn(0);
+			prd.setClockInTime(null);
+			prd.setMainStatus(0);
+			publicReleaseDetailsMapper.insertSelective(prd);
+		}
+	}
+
 	/**
 	 * 处理技术助手
 	 * @param use
 	 */
-	private void updatepushAssistant(PublicRelease use,User u,Admin a) {
+	private void updatepushAssistant(PublicRelease use,Admin a) {
 		List<String> list=new ArrayList();
-		list =new ArrayList<>(Arrays.asList(use.getAssistantAid().split(",")));
-		List<PublicRelease> deletelist = publicReleaseMapper.selectByMainId(use.getId(),4,null);
-		for (PublicRelease p : deletelist) {
-				boolean flag=false;
-				for (String s : list) {
-					if (p.getAid().equals(s)){
-						flag=true;
-						break;
-					}
-				}
-				if (flag){
-					if (!use.getUid().equals(p.getUid()))p.setUid(use.getUid());
-					if (!use.getUserName().equals(p.getUserName())){
-						p.setUserName(use.getUserName());
-						p.setLatitude(use.getLatitude());
-						p.setLongitude(use.getLongitude());
-					}
+		List<PublicRelease> uselist = publicReleaseMapper.selectByMainId(use.getId(),4,null);
+		for (PublicRelease p : uselist) {
 					if(!use.getReleaseStart().equals(p.getReleaseStart()))p.setReleaseStart(use.getReleaseStart());
 					if (!use.getReleaseEnd().equals(p.getReleaseEnd()))p.setReleaseEnd(use.getReleaseEnd());
 					p.setStatus(2);
+					p.setAssistantAid(use.getAssistantAid());
+					p.setAssistantName(use.getAssistantName());
+					p.setUserNames(use.getUserNames());
 					publicReleaseMapper.updateByPrimaryKeySelective(p);
-					StringBuffer str = new StringBuffer("[").append(a.getName()).append("]修改了").append("[").append(u.getUsername()).append("]。");
+					StringBuffer str = new StringBuffer("[").append(a.getName()).append("]修改了").append("[").append(use.getUserNames()).append("]。");
 					PublicReleaseLog log = new PublicReleaseLog(p.getId(), TokenManager.getAdminId(), PublicReleaseLog.states.ty.getCode(), str.toString(), new Date());
 					sendNoticeAndSoucket(p.getAid(),p.getStatus(),str.toString());
 					publicReleaseLogMapper.insertSelective(log);
-				}
 
 		}
 	}
@@ -489,46 +631,56 @@ public class PublicReleaseServiceImpl extends BaseMybatisDao<PublicReleaseMapper
 
 
 	@Override
-	public int pushPublicReleaseClockIn(Integer id,String photoUrl,Integer clockIn ,String clockInRemarks ) {
-		if(clockIn==null)clockIn=1;
-		PublicRelease p=new PublicRelease();
-		PublicRelease use=publicReleaseMapper.selectByPrimaryKey(id);
-		String aid=TokenManager.getAdminId();
-		p.setId(id);
-		p.setClockIn(clockIn);
-		p.setClockInRemarks(clockInRemarks);
-		p.setPhotoUrl(photoUrl);
-		p.setClockInTime(new Date());
-		String str="";
-		if (use.getClockIn()==0) {
-			FollowBusinessBo fbb=new FollowBusinessBo();
-			fbb.setUid(use.getUid());
-			fbb.setContactType("5");
-			fbb.setResult(use.getRemarks());
-			OrganizationContactBook ub=organizationContactBookMapper.getMajor(use.getUid(),aid);
-			if (ub !=null) {
-				fbb.setOcbId(ub.getId());
-			}
-			fbb.setFollowTime(DateUtils.formatDate(p.getClockInTime(), AFTConstants.YYYYMMDDHHMMSS));
-			String ufid=UUID.randomUUID().toString();
-			p.setUfid(ufid);
-			customerService.addFollow(fbb,ufid,use.getMainStatus());
-			if (clockIn==1)str="公出人员打卡";
-			else if(clockIn==2)str="公出人员异常打卡";
-		}else {
-			str="刷新打卡";
+	public int pushPublicReleaseClockIn(Integer id,String photoUrl,Integer clockIn ,String clockInRemarks ,String uid) {
+		if (clockIn == null) clockIn = 1;
+		PublicRelease use = publicReleaseMapper.selectByPrimaryKey(id);
+		List<OutPublicReleaseDetails> prdList = publicReleaseDetailsMapper.selectByPCid(id);
+		String str = "";
+		boolean flag=false;
+		for (OutPublicReleaseDetails prd : prdList) {
+			if (prd.getUid().equals(uid)){
+				String aid = TokenManager.getAdminId();
+				prd.setClockInRemarks(clockInRemarks);
+				prd.setPhotoUrl(photoUrl);
+				prd.setClockInTime(new Date());
+				if (prd.getClockIn() == 0) {
+					prd.setClockIn(clockIn);
+					//获取列表
+					FollowBusinessBo fbb = new FollowBusinessBo();
+					fbb.setUid(prd.getUid());
+					fbb.setContactType("5");
+					fbb.setResult(use.getRemarks());
+					OrganizationContactBook ub = organizationContactBookMapper.getMajor(prd.getUid(), aid);
+					if (ub != null) {
+						fbb.setOcbId(ub.getId());
+					}
+					fbb.setFollowTime(DateUtils.formatDate(prd.getClockInTime(), AFTConstants.YYYYMMDDHHMMSS));
+					String ufid = UUID.randomUUID().toString();
+					prd.setUfid(ufid);
+					customerService.addFollow(fbb, ufid, use.getMainStatus());
+					str = "公出人员打卡";
+				}else if (clockIn == 2){
+					str = "公出人员异常打卡";
+				}else {
+					str = "刷新打卡";
+				}
+				PublicReleaseLog log = new PublicReleaseLog(id, aid, PublicReleaseLog.states.dk.getCode(), str, new Date());
+				log.setPhotoUrl(photoUrl);
+				publicReleaseLogMapper.insertSelective(log);
+				publicReleaseDetailsMapper.updateByPrimaryKeySelective(prd);
+				flag=true;
+			}
+		}
+		if (!flag){
+			return 0;
 		}
-		PublicReleaseLog log=new PublicReleaseLog(id,aid,PublicReleaseLog.states.dk.getCode(),str,new Date());
-		log.setPhotoUrl(photoUrl);
-		publicReleaseLogMapper.insertSelective(log);
-		publicReleaseMapper.updateByPrimaryKeySelective(p);
 		return 1;
 	}
 
 	@Override
 	public OutPublicRelease dtails(Integer id) {
 		//如果不是本人和审核人员则不返回信息
-		OutPublicRelease out=publicReleaseMapper.selectDtails(id,null);
+		OutPublicRelease out=publicReleaseMapper.selectDtails(id);
 		if(out!=null){
 			boolean flag=false;
 			//自己、审核人员与部门负责人可以查看
@@ -549,22 +701,24 @@ public class PublicReleaseServiceImpl extends BaseMybatisDao<PublicReleaseMapper
 				}
 			}
 		}
+		out.setPrdList(publicReleaseDetailsMapper.selectByPCid(out.getId()));
 		return out;
 	}
 
 
 
 	@Override
-	public OutPublicRelease followDtails(String id) {
-		return	publicReleaseMapper.selectDtails(null,id);
+	public OutPublicReleaseAndDetails followDtails(String id) {
+		OutPublicReleaseAndDetails out = publicReleaseMapper.selectDtailsByFid( id);
+		return out;
 	}
 
 	@SuppressWarnings("unchecked")
 	@Override
-	@Cacheable(value = "publicReleaseStatistics#300", key = "'publicReleaseStatistics:" +
-			"aid:'+#in.aid+'depId:'+#in.depId+'clockStart:'+#in.clockStart+" +
-			"'clockEnd:'+#in.clockEnd+'createStart:'+#in.createStart+'createEnd'+#in.createEnd+" +
-			"'pageNo:'+#in.pageNo+'pageSzie:'+#in.pageSize")
+//	@Cacheable(value = "publicReleaseStatistics#300", key = "'publicReleaseStatistics:" +
+//			"aid:'+#in.aid+'depId:'+#in.depId+'clockStart:'+#in.clockStart+" +
+//			"'clockEnd:'+#in.clockEnd+'createStart:'+#in.createStart+'createEnd'+#in.createEnd+" +
+//			"'pageNo:'+#in.pageNo+'pageSzie:'+#in.pageSize")
 	public Object publicReleaseStatistics(InputPublicStatistics in) {
 		Map<String,Object> map =new HashMap<String, Object>();
 		if(in.getAid()!=null)map.put("aid", in.getAid());
@@ -616,6 +770,7 @@ public class PublicReleaseServiceImpl extends BaseMybatisDao<PublicReleaseMapper
 		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.getContractNo()!=null) map.put("contractNo", in.getContractNo());
 		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());
@@ -745,6 +900,10 @@ public class PublicReleaseServiceImpl extends BaseMybatisDao<PublicReleaseMapper
 		}
 		map.put("aid",TokenManager.getAdminId());
 		List<OutPublicReleaseList> list = (List<OutPublicReleaseList>) findList("listPublicRelease",map,1,1);
+		for (OutPublicReleaseList out : list) {
+			out.setPrdList(publicReleaseDetailsMapper.selectByPCid(out.getId()));
+
+		}
 		return list;
 	}
 
@@ -764,7 +923,7 @@ public class PublicReleaseServiceImpl extends BaseMybatisDao<PublicReleaseMapper
 	}
 
 	private void addAssistantPublicRelease(PublicRelease p, String aid) {
-		List<PublicRelease> list = publicReleaseMapper.selectByMainId(p.getMainId(), 4, aid);
+		List<PublicRelease> list = publicReleaseMapper.selectByMainId(p.getMainId(), 4, null);
 		PublicRelease newP= new PublicRelease();
 		if(list.isEmpty()){
 			BeanUtils.copyProperties(p,newP);
@@ -773,23 +932,19 @@ public class PublicReleaseServiceImpl extends BaseMybatisDao<PublicReleaseMapper
 			newP.setAssist(3);
 			newP.setType(4);
 			publicReleaseMapper.insertSelective(newP);
+			addpublicReleaseDtails(p,newP.getId());
+			StringBuffer str=new StringBuffer();
+			str=str.append("公出").append("[").append(p.getUserNames()).append("]").append("邀请你协助!");
+			addWeChatNotice( aid,1,str.toString(),newP.getId());
 		}else {
 			for (PublicRelease pr : list) {
-				if (pr.getAid().equals(aid)){
 					newP.setId(pr.getId());
-					newP.setStatus(2);
-					newP.setAssistantAid(pr.getAssistantAid());
-					newP.setAssistantName(pr.getAssistantName());
+					newP.setAssistantAid(p.getAssistantAid());
+					newP.setAssistantName(p.getAssistantName());
 					publicReleaseMapper.updateByPrimaryKeySelective(newP);
-				}
-
+					updatePublicReleaseDtails(p,newP.getId());
 			}
 		}
-
-		User u=userMapper.selectByPrimaryKey(p.getUid());
-		StringBuffer str=new StringBuffer();
-		str=str.append("公出").append("[").append(u.getUsername()).append("]").append("邀请你协助!");
-		addWeChatNotice( aid,1,str.toString(),newP.getId());
 	}
 
 	/**
@@ -885,6 +1040,8 @@ public class PublicReleaseServiceImpl extends BaseMybatisDao<PublicReleaseMapper
 		}
 		String sname = pushAssistant(aid, list,1);
 		String said =String.join(",",list);
+		p.setAssistantAid(said);
+		p.setAssistantName(sname);
 		deleteAssistantPulicRelease(p,aid);
 		return updateAssistant(p, said, sname);
 	}
@@ -893,12 +1050,19 @@ public class PublicReleaseServiceImpl extends BaseMybatisDao<PublicReleaseMapper
 
 	private void deleteAssistantPulicRelease(PublicRelease p, String aid) {
 		publicReleaseMapper.updateStatusByMainId(3,4,p.getMainId(),aid);
-		List<PublicRelease> list = publicReleaseMapper.selectByMainId(p.getMainId(), 4, aid);
-		User u=userMapper.selectByPrimaryKey(p.getUid());
+		List<PublicRelease> list = publicReleaseMapper.selectByMainId(p.getMainId(), 4, null);
 		StringBuffer str=new StringBuffer();
-		str=str.append("公出").append("[").append(u.getUsername()).append("]").append("撤销了你的协助!");
+		str=str.append("公出").append("[").append(p.getUserNames()).append("]").append("撤销了你的协助!");
 		for (PublicRelease pr : list) {
-			addWeChatNotice( pr.getAid(),3,str.toString(),pr.getId());
+			if (pr.getAid().equals(aid)){
+				addWeChatNotice( pr.getAid(),3,str.toString(),pr.getId());
+			}else {
+				PublicRelease newPr=new PublicRelease();
+				newPr.setId(pr.getId());
+				newPr.setAssistantAid(p.getAssistantAid());
+				newPr.setAssistantName(p.getAssistantName());
+				publicReleaseMapper.updateByPrimaryKeySelective(newPr);
+			}
 		}
 	}
 
@@ -907,9 +1071,9 @@ public class PublicReleaseServiceImpl extends BaseMybatisDao<PublicReleaseMapper
 		PublicRelease p = publicReleaseMapper.selectByPrimaryKey(id);
 		List<PublicRelease> list = publicReleaseMapper.selectByMainId(p.getMainId(), 4, aid);
 		for (PublicRelease use : list) {
-			if (use.getClockIn()==1){
-				return true;
-			}
+//			if (use.getClockIn()==1){
+//				return true;
+//			}
 		}
 		return false;
 	}
@@ -926,5 +1090,21 @@ public class PublicReleaseServiceImpl extends BaseMybatisDao<PublicReleaseMapper
 		return false;
 	}
 
+	@Override
+	public int updateLocation(InputPublicRelease in) {
+		PublicReleaseDetails prd=publicReleaseDetailsMapper.selectBypridAndUid(in);
+		if (prd==null){
+			throw  new BusinessException("公出企业不存在");
+		}
+		PublicReleaseDetails updateprd=new PublicReleaseDetails();
+		updateprd.setId(prd.getId());
+		updateprd.setLatitude(in.getLatitude());
+		updateprd.setLongitude(in.getLongitude());
+		updateprd.setDistrictName(in.getDistrictName());
+		updateprd.setClockIn(0);
+		addpublicLog(in.getId(),5,"发起公出地点修改");
+		return publicReleaseDetailsMapper.updateByPrimaryKeySelective(updateprd);
+	}
+
 
 }

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

@@ -1,6 +1,6 @@
 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/aft20221026?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
@@ -52,10 +52,10 @@ yxjl_max=100
 amb.maxLvl=6
 
 avatar.host=//static.jishutao.com
-static.host=//static.jishutao.com/1.2.62
+static.host=//static.jishutao.com/1.2.63
 rd.static.host=//static.jishutao.com/RD/1.0.00
 #avatar.host=//172.16.0.255:3000
-#static.host=//172.16.0.255:3000/1.2.14
+#static.host=//172.16.0.255:3000/1.2.62
 #static.host=http://172.16.1.187/prod/1.2.25
 
 wx.appId=wxff2f5720ed7d7f63

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

@@ -49,7 +49,7 @@ yxjl_max=100
 
 amb.maxLvl=6
 
-static.host=//static.jishutao.com/1.2.62
+static.host=//static.jishutao.com/1.2.63
 portal.host=//static.jishutao.com/portal/2.0.6
 avatar.host=//static.jishutao.com
 rd.static.host=//static.jishutao.com/RD/1.0.00