|
@@ -13,6 +13,7 @@ import org.springframework.beans.factory.annotation.Value;
|
|
|
import org.springframework.util.StringUtils;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
+import java.math.BigDecimal;
|
|
|
import java.time.LocalDateTime;
|
|
|
import java.util.ArrayList;
|
|
|
import java.util.List;
|
|
@@ -117,7 +118,7 @@ public class SyncSapUtils {
|
|
|
}
|
|
|
|
|
|
//推送工时管家填报考勤数据到SAP
|
|
|
- public static XmlResponseData pushReportToSap(Map<String,Object> map,boolean isDev){
|
|
|
+ public static String pushReportToSap(Map<String,Object> map,boolean isDev){
|
|
|
//配置xml请求参数
|
|
|
XmlRequestData xmlRequestData=new XmlRequestData();
|
|
|
EmployeeTime employeeTime=new EmployeeTime();
|
|
@@ -134,19 +135,24 @@ public class SyncSapUtils {
|
|
|
datePeriod.setEndDate(String.valueOf(map.get("EndDate")));
|
|
|
}
|
|
|
if(map.get("StartTime")!=null){
|
|
|
- timePeriod.setStartTime(String.valueOf(map.get("StartTime")));
|
|
|
+ timePeriod.setStartTime(String.valueOf(map.get("StartTime"))+":00");
|
|
|
}
|
|
|
if(map.get("EndTime")!=null){
|
|
|
- timePeriod.setEndTime(String.valueOf(map.get("EndTime")));
|
|
|
+ timePeriod.setEndTime(String.valueOf(map.get("EndTime"))+":00");
|
|
|
}
|
|
|
employeeTime.setDatePeriod(datePeriod);
|
|
|
if(map.get("StartTime")!=null&&map.get("EndTime")!=null){
|
|
|
employeeTime.setTimePeriod(timePeriod);
|
|
|
}
|
|
|
employeeTime.setItemTypeCode("CN0001");
|
|
|
- employeeTime.setDuration("PT"+(map.get("Duration")==null?"0":String.valueOf(map.get("Duration")))+"H");
|
|
|
+ String duration=map.get("Duration")==null?"0":String.valueOf(map.get("Duration"))+"";
|
|
|
+ String hour = duration.substring(0, duration.indexOf("."));
|
|
|
+ String min = "0"+duration.substring(duration.indexOf("."));
|
|
|
+ BigDecimal minBigDecimal = new BigDecimal(min);
|
|
|
+ minBigDecimal=minBigDecimal.multiply(new BigDecimal(60)).setScale(0,BigDecimal.ROUND_HALF_UP);
|
|
|
+ employeeTime.setDuration("PT"+hour+"H"+minBigDecimal.intValue()+"M");
|
|
|
if(map.get("ProjectElementID")==null||map.get("ServiceProductInternalID")==null){
|
|
|
- return new XmlResponseData();
|
|
|
+ return "";
|
|
|
}
|
|
|
employeeTime.setProjectElementID(String.valueOf(map.get("ProjectElementID")));
|
|
|
employeeTime.setServiceProductInternalID(String.valueOf(map.get("ServiceProductInternalID")));
|
|
@@ -179,13 +185,12 @@ public class SyncSapUtils {
|
|
|
result = result.substring(result.indexOf(">")+1, result.lastIndexOf("</n0:EmployeeTimeAsBundleMaintainConfirmation_sync>"));
|
|
|
result="<XMLDATA>"+result+"</XMLDATA>";
|
|
|
}
|
|
|
- System.out.println(result);
|
|
|
- xmlResponseData = (XmlResponseData) CommonUtils.convertXmlStrToObject(XmlResponseData.class, result);
|
|
|
+ return result;
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
|
}
|
|
|
|
|
|
- return xmlResponseData;
|
|
|
+ return "";
|
|
|
}
|
|
|
|
|
|
|