Commit 5ab94b4e by zhanghj

V1.5.0--提交申请售后相关功能代码

git-svn-id: svn://192.168.3.233/frms/code/car-service/trunk/car-service@24342 aeb6102e-e053-11e5-9fec-f9ebc45caf4b
1 parent 6e5b7fb7
......@@ -403,7 +403,7 @@ public class OrderController extends BaseController {
@RequestMapping(value = "/addAfterSaleRepair", method = { RequestMethod.GET, RequestMethod.POST })
public ResultObject addAfterSaleRepair(HttpServletRequest request, Integer orderId, Integer afterSaleType,
String repairReason, String expectInstallTime, String vinNo, Integer carBrand, Integer carSeries,
String carType, String carColor, Integer district, String address) {
String carType, String carColor, Integer district, String address, String orderDeviceIds) {
if (org.springframework.util.StringUtils.isEmpty(orderId)
|| org.springframework.util.StringUtils.isEmpty(afterSaleType)
......@@ -434,6 +434,7 @@ public class OrderController extends BaseController {
order.setAfterSaleType(afterSaleType);
order.setDistrict(district);
order.setAddress(address);
order.setOrderDeviceIds(orderDeviceIds);
ResultObject result = orderService.addAfterSaleRepair(request, order);
return result;
}
......
package com.glsx.ordercenter.mapper;
import java.util.List;
import com.glsx.ordercenter.pojo.SysOrderDevice;
public interface SysOrderDeviceMapper {
int deleteByPrimaryKey(Integer id);
int insert(SysOrderDevice record);
int insertSelective(SysOrderDevice record);
SysOrderDevice selectByPrimaryKey(Integer id);
int updateByPrimaryKeySelective(SysOrderDevice record);
int updateByPrimaryKey(SysOrderDevice record);
/**
*
* @author zhanghj
* @Title: getOrderDeviceList
* @Description: TODO 获取某个订单的设备列表
* @param record
* @return
* List<SysOrderDevice>
*
*/
List<SysOrderDevice> getOrderDeviceList(SysOrderDevice record);
}
\ No newline at end of file
......@@ -382,6 +382,10 @@ public class SysOrder {
*/
@NotNull(message="{param.not.null}", groups={GroupA.class})
private String serviceCode;
/**
* 订单安装设备id集,以,分隔
*/
private String orderDeviceIds;
// 安装图片
private List<String> installPiuctures;
......@@ -1190,6 +1194,14 @@ public class SysOrder {
this.serviceCode = serviceCode;
}
public String getOrderDeviceIds() {
return orderDeviceIds;
}
public void setOrderDeviceIds(String orderDeviceIds) {
this.orderDeviceIds = orderDeviceIds;
}
@Override
public String toString() {
return "SysOrder [noBidingDuration=" + noBidingDuration
......
package com.glsx.ordercenter.pojo;
/**
*
* @Title SysOrderDevice.java
* @Package com.glsx.ordercenter.pojo
* @Description TODO 订单安装设备
* @author zhanghj
* @date 2019年10月16日 下午4:58:54
* @version 1.0.0
*/
public class SysOrderDevice {
private Integer id;
private Integer orderId;
private String deviceNo;
private String deviceType;
private String installLocation;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public Integer getOrderId() {
return orderId;
}
public void setOrderId(Integer orderId) {
this.orderId = orderId;
}
public String getDeviceNo() {
return deviceNo;
}
public void setDeviceNo(String deviceNo) {
this.deviceNo = deviceNo == null ? null : deviceNo.trim();
}
public String getDeviceType() {
return deviceType;
}
public void setDeviceType(String deviceType) {
this.deviceType = deviceType == null ? null : deviceType.trim();
}
public String getInstallLocation() {
return installLocation;
}
public void setInstallLocation(String installLocation) {
this.installLocation = installLocation == null ? null : installLocation.trim();
}
}
\ No newline at end of file
......@@ -81,6 +81,7 @@ import com.glsx.ordercenter.mapper.SysIndentMapper;
import com.glsx.ordercenter.mapper.SysMechanicMapper;
import com.glsx.ordercenter.mapper.SysMerchantMapper;
import com.glsx.ordercenter.mapper.SysOrderBiddingRecordsMapper;
import com.glsx.ordercenter.mapper.SysOrderDeviceMapper;
import com.glsx.ordercenter.mapper.SysOrderLabelMapper;
import com.glsx.ordercenter.mapper.SysOrderMapper;
import com.glsx.ordercenter.mapper.SysOrderRepairMapper;
......@@ -100,6 +101,7 @@ import com.glsx.ordercenter.pojo.SysIndent;
import com.glsx.ordercenter.pojo.SysOrder;
import com.glsx.ordercenter.pojo.SysOrderBiddingRecords;
import com.glsx.ordercenter.pojo.SysOrderBiddingRecordsExample;
import com.glsx.ordercenter.pojo.SysOrderDevice;
import com.glsx.ordercenter.pojo.SysOrderExample;
import com.glsx.ordercenter.pojo.SysOrderExample.Criteria;
import com.glsx.ordercenter.pojo.SysOrderRepair;
......@@ -196,6 +198,8 @@ public class OrderServiceImpl implements IOrderService {
private SysOrderServiceTypeMapper sysOrderServiceTypeMapper;
@Autowired
private OrderUtil orderUtil;
@Autowired
private SysOrderDeviceMapper orderDeviceDao;
/**
*
......@@ -1902,7 +1906,7 @@ public class OrderServiceImpl implements IOrderService {
/**
* V1.3.0--商户端和后台管理系统都可以添加售后
*/
@Transactional
@Transactional(rollbackFor=Exception.class)
@Override
public ResultObject addAfterSaleRepair(HttpServletRequest request, SysOrder order) {
......@@ -1922,13 +1926,6 @@ public class OrderServiceImpl implements IOrderService {
}
/*
* 售后单的部分字段需要初始化,不能直接复制原单的数据
*/
originalOrder.setReserveInstallTime(null);
originalOrder.setWorkOrderNo(null);
originalOrder.setChannel(null);
/*
* 若售后类型是更换车辆,则需要生成一个拆除单,一个安装单
*/
Date now = new Date();
......@@ -1948,7 +1945,7 @@ public class OrderServiceImpl implements IOrderService {
/*
* 增加售后记录
*/
int dismantleOrderId = dismantleOrder.getId();
int dismantleOrderId = order.getId();
addOrderRepair(originalOrderId, dismantleOrderId, afterSaleType);
/*
......@@ -1964,7 +1961,7 @@ public class OrderServiceImpl implements IOrderService {
/*
* 增加售后记录
*/
int installOrderId = dismantleOrder.getId();
int installOrderId = order.getId();
addOrderRepair(originalOrderId, installOrderId, afterSaleType);
} else if (BizConstants.ORDER_AFTER_SALE_TYPE_DISMANTLE == afterSaleType) {
......@@ -1981,7 +1978,7 @@ public class OrderServiceImpl implements IOrderService {
/*
* 增加售后记录
*/
int dismantleOrderId = dismantleOrder.getId();
int dismantleOrderId = order.getId();
addOrderRepair(originalOrderId, dismantleOrderId, afterSaleType);
} else if (BizConstants.ORDER_AFTER_SALE_TYPE_REPAIR == afterSaleType) {
......@@ -1998,7 +1995,7 @@ public class OrderServiceImpl implements IOrderService {
/*
* 增加售后记录
*/
int repairOrderId = repairOrder.getId();
int repairOrderId = order.getId();
addOrderRepair(originalOrderId, repairOrderId, afterSaleType);
}
return new ResultObject(ResultCodeEnum.SUCCESS.getCode(), ResultCodeEnum.SUCCESS.getMsg());
......@@ -2179,8 +2176,8 @@ public class OrderServiceImpl implements IOrderService {
}
/**
* @param order
* @param orderParam
* @param order 原单数据
* @param orderParam 售后单数据
* @param orderType
* @param now
* @param createBy
......@@ -2196,35 +2193,38 @@ public class OrderServiceImpl implements IOrderService {
if (org.springframework.util.StringUtils.isEmpty(orderSn)) {
return new ResultObject(ResultCodeEnum.FAIL.getCode(), ResultCodeEnum.FAIL.getMsg());
}
order.setOrderSn(orderSn);
order.setOrderType(orderType);
orderParam.setOrderSn(orderSn);
orderParam.setOrderType(orderType);
byte activeStatus = (byte) OrderActiveStatusEnum.ORDER_ACTIVE_STATUS_MECHANIC_NOT_ACCEPT.getActiveStatus();
order.setActiveStatus(activeStatus);
order.setRepairReason(orderParam.getRepairReason());
if (BizConstants.ORDER_AFTER_SALE_TYPE_CHANGE_CAR == afterSaleType) {
order.setCarBrand(orderParam.getCarBrand());
order.setCarSeries(orderParam.getCarSeries());
order.setCarType(orderParam.getCarType());
order.setCarColor(orderParam.getCarColor());
orderParam.setActiveStatus(activeStatus);
orderParam.setServiceCode(order.getServiceCode());
orderParam.setShopId(order.getShopId());
orderParam.setContact(order.getContact());
orderParam.setPhoneNumber(order.getPhoneNumber());
orderParam.setMerchantId(order.getMerchantId());
orderParam.setMechanicId(order.getMechanicId());
orderParam.setCreateTime(now);
orderParam.setCreateBy(createBy);
if (BizConstants.ORDER_AFTER_SALE_TYPE_REPAIR == afterSaleType || BizConstants.ORDER_AFTER_SALE_TYPE_DISMANTLE == afterSaleType) {
orderParam.setCarBrand(order.getCarBrand());
orderParam.setCarSeries(order.getCarSeries());
orderParam.setCarType(order.getCarType());
orderParam.setCarColor(order.getCarColor());
/*
* 更换车辆,拆除单显示旧车架号,安装单显示新的车架号
*/
if (BizConstants.ORDER_TYPE_INSTALL == orderType) {
order.setVinNo(orderParam.getVinNo());
orderParam.setVinNo(order.getVinNo());
}
}
order.setExpectInstallTime(orderParam.getExpectInstallTime());
order.setDistrict(orderParam.getDistrict());
order.setAddress(orderParam.getAddress());
order.setCreateTime(now);
order.setCreateBy(createBy);
int num = insertSelective(order);
orderParam.setServiceType(order.getServiceType());
int num = insertSelective(orderParam);
/*
* 增加订单进度
*/
if (num >0) {
SysOrderStatus sysOrderStatus = new SysOrderStatus();
sysOrderStatus.setOrderId(order.getId());
sysOrderStatus.setOrderId(orderParam.getId());
sysOrderStatus.setUpdateBy(createBy);
sysOrderStatus.setUpdateTime(now);
sysOrderStatus.setActiveStatus(activeStatus);
......@@ -2232,7 +2232,37 @@ public class OrderServiceImpl implements IOrderService {
sysOrderStatus.setRemark("售后单");
insertOrderStatus(sysOrderStatus);
}
/*
* 根据不同售后,把原单设备同步进新单
*/
Integer orderId = orderParam.getId();
if (BizConstants.ORDER_AFTER_SALE_TYPE_CHANGE_CAR == afterSaleType || BizConstants.ORDER_AFTER_SALE_TYPE_DISMANTLE == afterSaleType) {
Integer originalOrderId = order.getId();
SysOrderDevice orderDevice = new SysOrderDevice();
orderDevice.setOrderId(originalOrderId);
List<SysOrderDevice> orderDeviceList = orderDeviceDao.getOrderDeviceList(orderDevice);
for (SysOrderDevice sysOrderDevice : orderDeviceList) {
SysOrderDevice oDevice = new SysOrderDevice();
oDevice.setOrderId(orderId);
oDevice.setDeviceNo(sysOrderDevice.getDeviceNo());
oDevice.setDeviceType(sysOrderDevice.getDeviceType());
orderDeviceDao.insertSelective(oDevice);
}
} else if (BizConstants.ORDER_AFTER_SALE_TYPE_REPAIR == afterSaleType) {
String orderDeviceIds = order.getOrderDeviceIds();
if (StringUtil.isNotEmpty(orderDeviceIds)) {
String[] orderDeviceIdArray = orderDeviceIds.split(BizConstants.SEPARATOR);
for(String deviceId : orderDeviceIdArray) {
Integer orderDeviceId = Integer.parseInt(deviceId);
SysOrderDevice sysOrderDevice = orderDeviceDao.selectByPrimaryKey(orderDeviceId);
SysOrderDevice oDevice = new SysOrderDevice();
oDevice.setOrderId(orderId);
oDevice.setDeviceNo(sysOrderDevice.getDeviceNo());
oDevice.setDeviceType(sysOrderDevice.getDeviceType());
orderDeviceDao.insertSelective(oDevice);
}
}
}
return result;
}
......
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.glsx.ordercenter.mapper.SysOrderDeviceMapper">
<resultMap id="BaseResultMap" type="com.glsx.ordercenter.pojo.SysOrderDevice">
<id column="id" jdbcType="INTEGER" property="id" />
<result column="order_id" jdbcType="INTEGER" property="orderId" />
<result column="device_no" jdbcType="VARCHAR" property="deviceNo" />
<result column="device_type" jdbcType="VARCHAR" property="deviceType" />
<result column="install_location" jdbcType="VARCHAR" property="installLocation" />
</resultMap>
<sql id="Base_Column_List">
id, order_id, device_no, device_type, install_location
</sql>
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from sys_order_device
where id = #{id,jdbcType=INTEGER}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
delete from sys_order_device
where id = #{id,jdbcType=INTEGER}
</delete>
<insert id="insert" parameterType="com.glsx.ordercenter.pojo.SysOrderDevice">
<selectKey keyProperty="id" order="AFTER" resultType="java.lang.Integer">
SELECT LAST_INSERT_ID()
</selectKey>
insert into sys_order_device (order_id, device_no, device_type,
install_location)
values (#{orderId,jdbcType=INTEGER}, #{deviceNo,jdbcType=VARCHAR}, #{deviceType,jdbcType=VARCHAR},
#{installLocation,jdbcType=VARCHAR})
</insert>
<insert id="insertSelective" parameterType="com.glsx.ordercenter.pojo.SysOrderDevice">
<selectKey keyProperty="id" order="AFTER" resultType="java.lang.Integer">
SELECT LAST_INSERT_ID()
</selectKey>
insert into sys_order_device
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="orderId != null">
order_id,
</if>
<if test="deviceNo != null">
device_no,
</if>
<if test="deviceType != null">
device_type,
</if>
<if test="installLocation != null">
install_location,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="orderId != null">
#{orderId,jdbcType=INTEGER},
</if>
<if test="deviceNo != null">
#{deviceNo,jdbcType=VARCHAR},
</if>
<if test="deviceType != null">
#{deviceType,jdbcType=VARCHAR},
</if>
<if test="installLocation != null">
#{installLocation,jdbcType=VARCHAR},
</if>
</trim>
</insert>
<update id="updateByPrimaryKeySelective" parameterType="com.glsx.ordercenter.pojo.SysOrderDevice">
update sys_order_device
<set>
<if test="orderId != null">
order_id = #{orderId,jdbcType=INTEGER},
</if>
<if test="deviceNo != null">
device_no = #{deviceNo,jdbcType=VARCHAR},
</if>
<if test="deviceType != null">
device_type = #{deviceType,jdbcType=VARCHAR},
</if>
<if test="installLocation != null">
install_location = #{installLocation,jdbcType=VARCHAR},
</if>
</set>
where id = #{id,jdbcType=INTEGER}
</update>
<update id="updateByPrimaryKey" parameterType="com.glsx.ordercenter.pojo.SysOrderDevice">
update sys_order_device
set order_id = #{orderId,jdbcType=INTEGER},
device_no = #{deviceNo,jdbcType=VARCHAR},
device_type = #{deviceType,jdbcType=VARCHAR},
install_location = #{installLocation,jdbcType=VARCHAR}
where id = #{id,jdbcType=INTEGER}
</update>
<select id="getOrderDeviceList" parameterType="com.glsx.ordercenter.pojo.SysOrderDevice" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from sys_order_device
where order_id = #{orderId,jdbcType=INTEGER}
</select>
</mapper>
\ No newline at end of file
......@@ -170,10 +170,8 @@
#{serviceCode}
)
</insert>
<insert id="insertSelective" parameterType="com.glsx.ordercenter.pojo.SysOrder">
<selectKey keyProperty="id" order="AFTER" resultType="java.lang.Integer">
SELECT LAST_INSERT_ID()
</selectKey>
<insert id="insertSelective" parameterType="com.glsx.ordercenter.pojo.SysOrder" useGeneratedKeys="true"
keyProperty="id">
insert into sys_order
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="orderSn != null">
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!