|
@@ -14,12 +14,14 @@ import org.springframework.web.bind.annotation.RestController;
|
|
|
import com.fuzamei.constant.HintMSG;
|
|
|
import com.fuzamei.constant.RegexConstant;
|
|
|
import com.fuzamei.constant.Role;
|
|
|
-import com.fuzamei.constant.Status;
|
|
|
+import com.fuzamei.constant.Statuses;
|
|
|
import com.fuzamei.entity.Orders;
|
|
|
import com.fuzamei.entity.Params;
|
|
|
+import com.fuzamei.entity.Status;
|
|
|
import com.fuzamei.entity.UserDetail;
|
|
|
import com.fuzamei.service.CargoConsignService;
|
|
|
import com.fuzamei.service.OrderService;
|
|
|
+import com.fuzamei.service.StatusService;
|
|
|
import com.fuzamei.service.UserAuthoricationService;
|
|
|
import com.fuzamei.util.JSONUtil;
|
|
|
import com.fuzamei.util.PageDTO;
|
|
@@ -39,6 +41,9 @@ public class CargoConsignAction {
|
|
|
@Autowired
|
|
|
private OrderService orderService;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private StatusService statusService;
|
|
|
+
|
|
|
@Autowired
|
|
|
private HttpServletRequest req;
|
|
|
|
|
@@ -67,6 +72,7 @@ public class CargoConsignAction {
|
|
|
try {
|
|
|
String userId = req.getHeader("Authorization").split("&")[1];
|
|
|
userAuthoricationService.queryUserAuthority(ValidationUtil.checkAndAssignInt(userId), Role.SUPPLIER);
|
|
|
+ params.setUserId(Integer.parseInt(userId));
|
|
|
int page = ValidationUtil.checkMinAndAssignInt(params.getPage(), 1);
|
|
|
int rowNum=ValidationUtil.checkMinAndAssignInt(params.getRowNum(), 1);
|
|
|
Long startTime=ValidationUtil.checkAndAssignDefaultLong(params.getStartTime(), 0L);
|
|
@@ -107,6 +113,7 @@ public class CargoConsignAction {
|
|
|
try {
|
|
|
String userId = req.getHeader("Authorization").split("&")[1];
|
|
|
userAuthoricationService.queryUserAuthority(ValidationUtil.checkAndAssignInt(userId), Role.CARRIER);
|
|
|
+ params.setUserId(Integer.parseInt(userId));
|
|
|
int page = ValidationUtil.checkMinAndAssignInt(params.getPage(), 1);
|
|
|
int rowNum=ValidationUtil.checkMinAndAssignInt(params.getRowNum(), 1);
|
|
|
Long startTime=ValidationUtil.checkAndAssignDefaultLong(params.getStartTime(), 0L);
|
|
@@ -146,7 +153,7 @@ public class CargoConsignAction {
|
|
|
Orders order = orderService.queryFullOrderByOrderId(ValidationUtil.checkAndAssignInt(params.getOrderId()));
|
|
|
ValidationUtil.checkBlankAndAssignString(params.getCarNo());//车牌号校验
|
|
|
if(order==null) throw new RuntimeException("订单不存在");
|
|
|
- if(!Status.UNDELIVER.equals(order.getStatusId())) throw new RuntimeException("非法操作");
|
|
|
+ if(!Statuses.UNDELIVER.equals(order.getStatusId())) throw new RuntimeException("非法操作");
|
|
|
if(!params.getUserId().equals(order.getCarrierId())) throw new RuntimeException("无权操作");
|
|
|
cargoConsignService.doCarry(params);
|
|
|
return JSONUtil.getJsonMap(200, true, HintMSG.OPERATION_SUCCESS, null);
|
|
@@ -183,6 +190,30 @@ public class CargoConsignAction {
|
|
|
}
|
|
|
|
|
|
|
|
|
+
|
|
|
+ /**
|
|
|
+ *
|
|
|
+ * @Title: showAllStatus
|
|
|
+ * @Description: TODO(返回给前端所有状态的id和状态名称)
|
|
|
+ * @param @return 设定文件
|
|
|
+ * @return Map<String,Object> 返回类型
|
|
|
+ * @author ylx
|
|
|
+ * @date 2018年1月31日 下午4:16:11
|
|
|
+ * @throws
|
|
|
+ */
|
|
|
+ @RequestMapping(value="/showAllStatus",method=RequestMethod.POST)
|
|
|
+ public Map<String, Object> showAllStatus(){
|
|
|
+ try {
|
|
|
+ String userId = req.getHeader("Authorization").split("&")[1];
|
|
|
+ userAuthoricationService.queryUserAuthority(ValidationUtil.checkAndAssignInt(userId), Role.SUPPLIER,Role.CARRIER);//检测当前操作用户权限
|
|
|
+ List<Status> statusList = statusService.queryAllStatusInformation();
|
|
|
+ return JSONUtil.getJsonMap(200, true, HintMSG.QUERY_SUCCESS, statusList);
|
|
|
+ } catch (Exception e) {
|
|
|
+ return JSONUtil.getJsonMap(500, false, HintMSG.QUERY_FAIL+":"+e.getMessage(), null);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
/**
|
|
|
*
|
|
|
* @Title: orderTracking
|