mirror of
https://codeup.aliyun.com/67762337eccfc218f6110e0e/per-boe/java-servers.git
synced 2025-12-09 02:46:50 +08:00
Merge branch 'cloud' into old-cloud
This commit is contained in:
@@ -32,6 +32,8 @@ public class UrlSecurityFilterImpl implements IUrlSecurityFilter{
|
||||
noLoginUrls.add("/xboe/sys/user/sync-all");
|
||||
//noLoginUrls.add("");
|
||||
noLoginUrls.add("/xboe/m/exam/alone-extend/save");
|
||||
|
||||
noLoginUrls.add("/xboe/m/course/manage/test");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -228,6 +228,7 @@ public class OutSideDataServiceImpl implements IOutSideDataService {
|
||||
public UserOrgIds getOrgIds() {
|
||||
UserOrgIds uids=new UserOrgIds();
|
||||
List<String> orgIds = new ArrayList<>();
|
||||
|
||||
uids.setIds(orgIds);
|
||||
String token = TokenProxy.getToken(request);
|
||||
String type="application/json";
|
||||
@@ -259,12 +260,29 @@ public class OutSideDataServiceImpl implements IOutSideDataService {
|
||||
// orgIds.add(elements.next().toString());
|
||||
// }
|
||||
// }
|
||||
Set<String> orgSetIds = new HashSet<>();//用于排重判断
|
||||
|
||||
if(rootNode.get("result")!=null & rootNode.get("result").get("mainList")!=null) {
|
||||
JsonNode result = rootNode.get("result").get("mainList");
|
||||
Iterator<JsonNode> elements = result.elements();
|
||||
while (elements.hasNext()){
|
||||
orgIds.add(elements.next().toString());
|
||||
if(rootNode.get("result")!=null) {
|
||||
JsonNode mainList = rootNode.get("result").get("mainList");
|
||||
JsonNode readOnlyList = rootNode.get("result").get("readOnlyList");
|
||||
//主列表
|
||||
if(mainList!=null && !mainList.isEmpty()) {
|
||||
Iterator<JsonNode> elements = mainList.elements();
|
||||
while (elements.hasNext()){
|
||||
String oid=elements.next().asText();
|
||||
orgIds.add(oid);
|
||||
orgSetIds.add(oid);
|
||||
}
|
||||
}
|
||||
//只读列表
|
||||
if(readOnlyList!=null && !readOnlyList.isEmpty()) {
|
||||
Iterator<JsonNode> elements = readOnlyList.elements();
|
||||
while (elements.hasNext()){
|
||||
String oid=elements.next().asText();
|
||||
if(!orgSetIds.contains(oid)) {
|
||||
orgIds.add(oid);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -275,6 +293,24 @@ public class OutSideDataServiceImpl implements IOutSideDataService {
|
||||
|
||||
}
|
||||
|
||||
// public static void main(String[] args) {
|
||||
// String json="{\"mainList\": [\"6998568222014574593\",\"6998568178507059201\",\"6998568191714922497\",\"6998568195720482817\",\"6998568197947658241\",\"6998568188397228033\",\"6998568201529593857\",\"6998568211277156353\",\"6998568231271403521\",\"6998568237076320257\",\"6998568255854219265\",\"6998568239068614657\",\"6998568283775700993\",\"6998568294148214785\",\"6998568454492262401\",\"6998568457495384065\",\"6998568488780697601\",\"6998568492371021825\",\"6998568492924669953\",\"6998568219623821313\",\"6998568507143360513\",\"6998568507181109249\",\"6998568507248218113\",\"6998568181724090369\",\"6998568481679740929\",\"6998568513686474753\",\"6998568547987492865\",\"6998568579704819713\",\"6998568598142980097\",\"6998568598520467457\",\"6998568600449847297\",\"6998568651326754817\",\"6998568652689903617\",\"6998568658578706433\",\"6998568496787623937\"]}";
|
||||
// ObjectMapper mapper=new ObjectMapper();
|
||||
//
|
||||
// try {
|
||||
// JsonNode rootNode= mapper.readTree(json);
|
||||
// JsonNode mainList = rootNode.get("mainList");
|
||||
// Iterator<JsonNode> elements = mainList.elements();
|
||||
// while (elements.hasNext()){
|
||||
// String oid=elements.next().asText();
|
||||
// System.out.println(oid);
|
||||
// }
|
||||
//
|
||||
// }catch(Exception e) {
|
||||
// e.printStackTrace();
|
||||
// }
|
||||
// }
|
||||
|
||||
private String getBaseUrl(String url) {
|
||||
String baseUrl=SysConstant.getConfigValue("xboe.server.userbasic.url");
|
||||
if(StringUtils.isBlank(baseUrl)) {
|
||||
|
||||
@@ -8,6 +8,7 @@ import com.xboe.system.organization.entity.Organization;
|
||||
/**
|
||||
* 调用旧系统的外部接口
|
||||
*/
|
||||
@Deprecated
|
||||
public interface IFwOrganizationService {
|
||||
|
||||
/**
|
||||
|
||||
@@ -7,6 +7,7 @@ import java.util.List;
|
||||
/**
|
||||
* 调用旧系统的外部接口
|
||||
*/
|
||||
@Deprecated
|
||||
public interface IFwUserService {
|
||||
|
||||
/**
|
||||
|
||||
@@ -8,6 +8,7 @@ import com.xboe.module.teacher.vo.TeacherVo;
|
||||
/**
|
||||
* 调用旧系统的外部接口
|
||||
*/
|
||||
@Deprecated
|
||||
public interface ILnTeacherService {
|
||||
|
||||
/**
|
||||
|
||||
@@ -2,6 +2,7 @@ package com.xboe.externalinterface.system.service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Deprecated
|
||||
public interface IManagerRefService {
|
||||
|
||||
List<String> getCompanyIdsByUserId(String uid);
|
||||
|
||||
@@ -8,6 +8,7 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
@@ -19,7 +20,6 @@ import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import com.xboe.account.entity.Account;
|
||||
import com.xboe.common.PageList;
|
||||
import com.xboe.common.Pagination;
|
||||
import com.xboe.core.CurrentUser;
|
||||
@@ -28,7 +28,7 @@ import com.xboe.core.api.ApiBaseController;
|
||||
import com.xboe.core.log.AutoLog;
|
||||
import com.xboe.data.dto.UserOrgIds;
|
||||
import com.xboe.data.outside.IOutSideDataService;
|
||||
import com.xboe.externalinterface.system.service.IFwUserService;
|
||||
import com.xboe.data.service.IDataUserSyncService;
|
||||
import com.xboe.module.assistance.service.IEmailService;
|
||||
import com.xboe.module.course.dto.CourseExportDto;
|
||||
import com.xboe.module.course.dto.CourseFullDto;
|
||||
@@ -51,11 +51,9 @@ import com.xboe.module.course.service.ICourseTeacherService;
|
||||
import com.xboe.module.excel.ExportsExcelSenderUtil;
|
||||
import com.xboe.standard.enums.BoedxContentType;
|
||||
import com.xboe.standard.enums.BoedxCourseType;
|
||||
import com.xboe.system.organization.entity.Organization;
|
||||
import com.xboe.system.organization.service.IOrganizationService;
|
||||
import com.xboe.system.user.entity.User;
|
||||
import com.xboe.system.user.service.IUserService;
|
||||
import com.xboe.system.user.vo.UserVo;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
@@ -73,8 +71,9 @@ public class CourseManageApi extends ApiBaseController{
|
||||
@Resource
|
||||
private ICourseService courseService;
|
||||
|
||||
@Autowired
|
||||
IFwUserService fwUserService;
|
||||
@Autowired
|
||||
IOutSideDataService outsideService;
|
||||
|
||||
|
||||
@Resource
|
||||
IEmailService service;
|
||||
@@ -103,6 +102,17 @@ public class CourseManageApi extends ApiBaseController{
|
||||
@Resource
|
||||
IOutSideDataService outSideDataService;
|
||||
|
||||
@Autowired
|
||||
IDataUserSyncService userSyncService;
|
||||
|
||||
|
||||
@PostMapping("/test")
|
||||
public JsonResponse<PageList<Course>> findTest(Pagination pager,CourseQueryDto dto){
|
||||
//dto.setOrgAid("7003708665807110150");
|
||||
PageList<Course> coursePageList = courseService.findPage(pager.getPageIndex(), pager.getPageSize(),dto);
|
||||
return success(coursePageList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 管理列表的查询
|
||||
* @param pager
|
||||
@@ -116,12 +126,15 @@ public class CourseManageApi extends ApiBaseController{
|
||||
//getCurrent().get
|
||||
try {
|
||||
UserOrgIds userOrgIds=outSideDataService.getOrgIds();
|
||||
|
||||
List<String> orgIds = userOrgIds.getIds();
|
||||
if(userOrgIds.getPermissions().containsKey(UserOrgIds.IsSystemAdminKey)) {
|
||||
|
||||
if(userOrgIds.getPermissions().containsKey(UserOrgIds.IsSystemAdminKey)){
|
||||
dto.setIsSystemAdmin(userOrgIds.getPermissions().get(UserOrgIds.IsSystemAdminKey));
|
||||
}else {
|
||||
dto.setIsSystemAdmin(false);
|
||||
}
|
||||
|
||||
String ids="";
|
||||
if(userOrgIds.getIds()!=null && !userOrgIds.getIds().isEmpty())
|
||||
{
|
||||
@@ -130,7 +143,7 @@ public class CourseManageApi extends ApiBaseController{
|
||||
//log.info("获取到的用户的组织机构权限ids",ids);
|
||||
String aid=getCurrent().getAccountId();
|
||||
//如果前端查询当前人的,这里去掉
|
||||
if(StringUtils.isNotBlank( dto.getAid())) {
|
||||
if(StringUtils.isNotBlank(dto.getAid())) {
|
||||
dto.setAid(null);
|
||||
}
|
||||
dto.setOrgAid(aid);
|
||||
@@ -480,16 +493,18 @@ public class CourseManageApi extends ApiBaseController{
|
||||
}
|
||||
if(!isLocalDevelopment()) {
|
||||
if(StringUtils.isBlank(dto.getAuditUser().getAid())) {
|
||||
if(StringUtils.isBlank(dto.getAuditUser().getKid())) {
|
||||
return badRequest("HRBP审核信息人员错误");
|
||||
}
|
||||
// if(StringUtils.isBlank(dto.getAuditUser().getKid())) {
|
||||
// return badRequest("HRBP审核信息人员错误");
|
||||
// }
|
||||
//转化用户id
|
||||
User u = userService.getByUserNo(dto.getAuditUser().getCode());
|
||||
if(u==null) { //本地没有,需要同步
|
||||
if(u==null) { //本地没有,需要同步、
|
||||
//20230815 直接返回错误,这个时候传的用户,在新系统中没有,需要用户登录一下,或着用户中心推送
|
||||
return badRequest("无关联HRBP审核人员,请先同步用户");
|
||||
//Organization org = orgService.getBySysId(dto.getAuditUser().getOrgkid());
|
||||
UserVo fwUser = fwUserService.getById(dto.getAuditUser().getKid());
|
||||
Account a =userService.syncAccountUser(fwUser);
|
||||
dto.getAuditUser().setAid(a.getId());
|
||||
// UserVo fwUser = fwUserService.getById(dto.getAuditUser().getKid());
|
||||
// Account a =userService.syncAccountUser(fwUser);
|
||||
// dto.getAuditUser().setAid(a.getId());
|
||||
}else {
|
||||
dto.getAuditUser().setAid(u.getId());
|
||||
}
|
||||
@@ -566,7 +581,7 @@ public class CourseManageApi extends ApiBaseController{
|
||||
}
|
||||
|
||||
@PostMapping("/sumbits")
|
||||
public JsonResponse<Boolean> sumbitId(CourseHRBPAudit audit,String ucode,String ukid,String email,String orgName){
|
||||
public JsonResponse<Boolean> sumbitId(HttpServletRequest request,CourseHRBPAudit audit,String ucode,String ukid,String email,String orgName){
|
||||
if(StringUtils.isBlank(audit.getCourseId())){
|
||||
return badRequest("参数错误");
|
||||
}
|
||||
@@ -596,16 +611,31 @@ public class CourseManageApi extends ApiBaseController{
|
||||
|
||||
if(!isLocalDevelopment()) {
|
||||
if(StringUtils.isBlank(audit.getAid())) {
|
||||
if(StringUtils.isBlank(ukid)){
|
||||
return badRequest("未关联HRBP审核人员");
|
||||
}
|
||||
|
||||
// if(StringUtils.isBlank(ukid)){
|
||||
// return badRequest("未关联HRBP审核人员");
|
||||
// }
|
||||
//转化用户id
|
||||
User u = userService.getByUserNo(ucode);
|
||||
if(u==null) { //本地没有,需要同步
|
||||
return badRequest("无关联HRBP审核人员,请先同步用户");
|
||||
//Organization org = orgService.getBySysId(dto.getAuditUser().getOrgkid());
|
||||
UserVo fwUser = fwUserService.getById(ukid);
|
||||
Account a =userService.syncAccountUser(fwUser);
|
||||
audit.setAid(a.getId());
|
||||
//20230815 已经不再使用直接查老系统,采用接口同步的方式
|
||||
// UserVo fwUser = fwUserService.getById(ukid);
|
||||
// Account a =userService.syncAccountUser(fwUser);
|
||||
// audit.setAid(a.getId());
|
||||
// String token = TokenProxy.getBoeToken(request);
|
||||
// UserData udata=outsideService.getUserInfoByToken(token);
|
||||
// if(udata==null) {
|
||||
// log.error("未获取当前登录人的用户信息");
|
||||
// return wrap(JsonResponseStatus.TOKEN_NOPASS, "用户信息查询失败");
|
||||
// }
|
||||
// //检查本地是否存在,如果存在就更新,不存在就添加
|
||||
// try {
|
||||
// userSyncService.syncUserFull(udata);
|
||||
// }catch(Exception exp) {
|
||||
// log.error("登录同步用户错误",exp);
|
||||
// }
|
||||
}else {
|
||||
audit.setAid(u.getId());
|
||||
}
|
||||
|
||||
@@ -255,14 +255,13 @@ public class CourseServiceImpl implements ICourseService {
|
||||
public PageList<Course> findPage(int pageIndex, int pageSize, CourseQueryDto dto) {
|
||||
List<IFieldFilter> filters = createFilters(dto);
|
||||
|
||||
//有权限的查询,也同时查询出创建人的数据,在权限上
|
||||
|
||||
//有权限的查询,也同时查询出创建人的数据,在权限上
|
||||
if(TempFilterConfig.Manager_CourseFile_ByOrgIds) {
|
||||
if(dto.getIsSystemAdmin()==null || !dto.getIsSystemAdmin()) {
|
||||
|
||||
if(StringUtil.isNotBlank(dto.getOrgIds())){
|
||||
log.error("【"+dto.getOrgAid()+"】 按机构过滤和自己创建的课程");
|
||||
log.error(" orgids "+dto.getOrgIds());
|
||||
if(StringUtil.isNotBlank(dto.getOrgIds())){
|
||||
//log.info("【"+dto.getOrgAid()+"】 按机构过滤和自己创建的课程");
|
||||
//log.info(" orgids "+dto.getOrgIds());
|
||||
if(dto.getOrgIds().contains(",")){
|
||||
String[] split = dto.getOrgIds().split(",");
|
||||
List<String> strings = Arrays.asList(split);
|
||||
@@ -271,12 +270,12 @@ public class CourseServiceImpl implements ICourseService {
|
||||
filters.add(FieldFilters.or(FieldFilters.eq("orgId",dto.getOrgIds()),FieldFilters.eq("sysCreateAid",dto.getOrgAid())));
|
||||
}
|
||||
}else {
|
||||
log.error("【"+dto.getOrgAid()+"】 机构ids没有, 只查询自己创建的课程");
|
||||
//log.info("【"+dto.getOrgAid()+"】 机构ids没有, 只查询自己创建的课程");
|
||||
//没有机构权限,只能查出自己创建的
|
||||
filters.add(FieldFilters.eq("sysCreateAid",dto.getOrgAid()));
|
||||
}
|
||||
}else {
|
||||
log.error("【"+dto.getOrgAid()+"】IsSystemAdmin is true 不过机构过滤,查询全部");
|
||||
//log.info("【"+dto.getOrgAid()+"】IsSystemAdmin is true 不过机构过滤,查询全部");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -294,7 +293,7 @@ public class CourseServiceImpl implements ICourseService {
|
||||
}
|
||||
|
||||
PageList<Course> rs=courseDao.findPage(pageIndex, pageSize, filters, oc);
|
||||
|
||||
//log.info("查询出的条数:"+rs.getCount());
|
||||
return rs;
|
||||
}
|
||||
|
||||
|
||||
@@ -60,8 +60,13 @@ public class ExamQuestionApi extends ApiBaseController {
|
||||
@PostMapping("/page")
|
||||
public JsonResponse<PageList<ExamQuestion>> page(Pagination pager,
|
||||
ExamQuestion examQuestion,String orderField,Boolean orderAsc) {
|
||||
PageList<ExamQuestion> list = service.query(pager.getPageIndex(), pager.getPageSize(), examQuestion,orderField,orderAsc);
|
||||
return success(list);
|
||||
try {
|
||||
PageList<ExamQuestion> list = service.query(pager.getPageIndex(), pager.getPageSize(), examQuestion,orderField,orderAsc);
|
||||
return success(list);
|
||||
}catch(Exception e) {
|
||||
log.error("分页查询试题错误",e);
|
||||
return error("查询试题错误",e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -101,10 +101,10 @@ public class TeacherServiceImpl implements ITeacherService {
|
||||
@Override
|
||||
public List<Teacher> findByName(String name) {
|
||||
String hql="Select t.id,t.name,u.userNo from "+Teacher.class.getSimpleName()+" t,"+User.class.getSimpleName()+" u ";
|
||||
hql+=" where t.id=u.id and t.name like '%"+name+"%'";
|
||||
hql+=" where t.id=u.id and (t.name like '%"+name+"%' or u.userNo=?1)";
|
||||
List<Teacher> teachers=new ArrayList<Teacher>();
|
||||
try {
|
||||
List<Object[]> list =dao.findListFields(hql);
|
||||
List<Object[]> list =dao.findListFields(hql,name);
|
||||
for(Object[] objs :list) {
|
||||
Teacher t=new Teacher();
|
||||
t.setId((String)objs[0]);
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.xboe.system.user.api;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@@ -256,6 +257,10 @@ public class UserApi extends ApiBaseController {
|
||||
*/
|
||||
@RequestMapping(value = "/ids", method = {RequestMethod.POST})
|
||||
public JsonResponse<List<UserSimpleVo>> findByIds(@RequestBody List<String> ids) {
|
||||
|
||||
if(ids.isEmpty()) {
|
||||
return success(new ArrayList<>());
|
||||
}
|
||||
|
||||
List<UserSimpleVo> list = null;
|
||||
// //最后从缓存中取,根据用户的id, 缓存用户的头像地址,姓名,机构信息。一期可以先直接查询,缓存可以后续修改
|
||||
|
||||
Reference in New Issue
Block a user