|
@@ -711,199 +711,233 @@ public class DingOaServiceImpl implements DingOaService {
|
|
|
|
|
|
/*查询宜搭【出差明细中间表】符合(同步状态=未同步)的单据*/
|
|
|
JSONObject jsonObject = null;
|
|
|
- try {
|
|
|
- com.aliyun.dingtalkyida_1_0.Client client = createClient();
|
|
|
- com.aliyun.dingtalkyida_1_0.models.SearchFormDataSecondGenerationNoTableFieldHeaders searchFormDataSecondGenerationNoTableFieldHeaders = new com.aliyun.dingtalkyida_1_0.models.SearchFormDataSecondGenerationNoTableFieldHeaders();
|
|
|
- searchFormDataSecondGenerationNoTableFieldHeaders.xAcsDingtalkAccessToken = accessTokenService.getAccessToken();
|
|
|
- com.aliyun.dingtalkyida_1_0.models.SearchFormDataSecondGenerationNoTableFieldRequest searchFormDataSecondGenerationNoTableFieldRequest = new com.aliyun.dingtalkyida_1_0.models.SearchFormDataSecondGenerationNoTableFieldRequest()
|
|
|
- .setSystemToken("ETA66681XCH5NWT9CNL9V88ZGIB12I8RTWBALZZE")
|
|
|
- .setFormUuid("FORM-RK966E71VZU5Y4NGCETV6DT8JUEL3I97XZ2BL4")
|
|
|
- //TODO 系统管理员id
|
|
|
- .setUserId("yida_pub_account")
|
|
|
- .setSearchCondition("[{ \"key\": \"textField_lbdex822\", \"value\": \"未同步\", \"type\": \"TEXT\", \"operator\": \"eq\", \"componentName\": \"TextField\" }]")
|
|
|
- .setAppType("APP_UTWSE5WCXGWTUOEJ9E1D");
|
|
|
|
|
|
- SearchFormDataSecondGenerationNoTableFieldResponse searchFormDataSecondGenerationNoTableFieldResponse = client.searchFormDataSecondGenerationNoTableFieldWithOptions(searchFormDataSecondGenerationNoTableFieldRequest, searchFormDataSecondGenerationNoTableFieldHeaders, new RuntimeOptions());
|
|
|
- System.out.println(JSON.toJSONString(searchFormDataSecondGenerationNoTableFieldResponse.getBody()));
|
|
|
- String s = JSON.toJSONString(searchFormDataSecondGenerationNoTableFieldResponse.getBody());
|
|
|
- jsonObject = JSON.parseObject(s);
|
|
|
- System.out.println("【出差明细中间表】实例详情接口object对象:" + jsonObject);
|
|
|
- } catch (TeaException err) {
|
|
|
- if (!com.aliyun.teautil.Common.empty(err.code) && !com.aliyun.teautil.Common.empty(err.message)) {
|
|
|
- // err 中含有 code 和 message 属性,可帮助开发定位问题
|
|
|
- }
|
|
|
+ int size = 100;
|
|
|
+ int page = 1;
|
|
|
+
|
|
|
+ do {
|
|
|
+ try {
|
|
|
+ com.aliyun.dingtalkyida_1_0.Client client = createClient();
|
|
|
+ com.aliyun.dingtalkyida_1_0.models.SearchFormDataSecondGenerationNoTableFieldHeaders searchFormDataSecondGenerationNoTableFieldHeaders = new com.aliyun.dingtalkyida_1_0.models.SearchFormDataSecondGenerationNoTableFieldHeaders();
|
|
|
+ searchFormDataSecondGenerationNoTableFieldHeaders.xAcsDingtalkAccessToken = accessTokenService.getAccessToken();
|
|
|
+ com.aliyun.dingtalkyida_1_0.models.SearchFormDataSecondGenerationNoTableFieldRequest searchFormDataSecondGenerationNoTableFieldRequest = new com.aliyun.dingtalkyida_1_0.models.SearchFormDataSecondGenerationNoTableFieldRequest()
|
|
|
+ .setSystemToken("ETA66681XCH5NWT9CNL9V88ZGIB12I8RTWBALZZE")
|
|
|
+ .setFormUuid("FORM-RK966E71VZU5Y4NGCETV6DT8JUEL3I97XZ2BL4")
|
|
|
+ //每页条数,最大100条
|
|
|
+ .setPageSize(size)
|
|
|
+ //当前页码,默认从1开始
|
|
|
+ .setPageNumber(page)
|
|
|
+ //TODO 系统管理员id
|
|
|
+ .setUserId("yida_pub_account")
|
|
|
+ .setSearchCondition("[{ \"key\": \"textField_lbdex822\", \"value\": \"未同步\", \"type\": \"TEXT\", \"operator\": \"eq\", \"componentName\": \"TextField\" }]")
|
|
|
+ .setAppType("APP_UTWSE5WCXGWTUOEJ9E1D");
|
|
|
+
|
|
|
+ SearchFormDataSecondGenerationNoTableFieldResponse searchFormDataSecondGenerationNoTableFieldResponse = client.searchFormDataSecondGenerationNoTableFieldWithOptions(searchFormDataSecondGenerationNoTableFieldRequest, searchFormDataSecondGenerationNoTableFieldHeaders, new RuntimeOptions());
|
|
|
+ System.out.println(JSON.toJSONString(searchFormDataSecondGenerationNoTableFieldResponse.getBody()));
|
|
|
+ String s = JSON.toJSONString(searchFormDataSecondGenerationNoTableFieldResponse.getBody());
|
|
|
+ jsonObject = JSON.parseObject(s);
|
|
|
+ System.out.println("【出差明细中间表】实例详情接口object对象:" + jsonObject);
|
|
|
+ } catch (TeaException err) {
|
|
|
+ if (!com.aliyun.teautil.Common.empty(err.code) && !com.aliyun.teautil.Common.empty(err.message)) {
|
|
|
+ // err 中含有 code 和 message 属性,可帮助开发定位问题
|
|
|
+ }
|
|
|
+
|
|
|
+ } catch (Exception _err) {
|
|
|
+ TeaException err = new TeaException(_err.getMessage(), _err);
|
|
|
+ if (!com.aliyun.teautil.Common.empty(err.code) && !com.aliyun.teautil.Common.empty(err.message)) {
|
|
|
+ // err 中含有 code 和 message 属性,可帮助开发定位问题
|
|
|
+ }
|
|
|
|
|
|
- } catch (Exception _err) {
|
|
|
- TeaException err = new TeaException(_err.getMessage(), _err);
|
|
|
- if (!com.aliyun.teautil.Common.empty(err.code) && !com.aliyun.teautil.Common.empty(err.message)) {
|
|
|
- // err 中含有 code 和 message 属性,可帮助开发定位问题
|
|
|
}
|
|
|
|
|
|
- }
|
|
|
+ JSONArray data = jsonObject.getJSONArray("data");
|
|
|
+ for (int i = 0; i < data.size(); i++) {
|
|
|
+ //================出差人员id================
|
|
|
+ String employeeField_lajb96ub_id = data.getJSONObject(i).getJSONObject("formData").getJSONArray("employeeField_lajb96ub_id").getString(0);
|
|
|
+ System.out.println("出差人员id:" + employeeField_lajb96ub_id);
|
|
|
|
|
|
- JSONArray data = jsonObject.getJSONArray("data");
|
|
|
- for (int i = 0; i < data.size(); i++) {
|
|
|
- //================出差人员id================
|
|
|
- String employeeField_lajb96ub_id = data.getJSONObject(i).getJSONObject("formData").getJSONArray("employeeField_lajb96ub_id").getString(0);
|
|
|
- System.out.println("出差人员id:" + employeeField_lajb96ub_id);
|
|
|
+ //================审批实例id================
|
|
|
+ String formInstanceId = data.getJSONObject(i).getString("formInstanceId");
|
|
|
+ System.out.println("审批实例id:" + formInstanceId);
|
|
|
|
|
|
- //================审批实例id================
|
|
|
- String formInstanceId = data.getJSONObject(i).getString("formInstanceId");
|
|
|
- System.out.println("审批实例id:" + formInstanceId);
|
|
|
+ //================同步状态================
|
|
|
+ String textField_lbdex822 = data.getJSONObject(i).getJSONObject("formData").getString("textField_lbdex822");
|
|
|
+ System.out.println("同步状态:" + textField_lbdex822);
|
|
|
|
|
|
- //================岗位补助标准================
|
|
|
- int numberField_lajb96um = data.getJSONObject(i).getJSONObject("formData").getInteger("numberField_lajb96um");
|
|
|
- System.out.println("岗位补助标准:" + numberField_lajb96um);
|
|
|
-
|
|
|
- SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
|
|
- //================出差开始时间(毫秒级时间戳)================
|
|
|
- String dateField_lajb96ud = data.getJSONObject(i).getJSONObject("formData").getString("dateField_lajb96ud");
|
|
|
- System.out.println("出差开始时间(毫秒级时间戳):" + dateField_lajb96ud);
|
|
|
- long startLong = new Long(dateField_lajb96ud);
|
|
|
- //将时间戳转换为时间
|
|
|
- Date startDate = new Date(startLong);
|
|
|
- System.out.println("出差开始时间(时间型):" + startDate);
|
|
|
- //将时间调整为yyyy-MM-dd HH:mm:ss时间样式
|
|
|
- String startString = simpleDateFormat.format(startDate);
|
|
|
- System.out.println("出差开始时间(时间样式):" + startString);
|
|
|
-
|
|
|
- //================出差结束时间(毫秒级时间戳)================
|
|
|
- String dateField_lajb96uf = data.getJSONObject(i).getJSONObject("formData").getString("dateField_lajb96uf");
|
|
|
- System.out.println("出差结束时间(毫秒级时间戳):" + dateField_lajb96uf);
|
|
|
- long endLong = new Long(dateField_lajb96uf);
|
|
|
- //将时间戳转换为时间
|
|
|
- Date endDate = new Date(endLong);
|
|
|
- System.out.println("出差结束时间(时间型):" + endDate);
|
|
|
- //将时间调整为yyyy-MM-dd HH:mm:ss时间样式
|
|
|
- String endString = simpleDateFormat.format(endDate);
|
|
|
- System.out.println("出差结束时间(时间样式):" + endString);
|
|
|
-
|
|
|
- //================当前时间================
|
|
|
- Date dateNow = new Date(System.currentTimeMillis());
|
|
|
- System.out.println("当前时间(时间型):" + dateNow);
|
|
|
- String dateNowString = simpleDateFormat.format(dateNow);
|
|
|
- System.out.println("当前时间(时间样式):" + dateNowString);
|
|
|
-
|
|
|
- //================获取出差结束时间后面一天的零点零分零秒================
|
|
|
- Calendar calendar = Calendar.getInstance();
|
|
|
- calendar.setTime(endDate);
|
|
|
- //后面一天
|
|
|
- calendar.add(Calendar.DAY_OF_MONTH,1);
|
|
|
- calendar.set(Calendar.HOUR_OF_DAY,0);
|
|
|
- calendar.set(Calendar.MINUTE,0);
|
|
|
- calendar.set(Calendar.SECOND,0);
|
|
|
- calendar.set(Calendar.MILLISECOND,0);
|
|
|
- String lastTime = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(calendar.getTime());
|
|
|
- System.out.println("出差结束时间后面一天零点:" + lastTime);
|
|
|
-
|
|
|
- //================时间比对================
|
|
|
- //当前时间
|
|
|
- DateTime parseA = DateUtil.parse(dateNowString);
|
|
|
- //出差结束时间后面一天
|
|
|
- DateTime parseB = DateUtil.parse(lastTime);
|
|
|
- //比对两个时间是否属于同一天,属于为true,反之为false
|
|
|
- boolean sameDay = DateUtil.isSameDay(parseA, parseB);
|
|
|
- System.out.println("时间比对结果:" + sameDay);
|
|
|
-
|
|
|
- //================时间相等(满足执行时间)则去抓取该人员的考勤打卡数据,并将出勤结果同步更新至宜搭================
|
|
|
- if (sameDay == true){
|
|
|
- //出差实际总天数
|
|
|
- int ccts = 0;
|
|
|
-
|
|
|
- /*查询指定出差申请日期的人员的钉钉考勤打卡*/
|
|
|
- //待查询人员userid
|
|
|
- List list = new ArrayList();
|
|
|
- list.add(employeeField_lajb96ub_id);
|
|
|
-
|
|
|
- String body = null;
|
|
|
- try {
|
|
|
- DingTalkClient client = new DefaultDingTalkClient("https://oapi.dingtalk.com/attendance/list");
|
|
|
- OapiAttendanceListRequest req = new OapiAttendanceListRequest();
|
|
|
- //出差开始时间
|
|
|
- req.setWorkDateFrom(startString);
|
|
|
- //出差结束时间
|
|
|
- req.setWorkDateTo(endString);
|
|
|
+ //================岗位补助标准================
|
|
|
+ int numberField_lajb96um = data.getJSONObject(i).getJSONObject("formData").getInteger("numberField_lajb96um");
|
|
|
+ System.out.println("岗位补助标准:" + numberField_lajb96um);
|
|
|
+
|
|
|
+ SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
|
|
+ //================出差开始时间(毫秒级时间戳)================
|
|
|
+ String dateField_lajb96ud = data.getJSONObject(i).getJSONObject("formData").getString("dateField_lajb96ud");
|
|
|
+ System.out.println("出差开始时间(毫秒级时间戳):" + dateField_lajb96ud);
|
|
|
+ long startLong = new Long(dateField_lajb96ud);
|
|
|
+ //将时间戳转换为时间
|
|
|
+ Date startDate = new Date(startLong);
|
|
|
+ System.out.println("出差开始时间(时间型):" + startDate);
|
|
|
+ //将时间调整为yyyy-MM-dd HH:mm:ss时间样式
|
|
|
+ String startString = simpleDateFormat.format(startDate);
|
|
|
+ System.out.println("出差开始时间(时间样式):" + startString);
|
|
|
+
|
|
|
+ //================出差结束时间(毫秒级时间戳)================
|
|
|
+ String dateField_lajb96uf = data.getJSONObject(i).getJSONObject("formData").getString("dateField_lajb96uf");
|
|
|
+ System.out.println("出差结束时间(毫秒级时间戳):" + dateField_lajb96uf);
|
|
|
+ long endLong = new Long(dateField_lajb96uf);
|
|
|
+ //将时间戳转换为时间
|
|
|
+ Date endDate = new Date(endLong);
|
|
|
+ System.out.println("出差结束时间(时间型):" + endDate);
|
|
|
+ //将时间调整为yyyy-MM-dd HH:mm:ss时间样式
|
|
|
+ String endString = simpleDateFormat.format(endDate);
|
|
|
+ System.out.println("出差结束时间(时间样式):" + endString);
|
|
|
+
|
|
|
+ //================当前时间================
|
|
|
+ Date dateNow = new Date(System.currentTimeMillis());
|
|
|
+ System.out.println("当前时间(时间型):" + dateNow);
|
|
|
+ String dateNowString = simpleDateFormat.format(dateNow);
|
|
|
+ System.out.println("当前时间(时间样式):" + dateNowString);
|
|
|
+
|
|
|
+ //================获取出差结束时间后面一天的零点零分零秒================
|
|
|
+ Calendar calendar = Calendar.getInstance();
|
|
|
+ calendar.setTime(endDate);
|
|
|
+ //后面一天
|
|
|
+ calendar.add(Calendar.DAY_OF_MONTH, 1);
|
|
|
+ calendar.set(Calendar.HOUR_OF_DAY, 6);
|
|
|
+ calendar.set(Calendar.MINUTE, 0);
|
|
|
+ calendar.set(Calendar.SECOND, 0);
|
|
|
+ calendar.set(Calendar.MILLISECOND, 0);
|
|
|
+ String lastTime = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(calendar.getTime());
|
|
|
+ System.out.println("出差结束时间后面一天早上6点:" + lastTime);
|
|
|
+
|
|
|
+ //================时间比对================
|
|
|
+ //当前时间
|
|
|
+ DateTime parseA = DateUtil.parse(dateNowString);
|
|
|
+ //出差结束时间后面一天
|
|
|
+ DateTime parseB = DateUtil.parse(lastTime);
|
|
|
+// //比对两个时间是否属于同一天,属于为true,反之为false
|
|
|
+// boolean sameDay = DateUtil.isSameDay(parseA, parseB);
|
|
|
+// System.out.println("时间比对结果:" + sameDay);
|
|
|
+ //比对两个时间大小,当前时间如果大于未同步单据的出差后一天凌晨6点的时间的话,则会执行查询考勤打卡情况
|
|
|
+ boolean after = parseA.after(parseB);
|
|
|
+ System.out.println("时间大小比对结果(当前时间是否大于未同步单据的出差后一天凌晨6点的时间):" + after);
|
|
|
+
|
|
|
+ //================时间相等(满足执行时间)则去抓取该人员的考勤打卡数据,并将出勤结果同步更新至宜搭================
|
|
|
+ if (after == true) {
|
|
|
+ //出差实际总天数
|
|
|
+ int ccts = 0;
|
|
|
+
|
|
|
+ /*查询指定出差申请日期的人员的钉钉考勤打卡*/
|
|
|
//待查询人员userid
|
|
|
- req.setUserIdList(list);
|
|
|
- req.setOffset(0L);
|
|
|
- req.setLimit(50L);
|
|
|
- OapiAttendanceListResponse rsp = client.execute(req, accessTokenService.getAccessToken());
|
|
|
- body = rsp.getBody();
|
|
|
- System.out.println("打卡结果返回:" + body);
|
|
|
- } catch (ApiException e) {
|
|
|
- e.printStackTrace();
|
|
|
- }
|
|
|
+ List list = new ArrayList();
|
|
|
+ list.add(employeeField_lajb96ub_id);
|
|
|
|
|
|
- JSONObject jsonObjectA = JSON.parseObject(body);
|
|
|
- JSONArray recordresult = jsonObjectA.getJSONArray("recordresult");
|
|
|
- int dkcs = 0;
|
|
|
- for (int a = 0; a < recordresult.size(); a++) {
|
|
|
- //位置结果:判断是否属于Outside:范围外
|
|
|
- //Normal:范围内
|
|
|
- //Outside:范围外
|
|
|
- //NotSigned:未打卡
|
|
|
- String result = recordresult.getJSONObject(a).getString("locationResult");
|
|
|
- System.out.println("打卡位置结果:" + result);
|
|
|
- if (result == "Outside"){
|
|
|
- dkcs = dkcs + 1;
|
|
|
+ String body = null;
|
|
|
+ String errmsg = null;
|
|
|
+ try {
|
|
|
+ DingTalkClient client = new DefaultDingTalkClient("https://oapi.dingtalk.com/attendance/list");
|
|
|
+ OapiAttendanceListRequest req = new OapiAttendanceListRequest();
|
|
|
+ //出差开始时间
|
|
|
+ req.setWorkDateFrom(startString);
|
|
|
+ //出差结束时间
|
|
|
+ req.setWorkDateTo(lastTime);
|
|
|
+ //待查询人员userid
|
|
|
+ req.setUserIdList(list);
|
|
|
+ req.setOffset(0L);
|
|
|
+ req.setLimit(50L);
|
|
|
+ OapiAttendanceListResponse rsp = client.execute(req, accessTokenService.getAccessToken());
|
|
|
+ body = rsp.getBody();
|
|
|
+ System.out.println("打卡结果返回:" + body);
|
|
|
+ JSONObject jsonObject1 = JSON.parseObject(body);
|
|
|
+ } catch (ApiException e) {
|
|
|
+ e.printStackTrace();
|
|
|
}
|
|
|
- }
|
|
|
- dkcs = dkcs/2;
|
|
|
- int dkcsLast = (int)dkcs;
|
|
|
|
|
|
- if (dkcs > 0){
|
|
|
- //出差实际总天数
|
|
|
- ccts = ccts + dkcsLast;
|
|
|
- }
|
|
|
- System.out.println("出差实际总天数:" + ccts);
|
|
|
+ try {
|
|
|
+ JSONObject jsonObjectA = JSON.parseObject(body);
|
|
|
+ JSONArray recordresult = jsonObjectA.getJSONArray("recordresult");
|
|
|
+
|
|
|
+ errmsg = jsonObjectA.getString("errmsg");
|
|
|
+ System.out.println("打卡结果返回错误信息:" + errmsg);
|
|
|
+ int dkcs = 0;
|
|
|
+ for (int a = 0; a < recordresult.size(); a++) {
|
|
|
+ //位置结果:判断是否属于Outside:范围外
|
|
|
+ //Normal:范围内
|
|
|
+ //Outside:范围外
|
|
|
+ //NotSigned:未打卡
|
|
|
+ String result = recordresult.getJSONObject(a).getString("locationResult");
|
|
|
+ System.out.println("打卡位置结果:" + result);
|
|
|
+ if (result.equals("Outside")) {
|
|
|
+ dkcs = dkcs + 1;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ dkcs = dkcs / 2;
|
|
|
+ int dkcsLast = (int) dkcs;
|
|
|
|
|
|
- //计算实际的出差补助(岗位补贴标准*出差实际总天数)
|
|
|
- int ccbz = numberField_lajb96um * ccts;
|
|
|
- System.out.println("实际的出差补助:" + ccbz);
|
|
|
+ if (dkcs > 0) {
|
|
|
+ //出差实际总天数
|
|
|
+ ccts = ccts + dkcsLast;
|
|
|
+ }
|
|
|
+ System.out.println("出差实际总天数:" + ccts);
|
|
|
|
|
|
- Map map = new HashMap();
|
|
|
- //出差实际总天数
|
|
|
- map.put("numberField_lc465cyx",ccts);
|
|
|
- //实际的出差补助
|
|
|
- map.put("numberField_lc465cyy",ccbz);
|
|
|
- //同步状态
|
|
|
- map.put("textField_lbdex822","已同步");
|
|
|
- String mapStr = JSON.toJSONString(map);
|
|
|
- System.out.println("封装修改的字段参数:" + mapStr);
|
|
|
+ //计算实际的出差补助(岗位补贴标准*出差实际总天数)
|
|
|
+ int ccbz = numberField_lajb96um * ccts;
|
|
|
+ System.out.println("实际的出差补助:" + ccbz);
|
|
|
|
|
|
- try {
|
|
|
- com.aliyun.dingtalkyida_1_0.Client client = createClient();
|
|
|
- com.aliyun.dingtalkyida_1_0.models.UpdateFormDataHeaders updateFormDataHeaders = new com.aliyun.dingtalkyida_1_0.models.UpdateFormDataHeaders();
|
|
|
- updateFormDataHeaders.xAcsDingtalkAccessToken = accessTokenService.getAccessToken();
|
|
|
- com.aliyun.dingtalkyida_1_0.models.UpdateFormDataRequest updateFormDataRequest = new com.aliyun.dingtalkyida_1_0.models.UpdateFormDataRequest()
|
|
|
- //应用秘钥
|
|
|
- .setSystemToken("ETA66681XCH5NWT9CNL9V88ZGIB12I8RTWBALZZE")
|
|
|
- //表单实例id
|
|
|
- .setFormInstanceId(formInstanceId)
|
|
|
- //TODO 系统管理员id
|
|
|
- .setUserId("yida_pub_account")
|
|
|
- //应用id
|
|
|
- .setAppType("APP_UTWSE5WCXGWTUOEJ9E1D")
|
|
|
- //修改字段
|
|
|
- .setUpdateFormDataJson(mapStr);
|
|
|
-
|
|
|
- client.updateFormDataWithOptions(updateFormDataRequest, updateFormDataHeaders, new com.aliyun.teautil.models.RuntimeOptions());
|
|
|
- } catch (TeaException err) {
|
|
|
- if (!com.aliyun.teautil.Common.empty(err.code) && !com.aliyun.teautil.Common.empty(err.message)) {
|
|
|
- // err 中含有 code 和 message 属性,可帮助开发定位问题
|
|
|
- }
|
|
|
+ Map map = new HashMap();
|
|
|
+ //出差实际总天数
|
|
|
+ map.put("numberField_lc465cyx", ccts);
|
|
|
+ //实际的出差补助
|
|
|
+ map.put("numberField_lc465cyy", ccbz);
|
|
|
+ //同步状态
|
|
|
+ map.put("textField_lbdex822", "已同步");
|
|
|
+ if (dkcs == 0){
|
|
|
+ //同步说明
|
|
|
+ map.put("textField_lemny5eq","打卡记录不存在!");
|
|
|
+ }else if (errmsg.equals("时间跨度太大")){
|
|
|
+ //同步说明
|
|
|
+ map.put("textField_lemny5eq","【errmsg】获取出差打卡记录时间跨度太大!");
|
|
|
+ }else {
|
|
|
+ //同步说明
|
|
|
+ map.put("textField_lemny5eq","已同步打卡记录。");
|
|
|
+ }
|
|
|
+ String mapStr = JSON.toJSONString(map);
|
|
|
+ System.out.println("封装修改的字段参数:" + mapStr);
|
|
|
+
|
|
|
+ try {
|
|
|
+ com.aliyun.dingtalkyida_1_0.Client client = createClient();
|
|
|
+ com.aliyun.dingtalkyida_1_0.models.UpdateFormDataHeaders updateFormDataHeaders = new com.aliyun.dingtalkyida_1_0.models.UpdateFormDataHeaders();
|
|
|
+ updateFormDataHeaders.xAcsDingtalkAccessToken = accessTokenService.getAccessToken();
|
|
|
+ com.aliyun.dingtalkyida_1_0.models.UpdateFormDataRequest updateFormDataRequest = new com.aliyun.dingtalkyida_1_0.models.UpdateFormDataRequest()
|
|
|
+ //应用秘钥
|
|
|
+ .setSystemToken("ETA66681XCH5NWT9CNL9V88ZGIB12I8RTWBALZZE")
|
|
|
+ //表单实例id
|
|
|
+ .setFormInstanceId(formInstanceId)
|
|
|
+ //TODO 系统管理员id
|
|
|
+ .setUserId("yida_pub_account")
|
|
|
+ //应用id
|
|
|
+ .setAppType("APP_UTWSE5WCXGWTUOEJ9E1D")
|
|
|
+ //修改字段
|
|
|
+ .setUpdateFormDataJson(mapStr);
|
|
|
+
|
|
|
+ client.updateFormDataWithOptions(updateFormDataRequest, updateFormDataHeaders, new com.aliyun.teautil.models.RuntimeOptions());
|
|
|
+ } catch (TeaException err) {
|
|
|
+ if (!com.aliyun.teautil.Common.empty(err.code) && !com.aliyun.teautil.Common.empty(err.message)) {
|
|
|
+ // err 中含有 code 和 message 属性,可帮助开发定位问题
|
|
|
+ }
|
|
|
+
|
|
|
+ } catch (Exception _err) {
|
|
|
+ TeaException err = new TeaException(_err.getMessage(), _err);
|
|
|
+ if (!com.aliyun.teautil.Common.empty(err.code) && !com.aliyun.teautil.Common.empty(err.message)) {
|
|
|
+ // err 中含有 code 和 message 属性,可帮助开发定位问题
|
|
|
+ }
|
|
|
|
|
|
- } catch (Exception _err) {
|
|
|
- TeaException err = new TeaException(_err.getMessage(), _err);
|
|
|
- if (!com.aliyun.teautil.Common.empty(err.code) && !com.aliyun.teautil.Common.empty(err.message)) {
|
|
|
- // err 中含有 code 和 message 属性,可帮助开发定位问题
|
|
|
+ }
|
|
|
+ }catch (Exception e){
|
|
|
+ e.printStackTrace();
|
|
|
}
|
|
|
-
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
-
|
|
|
- }
|
|
|
+ }while (jsonObject.getFloat("totalCount") / 100 > jsonObject.getInteger("pageNumber"));
|
|
|
|
|
|
return "同步【出差明细中间表】完成!";
|
|
|
}
|