01/10
This commit is contained in:
@@ -0,0 +1,41 @@
|
||||
package com.yxt.ordermall.api.ordorder;
|
||||
|
||||
import com.alibaba.excel.annotation.ExcelIgnore;
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
import com.alibaba.excel.annotation.write.style.ColumnWidth;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @author wangpengfei
|
||||
* @date 2025/1/9 11:27
|
||||
*/
|
||||
@Data
|
||||
public class OrdOrderExcelVo {
|
||||
@ExcelIgnore
|
||||
private String sid;
|
||||
@ColumnWidth(20)
|
||||
@ExcelProperty(value = "创建日期",index = 0)
|
||||
private String createTime;
|
||||
@ColumnWidth(20)
|
||||
@ExcelProperty(value = "订单编号",index = 1)
|
||||
private String outTradeNo;
|
||||
@ColumnWidth(30)
|
||||
@ExcelProperty(value = "商品名称",index = 2)
|
||||
private String name;
|
||||
@ColumnWidth(10)
|
||||
@ExcelProperty(value = "商品数量",index = 3)
|
||||
private String count;
|
||||
@ColumnWidth(20)
|
||||
@ExcelProperty(value = "支付金额",index = 4)
|
||||
private String meet;
|
||||
@ColumnWidth(50)
|
||||
@ExcelProperty(value = "支付方式",index = 5)
|
||||
private String payType="微信支付";
|
||||
@ColumnWidth(20)
|
||||
@ExcelProperty(value = "支付状态",index = 6)
|
||||
private String payStatusValue;
|
||||
@ColumnWidth(20)
|
||||
@ExcelProperty(value = "开票状态",index = 7)
|
||||
private String invoiceStatusValue;
|
||||
|
||||
}
|
||||
@@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Constants;
|
||||
import com.yxt.ordermall.api.ordorder.OrdOrder;
|
||||
import com.yxt.ordermall.api.ordorder.OrdOrderExcelVo;
|
||||
import com.yxt.ordermall.api.ordorder.OrdOrderVo;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
@@ -19,8 +20,9 @@ import java.util.List;
|
||||
@Mapper
|
||||
public interface OrdOrderMapper extends BaseMapper<OrdOrder> {
|
||||
IPage<OrdOrderVo> orderList(IPage<OrdOrder> page, @Param(Constants.WRAPPER) QueryWrapper<OrdOrder> qw);
|
||||
List<OrdOrderExcelVo> orderListE(@Param(Constants.WRAPPER) QueryWrapper<OrdOrder> qw);
|
||||
OrdOrderVo getOrderDetails(@Param("sid")String sid);
|
||||
|
||||
int updateBySidIsDelete(List<String> list);
|
||||
@Select("SELECT " +
|
||||
" ood.goodsName goodsName, " +
|
||||
" ood.partNumber goodsNumber " +
|
||||
|
||||
@@ -26,13 +26,43 @@
|
||||
${ew.sqlSegment}
|
||||
</where>
|
||||
</select>
|
||||
<select id="orderListE" resultType="com.yxt.ordermall.api.ordorder.OrdOrderExcelVo">
|
||||
select
|
||||
o.*,o.sid,
|
||||
case o.payStatus
|
||||
when 1 then '未生成支付订单'
|
||||
when 2 then '待支付'
|
||||
when 3 then '已取消'
|
||||
when 4 then '支付成功'
|
||||
when 5 then '申请退款'
|
||||
when 6 then '退款成功'
|
||||
when 7 then '退款失败'
|
||||
end payStatusValue,
|
||||
case o.invoiceStatus
|
||||
when 0 then '未开票'
|
||||
when 1 then '提交申请'
|
||||
when 2 then '申请通过'
|
||||
when 3 then '不通过'
|
||||
end invoiceStatusValue,
|
||||
(select count(sid) from ord_order_detail where orderSid=o.sid) as count
|
||||
from ord_order o
|
||||
<where>
|
||||
${ew.sqlSegment}
|
||||
</where>
|
||||
</select>
|
||||
<select id="getOrderDetails" resultType="com.yxt.ordermall.api.ordorder.OrdOrderVo">
|
||||
select
|
||||
*
|
||||
from ord_order
|
||||
where sid=#{sid}
|
||||
</select>
|
||||
|
||||
<update id="updateBySidIsDelete">
|
||||
delete from ord_order
|
||||
where sid in
|
||||
<foreach collection="list" item="item" index="index" open="(" separator="," close=")">
|
||||
#{item}
|
||||
</foreach>
|
||||
</update>
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,16 +1,28 @@
|
||||
package com.yxt.ordermall.biz.ordorder;
|
||||
|
||||
import com.alibaba.excel.EasyExcel;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.yxt.common.core.query.PagerQuery;
|
||||
import com.yxt.common.core.result.ResultBean;
|
||||
import com.yxt.common.core.vo.PagerVo;
|
||||
import com.yxt.ordermall.api.lpkreserveorder.LpkReserveOrderQuery;
|
||||
import com.yxt.ordermall.api.ordorder.OrdOrderDto;
|
||||
import com.yxt.ordermall.api.ordorder.OrdOrderExcelVo;
|
||||
import com.yxt.ordermall.api.ordorder.OrdOrderQuery;
|
||||
import com.yxt.ordermall.api.ordorder.OrdOrderVo;
|
||||
import com.yxt.ordermall.api.ordorderdetails.OrdOrderDetail;
|
||||
import com.yxt.ordermall.biz.ordorderdetails.OrdOrderDetailService;
|
||||
import com.yxt.ordermall.biz.vegecallerreserveorder.ReserveAllExcel;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.net.URLEncoder;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author wangpengfei
|
||||
* @date 2023/11/23 10:35
|
||||
@@ -21,7 +33,8 @@ import org.springframework.web.bind.annotation.*;
|
||||
public class OrdOrderRest {
|
||||
@Autowired
|
||||
OrdOrderService ordOrderService;
|
||||
|
||||
@Autowired
|
||||
OrdOrderDetailService ordOrderDetailService;
|
||||
|
||||
@PostMapping("/createOrder")
|
||||
@ApiOperation(value = "创建订单")
|
||||
@@ -48,6 +61,18 @@ public class OrdOrderRest {
|
||||
public ResultBean<PagerVo<OrdOrderVo>> pcOrderList(@RequestBody PagerQuery<OrdOrderQuery> query) {
|
||||
return ordOrderService.pcOrderList(query);
|
||||
}
|
||||
@PostMapping("/pcOrderListExport")
|
||||
@ApiOperation(value = "pc支付记录导出")
|
||||
public void pcOrderListExport(@RequestBody OrdOrderQuery query, HttpServletResponse response) throws IOException {
|
||||
// 这里注意 有同学反应使用swagger 会导致各种问题,请直接用浏览器或者用postman
|
||||
response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
|
||||
response.setCharacterEncoding("utf-8");
|
||||
// 这里URLEncoder.encode可以防止中文乱码 当然和easyexcel没有关系
|
||||
String fileName = URLEncoder.encode("预售单明细", "UTF-8").replaceAll("\\+", "%20");
|
||||
response.setHeader("Content-disposition", "attachment;filename*=utf-8''" + fileName + ".xlsx");
|
||||
List<OrdOrderExcelVo> list = ordOrderService.pcOrderList(query);
|
||||
EasyExcel.write(response.getOutputStream(), OrdOrderExcelVo.class).sheet("预售单明细").doWrite(list);
|
||||
}
|
||||
@GetMapping("/OrderDetails/{sid}")
|
||||
@ApiOperation(value = "支付记录明细")
|
||||
public ResultBean<OrdOrderVo> getOrderDetails(@PathVariable("sid") String sid) {
|
||||
@@ -85,4 +110,11 @@ public class OrdOrderRest {
|
||||
public ResultBean wxElectronicInvoice(@RequestBody OrdOrderQuery query) {
|
||||
return ordOrderService.wxElectronicInvoice(query);
|
||||
}
|
||||
@ApiOperation("根据sid批量删除")
|
||||
@DeleteMapping("/delBySids")
|
||||
public ResultBean delBySids(@RequestBody String[] sids){
|
||||
ResultBean rb = ResultBean.fireFail();
|
||||
ordOrderService.delAll(sids);
|
||||
return rb.success();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -613,6 +613,33 @@ public class OrdOrderService extends MybatisBaseService<OrdOrderMapper, OrdOrder
|
||||
return rb.success().setData(p);
|
||||
}
|
||||
|
||||
public List<OrdOrderExcelVo> pcOrderList(OrdOrderQuery query) {
|
||||
QueryWrapper<OrdOrder> qw = new QueryWrapper<>();
|
||||
if(StringUtils.isNotBlank(query.getBillNo())){
|
||||
qw.like("o.outTradeNo",query.getBillNo());
|
||||
}
|
||||
qw.apply(org.apache.commons.lang3.StringUtils.isNotEmpty(query.getStartDate()), "date_format (createTime,'%Y-%m-%d') >= date_format('" + query.getStartDate() + "','%Y-%m-%d')").
|
||||
apply(org.apache.commons.lang3.StringUtils.isNotEmpty(query.getEndDate()), "date_format (createTime,'%Y-%m-%d') <= date_format('" + query.getEndDate() + "','%Y-%m-%d')"
|
||||
);
|
||||
qw.apply(org.apache.commons.lang3.StringUtils.isNotEmpty(query.getPayStartDate()), "date_format (payTime,'%Y-%m-%d') >= date_format('" + query.getPayStartDate() + "','%Y-%m-%d')").
|
||||
apply(org.apache.commons.lang3.StringUtils.isNotEmpty(query.getPayEndDate()), "date_format (payTime,'%Y-%m-%d') <= date_format('" + query.getPayEndDate() + "','%Y-%m-%d')"
|
||||
);
|
||||
if (StringUtils.isNotBlank(query.getPayState())) {
|
||||
if(query.getPayState().equals("99")){
|
||||
qw.in("o.payStatus","5","6","7");
|
||||
}else{
|
||||
qw.eq("o.payStatus", query.getPayState());
|
||||
}
|
||||
}
|
||||
if(StringUtils.isNotBlank(query.getInvoiceState())){
|
||||
qw.eq("o.invoiceStatus",query.getInvoiceState());
|
||||
}
|
||||
qw.eq("1",1);
|
||||
qw.orderByDesc("o.createTime");
|
||||
List<OrdOrderExcelVo> pagging = baseMapper.orderListE(qw);
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
return pagging;
|
||||
}
|
||||
public ResultBean<PagerVo<OrdOrderVo>> pcOrderList(PagerQuery<OrdOrderQuery> pq) {
|
||||
ResultBean rb = new ResultBean().fail();
|
||||
OrdOrderQuery query = pq.getParams();
|
||||
@@ -930,7 +957,9 @@ public class OrdOrderService extends MybatisBaseService<OrdOrderMapper, OrdOrder
|
||||
}
|
||||
return rb.success().setData(res);
|
||||
}
|
||||
|
||||
public void delAll(String[] sids) {
|
||||
int count = baseMapper.updateBySidIsDelete(Arrays.stream(sids).collect(Collectors.toList()));
|
||||
}
|
||||
/**
|
||||
* 去除多余.0
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user