Commit aa4035f0 by xiaoyj

修改接口

git-svn-id: svn://192.168.3.233/frms/code/car-service/trunk/car-service@21986 aeb6102e-e053-11e5-9fec-f9ebc45caf4b
1 parent 10804573
......@@ -12,9 +12,11 @@ import com.glsx.ordercenter.service.DeviceService;
import com.glsx.ordercenter.service.IndentService;
import com.glsx.ordercenter.service.ReceiveAddressService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;
import java.lang.reflect.Array;
import java.util.*;
/**
......@@ -51,21 +53,24 @@ public class DeviceCtroller {
* 添加设备以及相关验证
*/
@RequestMapping(value = "/insertDevice", method = { RequestMethod.GET, RequestMethod.POST })
public ResultObject insertDevice(HttpServletRequest request,@RequestBody List<String> deviceNos,String indentNo) {
if (org.springframework.util.StringUtils.isEmpty(indentNo) || deviceNos.size()<=0) {
public ResultObject insertDevice(HttpServletRequest request,String deviceNos,String indentNo) {
if (StringUtils.isEmpty(indentNo) || StringUtils.isEmpty(indentNo)) {
return new ResultObject(ResultCodeEnum.PARAM_ERROR.getCode(), ResultCodeEnum.PARAM_ERROR.getMsg());
}
String[] arr=deviceNos.split(",");
List<String> list= Arrays.asList(arr);
//判断设备数量是否超出订货单数量
SysIndent sysIndent=indentService.getByIndentNo(indentNo);
if(sysIndent==null){
return new ResultObject(ResultCodeEnum.INDENT_NOT_EXIST.getCode(), ResultCodeEnum.INDENT_NOT_EXIST.getMsg());
}
if(deviceNos.size()>sysIndent.getDeviceAmount()){
if(list.size()>sysIndent.getDeviceAmount()){
return new ResultObject(ResultCodeEnum.DEVICE_MOUNT_ERROR.getCode(),ResultCodeEnum.DEVICE_MOUNT_ERROR.getMsg());
}
int userId=UserUtils.getUserId(request);
return deviceService.checkAndInserts(deviceNos,sysIndent,userId);
return deviceService.checkAndInserts(list,sysIndent,userId);
}
/**
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!