Commit 4eb668ab by zhanghj

V1.2.0--提交修改或新增订货单物流信息代码

git-svn-id: svn://192.168.3.233/frms/code/car-service/trunk/car-service@21712 aeb6102e-e053-11e5-9fec-f9ebc45caf4b
1 parent c884dd9e
package com.glsx.ordercenter.controller;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import javax.validation.groups.Default;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.BindingResult;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import com.glsx.common.annotation.AuthCheck;
import com.glsx.common.constants.ResultObject;
import com.glsx.ordercenter.constants.ResultCodeEnum;
import com.glsx.ordercenter.pojo.SysIndentLogistics;
import com.glsx.ordercenter.service.IndentLogisticsService;
/**
*
* @Title IndentLogisticsController.java
* @Package com.glsx.ordercenter.controller
* @Description TODO 订货单物流相关controller
* @author zhanghj
* @date 2019年6月6日 上午10:48:13
* @version 1.0.0
*/
@RestController
@RequestMapping(value="/indentLogistics")
public class IndentLogisticsController extends BaseController{
@Autowired
private IndentLogisticsService indentLogisticsService;
/**
*
* @author zhanghj
* @Title: addOrUpdateIndentLogistics
* @Description: TODO 添加或者修改订货单物流信息
* @param request
* @param indentLogistics
* @return
* ResultObject
*
*/
@AuthCheck
@RequestMapping(value = "/addOrUpdateIndentLogistics", method = RequestMethod.POST)
public ResultObject addOrUpdateIndentLogistics(HttpServletRequest request, @Validated(value = {Default.class}) SysIndentLogistics indentLogistics, BindingResult bindingResult) {
if (bindingResult.hasErrors()) {
Map<String, String> errorMap = getErrors(bindingResult);
return new ResultObject(ResultCodeEnum.PARAM_ERROR.getCode(), ResultCodeEnum.PARAM_ERROR.getMsg(), errorMap);
}
int num = indentLogisticsService.addOrUpdateIndentLogistics(request, indentLogistics);
return new ResultObject(ResultCodeEnum.SUCCESS.getCode(),ResultCodeEnum.SUCCESS.getMsg());
}
}
......@@ -2,15 +2,22 @@ package com.glsx.ordercenter.pojo;
import java.util.Date;
import javax.validation.constraints.NotNull;
import javax.validation.groups.Default;
import org.springframework.format.annotation.DateTimeFormat;
public class SysIndentLogistics {
private Integer id;
@NotNull(message="{param.not.null}", groups={Default.class})
private Integer indentId;
private String logisticsNo;
private String logisticsUnicode;
@DateTimeFormat(pattern = "yyyy-MM-dd HH:ss")
private Date logisticsTime;
private String remark;
......
package com.glsx.ordercenter.service;
import javax.servlet.http.HttpServletRequest;
import com.glsx.ordercenter.pojo.SysIndentLogistics;
/**
*
* @Title IndentLogisticsService.java
* @Package com.glsx.ordercenter.service
* @Description TODO 订货单物流service
* @author zhanghj
* @date 2019年6月6日 上午10:57:33
* @version 1.0.0
*/
public interface IndentLogisticsService {
int addOrUpdateIndentLogistics(HttpServletRequest request, SysIndentLogistics indentLogistics);
}
package com.glsx.ordercenter.service.impl;
import java.util.Date;
import javax.servlet.http.HttpServletRequest;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.glsx.common.utils.UserUtils;
import com.glsx.ordercenter.mapper.SysIndentLogisticsMapper;
import com.glsx.ordercenter.pojo.SysIndentLogistics;
import com.glsx.ordercenter.service.IndentLogisticsService;
/**
*
* @Title IndentLogisticsServiceImpl.java
* @Package com.glsx.ordercenter.service.impl
* @Description TODO
* @author zhanghj
* @date 2019年6月6日 上午10:58:36
* @version 1.0.0
*/
@Service
public class IndentLogisticsServiceImpl implements IndentLogisticsService{
@Autowired
private SysIndentLogisticsMapper indentLogisticsDao;
@Override
public int addOrUpdateIndentLogistics(HttpServletRequest request, SysIndentLogistics indentLogistics) {
// TODO Auto-generated method stub
Integer id = indentLogistics.getId();
Integer userId = UserUtils.getUserId(request);
Date now = new Date();
int num = 0;
if (id == null) {
indentLogistics.setCreateBy(userId);
indentLogistics.setCreateTime(now);
indentLogistics.setUpdateBy(userId);
indentLogistics.setUpdateTime(now);
num = indentLogisticsDao.insertSelective(indentLogistics);
} else {
indentLogistics.setUpdateBy(userId);
indentLogistics.setUpdateTime(now);
num = indentLogisticsDao.updateByPrimaryKeySelective(indentLogistics);
}
return num;
}
}
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!