From 2f488a71e1d27088955db8c39b8ea263142d0278 Mon Sep 17 00:00:00 2001 From: "kuang.yife" Date: Sun, 18 Feb 2024 09:38:44 +0800 Subject: [PATCH] =?UTF-8?q?=E8=AE=A2=E5=8D=95=E5=AE=8C=E5=8D=95=E5=9B=BE?= =?UTF-8?q?=E7=89=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../web/controller/order/OrderController.java | 30 ++++++-- .../order/OrderOperationRecordController.java | 2 +- .../web/controller/pay/AlipayController.java | 59 ++++++++------ .../worker/WorkerCertificationController.java | 3 + .../main/resources/templates/order/imgs.html | 77 +++++++++++++++++++ .../resources/templates/order/pc-master.html | 10 ++- .../java/com/ghy/goods/domain/GoodsImgs.java | 4 + .../mapper/goods/GoodsImgsMapper.xml | 6 ++ 8 files changed, 160 insertions(+), 31 deletions(-) create mode 100644 ghy-admin/src/main/resources/templates/order/imgs.html diff --git a/ghy-admin/src/main/java/com/ghy/web/controller/order/OrderController.java b/ghy-admin/src/main/java/com/ghy/web/controller/order/OrderController.java index b2caca10..dab9bcab 100644 --- a/ghy-admin/src/main/java/com/ghy/web/controller/order/OrderController.java +++ b/ghy-admin/src/main/java/com/ghy/web/controller/order/OrderController.java @@ -1,22 +1,22 @@ package com.ghy.web.controller.order; -import com.ghy.common.annotation.Log; import com.ghy.common.core.controller.BaseController; import com.ghy.common.core.domain.AjaxResult; import com.ghy.common.core.domain.entity.SysUser; +import com.ghy.common.core.page.TableDataInfo; import com.ghy.common.enums.*; -import com.ghy.common.json.JSONObject; import com.ghy.common.utils.WechatMsgUtils; -import com.ghy.common.utils.poi.ExcelUtil; import com.ghy.customer.domain.Customer; import com.ghy.customer.domain.CustomerAddress; import com.ghy.customer.service.CustomerAddressService; import com.ghy.customer.service.CustomerService; import com.ghy.goods.domain.DeptGoodsCategory; import com.ghy.goods.domain.Goods; +import com.ghy.goods.domain.GoodsImgs; import com.ghy.goods.domain.GoodsStandard; import com.ghy.goods.request.AppGoodsRequest; import com.ghy.goods.service.DeptGoodsCategoryService; +import com.ghy.goods.service.GoodsImgsService; import com.ghy.goods.service.GoodsService; import com.ghy.goods.service.GoodsStandardService; import com.ghy.order.domain.*; @@ -44,15 +44,12 @@ import org.apache.commons.collections.CollectionUtils; import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.exception.ExceptionUtils; import org.apache.commons.lang3.time.DateUtils; -import org.apache.shiro.authz.annotation.RequiresPermissions; import org.springframework.beans.BeanUtils; import org.springframework.stereotype.Controller; import org.springframework.transaction.annotation.Transactional; import org.springframework.ui.ModelMap; import org.springframework.util.Assert; -import org.springframework.util.StopWatch; import org.springframework.web.bind.annotation.*; -import org.springframework.web.multipart.MultipartFile; import javax.annotation.Resource; import java.math.BigDecimal; @@ -111,8 +108,29 @@ public class OrderController extends BaseController { private IWxMsgService wxMsgService; @Resource private IOrderCallRecordService orderCallRecordService; + @Resource + private GoodsImgsService goodsImgsService; + @GetMapping("/imgs") + public String orderImgs(Long orderId, ModelMap mmap){ + mmap.put("orderId", orderId); + return "order/imgs"; + } + + @PostMapping("/imgs/list") + @ResponseBody + public TableDataInfo list(GoodsImgs goodsImgs) + { + List details = orderDetailService.selectByOrderMasterId(Long.valueOf(goodsImgs.getRemark())); + List ids = details.stream().map(OrderDetail::getId).collect(Collectors.toList()); + goodsImgs.setRemark(null); + goodsImgs.setRemarks(ids); + goodsImgs.setImgType(ImgType.FINISH_IMG.getId()); + List list = goodsImgsService.qryGoodsImgs(goodsImgs); + return getDataTable(list); + } + @GetMapping("/popup/editServingInfo") public String record(Long orderId, String pageCode, ModelMap mmap) { mmap.put("orderId", orderId); diff --git a/ghy-admin/src/main/java/com/ghy/web/controller/order/OrderOperationRecordController.java b/ghy-admin/src/main/java/com/ghy/web/controller/order/OrderOperationRecordController.java index bc4b69c7..fc4834e1 100644 --- a/ghy-admin/src/main/java/com/ghy/web/controller/order/OrderOperationRecordController.java +++ b/ghy-admin/src/main/java/com/ghy/web/controller/order/OrderOperationRecordController.java @@ -73,7 +73,7 @@ public class OrderOperationRecordController extends BaseController @ApiOperation("新增订单操作记录") @PostMapping("/app/add") @ResponseBody - public AjaxResult appAdd(OrderOperationRecord orderOperationRecord) + public AjaxResult appAdd(@RequestBody OrderOperationRecord orderOperationRecord) { return toAjax(orderOperationRecordService.insertOrderOperationRecord(orderOperationRecord)); } diff --git a/ghy-admin/src/main/java/com/ghy/web/controller/pay/AlipayController.java b/ghy-admin/src/main/java/com/ghy/web/controller/pay/AlipayController.java index c5391e0a..e91fb2df 100644 --- a/ghy-admin/src/main/java/com/ghy/web/controller/pay/AlipayController.java +++ b/ghy-admin/src/main/java/com/ghy/web/controller/pay/AlipayController.java @@ -31,6 +31,7 @@ import org.springframework.web.bind.annotation.RestController; import javax.annotation.Resource; import java.math.BigDecimal; import java.util.ArrayList; +import java.util.Arrays; import java.util.List; import java.util.Objects; @@ -88,30 +89,41 @@ public class AlipayController extends BaseController { @PostMapping("/addMasterQr") public AjaxResult addMasterQrPay(@RequestBody String orderId) { - // 不知道为啥参数可能会带上双引号 这里去掉再转Long - Long orderMasterId = Long.valueOf(orderId.replace("\"", "")); - BigDecimal payMoney = BigDecimal.ZERO; - OrderMaster orderMaster = orderMasterService.selectById(orderMasterId); - if (orderMaster == null) { - return AjaxResult.error("主订单不存在!"); - } - // 查询主单是否有未支付的付款单 - FinancialMaster fm = financialMasterService.selectByOrderMasterId(orderMaster.getId()); - if (fm == null) { - return AjaxResult.error("财务单不存在!"); - } + orderId = orderId.replace("\"", ""); + String [] orderIds = orderId.split(","); + List orderIdList = Arrays.asList(orderIds); ArrayList relations = new ArrayList<>(); - // 主单是否付款 没付款的话一起付 - boolean fmPaid = Objects.equals(PayStatus.WAIT_PAY.getCode(), fm.getPayStatus()); - if (fmPaid) { - payMoney = payMoney.add(fm.getPayMoney()); - relations.add(new PaymentRelation(null, fm.getId(), PaymentRelation.FINANCIAL_MASTER, fm.getPayMoney())); - } + List fmList = new ArrayList<>(); + BigDecimal payMoney = BigDecimal.ZERO; + for (String id : orderIdList){ + // 不知道为啥参数可能会带上双引号 这里去掉再转Long + Long orderMasterId = Long.valueOf(id); + OrderMaster orderMaster = orderMasterService.selectById(orderMasterId); + if (orderMaster == null) { + return AjaxResult.error("主订单不存在!"); + } + // 查询主单是否有未支付的付款单 + FinancialMaster fm = financialMasterService.selectByOrderMasterId(orderMaster.getId()); + if (fm == null) { + return AjaxResult.error("财务单不存在!"); + } + // 主单是否付款 没付款的话一起付 + boolean fmPaid = Objects.equals(PayStatus.WAIT_PAY.getCode(), fm.getPayStatus()); + if (fmPaid) { + fmList.add(fm.getId()); + payMoney = payMoney.add(fm.getPayMoney()); + relations.add(new PaymentRelation(null, fm.getId(), PaymentRelation.FINANCIAL_MASTER, fm.getPayMoney())); + }else { + return AjaxResult.error("选择了不需要付款的订单!"); + } - if (MoneyUtil.lte0(payMoney)) { - return AjaxResult.error("不需要支付"); - } + if (MoneyUtil.lte0(payMoney)) { + return AjaxResult.error("不需要支付"); + } + } + // 以第一单为第三放的付款单号 + OrderMaster orderMaster = orderMasterService.selectById(Long.valueOf(orderIdList.get(0))); // 付款 PayParam payParam = PayParam.delayPayParam(orderMaster.getCode() + "_" + System.currentTimeMillis(), MoneyUtil.toS(payMoney), "订单支付", "叮咚到家服务"); @@ -130,9 +142,9 @@ public class AlipayController extends BaseController { } // 支付二维码创建成功 保存一下paymentId String paymentId = response.getString("id"); - if (fmPaid) { + for (Long id : fmList){ FinancialMaster fm2update = new FinancialMaster(); - fm2update.setId(fm.getId()); + fm2update.setId(id); fm2update.setPaymentId(paymentId); fm2update.setPayType(PayTypeEnum.ALIPAY_QR.getCode()); financialMasterService.updateFinancialMaster(fm2update); @@ -142,6 +154,7 @@ public class AlipayController extends BaseController { relation.setPaymentId(paymentId); paymentRelationService.insert(relation); } + return AjaxResult.success(response); } diff --git a/ghy-admin/src/main/java/com/ghy/web/controller/worker/WorkerCertificationController.java b/ghy-admin/src/main/java/com/ghy/web/controller/worker/WorkerCertificationController.java index f04290b1..071bc07a 100644 --- a/ghy-admin/src/main/java/com/ghy/web/controller/worker/WorkerCertificationController.java +++ b/ghy-admin/src/main/java/com/ghy/web/controller/worker/WorkerCertificationController.java @@ -81,6 +81,9 @@ public class WorkerCertificationController extends BaseController workerCertification.setDeptId(this.getSysUser().getDept().getParentId()); } List list = workerCertificationService.selectWorkerCertificationList(workerCertification); + list.forEach(worker->{ + worker.setName(worker.getSurname() + worker.getName()); + }); return getDataTable(list); } diff --git a/ghy-admin/src/main/resources/templates/order/imgs.html b/ghy-admin/src/main/resources/templates/order/imgs.html new file mode 100644 index 00000000..9bf343b1 --- /dev/null +++ b/ghy-admin/src/main/resources/templates/order/imgs.html @@ -0,0 +1,77 @@ + + + + + + + + + + +
+
+
+
+
+ +
+
+
+
+
+
+
+
+ + + + + + + + \ No newline at end of file diff --git a/ghy-admin/src/main/resources/templates/order/pc-master.html b/ghy-admin/src/main/resources/templates/order/pc-master.html index a9dd1714..925c3604 100644 --- a/ghy-admin/src/main/resources/templates/order/pc-master.html +++ b/ghy-admin/src/main/resources/templates/order/pc-master.html @@ -424,7 +424,7 @@ + '' + row.code + '
' + ' ' + row.consoleGoodsName + '
' + ' 联系人:' + row.addressName + '
' - + ' 联系电话:' + row.addressPhone + '
' + // + ' 联系电话:' + row.addressPhone + '
' + ' 联系地址:' + row.address + '
' + ' 下单时间:' + row.createTime + '
' + ' 预约时间:' + row.mixExpectTime + '
' @@ -465,6 +465,9 @@ if(row.orderStatus == 0 || row.orderStatus == 1){ actions.push('商家退单 '); } + if(row.orderStatus == 5){ + actions.push('完单图片 '); + } if (row.payStatus == 0) { actions.push('付款 '); } @@ -564,6 +567,11 @@ }); } + function finishImgs(id){ + var url = "order/imgs?orderId=" + id; + $.modal.open("拨号记录", url); + } + function orderMasterReject(id) { $.modal.confirm("确定要退单吗?", function() { const url = "console/cancel"; diff --git a/ghy-goods/src/main/java/com/ghy/goods/domain/GoodsImgs.java b/ghy-goods/src/main/java/com/ghy/goods/domain/GoodsImgs.java index 42b569c5..f8e40e3a 100644 --- a/ghy-goods/src/main/java/com/ghy/goods/domain/GoodsImgs.java +++ b/ghy-goods/src/main/java/com/ghy/goods/domain/GoodsImgs.java @@ -4,6 +4,8 @@ import com.ghy.common.annotation.Excel; import com.ghy.common.core.domain.BaseEntity; import lombok.Data; +import java.util.List; + /** * 商品图片 * @author clunt @@ -25,4 +27,6 @@ public class GoodsImgs extends BaseEntity { @Excel(name = "图片类型 0.轮播图 1.详情图", cellType = Excel.ColumnType.NUMERIC) private Integer imgType; + private List remarks; + } diff --git a/ghy-goods/src/main/resources/mapper/goods/GoodsImgsMapper.xml b/ghy-goods/src/main/resources/mapper/goods/GoodsImgsMapper.xml index 3968ddb8..11029e32 100644 --- a/ghy-goods/src/main/resources/mapper/goods/GoodsImgsMapper.xml +++ b/ghy-goods/src/main/resources/mapper/goods/GoodsImgsMapper.xml @@ -26,6 +26,12 @@ AND img_type = #{imgType} + + AND remark in + + #{orderId} + +