|
|
@@ -9,6 +9,7 @@ import com.malk.huagao.mapper.YdUserInputMapper;
|
|
|
import com.malk.huagao.service.HuaGaoService;
|
|
|
import com.malk.server.aliwork.YDConf;
|
|
|
import com.malk.server.aliwork.YDParam;
|
|
|
+import com.malk.server.dingtalk.DDR_New;
|
|
|
import com.malk.service.aliwork.YDClient;
|
|
|
import com.malk.service.aliwork.YDService;
|
|
|
import com.malk.service.dingtalk.DDClient;
|
|
|
@@ -16,6 +17,7 @@ import com.malk.service.dingtalk.DDClient_Alibtrip;
|
|
|
import com.malk.service.dingtalk.DDClient_Attendance;
|
|
|
import com.malk.service.dingtalk.DDClient_Contacts;
|
|
|
import com.malk.utils.UtilDateTime;
|
|
|
+import com.malk.utils.UtilHttp;
|
|
|
import com.malk.utils.UtilMap;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.junit.Test;
|
|
|
@@ -127,8 +129,8 @@ public class YyYdTest {
|
|
|
|
|
|
@Test
|
|
|
public void test5(){
|
|
|
- String stTime="2025-08-21 00:00:00";
|
|
|
- String edTime="2025-08-22 00:00:00";
|
|
|
+ String stTime="2025-09-25 00:00:00";
|
|
|
+ String edTime="2025-09-26 00:00:00";
|
|
|
List<Map> list=ydService.queryAllFormData(YDParam.builder().formUuid("FORM-5061F7AE543B429C8241EC730A6F31653NNK").build());
|
|
|
for(Map map:list){
|
|
|
Map formData= UtilMap.getMap(map,"formData");
|
|
|
@@ -136,9 +138,6 @@ public class YyYdTest {
|
|
|
String price=UtilMap.getString(formData,"numberField_m8e4zajw_value");
|
|
|
List<String> users=ddClient_contacts.listDepartmentUserId(ddClient.getAccessToken(),Long.parseLong(deptId));
|
|
|
for (String user : users) {
|
|
|
- if (!user.equals("284156461536271475")){
|
|
|
- continue;
|
|
|
- }
|
|
|
List<Map> valList=ddClientAttendance.getAttColumnVal(ddClient.getAccessToken(),user, Arrays.asList("82772106","89349019","82772125"),stTime,edTime);
|
|
|
if(valList!=null&&valList.size()==3){
|
|
|
Map<String,Map<String,String>> dateMap=toDateMap(valList);
|
|
|
@@ -147,7 +146,12 @@ public class YyYdTest {
|
|
|
String workTime="休息".equals(dataMap.get("82772125"))?
|
|
|
dataMap.get("89349019"): NumberUtil.add(dataMap.get("89349019"),dataMap.get("82772106")).toString();
|
|
|
|
|
|
- log.info("user:{},date:{},workTime:{},price:{}",user,date,workTime,price);
|
|
|
+ //查询用户详情
|
|
|
+ DDR_New ddrNew1 = (DDR_New) UtilHttp.doPost("https://oapi.dingtalk.com/topapi/v2/user/get", null, ddClient.initTokenParams(), UtilMap.map("userid", user), DDR_New.class);
|
|
|
+ Map result1 = (Map) ddrNew1.getResult();
|
|
|
+ String userName = UtilMap.getString(result1, "name");
|
|
|
+
|
|
|
+ log.info("user:{},userName:{},date:{},workTime:{},price:{}",user,userName,date,workTime,price);
|
|
|
|
|
|
//同步到数据库
|
|
|
LambdaQueryWrapper<YdUserInput> ydUserInputLambdaQueryWrapper = new LambdaQueryWrapper<>();
|
|
|
@@ -157,6 +161,7 @@ public class YyYdTest {
|
|
|
YdUserInput ydUserInput = ydUserInputMapper.selectOne(ydUserInputLambdaQueryWrapper);
|
|
|
|
|
|
if (Objects.nonNull(ydUserInput)){
|
|
|
+ ydUserInput.setUserName(userName);
|
|
|
ydUserInput.setWorkHours(workTime);
|
|
|
ydUserInput.setPrice(price);
|
|
|
ydUserInput.setTotalPrice(NumberUtil.mul(workTime,price));
|
|
|
@@ -166,6 +171,7 @@ public class YyYdTest {
|
|
|
try {
|
|
|
ydUserInput = new YdUserInput();
|
|
|
ydUserInput.setUserId(user);
|
|
|
+ ydUserInput.setUserName(userName);
|
|
|
SimpleDateFormat formatter = new SimpleDateFormat(UtilDateTime.DATE_TIME_PATTERN);
|
|
|
ydUserInput.setDate(formatter.parse(date));
|
|
|
ydUserInput.setWorkHours(workTime);
|