1.仓库字典关联用户和单据类型

master
MrZhai 3 years ago
parent f921753024
commit 8f9daa0774

@ -5,7 +5,6 @@ import com.glxp.sale.admin.annotation.AuthRuleAnnotation;
import com.glxp.sale.admin.entity.auth.AuthAdmin;
import com.glxp.sale.admin.entity.auth.AuthRole;
import com.glxp.sale.admin.entity.auth.AuthRoleAdmin;
import com.glxp.sale.admin.entity.auth.CustomerInfoEntity;
import com.glxp.sale.admin.exception.JsonException;
import com.glxp.sale.admin.req.auth.AuthAdminQueryRequest;
import com.glxp.sale.admin.req.auth.AuthAdminSaveRequest;
@ -15,7 +14,6 @@ import com.glxp.sale.admin.res.auth.AuthAdminRoleResponse;
import com.glxp.sale.admin.service.auth.AuthAdminService;
import com.glxp.sale.admin.service.auth.AuthRoleAdminService;
import com.glxp.sale.admin.service.auth.AuthRoleService;
import com.glxp.sale.admin.service.auth.CustomerInfoService;
import com.glxp.sale.admin.util.PasswordUtils;
import com.glxp.sale.common.enums.ResultEnum;
import com.glxp.sale.common.res.BaseResponse;
@ -335,4 +333,14 @@ public class AuthAdminController {
AuthAdmin authAdmin = authAdminService.findById(Long.parseLong(userId));
return authAdmin;
}
/**
*
* @return
*/
@AuthRuleAnnotation("")
@GetMapping("/admin/auth/admin/hospitalUserList")
public BaseResponse getHospitalUserList() {
return ResultVOUtils.success(authAdminService.getHospitalUserList());
}
}

@ -1,5 +1,7 @@
package com.glxp.sale.admin.controller.inout;
import cn.hutool.core.util.StrUtil;
import cn.hutool.json.JSONUtil;
import com.github.pagehelper.PageInfo;
import com.glxp.sale.admin.annotation.AuthRuleAnnotation;
import com.glxp.sale.admin.constant.ConstantStatus;
@ -12,11 +14,11 @@ import com.glxp.sale.admin.entity.info.CompanyEntity;
import com.glxp.sale.admin.entity.inout.ErpOrderEntity;
import com.glxp.sale.admin.entity.inout.OrderEntity;
import com.glxp.sale.admin.entity.inout.WarehouseEntity;
import com.glxp.sale.admin.entity.inout.WarehouseUserEntity;
import com.glxp.sale.admin.entity.udid.UdiEntity;
import com.glxp.sale.admin.exception.JsonException;
import com.glxp.sale.admin.req.inout.*;
import com.glxp.sale.admin.res.PageSimpleResponse;
import com.glxp.sale.admin.res.basic.BussinessTypResponse;
import com.glxp.sale.admin.res.inout.WarehouseResponse;
import com.glxp.sale.admin.service.auth.AuthAdminService;
import com.glxp.sale.admin.service.auth.CustomerService;
@ -42,6 +44,7 @@ import javax.servlet.http.HttpServletRequest;
import javax.validation.Valid;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Random;
import java.util.stream.Collectors;
@ -476,12 +479,50 @@ public class WareHouseController {
* @return
*/
@AuthRuleAnnotation("")
@GetMapping("/admin/warehouse/inout/warehouseUserList")
private BaseResponse getWarehouseUserList(String code) {
if (StringUtils.isBlank(code)) {
@GetMapping("/warehouse/inout/warehouseUserList")
public BaseResponse getWarehouseUserList(String code) {
if (StringUtils.isBlank(code))
return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL);
}
List<WarehouseUserEntity> warehouseUserEntities = warehouseUserService.getWarehouseUserList(code);
return ResultVOUtils.success(warehouseUserService.getListByCode(code));
}
@AuthRuleAnnotation("")
@GetMapping("/warehouse/inout/warehouseBussniessTypeList")
public BaseResponse getWarehouseBussniessTypeList(String code) {
if (StrUtil.isBlank(code))
return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL);
return ResultVOUtils.success(warehouseBussinessTypeService.getListByCode(code));
}
@AuthRuleAnnotation("")
@PostMapping("/warehouse/inout/saveWarehouseUser")
public BaseResponse saveWarehouseUser(@RequestBody Map<String, Object> params) {
String code = String.valueOf(params.get("code"));
String userListJson = String.valueOf(params.get("userList"));
if (StrUtil.isBlank(code) || StrUtil.isBlank(userListJson))
return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL);
warehouseUserService.saveWarehouseUser(code, JSONUtil.toList(userListJson, AuthAdmin.class));
return ResultVOUtils.success();
}
@AuthRuleAnnotation("")
@PostMapping("/warehouse/inout/saveWarehouseBussinessType")
public BaseResponse saveWarehouseBussinessType(@RequestBody Map<String, Object> params) {
String code = String.valueOf(params.get("code"));
String bussinessTypeJson = String.valueOf(params.get("bussinessTypes"));
if (StrUtil.isBlank(code) || StrUtil.isBlank(bussinessTypeJson))
return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL);
warehouseBussinessTypeService.saveWarehouseBussinessType(code, JSONUtil.toList(bussinessTypeJson, BussinessTypResponse.class));
return ResultVOUtils.success();
}
@AuthRuleAnnotation("")
@PostMapping("/warehouse/inout/updateDirector")
public BaseResponse updateDirector(Integer id) {
if (null == id)
return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL);
warehouseUserService.updateDirector(id);
return ResultVOUtils.success();
}
}

@ -1,7 +1,6 @@
package com.glxp.sale.admin.dao.auth;
import com.glxp.sale.admin.entity.auth.AuthAdmin;
import com.glxp.sale.admin.entity.auth.UpdateUserflagBean;
import com.glxp.sale.admin.req.auth.AuthAdminQueryRequest;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
@ -70,4 +69,11 @@ public interface AuthAdminDao {
boolean deleteById(Long id);
boolean deleteByCustomerId(Long customerId);
/**
*
*
* @return
*/
List<AuthAdmin> selectHospitalUser();
}

@ -27,4 +27,8 @@ public interface WarehouseBussinessTypeDao {
int updateBatchSelective(List<WarehouseBussinessTypeEntity> list);
int batchInsert(@Param("list") List<WarehouseBussinessTypeEntity> list);
List<WarehouseBussinessTypeEntity> selectListByCode(@Param("code") String code);
void deleteByCode(@Param("code") String code);
}

@ -28,5 +28,23 @@ public interface WarehouseUserDao {
int batchInsert(@Param("list") List<WarehouseUserEntity> list);
List<WarehouseUserEntity> selectWarehouseUserListByCode(@Param("code") String code);
List<WarehouseUserEntity> selectListByCode(@Param("code") String code);
void deleteByCode(@Param("code") String code);
/**
*
*
* @param code
* @param isDirector
*/
void updateDirector(@Param("code") String code, @Param("isDirector") int isDirector);
/**
* id
*
* @param id
* @param isDirector
*/
void updateDirectorById(@Param("id") Integer id, @Param("isDirector") int isDirector);
}

@ -26,4 +26,10 @@ public class WarehouseUserEntity {
* /
*/
private String username;
/**
*
*/
private boolean isDirector;
}

@ -2,7 +2,6 @@ package com.glxp.sale.admin.service.auth;
import com.glxp.sale.admin.entity.auth.AuthAdmin;
import com.glxp.sale.admin.entity.auth.UpdateUserflagBean;
import com.glxp.sale.admin.req.auth.AuthAdminQueryRequest;
import java.util.List;
@ -28,4 +27,11 @@ public interface AuthAdminService {
boolean deleteByCustomerId(Long customerId);
/**
*
*
* @return
*/
List<AuthAdmin> getHospitalUserList();
}

@ -1,9 +1,9 @@
package com.glxp.sale.admin.service.auth.impl;
import cn.hutool.core.collection.CollUtil;
import com.github.pagehelper.PageHelper;
import com.glxp.sale.admin.dao.auth.AuthAdminDao;
import com.glxp.sale.admin.entity.auth.AuthAdmin;
import com.glxp.sale.admin.entity.auth.UpdateUserflagBean;
import com.glxp.sale.admin.exception.JsonException;
import com.glxp.sale.admin.req.auth.AuthAdminQueryRequest;
import com.glxp.sale.admin.service.auth.AuthAdminService;
@ -122,5 +122,14 @@ public class AuthAdminServiceImpl implements AuthAdminService {
return authAdminDao.deleteByCustomerId(customerId);
}
@Override
public List<AuthAdmin> getHospitalUserList() {
List<AuthAdmin> userList = authAdminDao.selectHospitalUser();
if (CollUtil.isEmpty(userList)) {
return Collections.emptyList();
}
return userList;
}
}

@ -1,4 +1,26 @@
package com.glxp.sale.admin.service.inout;
import com.glxp.sale.admin.entity.inout.WarehouseBussinessTypeEntity;
import com.glxp.sale.admin.res.basic.BussinessTypResponse;
import java.util.List;
public interface WarehouseBussinessTypeService {
/**
* code
*
* @param code
* @return
*/
List<WarehouseBussinessTypeEntity> getListByCode(String code);
/**
* -
*
* @param code
* @param bussinessTypeEntities
*/
void saveWarehouseBussinessType(String code, List<BussinessTypResponse> bussinessTypResponseList);
}

@ -1,5 +1,6 @@
package com.glxp.sale.admin.service.inout;
import com.glxp.sale.admin.entity.auth.AuthAdmin;
import com.glxp.sale.admin.entity.inout.WarehouseUserEntity;
import java.util.List;
@ -12,5 +13,20 @@ public interface WarehouseUserService {
* @param code
* @return
*/
List<WarehouseUserEntity> getWarehouseUserList(String code);
List<WarehouseUserEntity> getListByCode(String code);
/**
*
*
* @param code
* @param userList
*/
void saveWarehouseUser(String code, List<AuthAdmin> userList);
/**
*
*
* @param id
*/
void updateDirector(Integer id);
}

@ -1,11 +1,17 @@
package com.glxp.sale.admin.service.inout.impl;
import cn.hutool.core.collection.CollUtil;
import com.glxp.sale.admin.dao.inout.WarehouseBussinessTypeDao;
import com.glxp.sale.admin.entity.inout.WarehouseBussinessTypeEntity;
import com.glxp.sale.admin.res.basic.BussinessTypResponse;
import com.glxp.sale.admin.service.inout.WarehouseBussinessTypeService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
@Slf4j
@Service
@ -14,4 +20,30 @@ public class WarehouseBussinessTypeServiceImpl implements WarehouseBussinessType
@Resource
private WarehouseBussinessTypeDao warehouseBussinessTypeDao;
@Override
public List<WarehouseBussinessTypeEntity> getListByCode(String code) {
List<WarehouseBussinessTypeEntity> warehouseBussinessTypeEntities = warehouseBussinessTypeDao.selectListByCode(code);
if (CollUtil.isEmpty(warehouseBussinessTypeEntities)) {
return Collections.emptyList();
}
return warehouseBussinessTypeEntities;
}
@Override
public void saveWarehouseBussinessType(String code, List<BussinessTypResponse> bussinessTypResponseList) {
if (CollUtil.isNotEmpty(bussinessTypResponseList)) {
List<WarehouseBussinessTypeEntity> warehouseBussinessTypeEntities = new ArrayList<>(bussinessTypResponseList.size());
bussinessTypResponseList.forEach(bussinessTypeEntity -> {
WarehouseBussinessTypeEntity entity = new WarehouseBussinessTypeEntity();
entity.setCode(code);
entity.setAction(bussinessTypeEntity.getAction());
entity.setName(bussinessTypeEntity.getName());
warehouseBussinessTypeEntities.add(entity);
});
//删除旧数据
warehouseBussinessTypeDao.deleteByCode(code);
//加入新数据
warehouseBussinessTypeDao.batchInsert(warehouseBussinessTypeEntities);
}
}
}

@ -1,12 +1,16 @@
package com.glxp.sale.admin.service.inout.impl;
import cn.hutool.core.collection.CollUtil;
import com.glxp.sale.admin.dao.inout.WarehouseUserDao;
import com.glxp.sale.admin.entity.auth.AuthAdmin;
import com.glxp.sale.admin.entity.inout.WarehouseUserEntity;
import com.glxp.sale.admin.service.inout.WarehouseUserService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
@Slf4j
@ -18,7 +22,37 @@ public class WarehouseUserServiceImpl implements WarehouseUserService {
private WarehouseUserDao warehouseUserDao;
@Override
public List<WarehouseUserEntity> getWarehouseUserList(String code) {
return warehouseUserDao.selectWarehouseUserListByCode(code);
public List<WarehouseUserEntity> getListByCode(String code) {
List<WarehouseUserEntity> warehouseUserEntities = warehouseUserDao.selectListByCode(code);
if (CollUtil.isEmpty(warehouseUserEntities)) {
return Collections.emptyList();
}
return warehouseUserEntities;
}
@Override
public void saveWarehouseUser(String code, List<AuthAdmin> userList) {
if (CollUtil.isNotEmpty(userList)) {
List<WarehouseUserEntity> warehouseUserEntities = new ArrayList<>(userList.size());
userList.forEach(user -> {
WarehouseUserEntity warehouseUserEntity = new WarehouseUserEntity();
warehouseUserEntity.setCode(code);
warehouseUserEntity.setUsername(user.getUserName());
warehouseUserEntity.setUserid(user.getId());
warehouseUserEntities.add(warehouseUserEntity);
});
//删除旧数据
warehouseUserDao.deleteByCode(code);
warehouseUserDao.batchInsert(warehouseUserEntities);
}
}
@Override
public void updateDirector(Integer id) {
if (null != id) {
WarehouseUserEntity warehouseUserEntity = warehouseUserDao.selectByPrimaryKey(id);
warehouseUserDao.updateDirector(warehouseUserEntity.getCode(), 0);
warehouseUserDao.updateDirectorById(id, 1);
}
}
}

@ -133,4 +133,7 @@
where CustomerId = #{customerId}
</delete>
<select id="selectHospitalUser" resultType="com.glxp.sale.admin.entity.auth.AuthAdmin">
select id, userName from auth_user where CustomerId = 110
</select>
</mapper>

@ -226,4 +226,12 @@
</if>
</trim>
</insert>
<select id="selectListByCode" resultMap="BaseResultMap">
select * from inv_warehouse_bussiness_type where code = #{code}
</select>
<delete id="deleteByCode">
delete from inv_warehouse_bussiness_type where code = #{code}
</delete>
</mapper>

@ -8,10 +8,11 @@
<result column="code" jdbcType="VARCHAR" property="code" />
<result column="userId" jdbcType="BIGINT" property="userid" />
<result column="userName" jdbcType="VARCHAR" property="username" />
<result column="isDirector" javaType="boolean" property="isDirector" />
</resultMap>
<sql id="Base_Column_List">
<!--@mbg.generated-->
id, code, userId, userName
id, code, userId, userName, isDirector
</sql>
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
<!--@mbg.generated-->
@ -27,9 +28,9 @@
</delete>
<insert id="insert" keyColumn="id" keyProperty="id" parameterType="com.glxp.sale.admin.entity.inout.WarehouseUserEntity" useGeneratedKeys="true">
<!--@mbg.generated-->
insert into inv_warehouse_user (code, userId, userName
insert into inv_warehouse_user (code, userId, userName, isDirector
)
values (#{code,jdbcType=VARCHAR}, #{userid,jdbcType=BIGINT}, #{username,jdbcType=VARCHAR}
values (#{code,jdbcType=VARCHAR}, #{userid,jdbcType=BIGINT}, #{username,jdbcType=VARCHAR}, #{isDirector}
)
</insert>
<insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="com.glxp.sale.admin.entity.inout.WarehouseUserEntity" useGeneratedKeys="true">
@ -45,6 +46,7 @@
<if test="username != null">
userName,
</if>
isDirector
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="code != null">
@ -56,6 +58,7 @@
<if test="username != null">
#{username,jdbcType=VARCHAR},
</if>
#{isDirector}
</trim>
</insert>
<update id="updateByPrimaryKeySelective" parameterType="com.glxp.sale.admin.entity.inout.WarehouseUserEntity">
@ -72,6 +75,7 @@
userName = #{username,jdbcType=VARCHAR},
</if>
</set>
isDirector = #{isDirector}
where id = #{id,jdbcType=INTEGER}
</update>
<update id="updateByPrimaryKey" parameterType="com.glxp.sale.admin.entity.inout.WarehouseUserEntity">
@ -80,6 +84,7 @@
set code = #{code,jdbcType=VARCHAR},
userId = #{userid,jdbcType=BIGINT},
userName = #{username,jdbcType=VARCHAR}
isDirector = #{isDirector}
where id = #{id,jdbcType=INTEGER}
</update>
<update id="updateBatch" parameterType="java.util.List">
@ -141,10 +146,10 @@
<insert id="batchInsert" keyColumn="id" keyProperty="id" parameterType="map" useGeneratedKeys="true">
<!--@mbg.generated-->
insert into inv_warehouse_user
(code, userId, userName)
(code, userId, userName, isDirector)
values
<foreach collection="list" item="item" separator=",">
(#{item.code,jdbcType=VARCHAR}, #{item.userid,jdbcType=BIGINT}, #{item.username,jdbcType=VARCHAR}
(#{item.code,jdbcType=VARCHAR}, #{item.userid,jdbcType=BIGINT}, #{item.username,jdbcType=VARCHAR}, #{item.isDirector}
)
</foreach>
</insert>
@ -158,6 +163,7 @@
code,
userId,
userName,
isDirector,
</trim>
values
<trim prefix="(" suffix=")" suffixOverrides=",">
@ -167,6 +173,7 @@
#{code,jdbcType=VARCHAR},
#{userid,jdbcType=BIGINT},
#{username,jdbcType=VARCHAR},
#{isDirector}
</trim>
on duplicate key update
<trim suffixOverrides=",">
@ -227,7 +234,19 @@
</trim>
</insert>
<select id="selectWarehouseUserListByCode" resultMap="BaseResultMap">
<select id="selectListByCode" resultMap="BaseResultMap">
select * from inv_warehouse_user where code = #{code}
</select>
<delete id="deleteByCode">
delete from inv_warehouse_user where code = #{code}
</delete>
<update id="updateDirector">
update inv_warehouse_user set isDirector = #{isDirector} where code = #{code}
</update>
<update id="updateDirectorById">
update inv_warehouse_user set isDirector = #{isDirector} where id = #{id}
</update>
</mapper>
Loading…
Cancel
Save