Commit 8e6d60cf by zhanghj

V1.2.0--提交技工端增加订货单

git-svn-id: svn://192.168.3.233/frms/code/car-service/trunk/car-service@21804 aeb6102e-e053-11e5-9fec-f9ebc45caf4b
1 parent d969ad5f
......@@ -77,5 +77,12 @@ public interface BizConstants {
* 订货单编码前缀
*/
public static final String INDENT_NO_PREFIX = "8000";
/**
* 发货方式,1:服务商发货;2:广联发货
*/
public static final int INDENT_SEND_TYPE_SERVICE = 1;
public static final int INDENT_SEND_TYPE_GLSX = 2;
}
......@@ -106,12 +106,7 @@ public class IndentController extends BaseController{
Map<String, String> errorMap = getErrors(bindingResult);
return new ResultObject(ResultCodeEnum.PARAM_ERROR.getCode(), ResultCodeEnum.PARAM_ERROR.getMsg(), errorMap);
}
Integer userId = UserUtils.getUserId(request);
indent.setCreateBy(userId);
indent.setCreateTime(new Date());
indent.setUpdateBy(userId);
indent.setUpdateTime(new Date());
ResultObject result = indentService.add(indent);
ResultObject result = indentService.add(request, indent);
return result;
}
......
......@@ -67,6 +67,10 @@ public class SysIndent extends BaseModel{
private SysIndentLogistics sysIndentLogistics;
private SysArea sysArea;
/**
* 登录终端 0:后台管理系统,3:技工端
*/
private Integer terminalType;
public Integer getId() {
return id;
......@@ -220,6 +224,14 @@ public class SysIndent extends BaseModel{
this.sysArea = sysArea;
}
public Integer getTerminalType() {
return terminalType;
}
public void setTerminalType(Integer terminalType) {
this.terminalType = terminalType;
}
@Override
public String toString() {
return "SysIndent [id=" + id + ", indentNo=" + indentNo + ", sendType="
......
......@@ -29,6 +29,7 @@ public interface IndentService {
/**
*
* @author zhanghj
* @param request
* @Title: add
* @Description: TODO 增加订货单
* @param indent
......@@ -36,7 +37,7 @@ public interface IndentService {
* ResultObject
*
*/
ResultObject add(SysIndent indent);
ResultObject add(HttpServletRequest request, SysIndent indent);
/**
*
......
......@@ -3,16 +3,23 @@ package com.glsx.ordercenter.service.impl;
import java.util.Date;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import com.alibaba.fastjson.JSONObject;
import com.github.pagehelper.PageHelper;
import com.glsx.common.constants.Constants;
import com.glsx.common.constants.ResultObject;
import com.glsx.common.feign.client.UserClient;
import com.glsx.common.utils.DateUtil;
import com.glsx.common.utils.Page;
import com.glsx.common.utils.UserUtils;
import com.glsx.ordercenter.constants.BizConstants;
import com.glsx.ordercenter.constants.IndentStatusEnum;
import com.glsx.ordercenter.constants.OrderActiveStatusEnum;
import com.glsx.ordercenter.constants.ResultCodeEnum;
import com.glsx.ordercenter.exception.BusinessException;
import com.glsx.ordercenter.mapper.SysIndentLogMapper;
......@@ -49,10 +56,36 @@ public class IndentServiceImpl implements IndentService {
@Autowired
private IAreaService areaService;
@Autowired
private UserClient userClient;
@Override
@Transactional
public ResultObject add(SysIndent indent) {
public ResultObject add(HttpServletRequest request, SysIndent indent) {
// TODO Auto-generated method stub
Integer userId = UserUtils.getUserId(request);
Integer terminalType = indent.getTerminalType();
Integer sendType = BizConstants.INDENT_SEND_TYPE_GLSX;
/*
* 技工端发订货单,先判断发货方式
*/
if (Constants.USER_TYPE_MECHANIC == terminalType) {
JSONObject result = userClient.getMechanicById(userId);
if (result != null && result.getIntValue("code") == ResultCodeEnum.SUCCESS.getCode()) {
JSONObject object = result.getJSONObject("data");
int userSendType = object.getIntValue("sendType");
if (BizConstants.INDENT_SEND_TYPE_SERVICE == userSendType) {
sendType = BizConstants.INDENT_SEND_TYPE_SERVICE;
}
}
}
indent.setSendType(sendType);
indent.setCreateBy(userId);
indent.setCreateTime(new Date());
indent.setUpdateBy(userId);
indent.setUpdateTime(new Date());
Integer receiveAddressId = indent.getReceiveAddressId();
SysReceiveAddress receiveAddress = receiveAddressService.get(receiveAddressId);
if (receiveAddress == null) {
......
......@@ -1249,7 +1249,8 @@
sm.service_type serviceType,
sm.address,
sm.mechanic_status AS mechanicStatus,
sm.work_status as workStatus
sm.work_status as workStatus,
sm.send_type as sendType
FROM
sys_user su
LEFT JOIN sys_mechanic sm ON su.id = sm.user_id
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!