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);
|
}
|
}
|