|
|
|
@ -9,6 +9,7 @@ import com.hfkj.common.utils.*; |
|
|
|
|
import com.hfkj.entity.*; |
|
|
|
|
import com.hfkj.meituan.MeiTuanService; |
|
|
|
|
import com.hfkj.model.ResponseData; |
|
|
|
|
import com.hfkj.model.goods.GoodsModel; |
|
|
|
|
import com.hfkj.service.discount.CouponDiscountService; |
|
|
|
|
import com.hfkj.service.goods.BsOrderGoodsService; |
|
|
|
|
import com.hfkj.service.goods.GoodsMsgService; |
|
|
|
@ -23,6 +24,7 @@ import io.swagger.annotations.ApiOperation; |
|
|
|
|
import org.apache.commons.lang3.StringUtils; |
|
|
|
|
import org.slf4j.Logger; |
|
|
|
|
import org.slf4j.LoggerFactory; |
|
|
|
|
import org.springframework.beans.BeanUtils; |
|
|
|
|
import org.springframework.stereotype.Controller; |
|
|
|
|
import org.springframework.web.bind.annotation.RequestMapping; |
|
|
|
|
import org.springframework.web.bind.annotation.RequestMethod; |
|
|
|
@ -119,17 +121,25 @@ public class TestController { |
|
|
|
|
@RequestMapping(value="/orderGoodsUpdate",method = RequestMethod.GET) |
|
|
|
|
@ResponseBody |
|
|
|
|
@ApiOperation(value = "商品更新") |
|
|
|
|
public ResponseData orderGoodsUpdate() { |
|
|
|
|
public ResponseData orderMsgUpdate() { |
|
|
|
|
try { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
List<BsOrderGoods> orderGoodsList = orderGoodsService.getList(); |
|
|
|
|
Map<String, Object> map = new HashMap<>(); |
|
|
|
|
|
|
|
|
|
for (BsOrderGoods goods : orderGoodsList) { |
|
|
|
|
BsOrderChild child = orderChildService.getDetail(goods.getChildOrderNo()); |
|
|
|
|
goods.setStatus(child.getStatus()); |
|
|
|
|
goods.setUpdateTime(new Date()); |
|
|
|
|
orderGoodsService.update(goods); |
|
|
|
|
map.put("status", 1); |
|
|
|
|
|
|
|
|
|
List<GoodsMsg> list = goodsMsgService.getList(map); |
|
|
|
|
|
|
|
|
|
List<GoodsSpecs> specsList = goodsSpecsService.getList(new HashMap<>()); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for (GoodsMsg goodsMsg : list) { |
|
|
|
|
List<GoodsSpecs> goodsSpecsList = specsList.stream().filter(s -> s.getGoodsId().equals(goodsMsg.getId())).collect(Collectors.toList()); |
|
|
|
|
if (!goodsSpecsList.isEmpty()) { |
|
|
|
|
goodsMsg.setSaleNum(CommonUtil.saleNumRandom(goodsSpecsList.get(0).getSalePrice())); |
|
|
|
|
} |
|
|
|
|
goodsMsgService.update(goodsMsg); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
return ResponseMsgUtil.success("成功"); |
|
|
|
@ -176,38 +186,44 @@ public class TestController { |
|
|
|
|
@RequestMapping(value="/getLogisticsMsg",method = RequestMethod.GET) |
|
|
|
|
@ResponseBody |
|
|
|
|
@ApiOperation(value = "查询物流") |
|
|
|
|
public ResponseData getLogisticsMsg(@RequestParam(value = "id" , required = false) Long id) { |
|
|
|
|
public ResponseData getLogisticsMsg() { |
|
|
|
|
try { |
|
|
|
|
Map<String, Object> map = new HashMap<>(); |
|
|
|
|
Map<String , Object> objectMap = new HashMap<>(); |
|
|
|
|
|
|
|
|
|
BsOrderGoods orderGoods = bsOrderGoodsService.queryDetail(id); |
|
|
|
|
objectMap.put("status" , 2); |
|
|
|
|
|
|
|
|
|
if (orderGoods == null) { |
|
|
|
|
throw ErrorHelp.genException(SysCode.System , ErrorCode.COMMON_ERROR , "暂无物流信息!"); |
|
|
|
|
} |
|
|
|
|
List<BsOrderGoods> orderGoodsList = orderGoodsService.getList(objectMap); |
|
|
|
|
|
|
|
|
|
for (BsOrderGoods goods : orderGoodsList) { |
|
|
|
|
|
|
|
|
|
GoodsUserAddress userAddress = addressService.queryDetail(orderGoods.getDeliveryAddressId()); |
|
|
|
|
if (goods == null) { |
|
|
|
|
throw ErrorHelp.genException(SysCode.System , ErrorCode.COMMON_ERROR , "暂无物流信息!"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (userAddress == null) { |
|
|
|
|
throw ErrorHelp.genException(SysCode.System , ErrorCode.COMMON_ERROR , "暂无物流信息!"); |
|
|
|
|
} |
|
|
|
|
GoodsUserAddress userAddress = addressService.queryDetail(goods.getDeliveryAddressId()); |
|
|
|
|
|
|
|
|
|
GoodsLogistics logistics = (GoodsLogistics) bsOrderGoodsService.getLogisticsMsg(orderGoods.getLogisticsNo() , userAddress.getPhone()); |
|
|
|
|
if (userAddress == null) { |
|
|
|
|
throw ErrorHelp.genException(SysCode.System , ErrorCode.COMMON_ERROR , "暂无物流信息!"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (logistics.getLogisticsStatus() != null) { |
|
|
|
|
orderGoods.setLogisticsStatus(logistics.getLogisticsStatus()); |
|
|
|
|
orderGoods.setLogisticsStatusDesc(logistics.getLogisticsStatusDesc()); |
|
|
|
|
} else { |
|
|
|
|
orderGoods.setLogisticsStatus(OrderLogisticsStatusEnum.statusWAIT_ACCEPT.getCode()); |
|
|
|
|
orderGoods.setLogisticsStatusDesc(OrderLogisticsStatusEnum.statusWAIT_ACCEPT.getName()); |
|
|
|
|
} |
|
|
|
|
if (goods.getLogisticsNo() != null) { |
|
|
|
|
GoodsLogistics logistics = (GoodsLogistics) bsOrderGoodsService.getLogisticsMsg(goods.getLogisticsNo() , userAddress.getPhone()); |
|
|
|
|
if (logistics.getLogisticsStatus() != null) { |
|
|
|
|
goods.setLogisticsStatus(logistics.getLogisticsStatus()); |
|
|
|
|
goods.setLogisticsStatusDesc(logistics.getLogisticsStatusDesc()); |
|
|
|
|
} else { |
|
|
|
|
goods.setLogisticsStatus(OrderLogisticsStatusEnum.statusWAIT_ACCEPT.getCode()); |
|
|
|
|
goods.setLogisticsStatusDesc(OrderLogisticsStatusEnum.statusWAIT_ACCEPT.getName()); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
bsOrderGoodsService.update(orderGoods); |
|
|
|
|
map.put("logistics", logistics); |
|
|
|
|
JSONArray object = JSONArray.parseArray(logistics.getLogisticsTraceDetails()); |
|
|
|
|
map.put("logisticsTraceDetails", object); |
|
|
|
|
goods.setUpdateTime(new Date()); |
|
|
|
|
|
|
|
|
|
bsOrderGoodsService.update(goods); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
return ResponseMsgUtil.success(map); |
|
|
|
|
return ResponseMsgUtil.success("map"); |
|
|
|
|
|
|
|
|
|
} catch (Exception e) { |
|
|
|
|
log.error("error!",e); |
|
|
|
|