订单完单图片
This commit is contained in:
parent
8c805e710a
commit
2f488a71e1
|
|
@ -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<OrderDetail> details = orderDetailService.selectByOrderMasterId(Long.valueOf(goodsImgs.getRemark()));
|
||||
List<Long> ids = details.stream().map(OrderDetail::getId).collect(Collectors.toList());
|
||||
goodsImgs.setRemark(null);
|
||||
goodsImgs.setRemarks(ids);
|
||||
goodsImgs.setImgType(ImgType.FINISH_IMG.getId());
|
||||
List<GoodsImgs> list = goodsImgsService.qryGoodsImgs(goodsImgs);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
@GetMapping("/popup/editServingInfo")
|
||||
public String record(Long orderId, String pageCode, ModelMap mmap) {
|
||||
mmap.put("orderId", orderId);
|
||||
|
|
|
|||
|
|
@ -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));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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<String> orderIdList = Arrays.asList(orderIds);
|
||||
ArrayList<PaymentRelation> 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<Long> 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);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -81,6 +81,9 @@ public class WorkerCertificationController extends BaseController
|
|||
workerCertification.setDeptId(this.getSysUser().getDept().getParentId());
|
||||
}
|
||||
List<WorkerCertification> list = workerCertificationService.selectWorkerCertificationList(workerCertification);
|
||||
list.forEach(worker->{
|
||||
worker.setName(worker.getSurname() + worker.getName());
|
||||
});
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,77 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="zh" xmlns:th="http://www.thymeleaf.org">
|
||||
|
||||
<head>
|
||||
<th:block th:include="include :: header('完单图片')"/>
|
||||
<th:block th:include="include :: layout-latest-css"/>
|
||||
</head>
|
||||
|
||||
<body class="gray-bg">
|
||||
|
||||
<div class="ui-layout-center">
|
||||
<div class="container-div">
|
||||
<div class="row">
|
||||
<div class="col-sm-12 search-collapse">
|
||||
<form id="order-goods-form">
|
||||
<!-- <input type="hidden" id="orderId" name="orderId" th:value="${orderMaster.id}">-->
|
||||
</form>
|
||||
</div>
|
||||
<div class="col-sm-12 select-table table-striped">
|
||||
<table id="bootstrap-table"></table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<th:block th:include="include :: footer"/>
|
||||
<th:block th:include="include :: layout-latest-js"/>
|
||||
|
||||
<script th:inline="javascript">
|
||||
|
||||
var prefix = ctx + "order/imgs";
|
||||
var orderId = '[[${orderId}]]';
|
||||
|
||||
$(function () {
|
||||
var panehHidden = false;
|
||||
if ($(this).width() < 769) {
|
||||
panehHidden = true;
|
||||
}
|
||||
$('body').layout({initClosed: panehHidden, west__size: 185});
|
||||
// 回到顶部绑定
|
||||
if ($.fn.toTop !== undefined) {
|
||||
var opt = {
|
||||
win: $('.ui-layout-center'),
|
||||
doc: $('.ui-layout-center')
|
||||
};
|
||||
$('#scroll-up').toTop(opt);
|
||||
}
|
||||
queryOrderCallList();
|
||||
});
|
||||
|
||||
function queryOrderCallList() {
|
||||
var options = {
|
||||
url: prefix + "/list?remark=" + orderId,
|
||||
modalName: "完单图片记录",
|
||||
search: false,
|
||||
showSearch: false,
|
||||
showToggle: false,
|
||||
showColumns: false,
|
||||
showRefresh: false,
|
||||
columns: [
|
||||
{
|
||||
field: 'imgUrl',
|
||||
title: '完单图片',
|
||||
formatter: function(value) {
|
||||
if (value != null && value !== ''){return '<a target="_blank" href="' + value+ '" >查看图片<a/>';}
|
||||
else {return '<a>无<a/>'}
|
||||
}
|
||||
}
|
||||
]
|
||||
};
|
||||
$.table.init(options);
|
||||
}
|
||||
|
||||
</script>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
|
|
@ -424,7 +424,7 @@
|
|||
+ '<small>' + row.code + '<small/> <br>'
|
||||
+ '<small> ' + row.consoleGoodsName + '<small/> <br>'
|
||||
+ '<small> 联系人:' + row.addressName + '</small> <br>'
|
||||
+ '<small> 联系电话:' + row.addressPhone + '</small> <br>'
|
||||
// + '<small> 联系电话:' + row.addressPhone + '</small> <br>'
|
||||
+ '<small> 联系地址:' + row.address + '</small> <br>'
|
||||
+ '<small> 下单时间:' + row.createTime + '</small> <br>'
|
||||
+ '<small> 预约时间:' + row.mixExpectTime + '</small> <br>'
|
||||
|
|
@ -465,6 +465,9 @@
|
|||
if(row.orderStatus == 0 || row.orderStatus == 1){
|
||||
actions.push('<a class="btn btn-success btn-xs " href="javascript:void(0)" onclick="orderMasterCancel(\'' + row.id + '\')"></i>商家退单</a> ');
|
||||
}
|
||||
if(row.orderStatus == 5){
|
||||
actions.push('<a class="btn btn-success btn-xs " href="javascript:void(0)" onclick="finishImgs(\'' + row.id + '\')"></i>完单图片</a> ');
|
||||
}
|
||||
if (row.payStatus == 0) {
|
||||
actions.push('<a class="btn btn-success btn-xs " href="javascript:void(0)" onclick="showPayQrcode(\'' + row.id + '\')"></i>付款</a> ');
|
||||
}
|
||||
|
|
@ -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";
|
||||
|
|
|
|||
|
|
@ -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<Long> remarks;
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -26,6 +26,12 @@
|
|||
<if test="imgType != null">
|
||||
AND img_type = #{imgType}
|
||||
</if>
|
||||
<if test="remarks != null and remarks.size() > 0">
|
||||
AND remark in
|
||||
<foreach collection="remarks" item="orderId" open="(" separator="," close=")">
|
||||
#{orderId}
|
||||
</foreach>
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue