仓库用户相关问题修改

master
anthonywj 2 years ago
parent 86b7e95a1d
commit 2bffc13f85

@ -87,23 +87,18 @@ public class AuthUserController extends BaseController {
@AuthRuleAnnotation("") @AuthRuleAnnotation("")
@GetMapping("/admin/auth/admin/selectNotSelectUser") @GetMapping("/admin/auth/admin/selectNotSelectUser")
public BaseResponse selectNotSelectUser(FilterInvLinkDataRequest filterInvLinkDataRequest) { public BaseResponse selectNotSelectUser(FilterInvLinkDataRequest filterInvLinkDataRequest) {
filterInvLinkDataRequest.setKey("1");
List<WarehouseUserEntity> warehouseUserEntities = warehouseUserService.getWarehouseUserList(filterInvLinkDataRequest);
List<Long> list = new ArrayList<>(); //获取当前仓库已关联用户
if (filterInvLinkDataRequest.getListUser() != null && filterInvLinkDataRequest.getListUser().length > 0) FilterInvLinkDataRequest temRequest = new FilterInvLinkDataRequest();
for (Long aLong : filterInvLinkDataRequest.getListUser()) { temRequest.setCode(filterInvLinkDataRequest.getCode());
list.add(aLong); List<WarehouseUserEntity> warehouseUserEntities = warehouseUserService.getWarehouseUserList(temRequest);
}
List<WarehouseUserEntity> warehouseUserEntities1 = warehouseUserService.selectNotSelectUserid(list);
List<Long> userIds = new ArrayList<>(); List<Long> userIds = new ArrayList<>();
for (WarehouseUserEntity warehouseUserEntity : warehouseUserEntities1) { for (WarehouseUserEntity warehouseUserEntity : warehouseUserEntities) {
userIds.add(warehouseUserEntity.getUserid()); userIds.add(warehouseUserEntity.getUserid());
} }
// List<Long> userIds = new ArrayList<>(); //过滤当前已关联用户
// warehouseUserEntities.forEach(user -> {
// userIds.add(user.getUserid());
// });
FilterNoSelectUserRequest filterNoSelectUserRequest = new FilterNoSelectUserRequest(); FilterNoSelectUserRequest filterNoSelectUserRequest = new FilterNoSelectUserRequest();
BeanUtils.copyProperties(filterInvLinkDataRequest, filterNoSelectUserRequest); BeanUtils.copyProperties(filterInvLinkDataRequest, filterNoSelectUserRequest);
filterNoSelectUserRequest.setUserIds(userIds); filterNoSelectUserRequest.setUserIds(userIds);

@ -73,7 +73,7 @@ public class InvWarehouseController extends BaseController {
// PageInfo<InvSubWarehouseResponse> pageInfo = new PageInfo<>(responses); // PageInfo<InvSubWarehouseResponse> pageInfo = new PageInfo<>(responses);
// PageSimpleResponse<InvSubWarehouseResponse> pageSimpleResponse = new PageSimpleResponse<>(); // PageSimpleResponse<InvSubWarehouseResponse> pageSimpleResponse = new PageSimpleResponse<>();
// pageSimpleResponse.setTotal(pageInfo.getTotal()); // pageSimpleResponse.setTotal(pageInfo.getTotal());
// pageSimpleResponse.setList(responses); // pageSimpleResponse.setList(responses);
return ResultVOUtils.success(responses); return ResultVOUtils.success(responses);
} }
@ -218,7 +218,7 @@ public class InvWarehouseController extends BaseController {
boolean checkResult = invWarehouseService.checkDuplicateName(invWarehouseEntity.getParentId(), invWarehouseEntity.getName()); boolean checkResult = invWarehouseService.checkDuplicateName(invWarehouseEntity.getParentId(), invWarehouseEntity.getName());
if (checkResult) { if (checkResult) {
return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL, "库名称重复!"); return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL, "库名称重复!");
} }
FilterInvSubWarehouseRequest filterInvWarehouseRequest = new FilterInvSubWarehouseRequest(); FilterInvSubWarehouseRequest filterInvWarehouseRequest = new FilterInvSubWarehouseRequest();
@ -248,7 +248,7 @@ public class InvWarehouseController extends BaseController {
@AuthRuleAnnotation("") @AuthRuleAnnotation("")
@PostMapping("/spms/sub/inv/warehouse/edit") @PostMapping("/spms/sub/inv/warehouse/edit")
public BaseResponse edit(@RequestBody @Valid InvWarehouseEntity invWarehouseEntity, public BaseResponse edit(@RequestBody @Valid InvWarehouseEntity invWarehouseEntity,
BindingResult bindingResult,FilterInvSubWarehouseRequest filterInvSubWarehouseRequest) { BindingResult bindingResult, FilterInvSubWarehouseRequest filterInvSubWarehouseRequest) {
if (bindingResult.hasErrors()) { if (bindingResult.hasErrors()) {
return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL, bindingResult.getFieldError().getDefaultMessage()); return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL, bindingResult.getFieldError().getDefaultMessage());
@ -256,31 +256,17 @@ public class InvWarehouseController extends BaseController {
if (invWarehouseEntity.getId() == null) { if (invWarehouseEntity.getId() == null) {
return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL); return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL);
} }
//判断仓库是否存在 boolean b = invWarehouseService.updateInvSubWarehouse(invWarehouseEntity);
ArrayList<InvWarehouseEntity> list = new ArrayList<>();
filterInvSubWarehouseRequest.setParentId(invWarehouseEntity.getParentId());
List<InvWarehouseEntity> invWarehouseEntities = invWarehouseService.filterInvSubWarehouse(filterInvSubWarehouseRequest);
for (InvWarehouseEntity warehouseEntity : invWarehouseEntities) {
if(invWarehouseEntity.name.equals(warehouseEntity.getName()) && invWarehouseEntity.getParentCode().equals(warehouseEntity.getParentCode())){
list.add(warehouseEntity);
}
}
if(list.size()==0){
boolean b = invWarehouseService.updateInvSubWarehouse(invWarehouseEntity);
DeptEntity pEntity = deptService.selectByCode(invWarehouseEntity.getParentId());
pEntity.setUpdateTime(new Date());
deptService.updateInvWarehouse(pEntity);
if (!b) { DeptEntity pEntity = deptService.selectByCode(invWarehouseEntity.getParentId());
return ResultVOUtils.error(ResultEnum.NOT_NETWORK); pEntity.setUpdateTime(new Date());
} deptService.updateInvWarehouse(pEntity);
return ResultVOUtils.success("修改成功!"); if (!b) {
}else{ return ResultVOUtils.error(ResultEnum.NOT_NETWORK);
return ResultVOUtils.error(ResultEnum.DATA_REPEAT);
} }
return ResultVOUtils.success("修改成功!");
} }
@ -401,12 +387,12 @@ public class InvWarehouseController extends BaseController {
filterInvLinkDataRequest.setUserName(null); filterInvLinkDataRequest.setUserName(null);
filterInvLinkDataRequest.setEmployeeName(filterInvLinkDataRequest.getKey()); filterInvLinkDataRequest.setEmployeeName(filterInvLinkDataRequest.getKey());
List<WarehouseUserEntity> warehouseUserList1 = warehouseUserService.getWarehouseUserList(filterInvLinkDataRequest); List<WarehouseUserEntity> warehouseUserList1 = warehouseUserService.getWarehouseUserList(filterInvLinkDataRequest);
PageInfo<WarehouseUserEntity> pageInfo=null; PageInfo<WarehouseUserEntity> pageInfo = null;
if(warehouseUserList.size()!=0){ if (warehouseUserList.size() != 0) {
pageInfo= new PageInfo<>(warehouseUserList); pageInfo = new PageInfo<>(warehouseUserList);
}else if(warehouseUserList1.size()!=0){ } else if (warehouseUserList1.size() != 0) {
pageInfo = new PageInfo<>(warehouseUserList1); pageInfo = new PageInfo<>(warehouseUserList1);
}else{ } else {
pageInfo = new PageInfo<>(warehouseUserList); pageInfo = new PageInfo<>(warehouseUserList);
} }

@ -122,13 +122,7 @@ public class WarehouseUserServiceImpl implements WarehouseUserService {
} }
if (filterInvLinkDataRequest.getPage() != null) { if (filterInvLinkDataRequest.getPage() != null) {
int offset = (filterInvLinkDataRequest.getPage() - 1) * filterInvLinkDataRequest.getLimit(); int offset = (filterInvLinkDataRequest.getPage() - 1) * filterInvLinkDataRequest.getLimit();
if("1".equals(filterInvLinkDataRequest.getKey())){ PageHelper.offsetPage(offset, filterInvLinkDataRequest.getLimit());
PageHelper.startPage (offset, filterInvLinkDataRequest.getLimit());
}else{
PageHelper.offsetPage (offset, filterInvLinkDataRequest.getLimit());
}
} }
return warehouseUserDao.selectListkey(filterInvLinkDataRequest); return warehouseUserDao.selectListkey(filterInvLinkDataRequest);
} }

@ -4,9 +4,9 @@ server:
spring: spring:
datasource: datasource:
driver-class-name: com.p6spy.engine.spy.P6SpyDriver driver-class-name: com.p6spy.engine.spy.P6SpyDriver
jdbc-url: jdbc:p6spy:mysql://192.168.0.66:3364/udi_wms?allowMultiQueries=true&serverTimezone=Asia/Shanghai&useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&allowPublicKeyRetrieval=true jdbc-url: jdbc:p6spy:mysql://127.0.0.1:3306/udi_wms?allowMultiQueries=true&serverTimezone=Asia/Shanghai&useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&allowPublicKeyRetrieval=true
username: root username: root
password: Glxp@6066 password: 123456
hikari: hikari:
connection-timeout: 60000 connection-timeout: 60000
maximum-pool-size: 60 maximum-pool-size: 60

@ -2,11 +2,11 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" > <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.glxp.api.dao.auth.AuthAdminDao"> <mapper namespace="com.glxp.api.dao.auth.AuthAdminDao">
<select id="listAdminPage" parameterType="com.glxp.api.req.auth.FilterAuthUserRequest" <select id="listAdminPage" parameterType="com.glxp.api.req.auth.FilterAuthUserRequest"
resultType="com.glxp.api.entity.auth.AuthAdmin"> resultType="com.glxp.api.entity.auth.AuthAdmin">
SELECT auth_user.*,auth_dept.name deptName SELECT auth_user.*, auth_dept.name deptName
FROM auth_user left join auth_dept on auth_user.locDeptCode = auth_dept.code FROM auth_user
left join auth_dept on auth_user.locDeptCode = auth_dept.code
<where> <where>
<if test="ids != null and ids.size > 0"> <if test="ids != null and ids.size > 0">
AND id IN AND id IN
@ -18,20 +18,24 @@
AND userFlag = #{userFlag} AND userFlag = #{userFlag}
</if> </if>
<if test="userName != null and '' != userName"> <if test="userName != null and '' != userName">
AND userName LIKE CONCAT(#{userName},'%') AND userName LIKE CONCAT(#{userName}, '%')
</if> </if>
<if test="neUserName != null and '' != neUserName"> <if test="neUserName != null and '' != neUserName">
AND userName != #{neUserName} AND userName != #{neUserName}
</if> </if>
<if test="lastUpdateTime!=null and lastUpdateTime!=''"> <if test="lastUpdateTime != null and lastUpdateTime != ''">
<![CDATA[ and DATE_FORMAT(lastModifyTime, '%Y-%m-%d %H:%i:%S')>= DATE_FORMAT(#{lastUpdateTime}, '%Y-%m-%d %H:%i:%S') ]]> <![CDATA[
and DATE_FORMAT(lastModifyTime
, '%Y-%m-%d %H:%i:%S')>= DATE_FORMAT(#{lastUpdateTime}
, '%Y-%m-%d %H:%i:%S')
]]>
</if> </if>
<if test="deptCode != null and deptCode != ''"> <if test="deptCode != null and deptCode != ''">
AND auth_user.locDeptCode = #{deptCode} AND auth_user.locDeptCode = #{deptCode}
</if> </if>
</where> </where>
ORDER BY id ORDER BY id
DESC DESC
</select> </select>
<select id="findByUserName" parameterType="hashmap" resultType="com.glxp.api.entity.auth.AuthAdmin"> <select id="findByUserName" parameterType="hashmap" resultType="com.glxp.api.entity.auth.AuthAdmin">
@ -157,7 +161,7 @@
comments=#{comments}, comments=#{comments},
</if> </if>
</set> </set>
WHERE id=#{id} WHERE id = #{id}
</update> </update>
<delete id="deleteById" parameterType="java.lang.Long"> <delete id="deleteById" parameterType="java.lang.Long">
@ -175,17 +179,18 @@
<select id="selectNotSelectUser" resultType="com.glxp.api.entity.auth.AuthAdmin"> <select id="selectNotSelectUser" resultType="com.glxp.api.entity.auth.AuthAdmin">
select * select *
from auth_user from auth_user
<where> <where>
userFlag != 0 userFlag != 0
<if test="userIds != null and userIds.size()!=0">
<if test="userIds != null and userIds.size() != 0">
and id not in and id not in
<foreach collection="userIds" item="item" open="(" separator="," close=")"> <foreach collection="userIds" item="item" open="(" separator="," close=")">
#{item} #{item}
</foreach> </foreach>
</if> </if>
</where> </where>
</select> </select>
@ -197,10 +202,9 @@
left join auth_role r on r.role_id = sur.role_id left join auth_role r on r.role_id = sur.role_id
<where> <where>
<if test="roleId != null and '' != roleId"> <if test="roleId != null and '' != roleId">
AND r.role_id =#{roleId} AND r.role_id = #{roleId}
</if> </if>
</where> </where>
</select> </select>
@ -225,6 +229,5 @@
AND u.user_name LIKE concat('%', #{userName}, '%') AND u.user_name LIKE concat('%', #{userName}, '%')
</if> </if>
</where> </where>
</select> </select>
</mapper> </mapper>

@ -128,7 +128,8 @@
parameterType="com.glxp.api.entity.auth.InvWarehouseEntity"> parameterType="com.glxp.api.entity.auth.InvWarehouseEntity">
replace replace
INTO auth_warehouse INTO auth_warehouse
(id, code, `name`, parentId, remark,defaultInv,parentCode) (id, code, `name`, parentId, remark,defaultInv,parentCode
,thirdId,thirdId1,thirdId2,thirdId3,thirdId4)
values ( values (
#{id}, #{id},
#{code}, #{code},
@ -136,7 +137,12 @@
#{parentId}, #{parentId},
#{remark}, #{remark},
#{defaultInv}, #{defaultInv},
#{parentCode} #{parentCode},
#{thirdId},
#{thirdId1},
#{thirdId2},
#{thirdId3},
#{thirdId4}
) )
</insert> </insert>
@ -175,6 +181,21 @@
<if test="parentCode != null"> <if test="parentCode != null">
parentCode=#{parentCode}, parentCode=#{parentCode},
</if> </if>
<if test="thirdId != null">
thirdId=#{thirdId},
</if>
<if test="thirdId1 != null">
thirdId1=#{thirdId1},
</if>
<if test="thirdId2 != null">
thirdId2=#{thirdId2},
</if>
<if test="thirdId3 != null">
thirdId3=#{thirdId3},
</if>
<if test="thirdId4 != null">
thirdId4=#{thirdId4},
</if>
</trim> </trim>
WHERE id = #{id} WHERE id = #{id}
</update> </update>
@ -182,9 +203,12 @@
<insert id="importInvSubWarehouse" parameterType="java.util.List"> <insert id="importInvSubWarehouse" parameterType="java.util.List">
replace replace
into auth_warehouse into auth_warehouse
(id, code, `name`, parentId, remark,defaultInv,parentCode) (id, code, `name`, parentId, remark,defaultInv,parentCode,thirdId,thirdId1,thirdId2,thirdId3,thirdId4)
values values
<foreach collection="invWarehouseEntities" item="item" index="index" separator=","> <foreach collection="invWarehouseEntities" item="item" index="index" separator=",">
( (
#{item.id}, #{item.id},
@ -193,7 +217,12 @@
#{item.parentId}, #{item.parentId},
#{item.remark}, #{item.remark},
#{item.defaultInv}, #{item.defaultInv},
#{item.parentCode} #{item.parentCode},
#{item.thirdId},
#{item.thirdId1},
#{item.thirdId2},
#{item.thirdId3},
#{item.thirdId4}
) )
</foreach> </foreach>
</insert> </insert>

Loading…
Cancel
Save