demand: tms-oa接口-员工提成实时查询接口返回增加员工OA工号
This commit is contained in:
parent
ce357a89c7
commit
ed120bbf70
@ -31,6 +31,7 @@ import com.xdadan.erp.emis.service.IEmisCommissionDtlService;
|
|||||||
import com.xdadan.erp.emis.service.IEmisCommissionProfitService;
|
import com.xdadan.erp.emis.service.IEmisCommissionProfitService;
|
||||||
import com.xdadan.erp.emis.utils.WaybillHelper;
|
import com.xdadan.erp.emis.utils.WaybillHelper;
|
||||||
import com.xdadan.erp.system.service.ISysUserService;
|
import com.xdadan.erp.system.service.ISysUserService;
|
||||||
|
import com.xdadan.erp.common.core.domain.entity.SysUser;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
@ -40,8 +41,10 @@ import org.springframework.util.CollectionUtils;
|
|||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
import java.lang.reflect.Method;
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -81,9 +84,62 @@ public class CommissionProfitController extends BaseController
|
|||||||
|
|
||||||
startPage();
|
startPage();
|
||||||
List<EmisCommissionProfit> list = emisCommissionProfitService.selectEmisCommissionProfitList(emisCommissionProfit);
|
List<EmisCommissionProfit> list = emisCommissionProfitService.selectEmisCommissionProfitList(emisCommissionProfit);
|
||||||
|
|
||||||
|
// 将每个对象的oaEmpCode设置到params中
|
||||||
|
if (list != null && !list.isEmpty()) {
|
||||||
|
for (EmisCommissionProfit item : list) {
|
||||||
|
try {
|
||||||
|
// 通过empName查询获取oaEmpCode
|
||||||
|
String oaEmpCode = getOaEmpCodeByEmpName(item);
|
||||||
|
// if (StringUtils.isNotEmpty(oaEmpCode)) {
|
||||||
|
// // 确保params不为null
|
||||||
|
// if (item.getParams() == null) {
|
||||||
|
// item.setParams(new HashMap<>());
|
||||||
|
// }
|
||||||
|
// // 将oaEmpCode设置到params中
|
||||||
|
// item.getParams().put("oaEmpCode", oaEmpCode);
|
||||||
|
// }
|
||||||
|
// 将oaEmpCode设置到params中
|
||||||
|
item.getParams().put("oaEmpCode", oaEmpCode);
|
||||||
|
} catch (Exception e) {
|
||||||
|
// 忽略异常,继续处理下一个对象
|
||||||
|
log.debug("设置oaEmpCode到params失败: {}", e.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return getDataTable(list);
|
return getDataTable(list);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 通过empName查询用户,获取oaEmpCode
|
||||||
|
*/
|
||||||
|
private String getOaEmpCodeByEmpName(EmisCommissionProfit item) {
|
||||||
|
if (item == null || sysUserService == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
String empName = item.getEmpName();
|
||||||
|
if (StringUtils.isEmpty(empName)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 使用empName查询用户
|
||||||
|
SysUser queryUser = new SysUser();
|
||||||
|
queryUser.setEmpName(empName);
|
||||||
|
List<SysUser> userList = sysUserService.selectUserList(queryUser);
|
||||||
|
|
||||||
|
if (userList != null && !userList.isEmpty()) {
|
||||||
|
// 取第一个用户
|
||||||
|
SysUser user = userList.get(0);
|
||||||
|
return user.getOaEmpCode();
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.debug("通过empName查询oaEmpCode失败: {}", e.getMessage());
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user