|
|
|
@ -2,7 +2,8 @@ package com.order.controller.business; |
|
|
|
|
|
|
|
|
|
import com.alibaba.excel.EasyExcel; |
|
|
|
|
import com.alibaba.fastjson.JSONArray; |
|
|
|
|
import com.fasterxml.jackson.databind.util.BeanUtil; |
|
|
|
|
|
|
|
|
|
import com.alibaba.fastjson.JSONObject; |
|
|
|
|
import com.github.pagehelper.PageHelper; |
|
|
|
|
import com.github.pagehelper.PageInfo; |
|
|
|
|
import com.hfkj.common.exception.ErrorCode; |
|
|
|
@ -13,12 +14,10 @@ import com.hfkj.common.security.UserCenter; |
|
|
|
|
import com.hfkj.common.utils.DateUtil; |
|
|
|
|
import com.hfkj.common.utils.ResponseMsgUtil; |
|
|
|
|
import com.hfkj.config.CommonSysConst; |
|
|
|
|
import com.hfkj.entity.BsOrderGoods; |
|
|
|
|
import com.hfkj.entity.FileRecords; |
|
|
|
|
import com.hfkj.entity.GoodsLogistics; |
|
|
|
|
import com.hfkj.entity.GoodsUserAddress; |
|
|
|
|
import com.hfkj.entity.*; |
|
|
|
|
import com.hfkj.model.ResponseData; |
|
|
|
|
import com.hfkj.model.SecUserSessionObject; |
|
|
|
|
import com.hfkj.model.UserSessionObject; |
|
|
|
|
import com.hfkj.model.order.orderExport.OrderGoodsExportModel; |
|
|
|
|
import com.hfkj.service.file.FileRecordsService; |
|
|
|
|
import com.hfkj.service.goods.BsOrderGoodsService; |
|
|
|
@ -26,17 +25,14 @@ import com.hfkj.service.goods.GoodsUserAddressService; |
|
|
|
|
import com.hfkj.service.order.BsOrderService; |
|
|
|
|
import com.hfkj.sysenum.SecUserObjectTypeEnum; |
|
|
|
|
import com.hfkj.sysenum.fileRecords.FileRecordsEnum; |
|
|
|
|
import com.hfkj.sysenum.order.OrderChildStatusEnum; |
|
|
|
|
import com.hfkj.sysenum.order.OrderLogisticsStatusEnum; |
|
|
|
|
import com.hfkj.sysenum.order.OrderPayChannelEnum; |
|
|
|
|
import com.hfkj.sysenum.order.OrderPayTypeEnum; |
|
|
|
|
import com.hfkj.sysenum.order.*; |
|
|
|
|
import io.swagger.annotations.Api; |
|
|
|
|
import io.swagger.annotations.ApiOperation; |
|
|
|
|
import org.apache.commons.beanutils.BeanUtils; |
|
|
|
|
import org.apache.commons.lang3.StringUtils; |
|
|
|
|
import org.slf4j.Logger; |
|
|
|
|
import org.slf4j.LoggerFactory; |
|
|
|
|
import org.springframework.context.annotation.Bean; |
|
|
|
|
|
|
|
|
|
import org.springframework.stereotype.Controller; |
|
|
|
|
import org.springframework.web.bind.annotation.*; |
|
|
|
|
|
|
|
|
@ -48,6 +44,8 @@ import java.util.*; |
|
|
|
|
import java.util.concurrent.ArrayBlockingQueue; |
|
|
|
|
import java.util.concurrent.ThreadPoolExecutor; |
|
|
|
|
import java.util.concurrent.TimeUnit; |
|
|
|
|
import java.util.concurrent.atomic.AtomicReference; |
|
|
|
|
import java.util.stream.Collectors; |
|
|
|
|
|
|
|
|
|
@Controller |
|
|
|
|
@RequestMapping(value="/orderGoods") |
|
|
|
@ -71,6 +69,9 @@ public class BsOrderGoodsController { |
|
|
|
|
@Resource |
|
|
|
|
private GoodsUserAddressService addressService; |
|
|
|
|
|
|
|
|
|
@Resource |
|
|
|
|
private BsOrderGoodsService orderGoodsService; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@RequestMapping(value="/getListGoods",method = RequestMethod.GET) |
|
|
|
|
@ResponseBody |
|
|
|
@ -182,13 +183,14 @@ public class BsOrderGoodsController { |
|
|
|
|
|
|
|
|
|
String dataSting = ""; |
|
|
|
|
if (createTimeE != null) { |
|
|
|
|
dataSting = DateUtil.date2String(DateUtil.long2Date(createTimeS) , DateUtil.Y_M_D) + "-" + DateUtil.date2String(DateUtil.long2Date(createTimeE) , DateUtil.Y_M_D); |
|
|
|
|
dataSting = DateUtil.date2String(DateUtil.long2Date(createTimeS) , DateUtil.YMDHMS) + "-" + DateUtil.date2String(DateUtil.long2Date(createTimeE) , DateUtil.YMDHMS); |
|
|
|
|
} else { |
|
|
|
|
dataSting = DateUtil.date2String(new Date(), DateUtil.Y_M_D); |
|
|
|
|
dataSting = DateUtil.date2String(new Date(), DateUtil.YMDHMS); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
String fileUrl = CommonSysConst.getSysConfig().getFileUrl(); |
|
|
|
|
String pathName = "/temporary/" + userModel.getAccount().getId() + "/" + FileRecordsEnum.status1.getName() + "交易数据导出" + dataSting +".xlsx"; |
|
|
|
|
String filePath = "/temporary/" + userModel.getAccount().getId() + "/" ; |
|
|
|
|
String pathName = filePath + FileRecordsEnum.status1.getName() + "交易数据导出" + dataSting +".xlsx"; |
|
|
|
|
|
|
|
|
|
if (fileRecordsService.findExported(map.toString() , userModel.getAccount().getId())) { |
|
|
|
|
throw ErrorHelp.genException(SysCode.System , ErrorCode.COMMON_ERROR , "相同导出内容请勿重复点击!"); |
|
|
|
@ -242,7 +244,7 @@ public class BsOrderGoodsController { |
|
|
|
|
goodsExportModels.add(orderGoodsExportModel); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
File file = new File(fileUrl); |
|
|
|
|
File file = new File(fileUrl + filePath); |
|
|
|
|
if (!file.exists()) { |
|
|
|
|
file.mkdirs(); |
|
|
|
|
} |
|
|
|
@ -258,6 +260,7 @@ public class BsOrderGoodsController { |
|
|
|
|
} catch (Exception e) { |
|
|
|
|
fileRecords.setStatus(3); |
|
|
|
|
fileRecords.setUpdateTime(new Date()); |
|
|
|
|
fileRecords.setExt1(e.toString()); |
|
|
|
|
fileRecordsService.update(fileRecords); |
|
|
|
|
log.error("error!",e); |
|
|
|
|
} |
|
|
|
@ -319,11 +322,12 @@ public class BsOrderGoodsController { |
|
|
|
|
@ApiOperation(value = "查询物流") |
|
|
|
|
public ResponseData getLogisticsMsg(@RequestParam(value = "id" , required = false) Long id) { |
|
|
|
|
try { |
|
|
|
|
Map<String , Object> map = new HashMap<>(); |
|
|
|
|
Map<String, Object> map = new HashMap<>(); |
|
|
|
|
|
|
|
|
|
BsOrderGoods orderGoods = bsOrderGoodsService.queryDetail(id); |
|
|
|
|
if (orderGoods == null || orderGoods.getLogisticsNo() == null) { |
|
|
|
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "暂未发货!"); |
|
|
|
|
|
|
|
|
|
if (orderGoods == null) { |
|
|
|
|
throw ErrorHelp.genException(SysCode.System , ErrorCode.COMMON_ERROR , "暂无物流信息!"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
GoodsUserAddress userAddress = addressService.queryDetail(orderGoods.getDeliveryAddressId()); |
|
|
|
@ -369,4 +373,39 @@ public class BsOrderGoodsController { |
|
|
|
|
return ResponseMsgUtil.exception(e); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@RequestMapping(value="/updateShippingAddress",method = RequestMethod.GET) |
|
|
|
|
@ResponseBody |
|
|
|
|
@ApiOperation(value = "更新收货地址") |
|
|
|
|
public ResponseData updateShippingAddress(@RequestParam(value = "orderNo" , required = true) String orderNo, |
|
|
|
|
@RequestParam(value = "addressId" , required = true) Long addressId) { |
|
|
|
|
try { |
|
|
|
|
|
|
|
|
|
GoodsUserAddress deliveryAddress = addressService.queryDetail(addressId); |
|
|
|
|
|
|
|
|
|
if (deliveryAddress == null) { |
|
|
|
|
log.error("GoodsDetailController -> findGoodsDetailById() error!"); |
|
|
|
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未找到相信息"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
BsOrderGoods orderGoods = orderGoodsService.findGoodsOrder(orderNo); |
|
|
|
|
|
|
|
|
|
if (orderGoods == null) { |
|
|
|
|
throw ErrorHelp.genException(SysCode.System , ErrorCode.COMMON_ERROR , "未找到相信息"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
orderGoods.setDeliveryAddressId(deliveryAddress.getId()); |
|
|
|
|
orderGoods.setUpdateTime(new Date()); |
|
|
|
|
orderGoods.setDeliveryAddress(deliveryAddress.getAddress()); |
|
|
|
|
|
|
|
|
|
orderGoodsService.update(orderGoods); |
|
|
|
|
|
|
|
|
|
return ResponseMsgUtil.success("成功"); |
|
|
|
|
|
|
|
|
|
} catch (Exception e) { |
|
|
|
|
log.error("error!",e); |
|
|
|
|
return ResponseMsgUtil.exception(e); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|