update code
parent
b21bbf095d
commit
8a49d3f250
|
@ -148,7 +148,11 @@ public class SurProjectAttendanceUserServiceImpl implements ISurProjectAttendanc
|
|||
if(list.size()==0){
|
||||
insertSurProjectAttendanceUser(user);
|
||||
}else{
|
||||
user.setId(list.get(0).getId());
|
||||
SurProjectAttendanceUser old=list.get(0);
|
||||
if(user.getVendorsCode().equals("jgw")){
|
||||
user.setCompanyId(old.getCompanyId());
|
||||
}
|
||||
user.setId(old.getId());
|
||||
updateSurProjectAttendanceUser(user);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -122,6 +122,7 @@ public class AttendanceJgwTask {
|
|||
//findDirectlyUnderTeam(appid,token,prjId,subcontractorId,0);
|
||||
//queryProject(appid,token,phone,0);;
|
||||
//findAddWorkerByProject(appid,token,prjId,0);
|
||||
findUpdateWorkerByProject(appid,token,prjId,0);
|
||||
//findAttendanceByProject(appid,token,prjId);
|
||||
//findTeamByProjectId(appid,token,prjId);
|
||||
//findProContractorByProjectId(appid,token,prjId);
|
||||
|
@ -553,7 +554,49 @@ public class AttendanceJgwTask {
|
|||
//findAddWorkerByProject(appId, token, projectId, endId);
|
||||
}
|
||||
}
|
||||
public static void findUpdateWorkerByProject(String appId,String token,String projectId,int startId){
|
||||
String path="/webapi/project/findUpdateWorkerByProject";
|
||||
String time = System.currentTimeMillis() + "";
|
||||
String url=host+path+"?appId=" + appId + "&tokenSign=" + token +"×tamp=" + time;
|
||||
|
||||
String tokenSign = Md5Utils.hash(url);
|
||||
|
||||
Map<String, Object> params = new HashMap<>();
|
||||
params.put("appId",appId);
|
||||
params.put("timestamp",time);
|
||||
params.put("tokenSign",tokenSign);
|
||||
params.put("projectId",projectId);
|
||||
params.put("updateTime","2024-01-01 00:00:00");
|
||||
//params.put("startId",startId);
|
||||
params.put("startId","32150708");
|
||||
Request request = new Request.Builder()
|
||||
.url(host+path)
|
||||
.post(toFormBody(params))
|
||||
.build();
|
||||
String data=AttendanceTask.getResult(request);
|
||||
JSONObject jo= JSON.parseObject(data);
|
||||
JSONObject joData= jo.getJSONObject("data");
|
||||
//int endId= joData.getInteger("endId");
|
||||
JSONArray arr=joData.getJSONArray("workerList");
|
||||
if(arr.size()>0) {
|
||||
int cnt=0;
|
||||
for(int i=0;i<arr.size();i++){
|
||||
JSONObject json=arr.getJSONObject(i);
|
||||
String workerStatus= json.getString("workerStatus");
|
||||
if("02".equals(workerStatus)){
|
||||
cnt++;
|
||||
}
|
||||
SurProjectAttendanceUser user=SurProjectAttendanceUser.createFromJgw(json);
|
||||
if(user.getName().equals("李文国")){
|
||||
String k=user.getName();
|
||||
JSONArray arr2= json.getJSONArray("corpName");
|
||||
Object o=arr2.get(0);
|
||||
}
|
||||
}
|
||||
System.out.println("cnt:"+cnt+","+arr.size());
|
||||
//findAddWorkerByProject(appId, token, projectId, endId);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* 同步人员信息
|
||||
*/
|
||||
|
@ -580,6 +623,7 @@ public class AttendanceJgwTask {
|
|||
}
|
||||
}
|
||||
}
|
||||
syncWorkerByLeader();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue