Просмотр исходного кода

修改打卡地址,已打卡修改成会重置

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

+ 17 - 4
src/main/java/com/goafanti/common/mapper/PublicReleaseDetailsMapper.xml

@@ -14,10 +14,11 @@
     <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" />
   </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
+    photo_url, district_name, clock_in_remarks
   </sql>
   <select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
     select
@@ -33,11 +34,13 @@
     insert into public_release_details (prid, `uid`, ufid,
       new_user, sign_sum, longitude,
       latitude, clock_in, clock_in_time,
-      photo_url, district_name)
+      photo_url, district_name, clock_in_remarks
+      )
     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})
+      #{photoUrl,jdbcType=VARCHAR}, #{districtName,jdbcType=VARCHAR}, #{clockInRemarks,jdbcType=VARCHAR}
+      )
   </insert>
   <insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="com.goafanti.common.model.PublicReleaseDetails" useGeneratedKeys="true">
     insert into public_release_details
@@ -75,6 +78,9 @@
       <if test="districtName != null">
         district_name,
       </if>
+      <if test="clockInRemarks != null">
+        clock_in_remarks,
+      </if>
     </trim>
     <trim prefix="values (" suffix=")" suffixOverrides=",">
       <if test="prid != null">
@@ -110,6 +116,9 @@
       <if test="districtName != null">
         #{districtName,jdbcType=VARCHAR},
       </if>
+      <if test="clockInRemarks != null">
+        #{clockInRemarks,jdbcType=VARCHAR},
+      </if>
     </trim>
   </insert>
   <update id="updateByPrimaryKeySelective" parameterType="com.goafanti.common.model.PublicReleaseDetails">
@@ -148,6 +157,9 @@
       <if test="districtName != null">
         district_name = #{districtName,jdbcType=VARCHAR},
       </if>
+      <if test="clockInRemarks != null">
+        clock_in_remarks = #{clockInRemarks,jdbcType=VARCHAR},
+      </if>
     </set>
     where id = #{id,jdbcType=INTEGER}
   </update>
@@ -163,7 +175,8 @@
       clock_in = #{clockIn,jdbcType=INTEGER},
       clock_in_time = #{clockInTime,jdbcType=TIMESTAMP},
       photo_url = #{photoUrl,jdbcType=VARCHAR},
-      district_name = #{districtName,jdbcType=VARCHAR}
+      district_name = #{districtName,jdbcType=VARCHAR},
+      clock_in_remarks = #{clockInRemarks,jdbcType=VARCHAR}
     where id = #{id,jdbcType=INTEGER}
   </update>
 

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

@@ -50,7 +50,7 @@ public class AdminReleaseApiController extends CertifyApiController{
 			res.getError().add(buildErrorMessageParams(ErrorConstants.PARAM_EMPTY_ERROR,"公出时间"));
 			return res;
 		}
-		if (StringUtils.isBlank(in.getUserName())) {
+		if (StringUtils.isBlank(in.getDistrictName())) {
 			res.getError().add(buildErrorMessageParams(ErrorConstants.PARAM_EMPTY_ERROR,"公出地点"));
 			return res;
 		}
@@ -93,7 +93,7 @@ public class AdminReleaseApiController extends CertifyApiController{
 			res.getError().add(buildErrorMessageParams(ErrorConstants.PARAM_EMPTY_ERROR,"编号"));
 			return res;
 		}
-		if (in.getLatitude()==null||in.getLongitude()==null||in.getUserName()==null){
+		if (in.getLatitude()==null||in.getLongitude()==null||in.getDistrictName()==null){
 			res.getError().add(buildErrorMessageParams(ErrorConstants.PARAM_EMPTY_ERROR,"位置"));
 			return res;
 		}
@@ -106,9 +106,9 @@ public class AdminReleaseApiController extends CertifyApiController{
 	 * @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;
 	}
 	/**

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

@@ -26,7 +26,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);
 

+ 49 - 39
src/main/java/com/goafanti/weChat/service/impl/PublicReleaseServiceImpl.java

@@ -97,8 +97,11 @@ public class PublicReleaseServiceImpl extends BaseMybatisDao<PublicReleaseMapper
 				prd.setPrid(in.getId());
 				prd.setUid(s);
 				prd.setSignSum(0);
-				prd.setDistrictName(in.getUserName());
-				prd.set
+				prd.setDistrictName(in.getDistrictName());
+				prd.setLatitude(in.getLatitude());
+				prd.setLongitude(in.getLongitude());
+				prd.setClockIn(in.getClockIn());
+				prd.setClockInTime(in.getClockInTime());
 				prdList.add(prd);
 			}
 			publicReleaseDetailsMapper.insertBatch(prdList);
@@ -517,8 +520,8 @@ public class PublicReleaseServiceImpl extends BaseMybatisDao<PublicReleaseMapper
 				}
 				if (flag){
 					if (!use.getUid().equals(p.getUid()))p.setUid(use.getUid());
-					if (!use.getUserName().equals(p.getUserName())){
-						p.setUserName(use.getUserName());
+					if (!use.getDistrictName().equals(p.getDistrictName())){
+						p.setDistrictName(use.getDistrictName());
 						p.setLatitude(use.getLatitude());
 						p.setLongitude(use.getLongitude());
 					}
@@ -543,43 +546,50 @@ 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) {
-			//获取列表
-			List<PublicReleaseDetails> prdList = publicReleaseDetailsMapper.selectByPCid(id);
-			for (PublicReleaseDetails prd : prdList) {
-				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());
+	public int pushPublicReleaseClockIn(Integer id,String photoUrl,Integer clockIn ,String clockInRemarks ,String uid) {
+		if (clockIn == null) clockIn = 1;
+		PublicRelease use = publicReleaseMapper.selectByPrimaryKey(id);
+		List<PublicReleaseDetails> prdList = publicReleaseDetailsMapper.selectByPCid(id);
+		String str = "";
+		boolean flag=false;
+		for (PublicReleaseDetails prd : prdList) {
+			if (prd.getUid().equals(uid)){
+				String aid = TokenManager.getAdminId();
+				prd.setId(id);
+				prd.setClockIn(clockIn);
+				prd.setClockInRemarks(clockInRemarks);
+				prd.setPhotoUrl(photoUrl);
+				prd.setClockInTime(new Date());
+				if (prd.getClockIn() == 0) {
+					//获取列表
+					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 = "刷新打卡";
 				}
-				fbb.setFollowTime(DateUtils.formatDate(p.getClockInTime(), AFTConstants.YYYYMMDDHHMMSS));
-				String ufid=UUID.randomUUID().toString();
-				p.setUfid(ufid);
-				customerService.addFollow(fbb,ufid,use.getMainStatus());
+				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 (clockIn==1)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);
-		publicReleaseMapper.updateByPrimaryKeySelective(p);
+		if (!flag){
+			return 0;
+		}
 		return 1;
 	}
 
@@ -987,7 +997,7 @@ public class PublicReleaseServiceImpl extends BaseMybatisDao<PublicReleaseMapper
 		publicRelease.setId(in.getId());
 		publicRelease.setLatitude(in.getLatitude());
 		publicRelease.setLongitude(in.getLongitude());
-		publicRelease.setUserName(in.getUserName());
+		publicRelease.setDistrictName(in.getDistrictName());
 		publicRelease.setStatus(1);
 		publicRelease.setClockIn(0);
 		addpublicLog(in.getId(),5,"发起公出地点修改");