Kaynağa Gözat

打卡接口逻辑修改

anderx 1 yıl önce
ebeveyn
işleme
e21cbe4a5d

+ 42 - 19
src/main/java/com/goafanti/weChat/service/impl/PublicReleaseServiceImpl.java

@@ -1081,6 +1081,8 @@ public class PublicReleaseServiceImpl extends BaseMybatisDao<PublicReleaseMapper
 			return -2;
 		}
 		List<OutPublicReleaseDetails> prdList = publicReleaseDetailsMapper.selectByPrid(id);
+		List<PublicReleaseDateClock> prdcList = publicReleaseDateClockMapper.selectByPrid(id);
+		pushDateClockDetails(prdList,prdcList);
 		String str = "";
 		Date date = new Date();
 		boolean flag=false;
@@ -1096,26 +1098,47 @@ public class PublicReleaseServiceImpl extends BaseMybatisDao<PublicReleaseMapper
 				prd.setClockInRemarks(clockInRemarks);
 				prd.setPhotoUrl(photoUrl);
 				prd.setClockInTime(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());
+				int  count=0;
+				for (PublicReleaseDateClock ep : prd.getPrdcList()) {
+					if (DateUtils.isSameDay(prd.getClockInTime(), ep.getClockInTime())){
+						if (ep.getStatus()==0){
+							ep.setStatus(1);
+							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, prd.getMainStatus());
+							if (clockIn==1){
+								str = "公出人员打卡";
+							}else if (clockIn==2) {
+								str = "公出人员异常打卡";
+							}
+							count++;
+							publicReleaseDateClockMapper.updateByPrimaryKeySelective(ep);
+						}else {
+							if (clockIn==1){
+								str = "刷新打卡";
+							}else if (clockIn==2) {
+								str = "刷新打卡,公出人员异常打卡";
+							}
+							count++;
+						}
+					}else {
+						if (ep.getStatus()==1){
+							count++;
+						}
 					}
-					fbb.setFollowTime(DateUtils.formatDate(prd.getClockInTime(), AFTConstants.YYYYMMDDHHMMSS));
-					String ufid = UUID.randomUUID().toString();
-					prd.setUfid(ufid);
-					customerService.addFollow(fbb, ufid, prd.getMainStatus());
-					str = "公出人员打卡";
-				}else if (clockIn == 2){
-					str = "公出人员异常打卡";
-				}else {
-					str = "刷新打卡";
+
+				}
+				if(prd.getPrdcList().size() == count){
+					prd.setClockIn(1);
 				}
 				PublicReleaseLog log = new PublicReleaseLog(id, aid, PublicReleaseLog.states.dk.getCode(), str, new Date());
 				log.setPhotoUrl(photoUrl);