袁野 3 months ago
parent 683a976d46
commit 5fea0ba7e2
  1. 1
      cweb/src/main/java/com/cweb/config/AuthConfig.java
  2. 4
      cweb/src/main/java/com/cweb/controller/goods/DeliveryAddressController.java
  3. 49
      cweb/src/main/java/com/cweb/controller/qianZhu/CinemaController.java
  4. 33
      order/src/main/java/com/order/controller/OrderController.java
  5. 73
      order/src/main/java/com/order/controller/business/BsOrderGoodsController.java
  6. 48
      schedule/src/main/java/com/hfkj/schedule/OrderGoodsSchedule.java
  7. 2
      service/src/main/java/com/hfkj/service/goods/impl/BsOrderGoodsServiceImpl.java
  8. 9
      service/src/main/java/com/hfkj/sysenum/order/OrderStatusEnum.java

@ -93,6 +93,7 @@ public class AuthConfig implements WebMvcConfigurer {
.excludePathPatterns("/wxMsg/*")
.excludePathPatterns("/cinema/*")
.excludePathPatterns("/starbucks/*")
.excludePathPatterns("/c/*")
;
}

@ -91,9 +91,7 @@ public class DeliveryAddressController {
deliveryAddress.setUpdateTime(new Date());
deliveryAddressService.create(deliveryAddress);
return ResponseMsgUtil.success("新增成功");
return ResponseMsgUtil.success(deliveryAddress);
} catch (Exception e) {
log.error("GoodsDetailController --> insertPrice() error!", e);

@ -2,10 +2,16 @@ package com.cweb.controller.qianZhu;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
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.utils.DateUtil;
import com.hfkj.common.utils.PageUtil;
import com.hfkj.common.utils.ResponseMsgUtil;
import com.hfkj.entity.BsProductConfig;
import com.hfkj.model.ResponseData;
import com.hfkj.model.goods.GoodsModel;
import com.hfkj.qianzhu.channel.CinemaService;
import com.hfkj.service.BsProductConfigService;
import com.hfkj.sysenum.order.OrderChildProductTypeEnum;
@ -22,9 +28,7 @@ import org.springframework.web.bind.annotation.ResponseBody;
import javax.annotation.Resource;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.util.Comparator;
import java.util.HashMap;
import java.util.Map;
import java.util.*;
import java.util.stream.Collectors;
@Controller
@ -41,6 +45,7 @@ public class CinemaController {
@ResponseBody
@ApiOperation(value = "根据城市分页查询影片")
public ResponseData filmsPagedQuery(@RequestParam(value = "cityId", required = false) Integer cityId,
@RequestParam(value = "name", required = false) String name,
@RequestParam(value = "cityCode", required = false) String cityCode,
@RequestParam(value = "cinemaId", required = false) String cinemaId,
@RequestParam(name = "pageNum", required = true) Integer pageNum,
@ -58,10 +63,42 @@ public class CinemaController {
if (cinemaId != null) {
params.put("cinemaId", cinemaId);
}
params.put("pageIndex", pageNum);
params.put("pageSize", pageSize);
params.put("pageIndex", 1);
params.put("pageSize", 499);
JSONObject object = CinemaService.filmsPagedQuery(params);
JSONArray array = object.getJSONArray("data");
List<JSONObject> list = new ArrayList<>();
for (Object o : array) {
JSONObject item = (JSONObject) o;
list.add(item);
}
return ResponseMsgUtil.success(CinemaService.filmsPagedQuery(params));
if (list.isEmpty()) {
throw ErrorHelp.genException(SysCode.System , ErrorCode.COMMON_ERROR , "暂无数据!");
}
if (name != null) {
list = list.stream()
.filter(s -> s.getString("name").contains(name)) // 使用contains方法进行模糊查询
.collect(Collectors.toList()); // 将结果收集到列表中
}
list = list.stream().sorted(
// 根据对象中的ID进行升序排序 小到大
Comparator.comparingLong(
e -> DateUtil.timesTamp(JSONObject.parseObject(e.toString()).getString("publishDate"))
)
// 放开下面的注释,使用reversed()方法,就是降序 大到小
.reversed()
).collect(Collectors.toList());
return ResponseMsgUtil.success(PageUtil.initPageInfoObj(pageNum, list.size(), pageSize, new PageInfo<>(list)));
} catch (Exception e) {
log.error("error!",e);

@ -35,6 +35,7 @@ import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
* @className: OrderController
@ -203,5 +204,37 @@ public class OrderController {
}
@RequestMapping(value="/orderNum",method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "订单数量")
public ResponseData orderNum() {
try {
// 用户session
UserSessionObject userSession = userCenter.getSessionModel(UserSessionObject.class);
Map<String , Object> map = new HashMap<>();
map.put("userId" , userSession.getUser().getId());
List<BsOrder> bsOrder = orderService.getOrderList(map);
Map<Integer, List<BsOrder>> collect = bsOrder.stream().collect(Collectors.groupingBy(BsOrder::getOrderStatus));
List<JSONObject> countRecords = collect.keySet().stream().map(key -> {
JSONObject goodObject = new JSONObject(true);
goodObject.put("name", OrderStatusEnum.getData(key).getName());
goodObject.put("status", key);
goodObject.put("num",collect.get(key).size());
return goodObject;
}).collect(Collectors.toList());
return ResponseMsgUtil.success(countRecords);
} catch (Exception e) {
log.error("error!",e);
return ResponseMsgUtil.exception(e);
}
}
}

@ -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);
}
}
}

@ -1,8 +1,16 @@
package com.hfkj.schedule;
import com.alibaba.fastjson.JSONArray;
import com.hfkj.common.exception.ErrorCode;
import com.hfkj.common.exception.ErrorHelp;
import com.hfkj.common.exception.SysCode;
import com.hfkj.common.utils.DateUtil;
import com.hfkj.entity.BsOrderGoods;
import com.hfkj.entity.GoodsLogistics;
import com.hfkj.entity.GoodsUserAddress;
import com.hfkj.service.goods.BsOrderGoodsService;
import com.hfkj.service.goods.GoodsUserAddressService;
import com.hfkj.sysenum.order.OrderLogisticsStatusEnum;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.context.annotation.Configuration;
@ -30,6 +38,9 @@ public class OrderGoodsSchedule {
@Resource
private BsOrderGoodsService bsOrderGoodsService;
@Resource
private GoodsUserAddressService addressService;
//每日凌晨12点5秒执行一次
@Scheduled(cron = "5 0 0 * * ?")
public void orderGoodsConfirmReceipt() {
@ -49,4 +60,41 @@ public class OrderGoodsSchedule {
}
}
}
@Scheduled(cron = "30 0 0 * * ?")
public void getLogisticsMsg() {
Map<String , Object> objectMap = new HashMap<>();
objectMap.put("status" , 2);
List<BsOrderGoods> orderGoodsList = orderGoodsService.getList(objectMap);
for (BsOrderGoods goods : orderGoodsList) {
if (goods == null) {
throw ErrorHelp.genException(SysCode.System , ErrorCode.COMMON_ERROR , "暂无物流信息!");
}
GoodsUserAddress userAddress = addressService.queryDetail(goods.getDeliveryAddressId());
if (userAddress == null) {
throw ErrorHelp.genException(SysCode.System , ErrorCode.COMMON_ERROR , "暂无物流信息!");
}
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());
}
goods.setUpdateTime(new Date());
bsOrderGoodsService.update(goods);
}
}
}

@ -68,7 +68,7 @@ public class BsOrderGoodsServiceImpl implements BsOrderGoodsService {
@Override
public BsOrderGoods findGoodsOrder(String orderNo) {
BsOrderGoodsExample example = new BsOrderGoodsExample();
example.createCriteria().andStatusNotEqualTo(0).andOrderNoEqualTo(orderNo);
example.createCriteria().andOrderNoEqualTo(orderNo);
List<BsOrderGoods> list = bsOrderGoodsMapper.selectByExample(example);

@ -2,6 +2,8 @@ package com.hfkj.sysenum.order;
import lombok.Getter;
import java.util.Objects;
/**
* 交易订单状态
* @className: OrderChildProductType
@ -45,4 +47,11 @@ public enum OrderStatusEnum {
this.code = code;
this.name = name;
}
public static OrderStatusEnum getData(Integer type) {
for (OrderStatusEnum ele : values()) {
if (Objects.equals(type,ele.getCode())) return ele;
}
return null;
}
}

Loading…
Cancel
Save