Commit 0fcd7b36 by xiaoyj

提交代码

git-svn-id: svn://192.168.3.233/frms/code/car-service/trunk/car-service@22061 aeb6102e-e053-11e5-9fec-f9ebc45caf4b
1 parent d48febca
......@@ -49,4 +49,6 @@ public interface SysDeviceMapper {
* @return
*/
int updateDevicesByIndentNo(String indentNo);
List<SysDevice> getByIndentNo(String indentNo);
}
\ No newline at end of file
......@@ -36,4 +36,11 @@ public interface DeviceService {
* @param userId
*/
void addDevice(int userId,String deviceNo,String installDeviceType,Integer deviceSource);
/**
* 技工确认收货修改服务商设备状态为出库
* @param indentNo
* @return
*/
int updateServiceDeviceStatu(String indentNo);
}
......@@ -67,14 +67,14 @@ public class DeviceServiceImpl implements DeviceService{
public ResultObject checkAndInserts(List<String> deviceNos, SysIndent sysIndent, int userId) {
List<SysDevice> list = new ArrayList<>();
List<ErrorDevice> errorDevices=new ArrayList<>();
if (sysIndent.getSendType() == 2) {
//运营发货(处理方式每次传进来的列表覆盖数据库现有列表)
//1.清除用户的订货单设备
SysDevice device=new SysDevice();
device.setUserId(userId);
device.setIndentNo(sysIndent.getIndentNo());
sysDeviceMapper.deleteDevices(device);
//1.清除用户的订货单设备
SysDevice device=new SysDevice();
device.setUserId(userId);
device.setIndentNo(sysIndent.getIndentNo());
sysDeviceMapper.deleteDevices(device);
if (sysIndent.getSendType() == 2) {
for (int i = 0; i < deviceNos.size(); i++) {
String deviceNo = deviceNos.get(i);
//设备重复校验
......@@ -101,41 +101,38 @@ public class DeviceServiceImpl implements DeviceService{
inserts(list);
}
if(sysIndent.getSendType()==1){
//服务商发货(处理方式是刷新列表中不是登录用户的设备)
for (int i = 0; i < deviceNos.size(); i++) {
String deviceNo = deviceNos.get(i);
//判断设备是否已经属于该技工
//设备重复校验
SysDevice sysDevice1 = deviceRepeat(deviceNo, userId);
if(sysDevice1!=null && !sysIndent.getIndentNo().equals(sysDevice1.getIndentNo())){
ErrorDevice errorDevice=new ErrorDevice();
if (sysDevice1 != null) {
ErrorDevice errorDevice = new ErrorDevice();
errorDevice.setDeviceNo(deviceNo);
errorDevice.setError("你的库存存在设备号");
errorDevices.add(errorDevice);
}
if(sysDevice1==null){
//查询该设备是否在技工的服务商列表中
SysDevice sysDevice = new SysDevice();
sysDevice = getByDeviceNoAndUserId(deviceNo, userId);
if (sysDevice == null) {
ErrorDevice errorDevice=new ErrorDevice();
errorDevice.setDeviceNo(deviceNo);
errorDevice.setError("设备不属于你的服务商库存");
errorDevices.add(errorDevice);
}else{
Date date = new Date();
sysDevice.setUpdateTime(date);
sysDevice.setStockTime(date);
sysDevice.setUserId(userId);
sysDevice.setIndentNo(sysIndent.getIndentNo());
sysDevice.setUpdateBy(userId);
list.add(sysDevice);
}
//查询该设备是否在技工的服务商列表中
SysDevice sysDevice = new SysDevice();
sysDevice = getByDeviceNoAndUserId(deviceNo, userId);
if (sysDevice == null) {
ErrorDevice errorDevice=new ErrorDevice();
errorDevice.setDeviceNo(deviceNo);
errorDevice.setError("设备不属于你的服务商库存");
errorDevices.add(errorDevice);
}else{
Date date = new Date();
sysDevice.setUpdateTime(date);
sysDevice.setStockTime(date);
sysDevice.setUserId(userId);
sysDevice.setIndentNo(sysIndent.getIndentNo());
sysDevice.setUpdateBy(userId);
list.add(sysDevice);
}
}
if(errorDevices.size()>0){
return new ResultObject(ResultCodeEnum.SUCCESS.getCode(),errorDevices);
}
updates(list);
inserts(list);
}
return new ResultObject(ResultCodeEnum.SUCCESS.getCode(), ResultCodeEnum.SUCCESS.getMsg());
}
......@@ -167,4 +164,10 @@ public class DeviceServiceImpl implements DeviceService{
sysDeviceMapper.updateByPrimaryKeySelective(sysDevice);
}
}
@Override
public int updateServiceDeviceStatu(String indentNo) {
List<SysDevice> list=sysDeviceMapper.getByIndentNo(indentNo);
return sysDeviceMapper.updates(list);
}
}
......@@ -8,6 +8,7 @@ import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import com.glsx.ordercenter.service.*;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -41,12 +42,6 @@ import com.glsx.ordercenter.pojo.SysIndentLog;
import com.glsx.ordercenter.pojo.SysIndentLogModel;
import com.glsx.ordercenter.pojo.SysIndentLogistics;
import com.glsx.ordercenter.pojo.SysReceiveAddress;
import com.glsx.ordercenter.service.DeviceRepertoryService;
import com.glsx.ordercenter.service.IAreaService;
import com.glsx.ordercenter.service.IndentLogisticsService;
import com.glsx.ordercenter.service.IndentService;
import com.glsx.ordercenter.service.LogisticsService;
import com.glsx.ordercenter.service.ReceiveAddressService;
@Service
public class IndentServiceImpl implements IndentService {
......@@ -85,6 +80,9 @@ public class IndentServiceImpl implements IndentService {
@Autowired
private CommonClient commonClient;
@Autowired
private DeviceService deviceService;
@Override
@Transactional
......@@ -560,6 +558,12 @@ public class IndentServiceImpl implements IndentService {
* 确认收货更新订货单设备的入库时间
*/
deviceDao.updateDevicesByIndentNo(indent.getIndentNo());
/**
* 如果订单类型是服务商发货把服务上这些设备改成已出库
*/
if(indent.getSendType()==1){
deviceService.updateServiceDeviceStatu(indent.getIndentNo());
}
/*
* 添加操作日志
*/
......
......@@ -378,47 +378,10 @@
</foreach>
</insert>
<update id="updates" parameterType="java.util.List">
UPDATE sys_device
<trim prefix="set" suffixOverrides=",">
<trim prefix="user_id =case" suffix="end,">
<foreach collection="list" item="i" index="index">
<if test="i.userId!=null">
when id=#{i.id} then #{i.userId}
</if>
</foreach>
</trim>
<trim prefix="update_by =case" suffix="end,">
<foreach collection="list" item="i" index="index">
<if test="i.updateBy!=null">
when id=#{i.id} then #{i.updateBy}
</if>
</foreach>
</trim>
<trim prefix="update_time =case" suffix="end,">
<foreach collection="list" item="i" index="index">
<if test="i.updateTime!=null">
when id=#{i.id} then #{i.updateTime}
</if>
</foreach>
</trim>
<trim prefix="stock_time =case" suffix="end,">
<foreach collection="list" item="i" index="index">
<if test="i.stockTime!=null">
when id=#{i.id} then #{i.stockTime}
</if>
</foreach>
</trim>
<trim prefix="indent_no =case" suffix="end,">
<foreach collection="list" item="i" index="index">
<if test="i.indentNo!=null">
when id=#{i.id} then #{i.indentNo}
</if>
</foreach>
</trim>
</trim>
UPDATE sys_device set device_status=3
where
<foreach collection="list" separator="or" item="i" index="index" >
id=#{i.id}
device_no=#{i.deviceNo} and user_id !=#{userId}
</foreach>
</update>
......@@ -434,4 +397,8 @@
UPDATE sys_device SET stock_time=now() where indent_no=#{indentNo}
</update>
<select id="getByIndentNo" resultMap="BaseResultMap">
SELECT * from sys_device where indent_no=#{indentNo}
</select>
</mapper>
\ No newline at end of file
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!