mirror of
https://codeup.aliyun.com/67762337eccfc218f6110e0e/per-boe/java-servers.git
synced 2025-12-11 20:06:51 +08:00
增加info日志
This commit is contained in:
@@ -7,6 +7,7 @@ import org.springframework.web.bind.annotation.RequestBody;
|
|||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
import com.xboe.account.entity.Account;
|
import com.xboe.account.entity.Account;
|
||||||
import com.xboe.account.service.IAccountService;
|
import com.xboe.account.service.IAccountService;
|
||||||
import com.xboe.core.JsonResponse;
|
import com.xboe.core.JsonResponse;
|
||||||
@@ -45,9 +46,9 @@ public class UserDataSyncApi extends ApiBaseController {
|
|||||||
if (StringUtils.isBlank(user.getId())) {
|
if (StringUtils.isBlank(user.getId())) {
|
||||||
return error("无用户的id");
|
return error("无用户的id");
|
||||||
}
|
}
|
||||||
//清除缓存需要loginName
|
|
||||||
try {
|
try {
|
||||||
//先查询是否存在
|
ObjectMapper mapper=new ObjectMapper();
|
||||||
|
log.info("同步的用户信息:{}",mapper.writeValueAsString(user));
|
||||||
service.syncUserFull(user);
|
service.syncUserFull(user);
|
||||||
return success(true);
|
return success(true);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
@@ -65,9 +66,11 @@ public class UserDataSyncApi extends ApiBaseController {
|
|||||||
//清除缓存需要loginName
|
//清除缓存需要loginName
|
||||||
try {
|
try {
|
||||||
//先查询是否存在
|
//先查询是否存在
|
||||||
|
log.info("删除用户【"+id+"】");
|
||||||
Account a=new Account();
|
Account a=new Account();
|
||||||
a.setId(id);
|
a.setId(id);
|
||||||
accountService.delete(a);
|
accountService.delete(a);
|
||||||
|
log.info("删除用户成功");
|
||||||
return success(true);
|
return success(true);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error("同步删除用户错误", e);
|
log.error("同步删除用户错误", e);
|
||||||
|
|||||||
@@ -55,6 +55,7 @@ public class OutSideDataServiceImpl implements IOutSideDataService {
|
|||||||
|
|
||||||
json = mapper.writeValueAsString(params);
|
json = mapper.writeValueAsString(params);
|
||||||
String responseStr = okHttpUtil.doPostJson(url, json, headers);
|
String responseStr = okHttpUtil.doPostJson(url, json, headers);
|
||||||
|
log.info("根据受众id获取受众的人员列表:",responseStr);
|
||||||
JsonNode rootNode= mapper.readTree(responseStr);
|
JsonNode rootNode= mapper.readTree(responseStr);
|
||||||
|
|
||||||
JsonNode result = rootNode.get("result");
|
JsonNode result = rootNode.get("result");
|
||||||
@@ -96,6 +97,7 @@ public class OutSideDataServiceImpl implements IOutSideDataService {
|
|||||||
try {
|
try {
|
||||||
//OkHttpUtil http=new OkHttpUtil();
|
//OkHttpUtil http=new OkHttpUtil();
|
||||||
String responseStr = okHttpUtil.doPostJson(url,"{}", headers);
|
String responseStr = okHttpUtil.doPostJson(url,"{}", headers);
|
||||||
|
log.info("获取用户信息:",responseStr);
|
||||||
//System.out.println(responseStr);
|
//System.out.println(responseStr);
|
||||||
JsonNode rootNode= mapper.readTree(responseStr);
|
JsonNode rootNode= mapper.readTree(responseStr);
|
||||||
int code = rootNode.get("status").asInt();
|
int code = rootNode.get("status").asInt();
|
||||||
@@ -142,6 +144,7 @@ public class OutSideDataServiceImpl implements IOutSideDataService {
|
|||||||
user.setAdminType(2);//非默认管理员
|
user.setAdminType(2);//非默认管理员
|
||||||
}
|
}
|
||||||
if(roleCode.equals("teacher")){
|
if(roleCode.equals("teacher")){
|
||||||
|
log.info("用户有教师身份");
|
||||||
user.setTeacher(true);//是老师
|
user.setTeacher(true);//是老师
|
||||||
user.setUserType(2);//教师
|
user.setUserType(2);//教师
|
||||||
}
|
}
|
||||||
@@ -175,6 +178,7 @@ public class OutSideDataServiceImpl implements IOutSideDataService {
|
|||||||
String responseStr=null;
|
String responseStr=null;
|
||||||
try{
|
try{
|
||||||
responseStr = okHttpUtil.doPostJson(url,"{}", headers);
|
responseStr = okHttpUtil.doPostJson(url,"{}", headers);
|
||||||
|
log.info("获取用户机构权限:",responseStr);
|
||||||
JsonNode rootNode= mapper.readTree(responseStr);
|
JsonNode rootNode= mapper.readTree(responseStr);
|
||||||
int code = rootNode.get("status").asInt();
|
int code = rootNode.get("status").asInt();
|
||||||
if(code!=200) {
|
if(code!=200) {
|
||||||
|
|||||||
@@ -19,6 +19,9 @@ import com.xboe.system.organization.entity.Organization;
|
|||||||
import com.xboe.system.user.dao.UserDao;
|
import com.xboe.system.user.dao.UserDao;
|
||||||
import com.xboe.system.user.entity.User;
|
import com.xboe.system.user.entity.User;
|
||||||
|
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
|
||||||
|
@Slf4j
|
||||||
@Service
|
@Service
|
||||||
public class DataUserSyncServiceImpl implements IDataUserSyncService{
|
public class DataUserSyncServiceImpl implements IDataUserSyncService{
|
||||||
|
|
||||||
@@ -52,6 +55,7 @@ public class DataUserSyncServiceImpl implements IDataUserSyncService{
|
|||||||
a.setDeleted(user.getDeleted());
|
a.setDeleted(user.getDeleted());
|
||||||
}
|
}
|
||||||
a.setLoginName(user.getCode());
|
a.setLoginName(user.getCode());
|
||||||
|
log.info("更新账号code");
|
||||||
}else {
|
}else {
|
||||||
//新账户
|
//新账户
|
||||||
a=new Account();
|
a=new Account();
|
||||||
@@ -62,6 +66,7 @@ public class DataUserSyncServiceImpl implements IDataUserSyncService{
|
|||||||
a.setRegTime(LocalDateTime.now());
|
a.setRegTime(LocalDateTime.now());
|
||||||
a.setSysId(user.getKid());
|
a.setSysId(user.getKid());
|
||||||
a.setStatus(1);
|
a.setStatus(1);
|
||||||
|
log.info("账号不存在,新添加账号【"+user.getId()+"】");
|
||||||
}
|
}
|
||||||
if(u!=null) {
|
if(u!=null) {
|
||||||
//更新部分用户字段
|
//更新部分用户字段
|
||||||
@@ -73,6 +78,7 @@ public class DataUserSyncServiceImpl implements IDataUserSyncService{
|
|||||||
if(user.getLearningDuration()>0) { //不大于0才会更新
|
if(user.getLearningDuration()>0) { //不大于0才会更新
|
||||||
u.setLearningDuration(user.getLearningDuration());
|
u.setLearningDuration(user.getLearningDuration());
|
||||||
}
|
}
|
||||||
|
log.info("更新用户信息,学习时长,姓名,所在部门");
|
||||||
}else {
|
}else {
|
||||||
//新建用户
|
//新建用户
|
||||||
u=new User();
|
u=new User();
|
||||||
@@ -93,12 +99,13 @@ public class DataUserSyncServiceImpl implements IDataUserSyncService{
|
|||||||
}else {
|
}else {
|
||||||
u.setShowHome(true);//band16以下,及其它无bandLevel的信息
|
u.setShowHome(true);//band16以下,及其它无bandLevel的信息
|
||||||
}
|
}
|
||||||
|
log.info("添加新用户");
|
||||||
}
|
}
|
||||||
//对机构的判断,不为空时才会处理,为空时不处理
|
//对机构的判断,不为空时才会处理,为空时不处理
|
||||||
if(StringUtils.isNotBlank(user.getDepartId())) {
|
if(StringUtils.isNotBlank(user.getDepartId())) {
|
||||||
org=orgDao.get(user.getDepartId());
|
org=orgDao.get(user.getDepartId());
|
||||||
if(org==null) {
|
if(org==null) {
|
||||||
|
log.info("无用户关联机构,添加新机构");
|
||||||
org=new Organization();
|
org=new Organization();
|
||||||
org.setCode("");
|
org.setCode("");
|
||||||
org.setId(user.getDepartId());
|
org.setId(user.getDepartId());
|
||||||
@@ -116,11 +123,14 @@ public class DataUserSyncServiceImpl implements IDataUserSyncService{
|
|||||||
userDao.saveOrUpdate(u);
|
userDao.saveOrUpdate(u);
|
||||||
if(org!=null) {
|
if(org!=null) {
|
||||||
orgDao.saveOrUpdate(org);
|
orgDao.saveOrUpdate(org);
|
||||||
|
log.info("更新用户对应的机构信息");
|
||||||
}
|
}
|
||||||
//老师信息
|
//老师信息
|
||||||
if(u.getUserType()!=null && u.getUserType()==2) {
|
if(u.getUserType()!=null && u.getUserType()==2) {
|
||||||
Teacher t = teacherDao.get(u.getId());
|
Teacher t = teacherDao.get(u.getId());
|
||||||
|
log.info("用户有教师身份,处理教师身份");
|
||||||
if(t==null) {
|
if(t==null) {
|
||||||
|
log.info("添加教师身份");
|
||||||
t=new Teacher();
|
t=new Teacher();
|
||||||
t.setId(u.getId());
|
t.setId(u.getId());
|
||||||
t.setDepartId(u.getDepartId());
|
t.setDepartId(u.getDepartId());
|
||||||
@@ -131,6 +141,7 @@ public class DataUserSyncServiceImpl implements IDataUserSyncService{
|
|||||||
t.setWaitStatus(0);
|
t.setWaitStatus(0);
|
||||||
t.setUser(u);
|
t.setUser(u);
|
||||||
teacherDao.save(t);
|
teacherDao.save(t);
|
||||||
|
log.info("教师身份已添加");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -28,7 +28,6 @@ import com.fasterxml.jackson.core.JsonProcessingException;
|
|||||||
import com.fasterxml.jackson.core.type.TypeReference;
|
import com.fasterxml.jackson.core.type.TypeReference;
|
||||||
import com.fasterxml.jackson.databind.DeserializationFeature;
|
import com.fasterxml.jackson.databind.DeserializationFeature;
|
||||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
import com.xboe.common.OrderCondition;
|
|
||||||
import com.xboe.common.PageList;
|
import com.xboe.common.PageList;
|
||||||
import com.xboe.common.Pagination;
|
import com.xboe.common.Pagination;
|
||||||
import com.xboe.common.utils.IDGenerator;
|
import com.xboe.common.utils.IDGenerator;
|
||||||
@@ -447,8 +446,8 @@ public class AloneExamApi extends ApiBaseController {
|
|||||||
* @param aea
|
* @param aea
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
|
//@Deprecated
|
||||||
@PostMapping("/start")
|
@PostMapping("/start")
|
||||||
@Deprecated
|
|
||||||
public JsonResponse<AloneExamAnswer> startTest(HttpServletRequest request,@RequestBody AloneExamAnswer aea) {
|
public JsonResponse<AloneExamAnswer> startTest(HttpServletRequest request,@RequestBody AloneExamAnswer aea) {
|
||||||
if (StringUtils.isBlank(aea.getPaperJson())) {
|
if (StringUtils.isBlank(aea.getPaperJson())) {
|
||||||
return badRequest("参数试题内容");
|
return badRequest("参数试题内容");
|
||||||
|
|||||||
@@ -206,10 +206,10 @@ public class PortalLoginApi extends ApiBaseController {
|
|||||||
return wrap(JsonResponseStatus.TOKEN_NOPASS, "token error");
|
return wrap(JsonResponseStatus.TOKEN_NOPASS, "token error");
|
||||||
}
|
}
|
||||||
|
|
||||||
Map<String, String> tokenInfo = authorizationToken.readToken(token);
|
// Map<String, String> tokenInfo = authorizationToken.readToken(token);
|
||||||
if (tokenInfo == null) {
|
// if (tokenInfo == null) {
|
||||||
return wrap(JsonResponseStatus.TOKEN_NOPASS, "token error");
|
// return wrap(JsonResponseStatus.TOKEN_NOPASS, "token error");
|
||||||
}
|
// }
|
||||||
|
|
||||||
UserData udata=outsideService.getUserInfoByUserId(null);
|
UserData udata=outsideService.getUserInfoByUserId(null);
|
||||||
if(udata==null) {
|
if(udata==null) {
|
||||||
@@ -223,20 +223,20 @@ public class PortalLoginApi extends ApiBaseController {
|
|||||||
log.error("登录同步用户错误",exp);
|
log.error("登录同步用户错误",exp);
|
||||||
}
|
}
|
||||||
|
|
||||||
Map<String, String> data = new HashMap<String, String>();
|
// Map<String, String> data = new HashMap<String, String>();
|
||||||
Map<String, Object> map = new HashMap<String, Object>();
|
Map<String, Object> map = new HashMap<String, Object>();
|
||||||
//模拟数据
|
//模拟数据
|
||||||
data.put("aid",udata.getId());
|
// data.put("aid",udata.getId());
|
||||||
data.put("uId", udata.getId());//匹配新的token中的 uId
|
// data.put("uId", udata.getId());//匹配新的token中的 uId
|
||||||
data.put("name", udata.getName());
|
// data.put("name", udata.getName());
|
||||||
data.put("userNo", udata.getCode());
|
// data.put("userNo", udata.getCode());
|
||||||
data.put("departId", udata.getDepartId());
|
// data.put("departId", udata.getDepartId());
|
||||||
data.put("userId",udata.getKid());
|
// data.put("userId",udata.getKid());
|
||||||
|
|
||||||
String newtoken = authorizationToken.createToken(data);
|
// String newtoken = authorizationToken.createToken(data);
|
||||||
map.put("expires_in", IAuthorizationToken.TOKEN_TIMEOUT);
|
// map.put("expires_in", IAuthorizationToken.TOKEN_TIMEOUT);
|
||||||
map.put("scope", "boe");
|
// map.put("scope", "boe");
|
||||||
map.put("access_token", newtoken);
|
// map.put("access_token", newtoken);
|
||||||
//
|
//
|
||||||
return success(map);
|
return success(map);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
|||||||
Reference in New Issue
Block a user