|
@@ -8,6 +8,7 @@ import com.google.common.collect.Lists;
|
|
|
import com.yh.saas.plugin.yiliangyiyun.constant.StatusEnum;
|
|
|
import com.yh.saas.plugin.yiliangyiyun.service.ICargoOwnerInfoService;
|
|
|
import com.yh.saas.plugin.yiliangyiyun.service.IDriverInfoService;
|
|
|
+import com.yh.saas.plugin.yiliangyiyun.service.IFleetMemberInfoService;
|
|
|
import org.apache.commons.collections.CollectionUtils;
|
|
|
import com.winsea.svc.base.base.entity.*;
|
|
|
import com.winsea.svc.base.base.exception.EnterpriseErrorCodeEnums;
|
|
@@ -46,6 +47,7 @@ import org.springframework.transaction.annotation.Transactional;
|
|
|
import org.springframework.util.StringUtils;
|
|
|
|
|
|
import com.baomidou.mybatisplus.mapper.Wrapper;
|
|
|
+import org.springframework.web.bind.annotation.RequestBody;
|
|
|
|
|
|
import java.text.SimpleDateFormat;
|
|
|
import java.util.*;
|
|
@@ -112,6 +114,8 @@ public class CommonUserServiceImpl extends ServiceImpl<CommonUserMapper, CommonU
|
|
|
private CommonStaffMapper staffMapper;
|
|
|
@Autowired
|
|
|
private IDriverInfoService driverInfoService;
|
|
|
+ @Autowired
|
|
|
+ private IFleetMemberInfoService fleetMemberInfoService;
|
|
|
|
|
|
|
|
|
//用来过滤权限的时候使用,当过滤的code已在其中的时候就不进行过滤;
|
|
@@ -379,6 +383,36 @@ public class CommonUserServiceImpl extends ServiceImpl<CommonUserMapper, CommonU
|
|
|
return "ok";
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 修改头像
|
|
|
+ *
|
|
|
+ * @throws ServiceException
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
+ public String editPortrait(CommonUser commonUser) throws ServiceException {
|
|
|
+ //查询用户信息
|
|
|
+ CommonUser commonUser1 = this.selectById(commonUser.getId());
|
|
|
+ //货主
|
|
|
+ if ("1".equals(commonUser1.getIdentityFlag())) {
|
|
|
+ commonUser1.setAvatarUrl(commonUser.getAvatarUrl());
|
|
|
+ }
|
|
|
+ //司机
|
|
|
+ else {
|
|
|
+ commonUser1.setAvatarUrl(commonUser.getAvatarUrl());
|
|
|
+ //查询司机是否是车队成员
|
|
|
+ List<FleetMemberInfo> fleetMemberInfoList = fleetMemberInfoService.selectList(new EntityWrapper<FleetMemberInfo>()
|
|
|
+ .eq("common_id", commonUser1.getId()).eq("delete_flag", "0"));
|
|
|
+ if (CollectionUtils.isNotEmpty(fleetMemberInfoList)) {
|
|
|
+ for (FleetMemberInfo fleetMemberInfo1 : fleetMemberInfoList) {
|
|
|
+ fleetMemberInfo1.setDriverPortrait(commonUser.getAvatarUrl());
|
|
|
+ fleetMemberInfoService.updateById(fleetMemberInfo1);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ this.updateById(commonUser1);
|
|
|
+ return "ok";
|
|
|
+ }
|
|
|
|
|
|
/**
|
|
|
* 修改用户信息
|
|
@@ -417,7 +451,7 @@ public class CommonUserServiceImpl extends ServiceImpl<CommonUserMapper, CommonU
|
|
|
* @throws ServiceException
|
|
|
*/
|
|
|
@Override
|
|
|
- public String sendVerifyCode(String phone, String identification,String flag) throws ServiceException {
|
|
|
+ public String sendVerifyCode(String phone, String identification, String flag) throws ServiceException {
|
|
|
if (StringUtils.isEmpty(phone)) {
|
|
|
throw new AppServiceException(ExceptionDefinition.USER_PHONE_HAS_ENTRY);
|
|
|
}
|
|
@@ -431,16 +465,16 @@ public class CommonUserServiceImpl extends ServiceImpl<CommonUserMapper, CommonU
|
|
|
}
|
|
|
}
|
|
|
//重置密码
|
|
|
- if("2".equals(flag)){
|
|
|
+ if ("2".equals(flag)) {
|
|
|
//校验用户是否存在
|
|
|
List<CommonUser> targetUserList = this.selectList(new EntityWrapper<CommonUser>()
|
|
|
- .eq("phone", phone).eq("identification", identification));
|
|
|
+ .eq("phone", phone).eq("identification", identification));
|
|
|
if (CollectionUtils.isEmpty(targetUserList)) {
|
|
|
throw new AppServiceException(ExceptionDefinition.USER_PHONE_NOT_EXIST);
|
|
|
}
|
|
|
}
|
|
|
//注册
|
|
|
- if("3".equals(flag)){
|
|
|
+ if ("3".equals(flag)) {
|
|
|
//2.校验用户是否存在
|
|
|
Integer count = this.selectCount(new EntityWrapper<CommonUser>()
|
|
|
.eq("phone", phone).eq("identification", identification));
|