jiazx0107@163.com
2023-05-26 6f4a366cad9109ddc338fd13c9d43ca2ce516f6b
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
package com.ld.igds.phone35.service.impl;
 
import com.alibaba.fastjson.JSONObject;
import com.ld.igds.constant.RespCodeEnum;
import com.ld.igds.models.Depot;
import com.ld.igds.phone35.dto.Phone35AuthUser;
import com.ld.igds.phone35.dto.PhoneResponse;
import com.ld.igds.phone35.param.Phone35CommonParam;
import com.ld.igds.phone35.param.Phone35Request;
import com.ld.igds.phone35.util.PhoneRespUtil;
import com.ld.igds.phone35.constant.Phone35Constant;
import com.ld.igds.phone35.service.Phone35Service;
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 Phone35ServiceImpl5102 implements Phone35Service {
 
    @Autowired
    private HPhoneServiceImpl hPhoneService;
 
    @Override
    public String getInterfaceId() {
        return Phone35Constant.API_PHONE_5102;
    }
 
    @SuppressWarnings("unchecked")
    @Override
    public PhoneResponse<Object> execute(Phone35Request<JSONObject> req, Phone35AuthUser phone35AuthUser)
            throws Exception {
 
        //转化为对象
        Phone35CommonParam param = JSONObject.parseObject(req.getData().toString(), Phone35CommonParam.class);
        if(null == param || StringUtils.isEmpty(param.getDeptId())){
            return PhoneRespUtil.error(RespCodeEnum.CODE_1111,"参数有误,请核查!");
        }
 
        //获取仓库信息
        List<Depot> depotList = hPhoneService.listDepot(phone35AuthUser.getCompanyId(), param.getDeptId());
        if(null == depotList || depotList.isEmpty()){
            return PhoneRespUtil.error(RespCodeEnum.CODE_1111,"参数有误,请核查!");
        }
 
        return PhoneRespUtil.success(depotList,req);
    }
}