|
|
|
@ -9,6 +9,8 @@ import com.os.mes.api.domain.ResponseData;
|
|
|
|
|
import com.os.mes.api.service.IERPPortService;
|
|
|
|
|
import com.os.mes.api.utils.ApiUtils;
|
|
|
|
|
import com.os.mes.api.utils.ERPConstants;
|
|
|
|
|
import com.os.mes.base.domain.BaseStaffInfo;
|
|
|
|
|
import com.os.mes.base.service.IBaseStaffInfoService;
|
|
|
|
|
import com.os.mes.prod.domain.ProdOrderDetail;
|
|
|
|
|
import com.os.mes.prod.service.IProdOrderInfoService;
|
|
|
|
|
import com.os.mes.prod.service.impl.ProdOrderInfoServiceImpl;
|
|
|
|
@ -18,6 +20,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
|
|
|
|
import java.util.ArrayList;
|
|
|
|
|
import java.util.HashMap;
|
|
|
|
|
import java.util.List;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -34,6 +37,9 @@ public class ERPPortServiceImpl implements IERPPortService {
|
|
|
|
|
@Autowired
|
|
|
|
|
private IProdOrderInfoService orderInfoService;
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
private IBaseStaffInfoService staffInfoService;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 获取ERP订单接口
|
|
|
|
|
*
|
|
|
|
@ -70,4 +76,39 @@ public class ERPPortServiceImpl implements IERPPortService {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 获取员工工资系数
|
|
|
|
|
* @param paramDto
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
@Override
|
|
|
|
|
public List<BaseStaffInfo> getERPEmployeeWageData(ERPParamDto paramDto) {
|
|
|
|
|
List<BaseStaffInfo> resultList = new ArrayList<>();
|
|
|
|
|
String requestParam = null;
|
|
|
|
|
String result = null;
|
|
|
|
|
try {
|
|
|
|
|
// 创建ObjectMapper实例 对象转JSON字符串
|
|
|
|
|
ObjectMapper objectMapper = new ObjectMapper();
|
|
|
|
|
objectMapper.setPropertyNamingStrategy(PropertyNamingStrategy.UPPER_CAMEL_CASE);
|
|
|
|
|
requestParam = objectMapper.writeValueAsString(paramDto);
|
|
|
|
|
result = ApiUtils.sendERPHttpPost(ERPConstants.ERP_URL, requestParam);
|
|
|
|
|
// 处理接口返回消息
|
|
|
|
|
ObjectMapper resultMapper = new ObjectMapper();
|
|
|
|
|
// 将 JSON 字符串转换为 Java 对象
|
|
|
|
|
HashMap hashMap = resultMapper.readValue(result, HashMap.class);
|
|
|
|
|
HashMap returnData = (HashMap)hashMap.get("ReturnData");
|
|
|
|
|
List<HashMap<String, String>> dataList = (List<HashMap<String, String>>)returnData.get("data");
|
|
|
|
|
for (HashMap<String, String> data : dataList) {
|
|
|
|
|
BaseStaffInfo baseStaffInfo = staffInfoService.insertStaffByERP(data);
|
|
|
|
|
resultList.add(baseStaffInfo);
|
|
|
|
|
}
|
|
|
|
|
logger.warn("获取员工工资系数成功:" + requestParam + "|" + result);
|
|
|
|
|
} catch (JsonProcessingException e) {
|
|
|
|
|
logger.warn("获取员工工资系数异常:" + requestParam + "|" + result + "|" + e);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return resultList;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|