package com.ld.igds.phone.service.impl;
|
|
import com.alibaba.fastjson.JSONObject;
|
import com.ld.igds.gas.manager.GasManager;
|
import com.ld.igds.constant.RespCodeEnum;
|
import com.ld.igds.gas.dto.GasParam;
|
import com.ld.igds.io.constant.OrderRespEnum;
|
import com.ld.igds.io.response.GasResponse;
|
import com.ld.igds.phone.constant.PhoneConstant;
|
import com.ld.igds.phone.dto.AuthUser;
|
import com.ld.igds.phone.dto.PhoneResponse;
|
import com.ld.igds.phone.param.ParamDepot;
|
import com.ld.igds.phone.param.PhoneRequest;
|
import com.ld.igds.phone.service.PhoneService;
|
import com.ld.igds.phone.util.PhoneRespUtil;
|
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.stereotype.Service;
|
|
/**
|
* 粮情展示-气体采集接口实现
|
*
|
* @author chen
|
*/
|
@Service
|
public class ServiceImpl5307 implements PhoneService {
|
|
@Autowired
|
private GasManager gasManager;
|
|
@Override
|
public String getInterfaceId() {
|
return PhoneConstant.API_PHONE_5307;
|
}
|
|
@SuppressWarnings("unchecked")
|
@Override
|
public PhoneResponse<Object> execute(PhoneRequest<JSONObject> req, AuthUser authUser)
|
throws Exception {
|
ParamDepot param = JSONObject.parseObject(req.getData().toString(), ParamDepot.class);
|
|
GasParam gasParam = new GasParam();
|
gasParam.setCompanyId(authUser.getCompanyId());
|
gasParam.setDepotId(param.getDepotId());
|
|
GasResponse gasResponse = gasManager.checkGas(gasParam);
|
|
if(OrderRespEnum.ORDER_ERROR.getCode().equals(gasResponse.getCode())){
|
return PhoneRespUtil.error(RespCodeEnum.CODE_1111,gasResponse.getMsg());
|
}else {
|
return PhoneRespUtil.success(gasResponse.getMsg(), req);
|
}
|
}
|
}
|