1
0

2 Коміти f313b52ddc ... 543cf5f094

Автор SHA1 Опис Дата
  yuanzhi_kuang 543cf5f094 Merge branch 'master' of http://47.92.104.23:3000/LiuYing/aibeike 1 тиждень тому
  yuanzhi_kuang 345da025d0 考勤同步 1 тиждень тому

+ 23 - 22
src/com/kingdee/eas/custom/synctask/SyncTranForAtsFacadeControllerBean.java

@@ -69,16 +69,16 @@ public class SyncTranForAtsFacadeControllerBean extends AbstractSyncTranForAtsFa
         LocalDate end = LocalDate.now();
         //如果时间参数都为空,则使用offset参数
         if(StringUtils.isEmpty(beginDate) && StringUtils.isEmpty(endDate)){
-    		if( offset > 0 ){
+            if( offset > 0 ){
                 //eDate增加offset天
                 end = end.plusDays(offset);
-    		}else if( offset < 0 ) {
+            }else if( offset < 0 ) {
                 start = start.plusDays(offset);
-    		}
-        }else  if(StringUtils.isEmpty(beginDate) ){
+            }
+        }else  if(!StringUtils.isEmpty(beginDate) ){
             //开始日期字定义,结束日期都是今天
             start = LocalDate.parse(beginDate, dateFormatter);
-        }else  if(StringUtils.isEmpty(endDate)){
+        }else  if(!StringUtils.isEmpty(endDate)){
             //开始日期,结束日期都是今天
             end = LocalDate.parse(endDate, dateFormatter);
         }
@@ -88,6 +88,7 @@ public class SyncTranForAtsFacadeControllerBean extends AbstractSyncTranForAtsFa
 
         // 1. 按天循环处理
         LocalDate currentDay = start;
+        logger.error("startDate:"+currentDay +",enddate:"+end );
         while (!currentDay.isAfter(end)) {
             try {
                 // 当天日期字符串
@@ -113,7 +114,7 @@ public class SyncTranForAtsFacadeControllerBean extends AbstractSyncTranForAtsFa
                 if (response != null) {
                     JSONObject result = JSONObject.parseObject(response);
                     if ("0".equals(result.getString("ret"))) {
-                    	JSONObject data = result.getJSONObject("data");
+                        JSONObject data = result.getJSONObject("data");
                         JSONArray items = data.getJSONArray("items");
                         logger.error("日期 " + dayStr + " 打卡同步接口,接口共传输记录数: " + items.size()+"条数据");
                         saveMJPunchCardData(ctx, items);
@@ -129,38 +130,38 @@ public class SyncTranForAtsFacadeControllerBean extends AbstractSyncTranForAtsFa
     }
 
 
-    
-    
-    
+
+
+
     private JSONObject buildRequestParams(String startDate, String endDate) {
         JSONObject params = new JSONObject();
         DateTimeFormatter dateFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
         DateTimeFormatter datetimeFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
-        
+
         LocalDate today = LocalDate.now();
         // 处理 startDate:默认为当天 00:00:00
         if (StringUtils.isEmpty(startDate)) {
             startDate = today.atStartOfDay().format(datetimeFormatter);
         } else {
             startDate = LocalDate.parse(startDate, dateFormatter)
-                                .atStartOfDay()
-                                .format(datetimeFormatter);
+                    .atStartOfDay()
+                    .format(datetimeFormatter);
         }
-        
+
         // 处理 endDate:默认为当天 23:59:59
         if (StringUtils.isEmpty(endDate)) {
             endDate = today.atTime(23, 59, 59).format(datetimeFormatter);
         } else {
             endDate = LocalDate.parse(endDate, dateFormatter)
-                              .atTime(23, 59, 59)
-                              .format(datetimeFormatter);
+                    .atTime(23, 59, 59)
+                    .format(datetimeFormatter);
         }
         params.put("starttime", startDate);
         params.put("endtime", endDate);
         return params;
     }
-    
-    
+
+
 
 
     /**
@@ -267,7 +268,7 @@ public class SyncTranForAtsFacadeControllerBean extends AbstractSyncTranForAtsFa
         } catch (Exception e) {
             logger.error("保存门禁打卡记录失败: " + e.getMessage(), e);
         }
-            // 考勤档案
+        // 考勤档案
 
     }
 
@@ -348,7 +349,7 @@ public class SyncTranForAtsFacadeControllerBean extends AbstractSyncTranForAtsFa
 
 
     private HashSet<String>  getExistedPunchCardRecordCol(Context ctx, HashSet<String> attId) throws BOSException {
-    	HashSet<String> hashSet = new HashSet<String>();
+        HashSet<String> hashSet = new HashSet<String>();
         EntityViewInfo evi = new EntityViewInfo();
         FilterInfo fi = new FilterInfo();
         evi.setFilter(fi);
@@ -356,8 +357,8 @@ public class SyncTranForAtsFacadeControllerBean extends AbstractSyncTranForAtsFa
         fi.getFilterItems().add(new FilterItemInfo("number", attId, CompareType.INCLUDE));
         PunchCardRecordCollection existColl = PunchCardRecordFactory.getLocalInstance(ctx).getPunchCardRecordCollection(evi);
         for(int i =0 ;i<existColl.size();i++) {
-        	PunchCardRecordInfo punchCardRecordInfo = existColl.get(i);
-        	hashSet.add(punchCardRecordInfo.getNumber());
+            PunchCardRecordInfo punchCardRecordInfo = existColl.get(i);
+            hashSet.add(punchCardRecordInfo.getNumber());
         }
         return hashSet;
 
@@ -365,5 +366,5 @@ public class SyncTranForAtsFacadeControllerBean extends AbstractSyncTranForAtsFa
 
 
 
-    
+
 }