anderx лет назад: 3
Родитель
Сommit
13b92318f5

+ 20 - 10
src/main/java/com/goafanti/common/mapper/PublicReleaseDetailsMapper.xml

@@ -15,10 +15,11 @@
     <result column="photo_url" jdbcType="VARCHAR" property="photoUrl" />
     <result column="photo_url" jdbcType="VARCHAR" property="photoUrl" />
     <result column="district_name" jdbcType="VARCHAR" property="districtName" />
     <result column="district_name" jdbcType="VARCHAR" property="districtName" />
     <result column="clock_in_remarks" jdbcType="VARCHAR" property="clockInRemarks" />
     <result column="clock_in_remarks" jdbcType="VARCHAR" property="clockInRemarks" />
+    <result column="duration" jdbcType="DOUBLE" property="duration" />
   </resultMap>
   </resultMap>
   <sql id="Base_Column_List">
   <sql id="Base_Column_List">
     id, prid, `uid`, ufid, new_user, sign_sum, longitude, latitude, clock_in, clock_in_time,
     id, prid, `uid`, ufid, new_user, sign_sum, longitude, latitude, clock_in, clock_in_time,
-    photo_url, district_name, clock_in_remarks
+    photo_url, district_name, clock_in_remarks, duration
   </sql>
   </sql>
   <select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
   <select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
     select
     select
@@ -34,13 +35,13 @@
     insert into public_release_details (prid, `uid`, ufid,
     insert into public_release_details (prid, `uid`, ufid,
       new_user, sign_sum, longitude,
       new_user, sign_sum, longitude,
       latitude, clock_in, clock_in_time,
       latitude, clock_in, clock_in_time,
-      photo_url, district_name, clock_in_remarks
-      )
+      photo_url, district_name, clock_in_remarks,
+      duration)
     values (#{prid,jdbcType=INTEGER}, #{uid,jdbcType=VARCHAR}, #{ufid,jdbcType=VARCHAR},
     values (#{prid,jdbcType=INTEGER}, #{uid,jdbcType=VARCHAR}, #{ufid,jdbcType=VARCHAR},
       #{newUser,jdbcType=INTEGER}, #{signSum,jdbcType=INTEGER}, #{longitude,jdbcType=VARCHAR},
       #{newUser,jdbcType=INTEGER}, #{signSum,jdbcType=INTEGER}, #{longitude,jdbcType=VARCHAR},
       #{latitude,jdbcType=VARCHAR}, #{clockIn,jdbcType=INTEGER}, #{clockInTime,jdbcType=TIMESTAMP},
       #{latitude,jdbcType=VARCHAR}, #{clockIn,jdbcType=INTEGER}, #{clockInTime,jdbcType=TIMESTAMP},
-      #{photoUrl,jdbcType=VARCHAR}, #{districtName,jdbcType=VARCHAR}, #{clockInRemarks,jdbcType=VARCHAR}
-      )
+      #{photoUrl,jdbcType=VARCHAR}, #{districtName,jdbcType=VARCHAR}, #{clockInRemarks,jdbcType=VARCHAR},
+      #{duration,jdbcType=DOUBLE})
   </insert>
   </insert>
   <insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="com.goafanti.common.model.PublicReleaseDetails" useGeneratedKeys="true">
   <insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="com.goafanti.common.model.PublicReleaseDetails" useGeneratedKeys="true">
     insert into public_release_details
     insert into public_release_details
@@ -81,6 +82,9 @@
       <if test="clockInRemarks != null">
       <if test="clockInRemarks != null">
         clock_in_remarks,
         clock_in_remarks,
       </if>
       </if>
+      <if test="duration != null">
+        duration,
+      </if>
     </trim>
     </trim>
     <trim prefix="values (" suffix=")" suffixOverrides=",">
     <trim prefix="values (" suffix=")" suffixOverrides=",">
       <if test="prid != null">
       <if test="prid != null">
@@ -119,6 +123,9 @@
       <if test="clockInRemarks != null">
       <if test="clockInRemarks != null">
         #{clockInRemarks,jdbcType=VARCHAR},
         #{clockInRemarks,jdbcType=VARCHAR},
       </if>
       </if>
+      <if test="duration != null">
+        #{duration,jdbcType=DOUBLE},
+      </if>
     </trim>
     </trim>
   </insert>
   </insert>
   <update id="updateByPrimaryKeySelective" parameterType="com.goafanti.common.model.PublicReleaseDetails">
   <update id="updateByPrimaryKeySelective" parameterType="com.goafanti.common.model.PublicReleaseDetails">
@@ -160,6 +167,9 @@
       <if test="clockInRemarks != null">
       <if test="clockInRemarks != null">
         clock_in_remarks = #{clockInRemarks,jdbcType=VARCHAR},
         clock_in_remarks = #{clockInRemarks,jdbcType=VARCHAR},
       </if>
       </if>
+      <if test="duration != null">
+        duration = #{duration,jdbcType=DOUBLE},
+      </if>
     </set>
     </set>
     where id = #{id,jdbcType=INTEGER}
     where id = #{id,jdbcType=INTEGER}
   </update>
   </update>
@@ -176,15 +186,15 @@
       clock_in_time = #{clockInTime,jdbcType=TIMESTAMP},
       clock_in_time = #{clockInTime,jdbcType=TIMESTAMP},
       photo_url = #{photoUrl,jdbcType=VARCHAR},
       photo_url = #{photoUrl,jdbcType=VARCHAR},
       district_name = #{districtName,jdbcType=VARCHAR},
       district_name = #{districtName,jdbcType=VARCHAR},
-      clock_in_remarks = #{clockInRemarks,jdbcType=VARCHAR}
+      clock_in_remarks = #{clockInRemarks,jdbcType=VARCHAR},
+      duration = #{duration,jdbcType=DOUBLE}
     where id = #{id,jdbcType=INTEGER}
     where id = #{id,jdbcType=INTEGER}
   </update>
   </update>
 
 
   <select id="selectByPCid" resultType="com.goafanti.weChat.bo.OutPublicReleaseDetails">
   <select id="selectByPCid" resultType="com.goafanti.weChat.bo.OutPublicReleaseDetails">
     select
     select
-      a.id,a.prid, a.`uid`, a.ufid, a.new_user newUser,a.longitude,a.latitude,
+      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
       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
     from public_release_details a left join user b on a.uid=b.id
     where prid = #{id,jdbcType=INTEGER}
     where prid = #{id,jdbcType=INTEGER}
   </select>
   </select>
@@ -193,13 +203,13 @@
     insert into public_release_details (prid, `uid`, ufid,
     insert into public_release_details (prid, `uid`, ufid,
     new_user, sign_sum, longitude,
     new_user, sign_sum, longitude,
     latitude, clock_in, clock_in_time,
     latitude, clock_in, clock_in_time,
-    photo_url, district_name)
+    photo_url, district_name,duration)
     values
     values
     <foreach  collection="list" item="prd"  separator=",">
     <foreach  collection="list" item="prd"  separator=",">
       (#{prd.prid,jdbcType=INTEGER}, #{prd.uid,jdbcType=VARCHAR}, #{prd.ufid,jdbcType=VARCHAR},
       (#{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.newUser,jdbcType=INTEGER}, #{prd.signSum,jdbcType=INTEGER}, #{prd.longitude,jdbcType=VARCHAR},
       #{prd.latitude,jdbcType=VARCHAR}, #{prd.clockIn,jdbcType=INTEGER}, #{prd.clockInTime,jdbcType=TIMESTAMP},
       #{prd.latitude,jdbcType=VARCHAR}, #{prd.clockIn,jdbcType=INTEGER}, #{prd.clockInTime,jdbcType=TIMESTAMP},
-      #{prd.photoUrl,jdbcType=VARCHAR}, #{prd.districtName,jdbcType=VARCHAR})
+      #{prd.photoUrl,jdbcType=VARCHAR}, #{prd.districtName,jdbcType=VARCHAR},#{prd.duration,jdbcType=DOUBLE})
     </foreach>
     </foreach>
   </insert>
   </insert>
 
 

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

@@ -70,6 +70,11 @@ public class PublicReleaseDetails implements Serializable {
      */
      */
     private String clockInRemarks;
     private String clockInRemarks;
 
 
+    /**
+     * 时长
+     */
+    private Double duration;
+
     private static final long serialVersionUID = 1L;
     private static final long serialVersionUID = 1L;
 
 
     public Integer getId() {
     public Integer getId() {
@@ -175,4 +180,12 @@ public class PublicReleaseDetails implements Serializable {
     public void setClockInRemarks(String clockInRemarks) {
     public void setClockInRemarks(String clockInRemarks) {
         this.clockInRemarks = clockInRemarks;
         this.clockInRemarks = clockInRemarks;
     }
     }
+
+    public Double getDuration() {
+        return duration;
+    }
+
+    public void setDuration(Double duration) {
+        this.duration = duration;
+    }
 }
 }

+ 21 - 1
src/main/java/com/goafanti/weChat/service/impl/PublicReleaseServiceImpl.java

@@ -1,12 +1,12 @@
 package com.goafanti.weChat.service.impl;
 package com.goafanti.weChat.service.impl;
 
 
+import java.math.BigDecimal;
 import java.text.ParseException;
 import java.text.ParseException;
 import java.util.*;
 import java.util.*;
 
 
 import com.goafanti.admin.service.DepartmentService;
 import com.goafanti.admin.service.DepartmentService;
 import com.goafanti.common.dao.*;
 import com.goafanti.common.dao.*;
 import com.goafanti.common.model.*;
 import com.goafanti.common.model.*;
-import com.goafanti.order.service.OrderService;
 import com.goafanti.weChat.bo.*;
 import com.goafanti.weChat.bo.*;
 import org.springframework.beans.BeanUtils;
 import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -77,6 +77,9 @@ public class PublicReleaseServiceImpl extends BaseMybatisDao<PublicReleaseMapper
 		StringBuffer str =new StringBuffer();
 		StringBuffer str =new StringBuffer();
 		if (in.getUids()!=null){
 		if (in.getUids()!=null){
 			List<String> split = Arrays.asList(in.getUids().split(","));
 			List<String> split = Arrays.asList(in.getUids().split(","));
+			int userCount=split.size();
+			Double duration = in.getDuration();
+			Integer index=1;
 			for (String s : split) {
 			for (String s : split) {
 				PublicReleaseDetails prd=new PublicReleaseDetails();
 				PublicReleaseDetails prd=new PublicReleaseDetails();
 				User u=userMapper.selectByPrimaryKey(s);
 				User u=userMapper.selectByPrimaryKey(s);
@@ -94,6 +97,7 @@ public class PublicReleaseServiceImpl extends BaseMybatisDao<PublicReleaseMapper
 				prd.setLongitude(in.getLongitude());
 				prd.setLongitude(in.getLongitude());
 				prd.setClockIn(in.getClockIn());
 				prd.setClockIn(in.getClockIn());
 				prd.setClockInTime(in.getClockInTime());
 				prd.setClockInTime(in.getClockInTime());
+				prd.setDuration(durationSum(duration,userCount,index));
 				prdList.add(prd);
 				prdList.add(prd);
 			}
 			}
 			publicReleaseDetailsMapper.insertBatch(prdList);
 			publicReleaseDetailsMapper.insertBatch(prdList);
@@ -108,6 +112,22 @@ public class PublicReleaseServiceImpl extends BaseMybatisDao<PublicReleaseMapper
 		return map;
 		return map;
 	}
 	}
 
 
+
+
+	private  double durationSum(Double duration, Integer sum,Integer index) {
+		if (sum==index){
+			return duration;
+		}else {
+			//获取有多少个0.5(打卡最小单位)
+			Double counts= Math.floor(duration/0.5);
+			//计算当前时间
+			Double my=Math.floor(counts/sum)*0.5;
+			duration=duration-my;
+			return my;
+		}
+	}
+
+
 	/**
 	/**
 	 *
 	 *
 	 * @param my 我的相关人员
 	 * @param my 我的相关人员