Merge branch 'master' of https://gitee.com/op-souls/ghy-all
This commit is contained in:
commit
ee2d5ea391
|
|
@ -6,21 +6,16 @@ import com.ghy.common.core.controller.BaseController;
|
|||
import com.ghy.common.core.domain.AjaxResult;
|
||||
import com.ghy.common.core.page.TableDataInfo;
|
||||
import com.ghy.common.enums.BusinessType;
|
||||
import com.ghy.common.utils.ObjectUtils;
|
||||
import com.ghy.common.utils.poi.ExcelUtil;
|
||||
import com.ghy.order.domain.OrderDetail;
|
||||
import com.ghy.order.service.OrderDetailService;
|
||||
import com.ghy.web.pojo.vo.OrderDetailsResponseVo;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.ModelMap;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -18,9 +18,12 @@ import com.ghy.order.domain.OrderMaster;
|
|||
import com.ghy.order.service.OrderDetailService;
|
||||
import com.ghy.order.service.OrderGoodsService;
|
||||
import com.ghy.order.service.OrderMasterService;
|
||||
import com.ghy.payment.domain.FinancialDetail;
|
||||
import com.ghy.payment.service.FinancialDetailService;
|
||||
import com.ghy.web.pojo.vo.OrderDetailsResponseVo;
|
||||
import com.ghy.worker.domain.Worker;
|
||||
import com.ghy.worker.service.WorkerService;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
|
@ -52,6 +55,7 @@ public class OrderMasterController extends BaseController {
|
|||
private final OrderDetailService orderDetailService;
|
||||
private final OrderGoodsService orderGoodsService;
|
||||
private final CustomerAddressService customerAddressService;
|
||||
private final FinancialDetailService financialDetailService;
|
||||
|
||||
@RequiresPermissions("order:master:view")
|
||||
@GetMapping()
|
||||
|
|
@ -97,17 +101,33 @@ public class OrderMasterController extends BaseController {
|
|||
// 订单数据
|
||||
Map<Long, List<OrderDetail>> longOrderDetailMap = orderDetailService.byOrderIdInMap(orderIdList);
|
||||
Map<Long, List<OrderGoods>> longOrderGoodsMap = orderGoodsService.byOrderIdInMap(orderIdList);
|
||||
// 消费者的上级邀请人信息。
|
||||
List<Long> customByPlaceIdList = new ArrayList<>();
|
||||
// 循环数据赋值。
|
||||
for(OrderMaster orderMasterByListData : orderMasterList){
|
||||
OrderDetailsResponseVo orderDetailsResponseVo = new OrderDetailsResponseVo();
|
||||
// 订单基本信息。
|
||||
orderDetailsResponseVo.setOrderId(orderMasterByListData.getId());
|
||||
orderDetailsResponseVo.setCode(orderMasterByListData.getCode());
|
||||
// 基本信息。
|
||||
List<OrderGoods> orderGoodsList = longOrderGoodsMap.get(orderMasterByListData.getId());
|
||||
if(orderGoodsList != null && orderGoodsList.size() > 0){
|
||||
List<OrderDetailsResponseVo.OrderDetails> orderDetailsList = new ArrayList<>();
|
||||
// 用于订单附表数据查询。
|
||||
List<Long> orderDetailsIdList = new ArrayList<>();
|
||||
for(OrderGoods orderGoods : orderGoodsList){
|
||||
orderDetailsIdList.add(orderGoods.getOrderId());
|
||||
}
|
||||
// 财务数据信息。
|
||||
Map<Long, FinancialDetail> longFinancialDetailMap = financialDetailService.byOrderIdInMap(orderDetailsIdList);
|
||||
for(OrderGoods orderGoods : orderGoodsList){
|
||||
OrderDetailsResponseVo.OrderDetails orderDetails = OrderDetailsResponseVo.OrderDetails.modelDataSupplement(orderGoods);
|
||||
FinancialDetail financialDetail = longFinancialDetailMap.get(orderGoods.getGoodsId());
|
||||
if(ObjectUtils.isNotNull(financialDetail)){
|
||||
orderDetails.setDiscountMoney(financialDetail.getDiscountMoney());
|
||||
orderDetails.setPayMoney(financialDetail.getPayMoney());
|
||||
orderDetails.setTotalMoney(financialDetail.getTotalMoney());
|
||||
}
|
||||
orderDetailsList.add(orderDetails);
|
||||
}
|
||||
orderDetailsResponseVo.setDetailsList(orderDetailsList);
|
||||
|
|
@ -126,12 +146,23 @@ public class OrderMasterController extends BaseController {
|
|||
if(customerAddressList != null && customerAddressList.size() > 0){
|
||||
orderDetailsResponseVo.setCustomDetails(OrderDetailsResponseVo.OrderCustomDetails.modelDataSupplement(customerAddressList.get(0)));
|
||||
}
|
||||
customByPlaceIdList.add(customer.getCustomerPlace());
|
||||
}
|
||||
// 数据添加处理。
|
||||
orderDetailsResponseVoList.add(orderDetailsResponseVo);
|
||||
}
|
||||
// 第三次数据循环处理 用于邀请人相关补充,
|
||||
Map<Long, Customer> longCustomerByPlaceMap = customerService.byCustomerUseridInMap(customByPlaceIdList);
|
||||
for(OrderDetailsResponseVo vo : orderDetailsResponseVoList){
|
||||
if(ObjectUtils.isNotNull(vo.getCustomDetails())){
|
||||
Customer customer = longCustomerByPlaceMap.get(vo.getCustomDetails().getCustomerId());
|
||||
if(ObjectUtils.isNotNull(customer)){
|
||||
vo.setInvitee(OrderDetailsResponseVo.OrderInvitee.modelDataSupplement(customer));
|
||||
}
|
||||
return getDataTable(orderDetailsResponseVoList);
|
||||
}
|
||||
}
|
||||
}
|
||||
return voDataTable(orderDetailsResponseVoList, orderMasterList);
|
||||
}
|
||||
|
||||
@Log(title = "主订单管理", businessType = BusinessType.EXPORT)
|
||||
|
|
|
|||
|
|
@ -1,8 +1,10 @@
|
|||
package com.ghy.web.pojo.vo;
|
||||
|
||||
import com.ghy.common.annotation.Excel;
|
||||
import com.ghy.common.enums.OrderStatus;
|
||||
import com.ghy.common.utils.DateUtils;
|
||||
import com.ghy.common.utils.ObjectUtils;
|
||||
import com.ghy.customer.domain.Customer;
|
||||
import com.ghy.customer.domain.CustomerAddress;
|
||||
import com.ghy.order.domain.OrderGoods;
|
||||
import com.ghy.order.domain.OrderMaster;
|
||||
|
|
@ -11,6 +13,7 @@ import lombok.*;
|
|||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
|
|
@ -81,6 +84,46 @@ public class OrderDetailsResponseVo implements Serializable {
|
|||
*/
|
||||
private OrderReceiving receiving;
|
||||
|
||||
/**
|
||||
* 邀请人相关。
|
||||
*/
|
||||
private OrderInvitee invitee;
|
||||
|
||||
/**
|
||||
* 邀请人相关。
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
public static class OrderInvitee{
|
||||
/**
|
||||
* 消费者id
|
||||
*/
|
||||
private Long customerId;
|
||||
|
||||
/**
|
||||
* 收件人姓名
|
||||
*/
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 收件人手机号
|
||||
*/
|
||||
private String phone;
|
||||
|
||||
public static OrderInvitee modelDataSupplement(Customer customer){
|
||||
OrderInvitee orderInvitee = new OrderInvitee();
|
||||
if(ObjectUtils.isNotNull(customer)){
|
||||
orderInvitee.setCustomerId(customer.getCustomerId());
|
||||
orderInvitee.setName(customer.getName());
|
||||
orderInvitee.setPhone(customer.getPhone());
|
||||
}else {
|
||||
orderInvitee.setName("--");
|
||||
orderInvitee.setPhone("--");
|
||||
}
|
||||
return orderInvitee;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 订单状态
|
||||
*/
|
||||
|
|
@ -277,6 +320,21 @@ public class OrderDetailsResponseVo implements Serializable {
|
|||
*/
|
||||
private String finishTime;
|
||||
|
||||
/**
|
||||
* 子单总金额
|
||||
*/
|
||||
private BigDecimal totalMoney;
|
||||
|
||||
/**
|
||||
* 优惠金额
|
||||
*/
|
||||
private BigDecimal discountMoney;
|
||||
|
||||
/**
|
||||
* 实付金额
|
||||
*/
|
||||
private BigDecimal payMoney;
|
||||
|
||||
public static OrderDetails modelDataSupplement(OrderGoods orderGoods){
|
||||
OrderDetails orderDetails = new OrderDetails();
|
||||
if(ObjectUtils.isNotNull(orderGoods)){
|
||||
|
|
|
|||
|
|
@ -90,16 +90,13 @@
|
|||
visible: false
|
||||
},
|
||||
{
|
||||
field: 'id',
|
||||
field: 'code',
|
||||
title: '序号'
|
||||
},
|
||||
{
|
||||
field: 'detailsList',
|
||||
title: '订单信息',
|
||||
formatter: function (value, row, index) {
|
||||
console.log(value);
|
||||
console.log(row);
|
||||
console.log(index);
|
||||
var actions = [];
|
||||
value.forEach(item => {
|
||||
actions.push("商品id:" + item.goodsId + "</br>");
|
||||
|
|
@ -107,6 +104,21 @@
|
|||
actions.push("商品数量:" + item.goodsNum+ "</br>");
|
||||
actions.push("已服务数量:" + item.serverGoodsNum + "</br>");
|
||||
actions.push("完成时间:" + item.finishTime + "</br>");
|
||||
if(item.totalMoney){
|
||||
actions.push("子单总金额:" + item.totalMoney + "</br>");
|
||||
}else {
|
||||
actions.push("子单总金额:--" + "</br>");
|
||||
}
|
||||
if(item.discountMoney){
|
||||
actions.push("优惠金额:" + item.discountMoney + "</br>");
|
||||
}else {
|
||||
actions.push("优惠金额:--" + "</br>");
|
||||
}
|
||||
if(item.payMoney){
|
||||
actions.push("实付金额:" + item.payMoney + "</br>");
|
||||
}else {
|
||||
actions.push("实付金额:--" + "</br>");
|
||||
}
|
||||
})
|
||||
/** 消费者相关信息 **/
|
||||
if(row.customDetails){
|
||||
|
|
@ -219,8 +231,20 @@
|
|||
title: '奖励金'
|
||||
},
|
||||
{
|
||||
field: 'createTime',
|
||||
title: '邀请人'
|
||||
field: 'invitee',
|
||||
title: '邀请人',
|
||||
formatter: function (value, row, index) {
|
||||
console.log(value);
|
||||
var actions = [];
|
||||
if(value){
|
||||
actions.push("邀请人姓名:" + value.name + "</br>");
|
||||
actions.push("邀请人电话:" + value.phone + "</br>");
|
||||
}else {
|
||||
actions.push("邀请人姓名:--" + "</br>");
|
||||
actions.push("邀请人电话:--" + "</br>");
|
||||
}
|
||||
return actions.join('');
|
||||
}
|
||||
}
|
||||
// {
|
||||
// title: '操作',
|
||||
|
|
|
|||
|
|
@ -100,8 +100,7 @@ public class BaseController
|
|||
* 响应请求分页数据
|
||||
*/
|
||||
@SuppressWarnings({ "rawtypes", "unchecked" })
|
||||
protected TableDataInfo getDataTable(List<?> list)
|
||||
{
|
||||
protected TableDataInfo getDataTable(List<?> list) {
|
||||
TableDataInfo rspData = new TableDataInfo();
|
||||
rspData.setCode(0);
|
||||
rspData.setRows(list);
|
||||
|
|
@ -109,6 +108,14 @@ public class BaseController
|
|||
return rspData;
|
||||
}
|
||||
|
||||
protected TableDataInfo voDataTable(List<?> listByVo, List<?> listByModel){
|
||||
TableDataInfo rspData = new TableDataInfo();
|
||||
rspData.setCode(0);
|
||||
rspData.setRows(listByVo);
|
||||
rspData.setTotal(new PageInfo(listByModel).getTotal());
|
||||
return rspData;
|
||||
}
|
||||
|
||||
/**
|
||||
* 响应返回结果
|
||||
*
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
package com.ghy.payment.mapper;
|
||||
|
||||
import com.ghy.payment.domain.FinancialDetail;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import com.ghy.payment.response.FinancialCountResponse;
|
||||
|
||||
import java.util.List;
|
||||
|
|
@ -55,6 +56,14 @@ public interface FinancialDetailMapper {
|
|||
*/
|
||||
FinancialDetail checkFinancialDetailCodeUnique(String financialDetailCode);
|
||||
|
||||
/**
|
||||
* 根据订单id集合信息进行批量数据查询
|
||||
*
|
||||
* @param orderIdList 订单Id集合信息。
|
||||
* @return FinancialDetail实体集合信息。
|
||||
*/
|
||||
List<FinancialDetail> getByOrderIdList(@Param("orderIdList") List<Long> orderIdList);
|
||||
|
||||
/**
|
||||
* 撤销支付成功
|
||||
*
|
||||
|
|
|
|||
|
|
@ -64,6 +64,14 @@ public interface FinancialDetailService {
|
|||
*/
|
||||
String createCode();
|
||||
|
||||
/**
|
||||
* 根据订单id集合信息进行查询封装成为map数据,
|
||||
*
|
||||
* @param orderIdList 订单Id集合信息数据
|
||||
* @return 键值队列数据, key-> 订单Id value-> 财务相关信息
|
||||
*/
|
||||
Map<Long, FinancialDetail> byOrderIdInMap(List<Long> orderIdList);
|
||||
|
||||
/**
|
||||
* 撤销支付成功
|
||||
*
|
||||
|
|
|
|||
|
|
@ -12,10 +12,13 @@ import javax.annotation.Resource;
|
|||
import java.time.LocalDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.time.format.DateTimeFormatterBuilder;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.atomic.AtomicLong;
|
||||
|
||||
import static java.time.temporal.ChronoField.*;
|
||||
import static java.time.temporal.ChronoField.SECOND_OF_MINUTE;
|
||||
|
||||
@Service
|
||||
public class FinancialDetailServiceImpl implements FinancialDetailService {
|
||||
|
|
@ -101,4 +104,18 @@ public class FinancialDetailServiceImpl implements FinancialDetailService {
|
|||
public void payReverseSucceeded(String reverseId) {
|
||||
financialDetailMapper.payReverseSucceeded(reverseId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<Long, FinancialDetail> byOrderIdInMap(List<Long> orderIdList) {
|
||||
Map<Long, FinancialDetail> longFinancialDetailHashMap = new HashMap<>();
|
||||
if(orderIdList != null && orderIdList.size() > 0){
|
||||
List<FinancialDetail> financialDetailList = financialDetailMapper.getByOrderIdList(orderIdList);
|
||||
if(financialDetailList != null && financialDetailList.size() > 0){
|
||||
for(FinancialDetail financialDetail : financialDetailList){
|
||||
longFinancialDetailHashMap.put(financialDetail.getOrderDetailId(), financialDetail);
|
||||
}
|
||||
}
|
||||
}
|
||||
return longFinancialDetailHashMap;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -171,4 +171,14 @@
|
|||
WHERE `code` = #{financialDetailCode} LIMIT 1
|
||||
</select>
|
||||
|
||||
<select id="getByOrderIdList" resultMap="FinancialDetailResult">
|
||||
<include refid="selectFinancialDetail" />
|
||||
<where>
|
||||
and order_detail_id in
|
||||
<foreach item="item" index="orderIdList" collection="orderIdList" open="(" separator="," close=")">
|
||||
#{item}
|
||||
</foreach>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
Loading…
Reference in New Issue