Commit cb542346 by yuanlin

提交包活干检修安装拆除审核驳回 finished by yuanlin

git-svn-id: svn://192.168.3.233/frms/code/car-service/trunk/car-service@26583 aeb6102e-e053-11e5-9fec-f9ebc45caf4b
1 parent 6b2cc9d9
...@@ -3,7 +3,6 @@ package com.glsx.ordercenter.controller.api; ...@@ -3,7 +3,6 @@ package com.glsx.ordercenter.controller.api;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.glsx.common.constants.ResultObject;
import com.glsx.ordercenter.constants.ResultCodeEnum; import com.glsx.ordercenter.constants.ResultCodeEnum;
import com.glsx.ordercenter.controller.BaseController; import com.glsx.ordercenter.controller.BaseController;
import com.glsx.ordercenter.dto.req.*; import com.glsx.ordercenter.dto.req.*;
...@@ -12,6 +11,8 @@ import com.glsx.ordercenter.service.DaSouCheOrderService; ...@@ -12,6 +11,8 @@ import com.glsx.ordercenter.service.DaSouCheOrderService;
import com.glsx.ordercenter.utils.DaSouCheUtil; import com.glsx.ordercenter.utils.DaSouCheUtil;
import com.souche.api.SoucheApiException; import com.souche.api.SoucheApiException;
import com.souche.api.util.SoucheSignature; import com.souche.api.util.SoucheSignature;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
...@@ -20,6 +21,7 @@ import org.springframework.web.bind.annotation.RequestMapping; ...@@ -20,6 +21,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import java.util.List;
import java.util.Map; import java.util.Map;
/** /**
...@@ -50,6 +52,10 @@ public class DaSouCheOrderController extends BaseController { ...@@ -50,6 +52,10 @@ public class DaSouCheOrderController extends BaseController {
logger.info("saveOrder params:{}", daSouCheBaseReq); logger.info("saveOrder params:{}", daSouCheBaseReq);
DaSouCheInstallOrderReq orderReq = JSON.parseObject(daSouCheBaseReq.getData(), DaSouCheInstallOrderReq.class); DaSouCheInstallOrderReq orderReq = JSON.parseObject(daSouCheBaseReq.getData(), DaSouCheInstallOrderReq.class);
try { try {
String errorStr = DaSouCheUtil.valiateInstall(orderReq);
if(StringUtils.isNotBlank(errorStr)){
return new DSCResultObject(ResultCodeEnum.PARAM_ERROR.getCode()+"",errorStr);
}
Map<String, String> map = DaSouCheUtil.doGetSign(daSouCheBaseReq); Map<String, String> map = DaSouCheUtil.doGetSign(daSouCheBaseReq);
String sign = SoucheSignature.sign(map, appSecret); String sign = SoucheSignature.sign(map, appSecret);
logger.info("saveOrder 系统签名#{}", sign); logger.info("saveOrder 系统签名#{}", sign);
...@@ -75,6 +81,10 @@ public class DaSouCheOrderController extends BaseController { ...@@ -75,6 +81,10 @@ public class DaSouCheOrderController extends BaseController {
logger.info("repairOrder params:{}", daSouCheBaseReq); logger.info("repairOrder params:{}", daSouCheBaseReq);
DaSouCheRepairOrderReq repairOrderReq = JSON.parseObject(daSouCheBaseReq.getData(), DaSouCheRepairOrderReq.class); DaSouCheRepairOrderReq repairOrderReq = JSON.parseObject(daSouCheBaseReq.getData(), DaSouCheRepairOrderReq.class);
try { try {
String errorStr = DaSouCheUtil.valiateRepair(repairOrderReq);
if(StringUtils.isNotBlank(errorStr)){
return new DSCResultObject(ResultCodeEnum.PARAM_ERROR.getCode()+"",errorStr);
}
Map<String, String> map = DaSouCheUtil.doGetSign(daSouCheBaseReq); Map<String, String> map = DaSouCheUtil.doGetSign(daSouCheBaseReq);
String sign = SoucheSignature.sign(map, appSecret); String sign = SoucheSignature.sign(map, appSecret);
logger.info("repairOrder 系统签名#{}", sign); logger.info("repairOrder 系统签名#{}", sign);
...@@ -99,6 +109,10 @@ public class DaSouCheOrderController extends BaseController { ...@@ -99,6 +109,10 @@ public class DaSouCheOrderController extends BaseController {
logger.info("removeOrder params:{}", daSouCheBaseReq); logger.info("removeOrder params:{}", daSouCheBaseReq);
DaSouCheRemoveOrderReq removeOrderReq = JSON.parseObject(daSouCheBaseReq.getData(), DaSouCheRemoveOrderReq.class); DaSouCheRemoveOrderReq removeOrderReq = JSON.parseObject(daSouCheBaseReq.getData(), DaSouCheRemoveOrderReq.class);
try { try {
String errorStr = DaSouCheUtil.valiateRemove(removeOrderReq);
if(StringUtils.isNotBlank(errorStr)){
return new DSCResultObject(ResultCodeEnum.PARAM_ERROR.getCode()+"",errorStr);
}
Map<String, String> map = DaSouCheUtil.doGetSign(daSouCheBaseReq); Map<String, String> map = DaSouCheUtil.doGetSign(daSouCheBaseReq);
String sign = SoucheSignature.sign(map, appSecret); String sign = SoucheSignature.sign(map, appSecret);
logger.info("removeOrder 系统签名#{}", sign); logger.info("removeOrder 系统签名#{}", sign);
...@@ -149,6 +163,16 @@ public class DaSouCheOrderController extends BaseController { ...@@ -149,6 +163,16 @@ public class DaSouCheOrderController extends BaseController {
logger.info("checkOrder params:{}", daSouCheBaseReq); logger.info("checkOrder params:{}", daSouCheBaseReq);
DaSouCheCheckReq cheCheckReq = JSON.parseObject(daSouCheBaseReq.getData(), DaSouCheCheckReq.class); DaSouCheCheckReq cheCheckReq = JSON.parseObject(daSouCheBaseReq.getData(), DaSouCheCheckReq.class);
try { try {
StringBuffer errorStr = new StringBuffer();
if(StringUtils.isBlank(cheCheckReq.getTicketNo())){
errorStr.append("工单编号不能为空");
}
if(cheCheckReq.getAuditResult() == null){
errorStr.append("审核结果不能为空");
}
if(StringUtils.isNotBlank(errorStr.toString())){
return new DSCResultObject(ResultCodeEnum.PARAM_ERROR.getCode()+"",errorStr);
}
Map<String, String> map = DaSouCheUtil.doGetSign(daSouCheBaseReq); Map<String, String> map = DaSouCheUtil.doGetSign(daSouCheBaseReq);
String sign = SoucheSignature.sign(map, appSecret); String sign = SoucheSignature.sign(map, appSecret);
logger.info("checkOrder 系统签名#{}", sign); logger.info("checkOrder 系统签名#{}", sign);
......
package com.glsx.ordercenter.dto.req; package com.glsx.ordercenter.dto.req;
import javax.validation.constraints.NotBlank; import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.groups.Default; import javax.validation.groups.Default;
import java.io.Serializable; import java.io.Serializable;
...@@ -10,7 +11,7 @@ public class DaSouCheCheckReq implements Serializable { ...@@ -10,7 +11,7 @@ public class DaSouCheCheckReq implements Serializable {
@NotBlank(message="工单编号不能为空", groups={Default.class}) @NotBlank(message="工单编号不能为空", groups={Default.class})
private String ticketNo; private String ticketNo;
//0:不通过 1:通过 //0:不通过 1:通过
@NotBlank(message="审核结果不能为空", groups={Default.class}) @NotNull(message="审核结果不能为空", groups={Default.class})
private Integer auditResult; private Integer auditResult;
private String reason; private String reason;
......
package com.glsx.ordercenter.dto.req; package com.glsx.ordercenter.dto.req;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.groups.Default;
import java.io.Serializable; import java.io.Serializable;
public class DaSouCheDevice implements Serializable { public class DaSouCheDevice implements Serializable {
...@@ -9,11 +12,13 @@ public class DaSouCheDevice implements Serializable { ...@@ -9,11 +12,13 @@ public class DaSouCheDevice implements Serializable {
/** /**
* 故障设备编号 * 故障设备编号
*/ */
@NotBlank(message="devNo不能为空", groups={Default.class})
private String devNo; private String devNo;
/** /**
* 设备类型 1:有源 2:无源 3:其他 (其他设备需安装无需反馈) 4:微型无源 * 设备类型 1:有源 2:无源 3:其他 (其他设备需安装无需反馈) 4:微型无源
*/ */
@NotNull(message="devType不能为空", groups={Default.class})
private Integer devType; private Integer devType;
/** /**
...@@ -24,11 +29,13 @@ public class DaSouCheDevice implements Serializable { ...@@ -24,11 +29,13 @@ public class DaSouCheDevice implements Serializable {
/** /**
* 安装位置 * 安装位置
*/ */
@NotBlank(message="devPosition不能为空", groups={Default.class})
private String devPosition; private String devPosition;
/** /**
* 设备供应商 * 设备供应商
*/ */
@NotBlank(message="devSupplier不能为空", groups={Default.class})
private String devSupplier; private String devSupplier;
/** /**
...@@ -39,6 +46,7 @@ public class DaSouCheDevice implements Serializable { ...@@ -39,6 +46,7 @@ public class DaSouCheDevice implements Serializable {
/** /**
* 安装确认单 * 安装确认单
*/ */
@NotBlank(message="installConfirm不能为空", groups={Default.class})
private String installConfirm; private String installConfirm;
/** /**
...@@ -49,6 +57,7 @@ public class DaSouCheDevice implements Serializable { ...@@ -49,6 +57,7 @@ public class DaSouCheDevice implements Serializable {
/** /**
* 检修类型 * 检修类型
*/ */
@NotBlank(message="repairType不能为空", groups={Default.class})
private Integer repairType; private Integer repairType;
......
package com.glsx.ordercenter.dto.req;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
public class DaSouCheOrderReq implements Serializable {
private static final long serialVersionUID = 2535099189944653672L;
@NotNull(message = "工单编号不能为空",groups = {Default.class,AuditOrder.class})
private String ticketNo;
@NotNull(message = "审核结果不能为空",groups = AuditOrder.class)
private int auditResult;
/**
* 审核不通过时的原因
*/
private String reason;
public interface Default{}
public interface AuditOrder{}
public String getTicketNo() {
return ticketNo;
}
public void setTicketNo(String ticketNo) {
this.ticketNo = ticketNo;
}
public int getAuditResult() {
return auditResult;
}
public void setAuditResult(int auditResult) {
this.auditResult = auditResult;
}
public String getReason() {
return reason;
}
public void setReason(String reason) {
this.reason = reason;
}
}
package com.glsx.ordercenter.dto.req; package com.glsx.ordercenter.dto.req;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.groups.Default;
import java.io.Serializable; import java.io.Serializable;
public class DaSouCheRemoveDevice implements Serializable { public class DaSouCheRemoveDevice implements Serializable {
...@@ -9,11 +12,13 @@ public class DaSouCheRemoveDevice implements Serializable { ...@@ -9,11 +12,13 @@ public class DaSouCheRemoveDevice implements Serializable {
/** /**
* 故障设备编号 * 故障设备编号
*/ */
@NotBlank(message="devNo不能为空", groups={Default.class})
private String devNo; private String devNo;
/** /**
* 设备类型 1:有源 2:无源 3:其他 (其他设备需安装无需反馈) 4:微型无源 * 设备类型 1:有源 2:无源 3:其他 (其他设备需安装无需反馈) 4:微型无源
*/ */
@NotNull(message="devType不能为空", groups={Default.class})
private Integer devType; private Integer devType;
/** /**
...@@ -24,11 +29,13 @@ public class DaSouCheRemoveDevice implements Serializable { ...@@ -24,11 +29,13 @@ public class DaSouCheRemoveDevice implements Serializable {
/** /**
* 安装位置 * 安装位置
*/ */
@NotBlank(message="devPosition不能为空", groups={Default.class})
private String devPosition; private String devPosition;
/** /**
* 设备供应商 * 设备供应商
*/ */
@NotBlank(message="devSupplier不能为空", groups={Default.class})
private String devSupplier; private String devSupplier;
/** /**
...@@ -39,6 +46,7 @@ public class DaSouCheRemoveDevice implements Serializable { ...@@ -39,6 +46,7 @@ public class DaSouCheRemoveDevice implements Serializable {
/** /**
* 安装确认单 * 安装确认单
*/ */
@NotBlank(message="installConfirm不能为空", groups={Default.class})
private String installConfirm; private String installConfirm;
/** /**
......
...@@ -1458,7 +1458,17 @@ public class OrderServiceImpl implements IOrderService { ...@@ -1458,7 +1458,17 @@ public class OrderServiceImpl implements IOrderService {
} }
} }
} }
SysOrderRepairExample exam = new SysOrderRepairExample();
exam.createCriteria().andOrderIdEqualTo(order.getId());
List<SysOrderRepair> subOrders = orderRepairDao.selectByExample(exam);
if (subOrders != null) {
for(SysOrderRepair orderRepair : subOrders){
if((byte)BizConstants.ORDER_REPAIR_ADD == orderRepair.getAfterSaleType()){
order.setIfAddDevice((byte)BizConstants.ORDER_ADD_DEVICE_IS);
}
}
}
} }
return orderList; return orderList;
...@@ -1499,6 +1509,11 @@ public class OrderServiceImpl implements IOrderService { ...@@ -1499,6 +1509,11 @@ public class OrderServiceImpl implements IOrderService {
subOrderNumber = subOrders.size(); subOrderNumber = subOrders.size();
order.setSubOrderCount(subOrderNumber); order.setSubOrderCount(subOrderNumber);
order.setOrderRepair(subOrders); order.setOrderRepair(subOrders);
for(SysOrderRepair orderRepair : subOrders){
if((byte)BizConstants.ORDER_REPAIR_ADD == orderRepair.getAfterSaleType()){
order.setIfAddDevice((byte)BizConstants.ORDER_ADD_DEVICE_IS);
}
}
} }
// 订单地址信息 // 订单地址信息
if (null != order.getDistrict() && order.getDistrict() > 0) { if (null != order.getDistrict() && order.getDistrict() > 0) {
......
package com.glsx.ordercenter.utils; package com.glsx.ordercenter.utils;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.glsx.ordercenter.dto.req.*;
import org.apache.commons.collections.CollectionUtils; import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang.ArrayUtils; import org.apache.commons.lang.ArrayUtils;
import org.apache.commons.lang.StringUtils;
import java.beans.BeanInfo; import java.beans.BeanInfo;
import java.beans.IntrospectionException; import java.beans.IntrospectionException;
...@@ -24,7 +26,6 @@ public class DaSouCheUtil { ...@@ -24,7 +26,6 @@ public class DaSouCheUtil {
public static Map<String, String> doGetSign(Object base) { public static Map<String, String> doGetSign(Object base) {
Map<String, String> map = new HashMap<>(); Map<String, String> map = new HashMap<>();
javabeanToMap(base,map); javabeanToMap(base,map);
// javabeanToMap(obj,map);
System.out.println("======签名map=========" + map); System.out.println("======签名map=========" + map);
return map; return map;
} }
...@@ -71,7 +72,7 @@ public class DaSouCheUtil { ...@@ -71,7 +72,7 @@ public class DaSouCheUtil {
String key1 = field2.getName(); String key1 = field2.getName();
Object ooo = field2.get(obj); Object ooo = field2.get(obj);
if (ooo == null) { if (ooo == null) {
resultChild.put(key, ""); resultChild.put(key1, "");
} else { } else {
resultChild.put(key1, field2.get(obj)); resultChild.put(key1, field2.get(obj));
} }
...@@ -92,9 +93,7 @@ public class DaSouCheUtil { ...@@ -92,9 +93,7 @@ public class DaSouCheUtil {
} }
} }
} catch (IllegalArgumentException e) { } catch (Exception e) {
e.printStackTrace();
} catch (IllegalAccessException e) {
e.printStackTrace(); e.printStackTrace();
} }
// 还原属性标识 // 还原属性标识
...@@ -293,5 +292,76 @@ public class DaSouCheUtil { ...@@ -293,5 +292,76 @@ public class DaSouCheUtil {
return 0; return 0;
} }
public static String valiateInstall(DaSouCheInstallOrderReq orderReq){
StringBuffer errorStr = new StringBuffer();
if(orderReq.getWirelessDevCount() == null){
errorStr.append("无源设备数量不能为空");
}
if(orderReq.getWirelineDevCount() == null){
errorStr.append("有源设备数量不能为空");
}
if(orderReq.getTinyWirelessDevCount() == null){
errorStr.append("微型无源设备数量不能为空");
}
if(orderReq.getOtherDevCount() == null){
errorStr.append("其他设备数量不能为空");
}
if(orderReq.getInstallMode() == null){
errorStr.append("安装模式不能为空");
}
return errorStr.toString();
}
public static String valiateRepair(DaSouCheRepairOrderReq repairOrderReq) {
List<DaSouCheDevice> devList = repairOrderReq.getDevList();
StringBuffer errorStr = new StringBuffer();
if(CollectionUtils.isNotEmpty(devList)){
for(DaSouCheDevice device : devList){
if(StringUtils.isBlank(device.getDevNo())){
errorStr.append("设备号不能为空");
}
if(device.getDevType()==null){
errorStr.append("设备类型不能为空");
}
if(StringUtils.isBlank(device.getDevPosition())){
errorStr.append("安装位置不能为空");
}
if(StringUtils.isBlank(device.getDevSupplier())){
errorStr.append("供应商不能为空");
}
if(StringUtils.isBlank(device.getInstallConfirm())){
errorStr.append("安装确认不能为空");
}
if(device.getRepairType()==null){
errorStr.append("检修不能为空");
}
}
}
return errorStr.toString();
}
public static String valiateRemove(DaSouCheRemoveOrderReq removeOrderReq) {
List<DaSouCheRemoveDevice> devList = removeOrderReq.getDevList();
StringBuffer errorStr = new StringBuffer();
if(CollectionUtils.isNotEmpty(devList)){
for(DaSouCheRemoveDevice device : devList){
if(StringUtils.isBlank(device.getDevNo())){
errorStr.append("设备号不能为空");
}
if(device.getDevType()==null){
errorStr.append("设备类型不能为空");
}
if(StringUtils.isBlank(device.getDevPosition())){
errorStr.append("安装位置不能为空");
}
if(StringUtils.isBlank(device.getDevSupplier())){
errorStr.append("供应商不能为空");
}
if(StringUtils.isBlank(device.getInstallConfirm())){
errorStr.append("安装确认不能为空");
}
}
}
return errorStr.toString();
}
} }
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!