This commit is contained in:
kuang.yifei@iwhalecloud.com 2022-06-07 17:08:25 +08:00
parent a96ab58e1e
commit aef73ce907
6 changed files with 66 additions and 5 deletions

View File

@ -22,9 +22,11 @@ import com.ghy.order.service.OrderDetailService;
import com.ghy.order.service.OrderGoodsService; import com.ghy.order.service.OrderGoodsService;
import com.ghy.order.service.OrderMasterService; import com.ghy.order.service.OrderMasterService;
import com.ghy.payment.domain.FinancialDetail; import com.ghy.payment.domain.FinancialDetail;
import com.ghy.payment.domain.FinancialMaster;
import com.ghy.payment.service.FinancialDetailService; import com.ghy.payment.service.FinancialDetailService;
import com.ghy.payment.service.FinancialMasterService; import com.ghy.payment.service.FinancialMasterService;
import com.ghy.web.pojo.vo.OrderDetailsResponseVo; import com.ghy.web.pojo.vo.OrderDetailsResponseVo;
import com.ghy.web.pojo.vo.OrderListResponse;
import com.ghy.worker.domain.Worker; import com.ghy.worker.domain.Worker;
import com.ghy.worker.service.WorkerService; import com.ghy.worker.service.WorkerService;
import com.github.pagehelper.PageInfo; import com.github.pagehelper.PageInfo;
@ -85,15 +87,17 @@ public class OrderMasterController extends BaseController {
@ResponseBody @ResponseBody
public TableDataInfo appList(OrderMaster orderMaster){ public TableDataInfo appList(OrderMaster orderMaster){
startPage(); startPage();
List<OrderListResponse> orderListResponses = new ArrayList<>();
List<OrderMaster> list = orderMasterService.selectOrderMasterList(orderMaster); List<OrderMaster> list = orderMasterService.selectOrderMasterList(orderMaster);
list.forEach(master->{ list.forEach(master->{
OrderListResponse orderListResponse = new OrderListResponse();
// 添加师傅信息 // 添加师傅信息
master.setWorker(workerService.selectById(master.getWorkerId())); Worker worker = workerService.selectById(master.getWorkerId());
OrderGoods orderGoods = orderGoodsService.selectByOrderMasterId(master.getId()); OrderGoods orderGoods = orderGoodsService.selectByOrderMasterId(master.getId());
// 添加商品信息 // 添加商品信息
List<GoodsStandard> goodsStandardList = goodsStandardService.selectByGoodsId(orderGoods.getGoodsId()); List<GoodsStandard> goodsStandardList = goodsStandardService.selectByGoodsStandardId(orderGoods.getGoodsId());
if(!CollectionUtils.isEmpty(goodsStandardList)){ if(!CollectionUtils.isEmpty(goodsStandardList)){
orderGoods.setGoodsStandard(goodsStandardList.get(0)); orderGoods.setGoodsStandard(goodsStandardList.get(0));
orderGoods.setGoodsLogoUrl(goodsService.selectById(goodsStandardList.get(0).getGoodsId()).getGoodsImgUrl()); orderGoods.setGoodsLogoUrl(goodsService.selectById(goodsStandardList.get(0).getGoodsId()).getGoodsImgUrl());
@ -102,10 +106,21 @@ public class OrderMasterController extends BaseController {
// 添加订单商品信息 // 添加订单商品信息
master.setOrderGoods(orderGoods); master.setOrderGoods(orderGoods);
// 添加财务主单信息 FinancialMaster financialMaster = financialMasterService.selectByOrderMasterId(master.getId());
master.setFinancialMaster(financialMasterService.selectByOrderMasterId(master.getId()));
orderListResponse.setOrderMasterId(master.getId());
orderListResponse.setNum(orderGoods.getGoodsNum());
orderListResponse.setGoodsName(orderGoods.getGoodsName());
orderListResponse.setStandardName(orderGoods.getGoodsStandard().getGoodsStandardName());
orderListResponse.setGoodsLogoUrl(orderGoods.getGoodsLogoUrl());
orderListResponse.setDiscountMoney(financialMaster.getDiscountMoney());
orderListResponse.setTotalMoney(financialMaster.getTotalMoney());
orderListResponse.setPayMoney(financialMaster.getPayMoney());
orderListResponse.setWorkerName(worker.getName());
orderListResponses.add(orderListResponse);
}); });
return getDataTable(list); return voDataTable(orderListResponses, list);
} }
@RequiresPermissions("order:master:list") @RequiresPermissions("order:master:list")

View File

@ -0,0 +1,28 @@
package com.ghy.web.pojo.vo;
import lombok.Data;
import java.math.BigDecimal;
@Data
public class OrderListResponse {
private Long orderMasterId;
private String workerName;
private String goodsName;
private String standardName;
private Integer num;
private BigDecimal totalMoney;
private BigDecimal payMoney;
private BigDecimal discountMoney;
private String goodsLogoUrl;
}

View File

@ -31,6 +31,8 @@ public interface GoodsStandardMapper {
*/ */
List<GoodsStandard> selectByGoodsId(Long goodsId); List<GoodsStandard> selectByGoodsId(Long goodsId);
List<GoodsStandard> selectByGoodsStandardId(Long goodsStandardId);
/** /**
* @param goodsStandardList 批量添加商品规格 * @param goodsStandardList 批量添加商品规格
* @return 添加成功条数 * @return 添加成功条数

View File

@ -30,6 +30,8 @@ public interface GoodsStandardService {
*/ */
List<GoodsStandard> selectByGoodsId(Long goodsId); List<GoodsStandard> selectByGoodsId(Long goodsId);
List<GoodsStandard> selectByGoodsStandardId(Long goodsStandardId);
/** /**
* @param goodsStandardList 批量添加商品规格 * @param goodsStandardList 批量添加商品规格
* @return 添加成功条数 * @return 添加成功条数

View File

@ -38,6 +38,11 @@ public class GoodsStandardServiceImpl implements GoodsStandardService {
return goodsStandardMapper.selectByGoodsId(goodsId); return goodsStandardMapper.selectByGoodsId(goodsId);
} }
@Override
public List<GoodsStandard> selectByGoodsStandardId(Long goodsStandardId) {
return goodsStandardMapper.selectByGoodsStandardId(goodsStandardId);
}
@Override @Override
public int batchInsert(List<GoodsStandard> goodsStandardList) { public int batchInsert(List<GoodsStandard> goodsStandardList) {
return goodsStandardMapper.batchInsert(goodsStandardList); return goodsStandardMapper.batchInsert(goodsStandardList);

View File

@ -66,6 +66,15 @@
</where> </where>
</select> </select>
<select id="selectByGoodsStandardId" parameterType="long" resultMap="GoodsStandardResult">
<include refid="selectGoodsStandard"/>
<where>
<if test="goodsId != null ">
AND goods_standard_id = #{goodsId}
</if>
</where>
</select>
<insert id="batchInsert" parameterType="list"> <insert id="batchInsert" parameterType="list">
INSERT INTO goods_standard ( INSERT INTO goods_standard (
goods_standard_name, goods_id, dept_goods_category_id, goods_price, discount_price, group_price, goods_num, goods_standard_name, goods_id, dept_goods_category_id, goods_price, discount_price, group_price, goods_num,