Commit 5d826e84 authored by 廖旭伟's avatar 廖旭伟

用户同步任务bug修改

parent 888bd51f
......@@ -341,10 +341,11 @@ public class UserServiceImpl extends AbstractCRUDServiceImpl<UserDao, UserEntity
throw new AppException("密码转换异常!", e);
}
entity.setUserType(DataUtil.converStr2Int(phpPdu.getType(),1));
this.save(entity);
dao.insert(entity);
} else {
//更新
UserEntity userEntity = new UserEntity();
userEntity.setId(tempUser.getId());
userEntity.setLoginName(phpPdu.getAccount());
userEntity.setRealName(phpPdu.getUser_name());
userEntity.setMobile(phpPdu.getMobile());
......@@ -354,7 +355,7 @@ public class UserServiceImpl extends AbstractCRUDServiceImpl<UserDao, UserEntity
throw new AppException("密码转换异常!", e);
}
userEntity.setUserType(DataUtil.converStr2Int(phpPdu.getType(),1));
this.update(userEntity);
dao.update(userEntity);
}
}
}
......
package com.mortals.xhx.daemon.task;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.mortals.framework.ap.GlobalSysInfo;
import com.mortals.framework.common.Rest;
import com.mortals.framework.exception.AppException;
......@@ -38,8 +40,9 @@ public class SyncUserTaskImpl implements ITaskExcuteService {
try {
HashMap<String, String> paramsMap = new HashMap<>();
resp = HttpUtil.doGet(phpUrl, paramsMap);
Rest<List<UserPhpPdu>> list = JSON.parseObject(resp,Rest.class);
userService.updateUserList(list.getData());
Rest<List<JSONObject>> list = JSON.parseObject(resp,Rest.class);
List<UserPhpPdu> upp = JSONArray.parseArray(JSONObject.toJSONString(list.getData()),UserPhpPdu.class);
userService.updateUserList(upp);
} catch (Exception e) {
log.error("同步用户发生异常",e);
}
......@@ -52,4 +55,5 @@ public class SyncUserTaskImpl implements ITaskExcuteService {
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment