|
|
@@ -31,6 +31,8 @@ import platform.modules.build.service.CompanyService;
|
|
|
import platform.modules.carrier.dto.ChangePassword;
|
|
|
import platform.modules.carrier.entity.Park;
|
|
|
import platform.modules.carrier.service.ParkService;
|
|
|
+import platform.modules.company.entity.ProjectApplicationCompanyInfo;
|
|
|
+import platform.modules.company.service.ProjectApplicationCompanyInfoService;
|
|
|
import platform.modules.government.dao.AttachmentDao;
|
|
|
import platform.modules.government.dao.UserDao;
|
|
|
import platform.modules.government.entity.Attachment;
|
|
|
@@ -56,6 +58,7 @@ import java.text.SimpleDateFormat;
|
|
|
import java.util.ArrayList;
|
|
|
import java.util.Date;
|
|
|
import java.util.List;
|
|
|
+import java.util.Objects;
|
|
|
|
|
|
/**
|
|
|
* 用户管理(政府)Service
|
|
|
@@ -85,6 +88,7 @@ public class UserService extends BaseService<User> {
|
|
|
|
|
|
@Autowired
|
|
|
private UserGroupService userGroupService;
|
|
|
+
|
|
|
@Autowired
|
|
|
private StreetService streetService;
|
|
|
|
|
|
@@ -112,6 +116,9 @@ public class UserService extends BaseService<User> {
|
|
|
@Autowired
|
|
|
private RedisService redisService;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private ProjectApplicationCompanyInfoService projectApplicationCompanyInfoService;
|
|
|
+
|
|
|
protected final transient Log log = LogFactory.get(this.getClass());
|
|
|
|
|
|
public PageInfo<User> findPage(Integer pageNum, Integer pageSize, String param) throws Exception {
|
|
|
@@ -670,11 +677,42 @@ public class UserService extends BaseService<User> {
|
|
|
user.setDel_flag(false);
|
|
|
List<User> users = this.findListByWhere(user);
|
|
|
if (users != null && users.size() > 0) {
|
|
|
- return users.get(0);
|
|
|
+ for (User user1 : users) {
|
|
|
+ if (user1.getPhone() != null && user1.getPhone() != "") {
|
|
|
+ return user1;
|
|
|
+ }
|
|
|
+ }
|
|
|
+// return users.get(0);
|
|
|
}
|
|
|
return null;
|
|
|
}
|
|
|
|
|
|
+ //查找企业管理员
|
|
|
+ public User findCompanyAdmin(Integer companyId, Integer applyId, String type) {
|
|
|
+ User user = new User();
|
|
|
+ user.setCompany_id(companyId);
|
|
|
+ user.setIs_admin(true);
|
|
|
+ user.setDel_flag(false);
|
|
|
+ List<User> users = this.findListByWhere(user);
|
|
|
+ boolean flag = true;
|
|
|
+ if (users != null && users.size() > 0) {
|
|
|
+ for (int i = users.size() - 1; i >= 0; i--) {
|
|
|
+ if (users.get(i) != null && users.get(i).getPhone() != null && !Objects.equals(users.get(i).getPhone(), "")) {
|
|
|
+ flag = false;
|
|
|
+ return users.get(i);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (flag) {
|
|
|
+ ProjectApplicationCompanyInfo companyInfo = projectApplicationCompanyInfoService.findByApplyIdAndType(applyId, type);
|
|
|
+ if (companyInfo != null && companyInfo.getContact_phone() != null) {
|
|
|
+ user = users.get(users.size() - 1);
|
|
|
+ user.setPhone(companyInfo.getContact_phone());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return user;
|
|
|
+ }
|
|
|
+
|
|
|
//删除企业账户,(例如:注册失败要删除企业账户)
|
|
|
public void deleteCompanyUser(Integer id) {
|
|
|
userDao.deleteCompanyUser(id);
|
|
|
@@ -844,7 +882,7 @@ public class UserService extends BaseService<User> {
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * 获取个人中心用户
|
|
|
+ * 获取个人中心用户
|
|
|
*
|
|
|
* @param id
|
|
|
* @return
|
|
|
@@ -860,7 +898,7 @@ public class UserService extends BaseService<User> {
|
|
|
* @param id
|
|
|
* @return
|
|
|
*/
|
|
|
- public String department(Unit user, Integer id){
|
|
|
+ public String department(Unit user, Integer id) {
|
|
|
return user.departmentName(id);
|
|
|
}
|
|
|
|
|
|
@@ -881,7 +919,7 @@ public class UserService extends BaseService<User> {
|
|
|
* @return
|
|
|
*/
|
|
|
public String getGovDepartment(User user) {
|
|
|
- if (user.getDepartment_id() != null){
|
|
|
+ if (user.getDepartment_id() != null) {
|
|
|
return departmentService.findById(user.getDepartment_id()).getName();
|
|
|
}
|
|
|
return null;
|
|
|
@@ -914,11 +952,13 @@ public class UserService extends BaseService<User> {
|
|
|
*/
|
|
|
public ResponseMessage changePassword(ChangePassword changePassword) {
|
|
|
User user = this.findById(changePassword.getUserId());
|
|
|
- if ( user == null){ return ResponseMessage.error("用户不存在");}
|
|
|
- if (!user.getPassword().equals(secureMD5(changePassword.getOldPass()))){
|
|
|
+ if (user == null) {
|
|
|
+ return ResponseMessage.error("用户不存在");
|
|
|
+ }
|
|
|
+ if (!user.getPassword().equals(secureMD5(changePassword.getOldPass()))) {
|
|
|
return ResponseMessage.error("旧密码不正确");
|
|
|
}
|
|
|
- if (user.getPassword().equals(secureMD5(changePassword.getNewPass()))){
|
|
|
+ if (user.getPassword().equals(secureMD5(changePassword.getNewPass()))) {
|
|
|
return ResponseMessage.error("新密码与旧密码相同");
|
|
|
}
|
|
|
user.setPassword(secureMD5(changePassword.getNewPass()));
|
|
|
@@ -927,7 +967,4 @@ public class UserService extends BaseService<User> {
|
|
|
}
|
|
|
|
|
|
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
}
|