|
@@ -179,12 +179,11 @@ public class CommonUserServiceImpl extends ServiceImpl<CommonUserMapper, CommonU
|
|
|
user.setRoleIds(commonStaff.getMajorRoleId());
|
|
|
user.setId(commonStaff.getStaffId());
|
|
|
CommonCompany commonCompany = commonCompanyService.selectById(commonStaff.getCompId());
|
|
|
- if(commonCompany != null){
|
|
|
- user.setUserName(commonCompany.getCompSimpleName() + "-" +commonStaff.getStaffName());
|
|
|
+ if (commonCompany != null) {
|
|
|
+ user.setUserName(commonCompany.getCompSimpleName() + "-" + commonStaff.getStaffName());
|
|
|
}
|
|
|
- }
|
|
|
- else{
|
|
|
- user.setUserName("用户"+commonUser.getPhone().substring(0, 3) + "****" + commonUser.getPhone().substring(7));
|
|
|
+ } else {
|
|
|
+ user.setUserName("用户" + commonUser.getPhone().substring(0, 3) + "****" + commonUser.getPhone().substring(7));
|
|
|
}
|
|
|
user.setPassword(Md5Crypt.md5Crypt(commonUser.getPassword().getBytes(), "$1$" + commonUser.getPhone().substring(0, 7)));
|
|
|
this.insert(user);
|
|
@@ -208,15 +207,23 @@ public class CommonUserServiceImpl extends ServiceImpl<CommonUserMapper, CommonU
|
|
|
CommonStaff commonStaff = commonStaffService.selectOne(new EntityWrapper<CommonStaff>()
|
|
|
.eq("staff_mobile_phone", commonUser.getPhone()).eq("enabled", "1"));
|
|
|
// 查询app 账号
|
|
|
- CommonUser user = this.selectOne(new EntityWrapper<CommonUser>().eq("phone",commonUser.getPhone()));
|
|
|
- if(user != null){
|
|
|
- this.deleteById(user.getId());
|
|
|
- user.setId(commonStaff.getStaffId());
|
|
|
- this.insert(user);
|
|
|
- return "OK";
|
|
|
+ CommonUser user = this.selectOne(new EntityWrapper<CommonUser>().eq("phone", commonUser.getPhone()));
|
|
|
+ if (user != null) {
|
|
|
+ if ("1".equals(commonUser.getFlag())) {
|
|
|
+ this.deleteById(user.getId());
|
|
|
+ user.setId(commonStaff.getStaffId());
|
|
|
+ this.insert(user);
|
|
|
+ return "OK";
|
|
|
+ } else if ("2".equals(commonUser.getFlag())) {
|
|
|
+ return "OK";
|
|
|
+ } else {
|
|
|
+ return "是否覆盖APP账号";
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
return "NG";
|
|
|
}
|
|
|
+
|
|
|
/**
|
|
|
* Session检测
|
|
|
*
|
|
@@ -226,7 +233,7 @@ public class CommonUserServiceImpl extends ServiceImpl<CommonUserMapper, CommonU
|
|
|
@Override
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
public String checkSession() throws ServiceException {
|
|
|
- if(AuthSecurityUtils.getCurrentUserId() == null || AuthSecurityUtils.getCurrentUserId().isEmpty()){
|
|
|
+ if (AuthSecurityUtils.getCurrentUserId() == null || AuthSecurityUtils.getCurrentUserId().isEmpty()) {
|
|
|
return "INVALID";
|
|
|
}
|
|
|
return "VALID";
|
|
@@ -266,7 +273,6 @@ public class CommonUserServiceImpl extends ServiceImpl<CommonUserMapper, CommonU
|
|
|
}
|
|
|
|
|
|
|
|
|
-
|
|
|
/**
|
|
|
* 修改用户信息
|
|
|
*
|
|
@@ -288,8 +294,8 @@ public class CommonUserServiceImpl extends ServiceImpl<CommonUserMapper, CommonU
|
|
|
* @return
|
|
|
*/
|
|
|
@Override
|
|
|
- public List<CommonCompany> getComp() {
|
|
|
- return commonCompanyService.selectList(new EntityWrapper<CommonCompany>().eq("delete_flag","0"));
|
|
|
+ public List<CommonCompany> getComp() {
|
|
|
+ return commonCompanyService.selectList(new EntityWrapper<CommonCompany>().eq("delete_flag", "0"));
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -298,20 +304,20 @@ public class CommonUserServiceImpl extends ServiceImpl<CommonUserMapper, CommonU
|
|
|
* @return
|
|
|
*/
|
|
|
@Override
|
|
|
- public List<CommonCompany> getCompOwn(String phone) {
|
|
|
+ public List<CommonCompany> getCompOwn(String phone) {
|
|
|
List<CommonStaff> staffs = commonStaffService.selectList(new EntityWrapper<CommonStaff>()
|
|
|
- .eq("staff_mobile_phone",phone));
|
|
|
+ .eq("staff_mobile_phone", phone));
|
|
|
List<CommonCompany> commonCompanyList = new ArrayList<>();
|
|
|
- if(!CollectionUtils.isEmpty(staffs)){
|
|
|
- for(int i=0;i<staffs.size();i++) {
|
|
|
+ if (!CollectionUtils.isEmpty(staffs)) {
|
|
|
+ for (int i = 0; i < staffs.size(); i++) {
|
|
|
CommonCompany commonCompany = commonCompanyService.selectById(staffs.get(i).getCompId());
|
|
|
- if(commonCompany.getCompName().contains("中天昊元")){
|
|
|
+ if (commonCompany.getCompName().contains("中天昊元")) {
|
|
|
commonCompanyList.add(commonCompany);
|
|
|
}
|
|
|
}
|
|
|
- for(int i=0;i<staffs.size();i++) {
|
|
|
+ for (int i = 0; i < staffs.size(); i++) {
|
|
|
CommonCompany commonCompany = commonCompanyService.selectById(staffs.get(i).getCompId());
|
|
|
- if(!commonCompany.getCompName().contains("中天昊元")){
|
|
|
+ if (!commonCompany.getCompName().contains("中天昊元")) {
|
|
|
commonCompanyList.add(commonCompany);
|
|
|
}
|
|
|
}
|
|
@@ -320,7 +326,6 @@ public class CommonUserServiceImpl extends ServiceImpl<CommonUserMapper, CommonU
|
|
|
}
|
|
|
|
|
|
|
|
|
-
|
|
|
/**
|
|
|
* 发送验证码
|
|
|
*
|
|
@@ -375,12 +380,11 @@ public class CommonUserServiceImpl extends ServiceImpl<CommonUserMapper, CommonU
|
|
|
userDO.setRoleIds(commonStaff.getMajorRoleId());
|
|
|
userDO.setId(commonStaff.getStaffId());
|
|
|
CommonCompany commonCompany = commonCompanyService.selectById(commonStaff.getCompId());
|
|
|
- if(commonCompany != null){
|
|
|
- userDO.setUserName(commonCompany.getCompSimpleName() + "-" +commonStaff.getStaffName());
|
|
|
+ if (commonCompany != null) {
|
|
|
+ userDO.setUserName(commonCompany.getCompSimpleName() + "-" + commonStaff.getStaffName());
|
|
|
}
|
|
|
- }
|
|
|
- else{
|
|
|
- userDO.setUserName("用户"+commonUser.getPhone().substring(0, 3) + "****" + commonUser.getPhone().substring(7));
|
|
|
+ } else {
|
|
|
+ userDO.setUserName("用户" + commonUser.getPhone().substring(0, 3) + "****" + commonUser.getPhone().substring(7));
|
|
|
}
|
|
|
userDO.setPhone(commonUser.getPhone());
|
|
|
userDO.setCid(commonUser.getCid());
|
|
@@ -391,8 +395,7 @@ public class CommonUserServiceImpl extends ServiceImpl<CommonUserMapper, CommonU
|
|
|
//检查帐号是否已经冻结
|
|
|
if (userDO.getStatus() == 0) {
|
|
|
throw new AppServiceException(ExceptionDefinition.USER_CAN_NOT_ACTICE);
|
|
|
- }
|
|
|
- else{
|
|
|
+ } else {
|
|
|
userDO.setCid(commonUser.getCid());
|
|
|
}
|
|
|
}
|
|
@@ -475,15 +478,15 @@ public class CommonUserServiceImpl extends ServiceImpl<CommonUserMapper, CommonU
|
|
|
* @throws ServiceException
|
|
|
*/
|
|
|
@Override
|
|
|
- public List<String> getCompList(String userMobilePhone){
|
|
|
+ public List<String> getCompList(String userMobilePhone) {
|
|
|
List<String> compList = new ArrayList<>();
|
|
|
List<Account> stringList = accountService.selectList(new EntityWrapper<Account>()
|
|
|
- .eq("user_mobile_phone",userMobilePhone)
|
|
|
+ .eq("user_mobile_phone", userMobilePhone)
|
|
|
.groupBy("comp_id"));
|
|
|
- if(CollectionUtils.isNotEmpty(stringList)){
|
|
|
- for(Account account1 : stringList){
|
|
|
+ if (CollectionUtils.isNotEmpty(stringList)) {
|
|
|
+ for (Account account1 : stringList) {
|
|
|
CommonCompany commonCompany = commonCompanyService.selectOne(new EntityWrapper<CommonCompany>()
|
|
|
- .eq("comp_id",account1.getCompId())
|
|
|
+ .eq("comp_id", account1.getCompId())
|
|
|
.eq("delete_flag", "0"));
|
|
|
compList.add(commonCompany.getCompName());
|
|
|
}
|
|
@@ -513,8 +516,7 @@ public class CommonUserServiceImpl extends ServiceImpl<CommonUserMapper, CommonU
|
|
|
//检查帐号是否已经冻结
|
|
|
if (userDO.getStatus() == 0) {
|
|
|
throw new AppServiceException(ExceptionDefinition.USER_CAN_NOT_ACTICE);
|
|
|
- }
|
|
|
- else if(commonUser.getCid() != null && !commonUser.getCid().isEmpty()){
|
|
|
+ } else if (commonUser.getCid() != null && !commonUser.getCid().isEmpty()) {
|
|
|
userDO.setCid(commonUser.getCid());
|
|
|
}
|
|
|
if (commonUser.getPhone() != null) {
|
|
@@ -721,7 +723,6 @@ public class CommonUserServiceImpl extends ServiceImpl<CommonUserMapper, CommonU
|
|
|
}
|
|
|
|
|
|
|
|
|
-
|
|
|
@Override
|
|
|
public Account login(Account user, String veriCode) {
|
|
|
Account targetUser = getTargetUser(user);
|
|
@@ -732,11 +733,11 @@ public class CommonUserServiceImpl extends ServiceImpl<CommonUserMapper, CommonU
|
|
|
// && StringUtils.isEmpty(password)) {
|
|
|
// password = targetUser.getLoginPassword();
|
|
|
// }
|
|
|
- if("123456".equals(veriCode)){
|
|
|
+ if ("123456".equals(veriCode)) {
|
|
|
password = targetUser.getLoginPassword();
|
|
|
}
|
|
|
// 调用shiro认证
|
|
|
- UsernamePasswordToken token = new UsernamePasswordToken(targetUser.getUserId(), password);
|
|
|
+ UsernamePasswordToken token = new UsernamePasswordToken(targetUser.getUserId(), password);
|
|
|
if (null == user.getRememberMe()) {
|
|
|
token.setRememberMe(false);
|
|
|
} else {
|
|
@@ -794,7 +795,8 @@ public class CommonUserServiceImpl extends ServiceImpl<CommonUserMapper, CommonU
|
|
|
}
|
|
|
|
|
|
|
|
|
- /**查询已完成任务
|
|
|
+ /**
|
|
|
+ * 查询已完成任务
|
|
|
*
|
|
|
* @param noticeTask
|
|
|
* @return
|
|
@@ -822,7 +824,6 @@ public class CommonUserServiceImpl extends ServiceImpl<CommonUserMapper, CommonU
|
|
|
}
|
|
|
|
|
|
|
|
|
-
|
|
|
/**
|
|
|
* 过滤没有这个权限的任务
|
|
|
*
|
|
@@ -877,9 +878,9 @@ public class CommonUserServiceImpl extends ServiceImpl<CommonUserMapper, CommonU
|
|
|
|
|
|
@Override
|
|
|
@Transactional
|
|
|
- public String saveRole(CommonStaffRole commonStaffRole){
|
|
|
- commonStaffRoleService.delete(new EntityWrapper<CommonStaffRole>().eq("staff_id",commonStaffRole.getStaffId())
|
|
|
- .eq("role_major","0"));
|
|
|
+ public String saveRole(CommonStaffRole commonStaffRole) {
|
|
|
+ commonStaffRoleService.delete(new EntityWrapper<CommonStaffRole>().eq("staff_id", commonStaffRole.getStaffId())
|
|
|
+ .eq("role_major", "0"));
|
|
|
commonStaffRole.setId(IdGenerator.generateUUID());
|
|
|
commonStaffRoleService.insert(commonStaffRole);
|
|
|
return "OK";
|
|
@@ -889,7 +890,7 @@ public class CommonUserServiceImpl extends ServiceImpl<CommonUserMapper, CommonU
|
|
|
@Transactional
|
|
|
public void changeInfo(CommonStaff staff) {
|
|
|
UniquenessChecker.check(staffMapper, (new EntityWrapper()).eq("comp_id", staff.getCompId()), staff);
|
|
|
- staff.setEnabled((Integer)null);
|
|
|
+ staff.setEnabled((Integer) null);
|
|
|
staff.updateById();
|
|
|
Account account;
|
|
|
if (null != staff.getStaffMobilePhone()) {
|
|
@@ -927,10 +928,10 @@ public class CommonUserServiceImpl extends ServiceImpl<CommonUserMapper, CommonU
|
|
|
majorRole.setMajor("1");
|
|
|
staff.getRoles().add(majorRole);
|
|
|
if (org.apache.commons.collections.CollectionUtils.isNotEmpty(staff.getRoleVesselIds())) {
|
|
|
- List<String> roleIds = (List)staff.getRoleVesselIds().stream().map((roleVesselId) -> {
|
|
|
+ List<String> roleIds = (List) staff.getRoleVesselIds().stream().map((roleVesselId) -> {
|
|
|
return roleVesselId.split("_")[0];
|
|
|
}).distinct().collect(Collectors.toList());
|
|
|
- staff.getRoles().addAll((Collection)roleIds.stream().map((roleId) -> {
|
|
|
+ staff.getRoles().addAll((Collection) roleIds.stream().map((roleId) -> {
|
|
|
CommonRole role = new CommonRole();
|
|
|
role.setRoleId(roleId);
|
|
|
role.setMajor("0");
|
|
@@ -946,7 +947,7 @@ public class CommonUserServiceImpl extends ServiceImpl<CommonUserMapper, CommonU
|
|
|
|
|
|
private void bindRoles(String staffId, List<CommonRole> roles) {
|
|
|
if (null != roles) {
|
|
|
- List<CommonStaffRole> staffRoles = (List)roles.stream().map((role) -> {
|
|
|
+ List<CommonStaffRole> staffRoles = (List) roles.stream().map((role) -> {
|
|
|
CommonStaffRole staffRole = new CommonStaffRole();
|
|
|
staffRole.setRoleId(role.getRoleId());
|
|
|
if (!org.apache.commons.lang3.StringUtils.isEmpty(role.getMajor())) {
|
|
@@ -964,7 +965,7 @@ public class CommonUserServiceImpl extends ServiceImpl<CommonUserMapper, CommonU
|
|
|
|
|
|
private void bindVessels(String staffId, List<CommonVessel> vessels, String roleId, List<String> roleVessels) {
|
|
|
if (null != vessels) {
|
|
|
- List<String> vesselIds = (List)vessels.stream().map((vessel) -> {
|
|
|
+ List<String> vesselIds = (List) vessels.stream().map((vessel) -> {
|
|
|
return vessel.getVesselId();
|
|
|
}).collect(Collectors.toList());
|
|
|
Set<String> vesselIdSet = new HashSet();
|