Commit bc00d522 by xiaoyj

设备信息提交

git-svn-id: svn://192.168.3.233/frms/code/car-service/trunk/car-service@21593 aeb6102e-e053-11e5-9fec-f9ebc45caf4b
1 parent be3e7fda
...@@ -3,9 +3,12 @@ package com.glsx.ordercenter.controller; ...@@ -3,9 +3,12 @@ package com.glsx.ordercenter.controller;
import com.glsx.common.annotation.AuthCheck; import com.glsx.common.annotation.AuthCheck;
import com.glsx.common.constants.ResultObject; import com.glsx.common.constants.ResultObject;
import com.glsx.common.utils.Page; import com.glsx.common.utils.Page;
import com.glsx.common.utils.UserUtils;
import com.glsx.ordercenter.constants.ResultCodeEnum; import com.glsx.ordercenter.constants.ResultCodeEnum;
import com.glsx.ordercenter.pojo.SysDevice; import com.glsx.ordercenter.pojo.SysDevice;
import com.glsx.ordercenter.pojo.SysReaceiveAddress;
import com.glsx.ordercenter.service.DeviceService; import com.glsx.ordercenter.service.DeviceService;
import com.glsx.ordercenter.service.ReaceiveAddressService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestMethod;
...@@ -13,7 +16,9 @@ import org.springframework.web.bind.annotation.RequestParam; ...@@ -13,7 +16,9 @@ import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map;
/** /**
* @author xiaoyj * @author xiaoyj
...@@ -28,8 +33,11 @@ public class DeviceCtroller { ...@@ -28,8 +33,11 @@ public class DeviceCtroller {
@Autowired @Autowired
private DeviceService deviceService; private DeviceService deviceService;
@Autowired
private ReaceiveAddressService reaceiveAddressService;
/** /**
* 订货单的设备清单 * 订货单的设备清单(技工端/服务商端)
* @param request * @param request
* @param indentNo * @param indentNo
* @return * @return
...@@ -40,11 +48,53 @@ public class DeviceCtroller { ...@@ -40,11 +48,53 @@ public class DeviceCtroller {
if (org.springframework.util.StringUtils.isEmpty(indentNo)) { if (org.springframework.util.StringUtils.isEmpty(indentNo)) {
return new ResultObject(ResultCodeEnum.PARAM_ERROR.getCode(), ResultCodeEnum.PARAM_ERROR.getMsg()); return new ResultObject(ResultCodeEnum.PARAM_ERROR.getCode(), ResultCodeEnum.PARAM_ERROR.getMsg());
} }
Map<String, Object> result = new HashMap<String, Object>();
Page page = new Page(pageIndex, pageSize); Page page = new Page(pageIndex, pageSize);
List<SysDevice> list=deviceService.catIndentDevices(indentNo,page); List<SysDevice> list=deviceService.catIndentDevices(indentNo,page);
return new ResultObject(ResultCodeEnum.PARAM_ERROR.getCode(),ResultCodeEnum.PARAM_ERROR.getMsg(),list); com.github.pagehelper.Page<SysDevice> pages = (com.github.pagehelper.Page<SysDevice>) list;
page.setTotalCount((int) pages.getTotal());
result.put("page", page);
result.put("items", list);
return new ResultObject(ResultCodeEnum.PARAM_ERROR.getCode(),ResultCodeEnum.PARAM_ERROR.getMsg(),result);
}
/**
* 添加设备相关验证
*/
@RequestMapping(value = "/insertDevice", method = RequestMethod.POST)
public ResultObject insertDevice(HttpServletRequest request,List<String> deviceNos,String indentNo) {
if (org.springframework.util.StringUtils.isEmpty(indentNo) || deviceNos.size()<=0) {
return new ResultObject(ResultCodeEnum.PARAM_ERROR.getCode(), ResultCodeEnum.PARAM_ERROR.getMsg());
} }
//Todo
return new ResultObject(ResultCodeEnum.PARAM_ERROR.getCode(),ResultCodeEnum.PARAM_ERROR.getMsg());
}
/**
* 收货地址列表
*/
@RequestMapping(value = "/listReaceiveAdress", method = RequestMethod.POST)
public ResultObject listReaceiveAdress(HttpServletRequest request) {
int userId = UserUtils.getUserId(request);
List<SysReaceiveAddress> list=reaceiveAddressService.getByUserId(userId);
return new ResultObject(ResultCodeEnum.PARAM_ERROR.getCode(),ResultCodeEnum.PARAM_ERROR.getMsg(),list);
}
/**
* 编辑收货地址
*/
@RequestMapping(value = "/editReaceiveAdress", method = RequestMethod.POST)
public ResultObject editReaceiveAdress(HttpServletRequest request,SysReaceiveAddress sysReaceiveAddress) {
int result=reaceiveAddressService.editReaceiveAdress(sysReaceiveAddress);
return new ResultObject(ResultCodeEnum.PARAM_ERROR.getCode(),ResultCodeEnum.PARAM_ERROR.getMsg());
}
/**
* 删除收货地址
*/
@RequestMapping(value = "/deleteReaceiveAdress", method = RequestMethod.POST)
public ResultObject deleteReaceiveAdress(HttpServletRequest request,SysReaceiveAddress sysReaceiveAddress) {
int result=reaceiveAddressService.deleteReaceiveAdress(sysReaceiveAddress);
return new ResultObject(ResultCodeEnum.PARAM_ERROR.getCode(),ResultCodeEnum.PARAM_ERROR.getMsg());
}
} }
...@@ -4,6 +4,7 @@ import com.github.pagehelper.PageHelper; ...@@ -4,6 +4,7 @@ import com.github.pagehelper.PageHelper;
import com.glsx.common.utils.Page; import com.glsx.common.utils.Page;
import com.glsx.ordercenter.mapper.SysDeviceMapper; import com.glsx.ordercenter.mapper.SysDeviceMapper;
import com.glsx.ordercenter.pojo.SysDevice; import com.glsx.ordercenter.pojo.SysDevice;
import com.glsx.ordercenter.pojo.SysDeviceExample;
import com.glsx.ordercenter.service.DeviceService; import com.glsx.ordercenter.service.DeviceService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
...@@ -19,6 +20,8 @@ public class DeviceServiceImpl implements DeviceService { ...@@ -19,6 +20,8 @@ public class DeviceServiceImpl implements DeviceService {
if (page != null) { if (page != null) {
PageHelper.startPage(page.getPageIndex(), page.getPageSize(), true); PageHelper.startPage(page.getPageIndex(), page.getPageSize(), true);
} }
return sysDeviceMapper.catIndentDevices(indentNo); SysDeviceExample sysDeviceExample=new SysDeviceExample();
sysDeviceExample.createCriteria().andIndentNoEqualTo(indentNo);
return sysDeviceMapper.selectByExample(sysDeviceExample);
} }
} }
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!