|
|
|
@ -1,28 +1,36 @@ |
|
|
|
|
package com.order.controller.business; |
|
|
|
|
|
|
|
|
|
import com.alibaba.fastjson.JSONArray; |
|
|
|
|
import com.alibaba.fastjson.JSONObject; |
|
|
|
|
import com.github.pagehelper.PageHelper; |
|
|
|
|
import com.github.pagehelper.PageInfo; |
|
|
|
|
import com.hfkj.common.exception.ErrorCode; |
|
|
|
|
import com.hfkj.common.exception.ErrorHelp; |
|
|
|
|
import com.hfkj.common.exception.SysCode; |
|
|
|
|
import com.hfkj.common.security.SessionObject; |
|
|
|
|
import com.hfkj.common.security.UserCenter; |
|
|
|
|
import com.hfkj.common.utils.ResponseMsgUtil; |
|
|
|
|
import com.hfkj.entity.BsOrderGoods; |
|
|
|
|
import com.hfkj.entity.GoodsLogistics; |
|
|
|
|
import com.hfkj.model.ResponseData; |
|
|
|
|
import com.hfkj.model.SecUserSessionObject; |
|
|
|
|
import com.hfkj.service.goods.BsOrderGoodsService; |
|
|
|
|
import com.hfkj.sysenum.SecUserObjectTypeEnum; |
|
|
|
|
import com.hfkj.sysenum.order.OrderGoodsStatusEnum; |
|
|
|
|
import io.swagger.annotations.Api; |
|
|
|
|
import io.swagger.annotations.ApiOperation; |
|
|
|
|
import org.apache.commons.lang3.StringUtils; |
|
|
|
|
import org.slf4j.Logger; |
|
|
|
|
import org.slf4j.LoggerFactory; |
|
|
|
|
import org.springframework.stereotype.Controller; |
|
|
|
|
import org.springframework.web.bind.annotation.RequestMapping; |
|
|
|
|
import org.springframework.web.bind.annotation.RequestMethod; |
|
|
|
|
import org.springframework.web.bind.annotation.RequestParam; |
|
|
|
|
import org.springframework.web.bind.annotation.ResponseBody; |
|
|
|
|
import org.springframework.web.bind.annotation.*; |
|
|
|
|
|
|
|
|
|
import javax.annotation.Resource; |
|
|
|
|
import javax.servlet.http.HttpServletRequest; |
|
|
|
|
import java.util.Date; |
|
|
|
|
import java.util.HashMap; |
|
|
|
|
import java.util.Map; |
|
|
|
|
import java.util.Objects; |
|
|
|
|
|
|
|
|
|
@Controller |
|
|
|
|
@RequestMapping(value="/orderGoods") |
|
|
|
@ -51,6 +59,8 @@ public class BsOrderGoodsController { |
|
|
|
|
@RequestParam(value = "goodsName" , required = false) String goodsName, |
|
|
|
|
@RequestParam(value = "payType" , required = false) Integer payType, |
|
|
|
|
@RequestParam(value = "status" , required = false) Integer status, |
|
|
|
|
@RequestParam(value = "createTimeS" , required = false) Long createTimeS, |
|
|
|
|
@RequestParam(value = "createTimeE" , required = false) Long createTimeE, |
|
|
|
|
@RequestParam(value = "pageNum" , required = true) Integer pageNum, |
|
|
|
|
@RequestParam(value = "pageSize" , required = true) Integer pageSize, HttpServletRequest request) { |
|
|
|
|
try { |
|
|
|
@ -73,6 +83,9 @@ public class BsOrderGoodsController { |
|
|
|
|
map.put("goodsSpecsName", goodsSpecsName); |
|
|
|
|
map.put("goodsName", goodsName); |
|
|
|
|
map.put("payType", payType); |
|
|
|
|
map.put("createTimeS", createTimeS); |
|
|
|
|
map.put("createTimeE", createTimeE); |
|
|
|
|
|
|
|
|
|
map.put("status", status); |
|
|
|
|
|
|
|
|
|
PageHelper.startPage(pageNum, pageSize); |
|
|
|
@ -84,4 +97,60 @@ public class BsOrderGoodsController { |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@RequestMapping(value="/updateLogisticsNo",method = RequestMethod.POST) |
|
|
|
|
@ResponseBody |
|
|
|
|
@ApiOperation(value = "更新物流订单号") |
|
|
|
|
public ResponseData updateLogisticsNo(@RequestBody BsOrderGoods body |
|
|
|
|
) { |
|
|
|
|
try { |
|
|
|
|
|
|
|
|
|
if (body == null |
|
|
|
|
|| body.getId() == null |
|
|
|
|
|| StringUtils.isBlank(body.getLogisticsNo()) |
|
|
|
|
) { |
|
|
|
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, ""); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
BsOrderGoods goodsOrder = bsOrderGoodsService.queryDetail(body.getId()); |
|
|
|
|
|
|
|
|
|
if (goodsOrder == null) { |
|
|
|
|
throw ErrorHelp.genException(SysCode.System , ErrorCode.COMMON_ERROR , "信息错误!"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
goodsOrder.setLogisticsNo(body.getLogisticsNo()); |
|
|
|
|
goodsOrder.setUpdateTime(new Date()); |
|
|
|
|
if (goodsOrder.getStatus() == OrderGoodsStatusEnum.status1.getCode()) { |
|
|
|
|
goodsOrder.setStatus(OrderGoodsStatusEnum.status2.getCode()); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
bsOrderGoodsService.update(goodsOrder); |
|
|
|
|
|
|
|
|
|
return ResponseMsgUtil.success("更新成功!"); |
|
|
|
|
|
|
|
|
|
} catch (Exception e) { |
|
|
|
|
log.error("OrderExtController -> getGasOrderDetail() error!",e); |
|
|
|
|
return ResponseMsgUtil.exception(e); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@RequestMapping(value="/getLogisticsMsg",method = RequestMethod.GET) |
|
|
|
|
@ResponseBody |
|
|
|
|
@ApiOperation(value = "查询物流") |
|
|
|
|
public ResponseData getLogisticsMsg(@RequestParam(value = "id" , required = false) Long id) { |
|
|
|
|
try { |
|
|
|
|
Map<String , Object> map = new HashMap<>(); |
|
|
|
|
GoodsLogistics logistics = (GoodsLogistics) bsOrderGoodsService.getLogisticsMsg(id); |
|
|
|
|
|
|
|
|
|
map.put("logistics", logistics); |
|
|
|
|
JSONArray object = JSONArray.parseArray(logistics.getLogisticsTraceDetails()); |
|
|
|
|
map.put("logisticsTraceDetails", object); |
|
|
|
|
|
|
|
|
|
return ResponseMsgUtil.success(map); |
|
|
|
|
|
|
|
|
|
} catch (Exception e) { |
|
|
|
|
log.error("error!",e); |
|
|
|
|
return ResponseMsgUtil.exception(e); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|