package com.ld.igds.phone.service.impl;
|
|
import com.alibaba.fastjson.JSONObject;
|
import com.ld.igds.constant.RespCodeEnum;
|
import com.ld.igds.phone.constant.PhoneConstant;
|
import com.ld.igds.phone.util.PhoneRespUtil;
|
import com.ld.igds.phone.dto.AuthUser;
|
import com.ld.igds.phone.dto.DtoDepot;
|
import com.ld.igds.phone.dto.PhoneResponse;
|
import com.ld.igds.phone.mapper.PhoneCommonMapper;
|
import com.ld.igds.phone.param.PhoneRequest;
|
import com.ld.igds.phone.service.PhoneService;
|
import org.apache.commons.lang3.StringUtils;
|
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.stereotype.Service;
|
|
import java.util.List;
|
|
/**
|
* 存储管理接口实现
|
* @author chen
|
*/
|
@Service
|
public class ServiceImpl5102 implements PhoneService {
|
|
@Autowired
|
private PhoneCommonMapper phoneCommonMapper;
|
|
@Override
|
public String getInterfaceId() {
|
return PhoneConstant.API_PHONE_5102;
|
}
|
|
@SuppressWarnings("unchecked")
|
@Override
|
public PhoneResponse<Object> execute(PhoneRequest<JSONObject> req, AuthUser authUser)
|
throws Exception {
|
|
//查看用户所属部门是否存在
|
String deptId = authUser.getDeptId();
|
if(StringUtils.isEmpty(deptId)){
|
return PhoneRespUtil.error(RespCodeEnum.CODE_1111,"您的账号尚未分配部门/分库,无法查看!");
|
}
|
|
//判断登录用户部门是否是顶级部门,是的话默认分配到分库一
|
if (deptId.equals(authUser.getCompanyId())) {
|
deptId = authUser.getCompanyId() + "_001";
|
}
|
|
//获取仓库信息
|
List<DtoDepot> depotList = phoneCommonMapper.phoneListDepot(authUser.getCompanyId(),deptId);
|
|
return PhoneRespUtil.success(depotList,req);
|
}
|
}
|