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

@ -3,6 +3,8 @@ package com.glxp.api.admin.req.inventory;
import com.glxp.api.admin.req.ListPageRequest; import com.glxp.api.admin.req.ListPageRequest;
import lombok.Data; import lombok.Data;
import java.util.List;
@Data @Data
public class FilterInvBusUserRequest extends ListPageRequest { public class FilterInvBusUserRequest extends ListPageRequest {
@ -10,4 +12,5 @@ public class FilterInvBusUserRequest extends ListPageRequest {
private String userId; private String userId;
private String subInvCode; private String subInvCode;
private String scAction; 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 com.glxp.api.admin.req.ListPageRequest;
import lombok.Data; import lombok.Data;
import java.util.List;
@Data @Data
public class FilterInvUserRequest extends ListPageRequest { public class FilterInvUserRequest extends ListPageRequest {
@ -16,4 +18,6 @@ public class FilterInvUserRequest extends ListPageRequest {
private Boolean isDirector; private Boolean isDirector;
private String lastUpdateTime; private String lastUpdateTime;
private List<Long> userList;
} }

@ -269,6 +269,12 @@
<if test="lastUpdateTime!=null and lastUpdateTime!=''"> <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') ]]> <![CDATA[ and DATE_FORMAT(updateTime, '%Y-%m-%d %H:%i:%S')>= DATE_FORMAT(#{lastUpdateTime}, '%Y-%m-%d %H:%i:%S') ]]>
</if> </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> </where>
</select> </select>

@ -36,7 +36,12 @@
<if test="scAction != '' and scAction != null"> <if test="scAction != '' and scAction != null">
AND scAction = #{scAction} AND scAction = #{scAction}
</if> </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> </where>
group by inv_bustype_user.id group by inv_bustype_user.id

Loading…
Cancel
Save