Commit c1a7f6b6 by zhanghj

V1.2.0--修复技工新增订货单后,给所属服务商发短信问题

git-svn-id: svn://192.168.3.233/frms/code/car-service/trunk/car-service@22105 aeb6102e-e053-11e5-9fec-f9ebc45caf4b
1 parent f84d192e
...@@ -9,6 +9,7 @@ import java.util.Map; ...@@ -9,6 +9,7 @@ import java.util.Map;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import com.glsx.ordercenter.service.*; 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;
...@@ -42,6 +43,7 @@ import com.glsx.ordercenter.pojo.SysIndentLog; ...@@ -42,6 +43,7 @@ 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.pojo.user.SysUser;
@Service @Service
public class IndentServiceImpl implements IndentService { public class IndentServiceImpl implements IndentService {
...@@ -94,7 +96,6 @@ public class IndentServiceImpl implements IndentService { ...@@ -94,7 +96,6 @@ public class IndentServiceImpl implements IndentService {
Integer indentStatus = IndentStatusEnum.INDENT_WAITDELIVER.getIndentStatus(); Integer indentStatus = IndentStatusEnum.INDENT_WAITDELIVER.getIndentStatus();
String mechanicName = ""; String mechanicName = "";
String servicePhone = "";
/* /*
* 技工端发订货单,先判断发货方式 * 技工端发订货单,先判断发货方式
*/ */
...@@ -110,7 +111,6 @@ public class IndentServiceImpl implements IndentService { ...@@ -110,7 +111,6 @@ public class IndentServiceImpl implements IndentService {
if (BizConstants.INDENT_SEND_TYPE_SERVICE == userSendType) { if (BizConstants.INDENT_SEND_TYPE_SERVICE == userSendType) {
sendType = BizConstants.INDENT_SEND_TYPE_SERVICE; sendType = BizConstants.INDENT_SEND_TYPE_SERVICE;
mechanicName = object.getString("name"); mechanicName = object.getString("name");
servicePhone = object.getString("phoneNumber");
} }
} }
} }
...@@ -148,7 +148,7 @@ public class IndentServiceImpl implements IndentService { ...@@ -148,7 +148,7 @@ public class IndentServiceImpl implements IndentService {
//给对应服务商发短信 //给对应服务商发短信
try { try {
logger.info("技工端增加订货单,发送短信给服务商!"); logger.info("技工端增加订货单,发送短信给服务商!");
sendIndentSmsToService(mechanicName, servicePhone, indentNo); sendIndentSmsToService(mechanicName, currentUserId, indentNo);
} catch (Exception e) { } catch (Exception e) {
logger.error("技工端增加订货单,发送短信给服务商失败", e); logger.error("技工端增加订货单,发送短信给服务商失败", e);
} }
...@@ -166,11 +166,26 @@ public class IndentServiceImpl implements IndentService { ...@@ -166,11 +166,26 @@ public class IndentServiceImpl implements IndentService {
return new ResultObject(ResultCodeEnum.SUCCESS.getCode(), ResultCodeEnum.SUCCESS.getMsg()); return new ResultObject(ResultCodeEnum.SUCCESS.getCode(), ResultCodeEnum.SUCCESS.getMsg());
} }
private void sendIndentSmsToService(String mechanicName, String phone, private void sendIndentSmsToService(String mechanicName, Integer mechanicUserId,
String indentNo) { String indentNo) {
// TODO Auto-generated method stub // TODO Auto-generated method stub
commonClient.sendIndentSmsToService(mechanicName, phone, indentNo); /*
* 获取技工所属服务商
*/
JSONObject object = userClient.getMechanicSP(mechanicUserId);
String phone = null;
if (object != null && object.getIntValue("code") == ResultCodeEnum.SUCCESS.getCode()) {
SysUser user = object.getObject("data", SysUser.class);
if (user != null) {
phone = user.getPhoneNumber();
}
} else {
throw BusinessException.create(ResultCodeEnum.FAIL.getCode(), ResultCodeEnum.FAIL.getMsg());
}
if (!StringUtils.isEmpty(phone)) {
commonClient.sendIndentSmsToService(mechanicName, phone, indentNo);
}
} }
@Override @Override
...@@ -531,7 +546,10 @@ public class IndentServiceImpl implements IndentService { ...@@ -531,7 +546,10 @@ public class IndentServiceImpl implements IndentService {
if(userType == Constants.USER_TYPE_MECHANIC){ if(userType == Constants.USER_TYPE_MECHANIC){
JSONObject object = userClient.getMechanicSP(userId); JSONObject object = userClient.getMechanicSP(userId);
if (object != null && object.getIntValue("code") == ResultCodeEnum.SUCCESS.getCode()) { if (object != null && object.getIntValue("code") == ResultCodeEnum.SUCCESS.getCode()) {
serviceId = object.getInteger("data"); SysUser user = object.getObject("data", SysUser.class);
if (user != null) {
serviceId = user.getId();
}
} else { } else {
throw BusinessException.create(ResultCodeEnum.FAIL.getCode(), ResultCodeEnum.FAIL.getMsg()); throw BusinessException.create(ResultCodeEnum.FAIL.getCode(), ResultCodeEnum.FAIL.getMsg());
} }
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!