Merge branch 'dev' of http://62.234.3.186:3000/sxyanzhu/jhprjv2 into dev
commit
1b8fb5fac3
|
@ -27,6 +27,8 @@ public interface SurProjectAttendanceDataMapper
|
|||
*/
|
||||
public List<SurProjectAttendanceData> selectSurProjectAttendanceDataList(SurProjectAttendanceData surProjectAttendanceData);
|
||||
|
||||
|
||||
public List<SurProjectAttendanceData> selectSurProjectAttendanceDataListEx(SurProjectAttendanceData surProjectAttendanceData);
|
||||
/**
|
||||
* 新增劳务实名制管理
|
||||
*
|
||||
|
|
|
@ -28,6 +28,8 @@ public interface ISurProjectAttendanceDataService
|
|||
*/
|
||||
public List<SurProjectAttendanceData> selectSurProjectAttendanceDataList(SurProjectAttendanceData surProjectAttendanceData);
|
||||
|
||||
public List<SurProjectAttendanceData> selectSurProjectAttendanceDataListEx(SurProjectAttendanceData surProjectAttendanceData);
|
||||
|
||||
/**
|
||||
* 新增劳务实名制管理
|
||||
*
|
||||
|
|
|
@ -45,6 +45,11 @@ public class SurProjectAttendanceDataServiceImpl implements ISurProjectAttendanc
|
|||
return surProjectAttendanceDataMapper.selectSurProjectAttendanceDataList(surProjectAttendanceData);
|
||||
}
|
||||
|
||||
public List<SurProjectAttendanceData> selectSurProjectAttendanceDataListEx(SurProjectAttendanceData surProjectAttendanceData)
|
||||
{
|
||||
return surProjectAttendanceDataMapper.selectSurProjectAttendanceDataListEx(surProjectAttendanceData);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增劳务实名制管理
|
||||
*
|
||||
|
@ -125,11 +130,14 @@ public class SurProjectAttendanceDataServiceImpl implements ISurProjectAttendanc
|
|||
|
||||
@Override
|
||||
public void add(SurProjectAttendanceData sdata) {
|
||||
if(StringUtils.isEmpty(sdata.getWorkerId()) || StringUtils.isEmpty(sdata.getAttendanceTime())){
|
||||
return;
|
||||
}
|
||||
SurProjectAttendanceData where=new SurProjectAttendanceData();
|
||||
where.setVendorsCode(sdata.getVendorsCode());
|
||||
where.setCfgid(sdata.getCfgid());
|
||||
where.setServerid(sdata.getServerid());
|
||||
List<SurProjectAttendanceData> list=selectSurProjectAttendanceDataList(where);
|
||||
List<SurProjectAttendanceData> list=selectSurProjectAttendanceDataListEx(where);
|
||||
if(list.size()==0){
|
||||
insertSurProjectAttendanceData(sdata);
|
||||
}else{
|
||||
|
|
|
@ -42,6 +42,9 @@ public class AttendanceHuazhuTask {
|
|||
HttpUrl.Builder urlBuilder = Objects.requireNonNull(HttpUrl.parse(host + path))
|
||||
.newBuilder();
|
||||
|
||||
|
||||
long startTime=DateUtil.date(DateUtil.parse("2024-03-16")).getTime();
|
||||
long endTime=startTime+3600*1000*24*1;
|
||||
Map<String, String> headerParams=new HashMap<>();
|
||||
headerParams.put("appId","8024283707153666851");
|
||||
headerParams.put("appSecret","2070308b49399d94b401d98adeaa5b342aa81627");
|
||||
|
@ -51,13 +54,26 @@ public class AttendanceHuazhuTask {
|
|||
params.put("orgId","1666339529033805825");
|
||||
params.put("tenantId","1666337067184893953");
|
||||
params.put("size","200");
|
||||
params.put("current","174");
|
||||
params.put("current","1");
|
||||
params.put("startTime",startTime);
|
||||
params.put("endTime",endTime);
|
||||
|
||||
Request request = new Request.Builder()
|
||||
.url(urlBuilder.build())
|
||||
.post(toFormBody(params)).headers(setHeaderParams(headerParams))
|
||||
.build();
|
||||
String data=AttendanceTask.getResult(request);
|
||||
System.out.println(data);
|
||||
JSONObject jo= JSON.parseObject(data);
|
||||
JSONObject joData= jo.getJSONObject("data");
|
||||
JSONArray arr=joData.getJSONArray("records");
|
||||
long pages=joData.getLong("pages");
|
||||
if(arr!=null && arr.size()>0){
|
||||
for(int i=0;i<arr.size();i++) {
|
||||
JSONObject json = arr.getJSONObject(i);
|
||||
SurProjectAttendanceData sdata = SurProjectAttendanceData.createFromHuazhu(json);
|
||||
System.out.println(JSON.toJSONString(sdata));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
//380649600000
|
||||
|
@ -69,6 +85,7 @@ public class AttendanceHuazhuTask {
|
|||
public static void main3(String[] args) {
|
||||
String path="/api/open/labour/findLabourWorkerByPage";
|
||||
Map<String,String> map=new HashMap<>();
|
||||
|
||||
map.put("appId","8024283707153666851");
|
||||
map.put("secret","2070308b49399d94b401d98adeaa5b342aa81627");
|
||||
map.put("projectId","1666339529033805825");
|
||||
|
@ -109,12 +126,18 @@ public class AttendanceHuazhuTask {
|
|||
/**
|
||||
* 同步7天之内的数据
|
||||
*/
|
||||
public void syncLastWeekAttendanceData() {
|
||||
public void syncLast90DayAttendanceData() {
|
||||
long endTime=DateUtil.current();
|
||||
long startTime=endTime-3600*1000*24*90;
|
||||
syncAttendanceData(startTime);
|
||||
}
|
||||
|
||||
public void syncLastWeekAttendanceData() {
|
||||
long endTime=DateUtil.current();
|
||||
long startTime=endTime-3600*1000*24*7;
|
||||
syncAttendanceData(startTime);
|
||||
}
|
||||
|
||||
/**
|
||||
* 同步当天数据
|
||||
*/
|
||||
|
@ -173,7 +196,7 @@ public class AttendanceHuazhuTask {
|
|||
Map<String,Object> map=new HashMap<>();
|
||||
long endTime=DateUtil.current();
|
||||
|
||||
map.put("endTime",endTime);
|
||||
//map.put("endTime",endTime);
|
||||
map.put("startTime",startTime);
|
||||
for(SurProjectAttendanceCfg it :list){
|
||||
String param= it.getVendorsParameter();
|
||||
|
|
|
@ -0,0 +1,101 @@
|
|||
package com.yanzhu.jh.project.task;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import com.alibaba.fastjson2.JSON;
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.ruoyi.common.utils.sign.Md5Utils;
|
||||
import okhttp3.*;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
|
||||
public class AttendanceJgwTask {
|
||||
static String host="http://api.gongyoumishu.com:80/gomeetapi/";
|
||||
//sign/photo/20240101/E24E76-C9A5CB-0000FF/1741751233297383424_8848.JPG
|
||||
public static String getToken(String appid,String secret){
|
||||
String grantType="client_credential";
|
||||
String path="/webapi/credential";
|
||||
Map<String, Object> params = new HashMap<>();
|
||||
params.put("appId",appid);
|
||||
params.put("secret",secret);
|
||||
params.put("grantType",grantType);
|
||||
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");
|
||||
if(joData!=null){
|
||||
return joData.getString("token");
|
||||
|
||||
}
|
||||
return null;
|
||||
}
|
||||
private static RequestBody toFormBody(Map<String, Object> params ){
|
||||
FormBody.Builder builder=new FormBody.Builder();
|
||||
for(String key :params.keySet()){
|
||||
builder.add(key,params.get(key).toString());
|
||||
}
|
||||
return builder.build();
|
||||
}
|
||||
public static void main(String[] args){
|
||||
String appid="6a6f24fe35b04ee0bcf31cfb46ed1051";
|
||||
String secret="c3h5enh4MjAyNHN1Yw==";
|
||||
String prjId="b67f1baa6dca4558a16bf90a4681b82e";
|
||||
String token= getToken(appid,secret);
|
||||
if(token==null || token.length()==0){
|
||||
return;
|
||||
}
|
||||
System.out.println(token);
|
||||
//findAddWorkerByProject(appid,token,prjId);
|
||||
findAttendanceByProject(appid,token,prjId);
|
||||
}
|
||||
public static void findAttendanceByProject(String appId,String token,String projectId){
|
||||
String path="/webapi/project/findAttendanceByProject";
|
||||
String time = System.currentTimeMillis() + "";
|
||||
String startId="0";
|
||||
String url=host+path+"?appId=" + appId + "&tokenSign=" + token +"×tamp=" + time;
|
||||
System.out.println(url);
|
||||
String tokenSign = Md5Utils.hash(url);
|
||||
System.out.println(tokenSign);
|
||||
Map<String, Object> params = new HashMap<>();
|
||||
params.put("appId",appId);
|
||||
params.put("timestamp",time);
|
||||
params.put("tokenSign",tokenSign);
|
||||
params.put("projectId",projectId);
|
||||
params.put("startId",startId);
|
||||
params.put("startId",startId);
|
||||
params.put("startTime","2024-01-01");
|
||||
params.put("endTime","2024-01-20");
|
||||
Request request = new Request.Builder()
|
||||
.url(host+path)
|
||||
.post(toFormBody(params))
|
||||
.build();
|
||||
String data=AttendanceTask.getResult(request);
|
||||
System.out.println(data);
|
||||
}
|
||||
public static void findAddWorkerByProject(String appId,String token,String projectId){
|
||||
String path="/webapi/project/findAddWorkerByProject";
|
||||
String time = System.currentTimeMillis() + "";
|
||||
String startId="0";
|
||||
String url=host+path+"?appId=" + appId + "&tokenSign=" + token +"×tamp=" + time;
|
||||
System.out.println(url);
|
||||
String tokenSign = Md5Utils.hash(url);
|
||||
System.out.println(tokenSign);
|
||||
Map<String, Object> params = new HashMap<>();
|
||||
params.put("appId",appId);
|
||||
params.put("timestamp",time);
|
||||
params.put("tokenSign",tokenSign);
|
||||
params.put("projectId",projectId);
|
||||
params.put("startId",startId);
|
||||
Request request = new Request.Builder()
|
||||
.url(host+path)
|
||||
.post(toFormBody(params))
|
||||
.build();
|
||||
String data=AttendanceTask.getResult(request);
|
||||
System.out.println(data);
|
||||
}
|
||||
|
||||
}
|
|
@ -45,6 +45,31 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
sur_project_attendance_data
|
||||
</sql>
|
||||
|
||||
<select id="selectSurProjectAttendanceDataListEx" parameterType="SurProjectAttendanceData" resultMap="SurProjectAttendanceDataResult">
|
||||
select * from sur_project_attendance_data
|
||||
<where>
|
||||
<if test="cfgid != null "> and cfgid = #{cfgid}</if>
|
||||
<if test="appId != null "> and app_id = #{appId}</if>
|
||||
<if test="vendorsCode != null and vendorsCode != ''"> and vendors_code = #{vendorsCode}</if>
|
||||
<if test="serverid != null "> and serverid = #{serverid}</if>
|
||||
<if test="workerId != null "> and workerId = #{workerId}</if>
|
||||
<if test="attendanceType != null and attendanceType != ''"> and attendance_type = #{attendanceType}</if>
|
||||
<if test="attendanceTime != null and attendanceTime != ''"> and attendance_time = #{attendanceTime}</if>
|
||||
<if test="identification != null and identification != ''"> and identification = #{identification}</if>
|
||||
<if test="teamId != null "> and teamId = #{teamId}</if>
|
||||
<if test="workTypeCode != null and workTypeCode != ''"> and workTypeCode = #{workTypeCode}</if>
|
||||
<if test="companyId != null "> and companyId = #{companyId}</if>
|
||||
<if test="vendorId != null "> and vendorId = #{vendorId}</if>
|
||||
<if test="projectType != null "> and projectType = #{projectType}</if>
|
||||
<if test="deviceCode != null and deviceCode != ''"> and device_code = #{deviceCode}</if>
|
||||
<if test="workPointId != null and workPointId != ''"> and work_point_id = #{workPointId}</if>
|
||||
<if test="scanPhoto != null and scanPhoto != ''"> and scanPhoto = #{scanPhoto}</if>
|
||||
<if test="other != null and other != ''"> and other = #{other}</if>
|
||||
<if test="state != null "> and state = #{state}</if>
|
||||
<if test="isDel != null "> and is_del = #{isDel}</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectSurProjectAttendanceDataList" parameterType="SurProjectAttendanceData" resultMap="SurProjectAttendanceDataResult">
|
||||
<include refid="selectSurProjectAttendanceDataVo"/>
|
||||
<where>
|
||||
|
|
Loading…
Reference in New Issue