| | |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.Optional; |
| | | import java.util.Set; |
| | | import java.util.stream.Collectors; |
| | | |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | |
| | | import com.consum.base.core.utils.IdUtil; |
| | | import com.consum.base.pojo.BaseWarehouseParam; |
| | | import com.consum.base.service.BaseWarehouseService; |
| | | import com.consum.base.service.FinSysTenantDepartmentService; |
| | | import com.consum.base.service.FinSysTenantServiceImpl; |
| | | import com.consum.base.service.SDictDataServiceImpl; |
| | | import com.consum.base.service.FinSysTenantService; |
| | | import com.consum.base.service.SDictDataService; |
| | | import com.consum.model.po.BaseWarehouse; |
| | | import com.consum.model.po.FinSysTenant; |
| | | import com.consum.model.po.FinSysTenantDepartment; |
| | | import com.consum.model.po.FinSysTenantUser; |
| | | import com.consum.model.po.SDictData; |
| | | import com.walker.db.page.GenericPager; |
| | |
| | | @Autowired |
| | | private CodeGeneratorService codeGeneratorService; |
| | | @Autowired |
| | | private FinSysTenantServiceImpl finSysTenantService; |
| | | private FinSysTenantService finSysTenantService; |
| | | @Autowired |
| | | private FinSysTenantDepartmentService departmentService; |
| | | @Autowired |
| | | private SDictDataServiceImpl sDictDataService; |
| | | private SDictDataService sDictDataService; |
| | | |
| | | /** |
| | | * @Description 新增 |
| | |
| | | } |
| | | |
| | | /** |
| | | * @Description 根据仓库id获取机构用户信息 |
| | | * @Author 卢庆阳 |
| | | * @Date 2023/10/26 |
| | | */ |
| | | @Override |
| | | public void queryUserList(Long baseWarehouseId) { |
| | | // 1.根据仓库id查询仓库 |
| | | BaseWarehouse baseWarehouse = this.getById(baseWarehouseId); |
| | | if (baseWarehouse != null) { |
| | | Long agencyId = baseWarehouse.getAgencyId(); |
| | | String agencyName = baseWarehouse.getAgencyName(); |
| | | // 2.根据机构id查询部门 |
| | | List<FinSysTenantDepartment> list = this.departmentService.getByTenantId(agencyId); |
| | | // 获取部门id |
| | | Set<Long> deptIds = list.stream().map(dept -> dept.getId()).collect(Collectors.toSet()); |
| | | // 3.根据部门id查询用户 |
| | | // this.userService.getByDeptIds(); |
| | | |
| | | } |
| | | |
| | | } |
| | | |
| | | /** |
| | | * @return |
| | | * @Description 根据机构id查询机构仓库 |
| | | * @Author 卢庆阳 |
| | | * @Date 2023/10/27 |
| | | */ |
| | | @Override |
| | | public List<BaseWarehouse> getByAgencyId(Long agencyId, Short isDefault, Short states) { |
| | | public List<BaseWarehouse> getBaseWareHouseList(Long agencyId, Integer states) { |
| | | StringBuilder sql = new StringBuilder("SELECT * FROM base_warehouse WHERE 1 = 1 "); |
| | | HashMap<String, Object> paramts = new HashMap<>(); |
| | | |
| | |
| | | sql.append(" and AGENCY_ID =:AGENCY_ID "); |
| | | paramts.put("AGENCY_ID", agencyId); |
| | | } |
| | | // 是否为默认仓库 |
| | | if (isDefault != null) { |
| | | sql.append(" and IS_DEFAULT =:isDefault "); |
| | | paramts.put("isDefault", isDefault); |
| | | } |
| | | // 状态 |
| | | if (states != null) { |
| | | sql.append(" and states =:states "); |
| | | paramts.put("states", states); |
| | | } |
| | | return select(sql.toString(), paramts, new BaseWarehouse()); |
| | | } |
| | | |
| | | /** |
| | | * 根据机构id查询默认仓库 |
| | | * |
| | | * @param agencyId |
| | | * @return |
| | | */ |
| | | @Override |
| | | public BaseWarehouse getDefaultWarehouseByAgencyId(Long agencyId) { |
| | | StringBuilder sql = |
| | | new StringBuilder("SELECT * FROM base_warehouse WHERE IS_DEFAULT = 1 and AGENCY_ID =:agencyId "); |
| | | Map<String, Object> param = new HashMap<>(); |
| | | param.put("agencyId", agencyId); |
| | | List<BaseWarehouse> select = select(sql.toString(), param, new BaseWarehouse()); |
| | | Optional<BaseWarehouse> optional = select.stream().findFirst(); |
| | | if (optional.isPresent()) { |
| | | return optional.get(); |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | @Override |