CZT
2023-11-27 c206acfaedc69c390fb67daa81bc686f58a212ef
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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
package com.ld.igds.phone.service.impl;
 
import com.alibaba.fastjson.JSONObject;
import com.ld.igds.phone.constant.PhoneConstant;
import com.ld.igds.phone.dto.*;
import com.ld.igds.phone.mapper.PhoneCommonMapper;
import com.ld.igds.phone.param.ParamOrder;
import com.ld.igds.phone.param.PhoneRequest;
import com.ld.igds.phone.service.PhoneService;
import com.ld.igds.phone.util.PhoneRespUtil;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.List;
 
/**
 * 工单模块-查询分库列表、工单类型列表、仓库列表
 *
 * @author chen
 */
@Service
public class ServiceImpl5701 implements PhoneService {
 
    @Autowired
    private PhoneCommonMapper phoneCommonMapper;
 
    @Override
    public String getInterfaceId() {
        return PhoneConstant.API_PHONE_5701;
    }
 
    @SuppressWarnings("unchecked")
    @Override
    public PhoneResponse<Object> execute(PhoneRequest<JSONObject> req, AuthUser authUser)
            throws Exception {
 
        //转化为对象
        ParamOrder param = JSONObject.parseObject(req.getData().toString(), ParamOrder.class);
 
 
        List<DtoDept> list = phoneCommonMapper.getDeptList(authUser.getCompanyId(), authUser.getDeptId() + "%");
        List<DtoDept> deptList = new ArrayList<>();
        if(null != list && list.size() > 0){
            for (DtoDept dtoDept : list) {
                List<DtoDepot> depots = phoneCommonMapper.phoneListDepot(authUser.getCompanyId(), dtoDept.getId());
                if(null != depots && depots.size() > 0){
                    dtoDept.setDepotList(depots);
                    deptList.add(dtoDept);
                }
            }
        }
 
        DtoOrder dtoOrder = new DtoOrder();
        if(StringUtils.isNotEmpty(param.getType())){
            List<DtoDic> dicList = phoneCommonMapper.getDicList(authUser.getCompanyId(), param.getType());
            if(dicList.size() > 0){
                dtoOrder.setTypeList(dicList);
            }
        }
 
        if(deptList.size() > 0){
            dtoOrder.setDeptList(deptList);
        }
 
        return PhoneRespUtil.success(dtoOrder, req);
    }
}