localizer
parent
4488a83cbd
commit
54acb0aa15
|
|
@ -185,7 +185,7 @@ public class BizCompanyService extends ServiceImpl<BizCompanyMapper, BizCompanyE
|
|||
// .eq("a.station", Boolean.FALSE)
|
||||
.eq("a.deleted", 0)
|
||||
.eq(StrUtil.isNotBlank(aStatus), "a.audit_status", aStatus)
|
||||
.eq(station != null, "a.station", station == 1)
|
||||
.eq(station != null, "a.station", station)
|
||||
// .eq(StrUtil.isNotBlank(searchCompanyParam.getStation()), "a.station", searchCompanyParam.getStation())
|
||||
.in(CollUtil.isNotEmpty(bizObjList), "b.biz_obj", bizObjList)
|
||||
.like(StrUtil.isNotBlank(companyName), "a.company_name", companyName)
|
||||
|
|
|
|||
|
|
@ -21,4 +21,6 @@ public interface OrderInfoMapper extends BaseMapper<OrderInfoEntity> {
|
|||
OrderPagingResult pendingOrder(@Param("ew") QueryWrapper<Object> ew);
|
||||
|
||||
OrderPagingResult obtainWeighBill(@Param("orderId") Long orderId);
|
||||
|
||||
Long getDriverId(@Param("userId") Long userId);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -42,7 +42,6 @@ import org.springframework.transaction.annotation.Transactional;
|
|||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
|
|
@ -149,7 +148,7 @@ public class OrderInfoService extends ServiceImpl<OrderInfoMapper, OrderInfoEnti
|
|||
LocalDateTime startTime = orderPagingSearchParam.getStartTime();
|
||||
LocalDateTime endTime = orderPagingSearchParam.getEndTime();
|
||||
Page<OrderPagingResult> page = pageParam.toPage();
|
||||
page.addOrder(OrderItem.asc("a.create_time"));
|
||||
page.addOrder(OrderItem.desc("a.create_time"));
|
||||
QueryWrapper<OrderPagingResult> ew = Wrappers.<OrderPagingResult>query()
|
||||
.like(StrUtil.isNotBlank(sn), "a.sn", sn)
|
||||
.like(StrUtil.isNotBlank(licensePlate), "a.license_plate", licensePlate)
|
||||
|
|
@ -197,7 +196,7 @@ public class OrderInfoService extends ServiceImpl<OrderInfoMapper, OrderInfoEnti
|
|||
if (BizObj.isDriver(bizObjStr)) {
|
||||
ew
|
||||
.eq("a.order_status", OrderStatus.DaiJieDan)
|
||||
.eq("a.driver_id", userId);
|
||||
.eq("f.user_id", userId);
|
||||
return;
|
||||
}
|
||||
Set<String> roles = userDetail.getRoles();
|
||||
|
|
@ -255,8 +254,11 @@ public class OrderInfoService extends ServiceImpl<OrderInfoMapper, OrderInfoEnti
|
|||
}
|
||||
if (BizObj.isDriver(bizObjStr)) {
|
||||
ew
|
||||
.in("a.order_status", OrderStatus.QingYunZhong, OrderStatus.YiJinChang, OrderStatus.YiChuChang)
|
||||
.eq("a.driver_id", userId)
|
||||
.eq("f.user_id", userId)
|
||||
.and(it ->
|
||||
it.in("a.order_status", OrderStatus.QingYunZhong, OrderStatus.YiJinChang, OrderStatus.YiChuChang)
|
||||
.or(it_ -> it_.eq("a.order_status", OrderStatus.YiJieDan).eq("a.audit_status", AuditStatus.TongGuo))
|
||||
)
|
||||
;
|
||||
return;
|
||||
}
|
||||
|
|
@ -294,7 +296,7 @@ public class OrderInfoService extends ServiceImpl<OrderInfoMapper, OrderInfoEnti
|
|||
if (BizObj.isDriver(bizObjStr)) {
|
||||
ew
|
||||
.eq("a.order_status", OrderStatus.YiWanCheng)
|
||||
.eq("a.driver_id", userId)
|
||||
.eq("f.user_id", userId)
|
||||
;
|
||||
return;
|
||||
}
|
||||
|
|
@ -364,29 +366,55 @@ public class OrderInfoService extends ServiceImpl<OrderInfoMapper, OrderInfoEnti
|
|||
UserDetail userDetail = SecurityUtil.loginUser();
|
||||
Set<String> roles = userDetail.getRoles();
|
||||
Assert.isTrue(CollUtil.isNotEmpty(roles) && roles.contains(ROLE_JG), () -> Exceptions.clierr("非监管角色,不能查看"));
|
||||
List<String> areas = bizAuditConfigService.list(Wrappers.<BizAuditConfigEntity>query()
|
||||
.select("DISTINCT area")
|
||||
.in("area_role", roles)
|
||||
.or().in("city_role", roles)
|
||||
.or(it -> it.isNull("area_role")
|
||||
.isNull("city_role"))
|
||||
).stream().map(BizAuditConfigEntity::getArea).collect(Collectors.toList());
|
||||
|
||||
List<String> areaList = bizAuditConfigService.list(Wrappers.<BizAuditConfigEntity>lambdaQuery().in(BizAuditConfigEntity::getAreaRole, roles))
|
||||
.stream().map(BizAuditConfigEntity::getArea).distinct().collect(Collectors.toList());
|
||||
List<String> cityList = bizAuditConfigService.list(Wrappers.<BizAuditConfigEntity>lambdaQuery().in(BizAuditConfigEntity::getCityRole, roles))
|
||||
.stream().map(BizAuditConfigEntity::getArea).distinct().collect(Collectors.toList());
|
||||
List<String> cityAreaList = bizAuditConfigService.list(Wrappers.<BizAuditConfigEntity>lambdaQuery()
|
||||
.isNull(BizAuditConfigEntity::getAreaRole).isNull(BizAuditConfigEntity::getCityRole))
|
||||
.stream().map(BizAuditConfigEntity::getArea).distinct().collect(Collectors.toList());
|
||||
|
||||
Page<OrderPagingResult> page = pageParam.toPage();
|
||||
page.addOrder(OrderItem.desc("a.create_time"));
|
||||
if (CollUtil.isEmpty(areas)) {
|
||||
return PageResult.of(page);
|
||||
}
|
||||
QueryWrapper<OrderPagingResult> ew = Wrappers.<OrderPagingResult>query()
|
||||
.in("b.area", areas);
|
||||
QueryWrapper<OrderPagingResult> ew = Wrappers.<OrderPagingResult>query();
|
||||
AuditStatus auditStatus = orderPagingSearchParam.getAuditStatus();
|
||||
|
||||
if (auditStatus != null) {
|
||||
if (auditStatus == AuditStatus.DaiShenHe) {
|
||||
ew.eq("a.order_status", OrderStatus.YiJieDan)
|
||||
.in("a.audit_status", Arrays.asList(AuditStatus.QuDaiShenHe.getVal(), AuditStatus.ShiDaiShenHe.getVal()));
|
||||
} else {
|
||||
ew.in("a.audit_status", Collections.singletonList(auditStatus.getVal()));
|
||||
ew
|
||||
.eq("a.order_status", OrderStatus.YiJieDan)
|
||||
.and(it ->
|
||||
it.in(CollUtil.isNotEmpty(areaList), "b.area", areaList).eq("a.audit_status", AuditStatus.QuDaiShenHe)
|
||||
.or(CollUtil.isNotEmpty(cityList), it1 -> it1.in("b.area", cityList).eq("a.audit_status", AuditStatus.ShiDaiShenHe))
|
||||
.or(CollUtil.isNotEmpty(cityAreaList), it2 -> it2.in("b.area", cityAreaList).eq("a.audit_status", AuditStatus.DaiShenHe))
|
||||
)
|
||||
;
|
||||
} else if (auditStatus == AuditStatus.TongGuo) {
|
||||
ew
|
||||
.in("a.order_status", OrderStatus.YiJieDan, OrderStatus.QingYunZhong, OrderStatus.YiJinChang, OrderStatus.YiChuChang, OrderStatus.YiWanCheng)
|
||||
.and(it ->
|
||||
it.in(CollUtil.isNotEmpty(areaList), "b.area", areaList).eq("a.audit_status", AuditStatus.ShiDaiShenHe)
|
||||
.or(CollUtil.isNotEmpty(cityList), it1 -> it1.in("b.area", cityList).eq("a.audit_status", AuditStatus.TongGuo))
|
||||
.or(CollUtil.isNotEmpty(cityAreaList), it2 -> it2.in("b.area", cityAreaList).eq("a.audit_status", AuditStatus.TongGuo))
|
||||
);
|
||||
} else if (auditStatus == AuditStatus.BoHui) {
|
||||
ew
|
||||
.in("a.order_status", OrderStatus.YiJieDan, OrderStatus.QingYunZhong, OrderStatus.YiJinChang, OrderStatus.YiChuChang, OrderStatus.YiWanCheng)
|
||||
.and(it ->
|
||||
it.in(CollUtil.isNotEmpty(areaList), "b.area", areaList).eq("a.audit_status", AuditStatus.BoHui)
|
||||
.or(CollUtil.isNotEmpty(cityList), it1 -> it1.in("b.area", cityList).eq("a.audit_status", AuditStatus.BoHui))
|
||||
.or(CollUtil.isNotEmpty(cityAreaList), it2 -> it2.in("b.area", cityAreaList).eq("a.audit_status", AuditStatus.BoHui))
|
||||
);
|
||||
}
|
||||
} else {
|
||||
ew
|
||||
.in("a.order_status", OrderStatus.YiJieDan, OrderStatus.QingYunZhong, OrderStatus.YiJinChang, OrderStatus.YiChuChang, OrderStatus.YiWanCheng)
|
||||
.and(it ->
|
||||
it.in(CollUtil.isNotEmpty(areaList), "b.area", areaList)
|
||||
.or(CollUtil.isNotEmpty(cityList), it1 -> it1.in("b.area", cityList))
|
||||
.or(CollUtil.isNotEmpty(cityAreaList), it2 -> it2.in("b.area", cityAreaList)))
|
||||
;
|
||||
}
|
||||
|
||||
return PageResult.of(baseMapper.paging(page, ew));
|
||||
|
|
@ -457,6 +485,7 @@ public class OrderInfoService extends ServiceImpl<OrderInfoMapper, OrderInfoEnti
|
|||
CheckStatus checkStatus = oldOrder.getCheckStatus();
|
||||
Assert.isFalse(checkStatus == null, () -> Exceptions.clierr("当前订单无需看料"));
|
||||
Assert.isFalse(CheckStatus.YiKanLiao == checkStatus, () -> Exceptions.clierr("当前订单已看料"));
|
||||
Assert.isTrue(oldOrder.getOrderStatus() == OrderStatus.YiJinChang, () -> Exceptions.clierr("当前订单状态,无法看料"));
|
||||
|
||||
this.updateById(new OrderInfoEntity()
|
||||
.setId(orderId)
|
||||
|
|
@ -509,7 +538,8 @@ public class OrderInfoService extends ServiceImpl<OrderInfoMapper, OrderInfoEnti
|
|||
Assert.isTrue(orderInfo.getOrderStatus() == OrderStatus.DaiJieDan, () -> Exceptions.clierr("当前订单状态,无法确认接单"));
|
||||
long driverId = orderInfo.getDriverId();
|
||||
long userId = SecurityUtil.currentUserId();
|
||||
Assert.isTrue(driverId == userId, () -> Exceptions.clierr("您没有权限确认此单"));
|
||||
Long driverId_ = baseMapper.getDriverId(userId);
|
||||
Assert.isTrue(driverId_ != null && driverId == driverId_, () -> Exceptions.clierr("您没有权限确认此单"));
|
||||
this.updateById(new OrderInfoEntity()
|
||||
.setId(orderInfo.getId())
|
||||
.setTruckId(truckId)
|
||||
|
|
|
|||
|
|
@ -25,4 +25,7 @@ public interface StationManageMapper extends BaseMapper<StationManageEntity> {
|
|||
List<SearchStationManageResult> listManager(@Param("ew") QueryWrapper<Object> ew);
|
||||
|
||||
List<Long> myManage(@Param("ew") QueryWrapper<Object> ew);
|
||||
|
||||
List<SearchStationManageResult> adminStation();
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -97,11 +97,11 @@ public class StationManageService extends ServiceImpl<StationManageMapper, Stati
|
|||
UserDetail userDetail = SecurityUtil.loginUser();
|
||||
Set<String> roles = userDetail.getRoles();
|
||||
Assert.isTrue(SecurityUtil.isAdmin() || roles.contains(Constant.ROLE_STATION_MANAGE), () -> Exceptions.clierr("当前用户无权限查询站点"));
|
||||
Long userId = null;
|
||||
if (!SecurityUtil.isAdmin()) {
|
||||
userId = userDetail.getUserId();
|
||||
if (SecurityUtil.isAdmin()) {
|
||||
return baseMapper.adminStation();
|
||||
} else {
|
||||
return baseMapper.myStation(Wrappers.query().eq("a.user_id", userDetail.getUserId()));
|
||||
}
|
||||
return baseMapper.myStation(Wrappers.query().eq(userId != null, "a.user_id", userId));
|
||||
}
|
||||
|
||||
public ListManagerResult listManager(SearchStationManageParam searchStationManageParam) {
|
||||
|
|
|
|||
|
|
@ -40,29 +40,29 @@ public class TokenService implements ITokenService {
|
|||
public UserDetail loadUser(String tokenStr) {
|
||||
Token token = Token.create(tokenStr);
|
||||
long userId = token.getUserId();
|
||||
return TOKEN_CACHE.get(userId, () -> Fastjson.toBean(sysTokenMapper
|
||||
return Fastjson.toBean(sysTokenMapper
|
||||
.selectOne(Wrappers.<SysTokenEntity>lambdaQuery()
|
||||
.eq(SysTokenEntity::getUserId, userId))
|
||||
.getUserDetail(),
|
||||
UserDetail.class));
|
||||
UserDetail.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeToken(Token token) {
|
||||
long userId = token.getUserId();
|
||||
TOKEN_CACHE.remove(userId);
|
||||
// TOKEN_CACHE.remove(userId);
|
||||
sysTokenMapper.delete(Wrappers.<SysTokenEntity>lambdaQuery()
|
||||
.eq(SysTokenEntity::getUserId, userId)
|
||||
);
|
||||
TOKEN_CACHE.remove(userId);
|
||||
// TOKEN_CACHE.remove(userId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeToken(Long userId) {
|
||||
TOKEN_CACHE.remove(userId);
|
||||
// TOKEN_CACHE.remove(userId);
|
||||
sysTokenMapper.delete(Wrappers.<SysTokenEntity>lambdaQuery()
|
||||
.eq(SysTokenEntity::getUserId, userId)
|
||||
);
|
||||
TOKEN_CACHE.remove(userId);
|
||||
// TOKEN_CACHE.remove(userId);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ import cn.hutool.core.util.StrUtil;
|
|||
import com.njzscloud.common.mvc.validator.Constrained;
|
||||
import com.njzscloud.common.mvc.validator.ValidRule;
|
||||
import com.njzscloud.supervisory.biz.constant.BizObj;
|
||||
import com.njzscloud.supervisory.sys.role.pojo.entity.RoleEntity;
|
||||
import com.njzscloud.supervisory.sys.user.contant.Gender;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
|
@ -11,7 +12,7 @@ import lombok.ToString;
|
|||
import lombok.experimental.Accessors;
|
||||
|
||||
import javax.validation.Valid;
|
||||
import java.util.Set;
|
||||
import java.util.List;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
|
|
@ -44,7 +45,7 @@ public class AddUserParam implements Constrained {
|
|||
/**
|
||||
* 角色 Id 列表
|
||||
*/
|
||||
private Set<Long> roleIds;
|
||||
private List<RoleEntity> roles;
|
||||
|
||||
@Override
|
||||
public ValidRule[] rules() {
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
package com.njzscloud.supervisory.sys.user.service;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.lang.Assert;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
|
|
@ -65,7 +66,11 @@ public class UserService extends ServiceImpl<UserMapper, UserEntity> implements
|
|||
|
||||
userAccountService.add(addUserAccountParam.setUserId(userEntityId));
|
||||
|
||||
Set<Long> roleIds = addUserParam.getRoleIds();
|
||||
List<RoleEntity> roles = addUserParam.getRoles();
|
||||
if (CollUtil.isEmpty(roles)) {
|
||||
return userEntityId;
|
||||
}
|
||||
Set<Long> roleIds = roles.stream().map(RoleEntity::getId).collect(Collectors.toSet());
|
||||
userRoleService.bindUserRole(userEntityId, roleIds);
|
||||
|
||||
return userEntityId;
|
||||
|
|
|
|||
|
|
@ -18,6 +18,7 @@ spring:
|
|||
- /device_info/report2
|
||||
- /geo_fence_config/**
|
||||
- /statistics/**
|
||||
- /district/default_place
|
||||
|
||||
app:
|
||||
default-place:
|
||||
|
|
|
|||
|
|
@ -179,4 +179,9 @@
|
|||
<include refid="base_select"/>
|
||||
WHERE a.id = #{orderId}
|
||||
</select>
|
||||
<select id="getDriverId" resultType="java.lang.Long">
|
||||
SELECT IFNULL(id, 0) id
|
||||
FROM biz_driver
|
||||
WHERE user_id = #{userId}
|
||||
</select>
|
||||
</mapper>
|
||||
|
|
|
|||
|
|
@ -85,4 +85,34 @@
|
|||
${ew.customSqlSegment}
|
||||
</if>
|
||||
</select>
|
||||
<select id="adminStation"
|
||||
resultType="com.njzscloud.supervisory.station.pojo.result.SearchStationManageResult">
|
||||
SELECT c.nickname,
|
||||
c.phone user_phone,
|
||||
b.uscc,
|
||||
b.company_name,
|
||||
b.business_license,
|
||||
b.license_start_time,
|
||||
b.license_end_time,
|
||||
b.legal_representative,
|
||||
b.province,
|
||||
b.city,
|
||||
b.area,
|
||||
b.town,
|
||||
b.province_name,
|
||||
b.city_name,
|
||||
b.area_name,
|
||||
b.town_name,
|
||||
b.address,
|
||||
b.lng,
|
||||
b.lat,
|
||||
b.contacts,
|
||||
b.phone,
|
||||
b.id station_id,
|
||||
b.company_name station_name
|
||||
FROM biz_company b
|
||||
INNER JOIN sys_user c ON c.id = 1 AND c.deleted = 0
|
||||
WHERE b.station = 1
|
||||
AND b.deleted = 0
|
||||
</select>
|
||||
</mapper>
|
||||
|
|
|
|||
|
|
@ -4,9 +4,12 @@
|
|||
<mapper namespace="com.njzscloud.supervisory.sys.user.mapper.UserMapper">
|
||||
|
||||
<resultMap id="pagingResultMap" autoMapping="true" type="com.njzscloud.supervisory.sys.user.pojo.result.UserDetailResult">
|
||||
<id column="id" property="id"/>
|
||||
<result column="biz_obj" property="bizObj" typeHandler="com.njzscloud.common.mp.support.handler.e.EnumTypeHandlerDealer"/>
|
||||
<association property="account" autoMapping="true" javaType="com.njzscloud.supervisory.sys.user.pojo.result.UserAccountDetailResult">
|
||||
<id column="account_id" property="id"/>
|
||||
<result column="username" property="username"/>
|
||||
<result column="account_phone" property="phone"/>
|
||||
</association>
|
||||
</resultMap>
|
||||
|
||||
|
|
@ -21,7 +24,7 @@
|
|||
b.id account_id,
|
||||
b.username,
|
||||
b.email,
|
||||
b.phone,
|
||||
b.phone as account_phone,
|
||||
b.secret,
|
||||
b.wechat_openid,
|
||||
b.wechat_unionid,
|
||||
|
|
|
|||
Loading…
Reference in New Issue