修复仓库绑定用户bug

zhairh
郑明梁 2 years ago
parent d0f8db5dcb
commit 0a28d48bea

@ -30,6 +30,7 @@ import com.glxp.api.admin.req.basic.CompanyProductRelevanceRequest;
import com.glxp.api.admin.req.inout.*;
import com.glxp.api.admin.req.inventory.FilterInvBusUserRequest;
import com.glxp.api.admin.req.inventory.FilterInvLinkDataRequest;
import com.glxp.api.admin.req.inventory.FilterInvUserRequest;
import com.glxp.api.admin.res.PageSimpleResponse;
import com.glxp.api.admin.res.basic.BussinessTypResponse;
import com.glxp.api.admin.res.basic.UdiRelevanceResponse;
@ -1280,28 +1281,25 @@ public class WareHouseController {
if (StrUtil.isBlank(code) || StrUtil.isBlank(userListJson))
return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL);
List<AuthAdmin> userList = JSONUtil.toList(userListJson, AuthAdmin.class);
//取出选中的userId
List<Long> list = userList .stream().map(AuthAdmin::getId).distinct().collect(Collectors.toList());
//查询该仓库下面绑定的用户
FilterInvUserRequest filterInvUserRequest=new FilterInvUserRequest();
filterInvUserRequest.setCode(code);
filterInvUserRequest.setUserList(list);
List<WarehouseUserEntity> filterList=warehouseUserService.filterWarehouseUsers(filterInvUserRequest);
list = filterList .stream().map(WarehouseUserEntity::getUserid).distinct().collect(Collectors.toList());
if(list.size()>0){
//获取用户关联单据类型信息
FilterInvBusUserRequest filterInvBusUserRequest = new FilterInvBusUserRequest();
filterInvBusUserRequest.setSubInvCode(code);
filterInvBusUserRequest.setUserList(list);
List<InvBusUserResponse> invBusUserEntities = invBusUserService.filterJoinInvBusUser(filterInvBusUserRequest);
Map<String, InvBusUserResponse> filteBusTypes = new HashMap<>();
for (InvBusUserResponse invBusUserEntity : invBusUserEntities) {
boolean isExit = false;
for (AuthAdmin authAdmin : userList) {
if (authAdmin.getId() == Long.parseLong(invBusUserEntity.getUserId())) {
isExit = true;
continue;
}
}
if (isExit) {
filteBusTypes.put(invBusUserEntity.getUserId(), invBusUserEntity);
}
}
if (filteBusTypes.size() > 0) {
if (invBusUserEntities.size() > 0) {
return ResultVOUtils.error(500, "请先移除用户已关联单据类型!");
}
}
warehouseUserService.saveWarehouseUser(code, userList);
InvSubWarehouseEntity invSubWarehouseEntity =

@ -3,6 +3,8 @@ package com.glxp.api.admin.req.inventory;
import com.glxp.api.admin.req.ListPageRequest;
import lombok.Data;
import java.util.List;
@Data
public class FilterInvBusUserRequest extends ListPageRequest {
@ -10,4 +12,5 @@ public class FilterInvBusUserRequest extends ListPageRequest {
private String userId;
private String subInvCode;
private String scAction;
private List<Long> userList;
}

@ -3,6 +3,8 @@ package com.glxp.api.admin.req.inventory;
import com.glxp.api.admin.req.ListPageRequest;
import lombok.Data;
import java.util.List;
@Data
public class FilterInvUserRequest extends ListPageRequest {
@ -16,4 +18,6 @@ public class FilterInvUserRequest extends ListPageRequest {
private Boolean isDirector;
private String lastUpdateTime;
private List<Long> userList;
}

@ -269,6 +269,12 @@
<if test="lastUpdateTime!=null and lastUpdateTime!=''">
<![CDATA[ and DATE_FORMAT(updateTime, '%Y-%m-%d %H:%i:%S')>= DATE_FORMAT(#{lastUpdateTime}, '%Y-%m-%d %H:%i:%S') ]]>
</if>
<if test="userList != null and userList.size()>0">
AND userId not in
<foreach collection="userList" index="index" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</if>
</where>
</select>

@ -36,7 +36,12 @@
<if test="scAction != '' and scAction != null">
AND scAction = #{scAction}
</if>
<if test="userList != null and userList.size()>0">
AND userId in
<foreach collection="userList" index="index" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</if>
</where>
group by inv_bustype_user.id

Loading…
Cancel
Save