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 { ...@@ -49,4 +49,6 @@ public interface SysDeviceMapper {
* @return * @return
*/ */
int updateDevicesByIndentNo(String indentNo); int updateDevicesByIndentNo(String indentNo);
List<SysDevice> getByIndentNo(String indentNo);
} }
\ No newline at end of file \ No newline at end of file
...@@ -36,4 +36,11 @@ public interface DeviceService { ...@@ -36,4 +36,11 @@ public interface DeviceService {
* @param userId * @param userId
*/ */
void addDevice(int userId,String deviceNo,String installDeviceType,Integer deviceSource); 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{ ...@@ -67,14 +67,14 @@ public class DeviceServiceImpl implements DeviceService{
public ResultObject checkAndInserts(List<String> deviceNos, SysIndent sysIndent, int userId) { public ResultObject checkAndInserts(List<String> deviceNos, SysIndent sysIndent, int userId) {
List<SysDevice> list = new ArrayList<>(); List<SysDevice> list = new ArrayList<>();
List<ErrorDevice> errorDevices=new ArrayList<>(); List<ErrorDevice> errorDevices=new ArrayList<>();
if (sysIndent.getSendType() == 2) {
//运营发货(处理方式每次传进来的列表覆盖数据库现有列表)
//1.清除用户的订货单设备 //1.清除用户的订货单设备
SysDevice device=new SysDevice(); SysDevice device=new SysDevice();
device.setUserId(userId); device.setUserId(userId);
device.setIndentNo(sysIndent.getIndentNo()); device.setIndentNo(sysIndent.getIndentNo());
sysDeviceMapper.deleteDevices(device); sysDeviceMapper.deleteDevices(device);
if (sysIndent.getSendType() == 2) {
for (int i = 0; i < deviceNos.size(); i++) { for (int i = 0; i < deviceNos.size(); i++) {
String deviceNo = deviceNos.get(i); String deviceNo = deviceNos.get(i);
//设备重复校验 //设备重复校验
...@@ -101,18 +101,16 @@ public class DeviceServiceImpl implements DeviceService{ ...@@ -101,18 +101,16 @@ public class DeviceServiceImpl implements DeviceService{
inserts(list); inserts(list);
} }
if(sysIndent.getSendType()==1){ if(sysIndent.getSendType()==1){
//服务商发货(处理方式是刷新列表中不是登录用户的设备)
for (int i = 0; i < deviceNos.size(); i++) { for (int i = 0; i < deviceNos.size(); i++) {
String deviceNo = deviceNos.get(i); String deviceNo = deviceNos.get(i);
//判断设备是否已经属于该技工 //设备重复校验
SysDevice sysDevice1 = deviceRepeat(deviceNo, userId); SysDevice sysDevice1 = deviceRepeat(deviceNo, userId);
if(sysDevice1!=null && !sysIndent.getIndentNo().equals(sysDevice1.getIndentNo())){ if (sysDevice1 != null) {
ErrorDevice errorDevice=new ErrorDevice(); ErrorDevice errorDevice = new ErrorDevice();
errorDevice.setDeviceNo(deviceNo); errorDevice.setDeviceNo(deviceNo);
errorDevice.setError("你的库存存在设备号"); errorDevice.setError("你的库存存在设备号");
errorDevices.add(errorDevice); errorDevices.add(errorDevice);
} }
if(sysDevice1==null){
//查询该设备是否在技工的服务商列表中 //查询该设备是否在技工的服务商列表中
SysDevice sysDevice = new SysDevice(); SysDevice sysDevice = new SysDevice();
sysDevice = getByDeviceNoAndUserId(deviceNo, userId); sysDevice = getByDeviceNoAndUserId(deviceNo, userId);
...@@ -131,11 +129,10 @@ public class DeviceServiceImpl implements DeviceService{ ...@@ -131,11 +129,10 @@ public class DeviceServiceImpl implements DeviceService{
list.add(sysDevice); list.add(sysDevice);
} }
} }
}
if(errorDevices.size()>0){ if(errorDevices.size()>0){
return new ResultObject(ResultCodeEnum.SUCCESS.getCode(),errorDevices); return new ResultObject(ResultCodeEnum.SUCCESS.getCode(),errorDevices);
} }
updates(list); inserts(list);
} }
return new ResultObject(ResultCodeEnum.SUCCESS.getCode(), ResultCodeEnum.SUCCESS.getMsg()); return new ResultObject(ResultCodeEnum.SUCCESS.getCode(), ResultCodeEnum.SUCCESS.getMsg());
} }
...@@ -167,4 +164,10 @@ public class DeviceServiceImpl implements DeviceService{ ...@@ -167,4 +164,10 @@ public class DeviceServiceImpl implements DeviceService{
sysDeviceMapper.updateByPrimaryKeySelective(sysDevice); 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; ...@@ -8,6 +8,7 @@ import java.util.Map;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import com.glsx.ordercenter.service.*;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
...@@ -41,12 +42,6 @@ import com.glsx.ordercenter.pojo.SysIndentLog; ...@@ -41,12 +42,6 @@ import com.glsx.ordercenter.pojo.SysIndentLog;
import com.glsx.ordercenter.pojo.SysIndentLogModel; import com.glsx.ordercenter.pojo.SysIndentLogModel;
import com.glsx.ordercenter.pojo.SysIndentLogistics; import com.glsx.ordercenter.pojo.SysIndentLogistics;
import com.glsx.ordercenter.pojo.SysReceiveAddress; 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 @Service
public class IndentServiceImpl implements IndentService { public class IndentServiceImpl implements IndentService {
...@@ -86,6 +81,9 @@ public class IndentServiceImpl implements IndentService { ...@@ -86,6 +81,9 @@ public class IndentServiceImpl implements IndentService {
@Autowired @Autowired
private CommonClient commonClient; private CommonClient commonClient;
@Autowired
private DeviceService deviceService;
@Override @Override
@Transactional @Transactional
public ResultObject add(HttpServletRequest request, SysIndent indent) { public ResultObject add(HttpServletRequest request, SysIndent indent) {
...@@ -560,6 +558,12 @@ public class IndentServiceImpl implements IndentService { ...@@ -560,6 +558,12 @@ public class IndentServiceImpl implements IndentService {
* 确认收货更新订货单设备的入库时间 * 确认收货更新订货单设备的入库时间
*/ */
deviceDao.updateDevicesByIndentNo(indent.getIndentNo()); deviceDao.updateDevicesByIndentNo(indent.getIndentNo());
/**
* 如果订单类型是服务商发货把服务上这些设备改成已出库
*/
if(indent.getSendType()==1){
deviceService.updateServiceDeviceStatu(indent.getIndentNo());
}
/* /*
* 添加操作日志 * 添加操作日志
*/ */
......
...@@ -378,47 +378,10 @@ ...@@ -378,47 +378,10 @@
</foreach> </foreach>
</insert> </insert>
<update id="updates" parameterType="java.util.List"> <update id="updates" parameterType="java.util.List">
UPDATE sys_device UPDATE sys_device set device_status=3
<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>
where where
<foreach collection="list" separator="or" item="i" index="index" > <foreach collection="list" separator="or" item="i" index="index" >
id=#{i.id} device_no=#{i.deviceNo} and user_id !=#{userId}
</foreach> </foreach>
</update> </update>
...@@ -434,4 +397,8 @@ ...@@ -434,4 +397,8 @@
UPDATE sys_device SET stock_time=now() where indent_no=#{indentNo} UPDATE sys_device SET stock_time=now() where indent_no=#{indentNo}
</update> </update>
<select id="getByIndentNo" resultMap="BaseResultMap">
SELECT * from sys_device where indent_no=#{indentNo}
</select>
</mapper> </mapper>
\ No newline at end of file \ 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!