|
|
@@ -19,9 +19,7 @@ import com.malk.server.dingtalk.DDR;
|
|
|
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;
|
|
|
-import com.malk.service.dingtalk.DDClient_Attendance;
|
|
|
-import com.malk.service.dingtalk.DDClient_Contacts;
|
|
|
+import com.malk.service.dingtalk.*;
|
|
|
import com.malk.service.fxiaoke.FXKClient;
|
|
|
import com.malk.utils.UtilDateTime;
|
|
|
import com.malk.utils.UtilMap;
|
|
|
@@ -53,6 +51,9 @@ public class HuaGaoServiceImpl implements HuaGaoService {
|
|
|
@Autowired
|
|
|
private DDClient ddClient;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private DDClient_Workflow ddClient_workflow;
|
|
|
+
|
|
|
@Autowired
|
|
|
private YdUserInputMapper ydUserInputMapper;
|
|
|
|
|
|
@@ -181,6 +182,92 @@ public class HuaGaoServiceImpl implements HuaGaoService {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public void updateWorkHours(Map map1) {
|
|
|
+ String formInstId = UtilMap.getString(map1, "formInstId");
|
|
|
+
|
|
|
+ Map processInstance = ddClient_workflow.getProcessInstanceId(ddClient.getAccessToken(), formInstId);
|
|
|
+
|
|
|
+ String user = UtilMap.getString(processInstance, "originatorUserId");
|
|
|
+ String originatorDeptId = UtilMap.getString(processInstance, "originatorDeptId");
|
|
|
+
|
|
|
+ String stTime="";
|
|
|
+ String edTime="";
|
|
|
+
|
|
|
+ List<Map> formComponentValues = UtilMap.getList(processInstance, "formComponentValues");
|
|
|
+
|
|
|
+ for (Map formComponentValue : formComponentValues) {
|
|
|
+ String componentType = UtilMap.getString(formComponentValue, "componentType");
|
|
|
+
|
|
|
+ if (componentType.equals("DDDateField")){
|
|
|
+ String bizAlias = UtilMap.getString(formComponentValue, "bizAlias");
|
|
|
+ String value = UtilMap.getString(formComponentValue, "value");
|
|
|
+ if (bizAlias.equals("startTime")){
|
|
|
+ stTime = value + ":00";
|
|
|
+ }else if (bizAlias.equals("finishTime")){
|
|
|
+ edTime = value + ":00";
|
|
|
+ }else if (bizAlias.equals("userCheckTime")){
|
|
|
+ stTime = value + ":00";
|
|
|
+ edTime = value + ":00";
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ //部门人员单价
|
|
|
+ List<Map> list=ydService.queryAllFormData(YDParam.builder().formUuid("FORM-5061F7AE543B429C8241EC730A6F31653NNK").build());
|
|
|
+ for(Map map:list){
|
|
|
+ Map formData= UtilMap.getMap(map,"formData");
|
|
|
+ String deptId=String.valueOf(UtilMap.getList(formData,"departmentSelectField_m8e4zaju_id").get(0));
|
|
|
+ String price=UtilMap.getString(formData,"numberField_m8e4zajw_value");
|
|
|
+
|
|
|
+ if (!originatorDeptId.equals(deptId)){
|
|
|
+ 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);
|
|
|
+ for (String date:dateMap.keySet()) {
|
|
|
+ Map<String,String> dataMap=dateMap.get(date);
|
|
|
+ String workTime="休息".equals(dataMap.get("82772125"))?
|
|
|
+ dataMap.get("89349019"): NumberUtil.add(dataMap.get("89349019"),dataMap.get("82772106")).toString();
|
|
|
+ saveData(user,date,workTime,price);
|
|
|
+
|
|
|
+ //同步到数据库
|
|
|
+ LambdaQueryWrapper<YdUserInput> ydUserInputLambdaQueryWrapper = new LambdaQueryWrapper<>();
|
|
|
+ ydUserInputLambdaQueryWrapper.eq(YdUserInput::getUserId,user)
|
|
|
+ .eq(YdUserInput::getDate, date);
|
|
|
+
|
|
|
+ YdUserInput ydUserInput = ydUserInputMapper.selectOne(ydUserInputLambdaQueryWrapper);
|
|
|
+
|
|
|
+ if (Objects.nonNull(ydUserInput)){
|
|
|
+ ydUserInput.setWorkHours(workTime);
|
|
|
+ ydUserInput.setPrice(price);
|
|
|
+ ydUserInput.setTotalPrice(NumberUtil.mul(workTime,price));
|
|
|
+
|
|
|
+ ydUserInputMapper.update(ydUserInput,ydUserInputLambdaQueryWrapper);
|
|
|
+ }else {
|
|
|
+ try {
|
|
|
+ ydUserInput = new YdUserInput();
|
|
|
+ ydUserInput.setUserId(user);
|
|
|
+ SimpleDateFormat formatter = new SimpleDateFormat(UtilDateTime.DATE_TIME_PATTERN);
|
|
|
+ ydUserInput.setDate(formatter.parse(date));
|
|
|
+ ydUserInput.setWorkHours(workTime);
|
|
|
+ ydUserInput.setPrice(price);
|
|
|
+ ydUserInput.setTotalPrice(NumberUtil.mul(workTime,price));
|
|
|
+
|
|
|
+ ydUserInputMapper.insert(ydUserInput);
|
|
|
+ }catch (ParseException e){
|
|
|
+ log.info("无法解析日期字符串: {}",e.getMessage());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
/*@Override
|
|
|
public void syncUserInput(LocalDateTime startTime, LocalDateTime endTime) {
|
|
|
List<Map> dataList = getYdFormDataList("FORM-78BF5DE20E244369BD475C11A5CA48A0ZAQJ", "", YDConf.FORM_QUERY.retrieve_list_all);
|