| @@ -5,6 +5,10 @@ import com.iformall.common.Result; | |||
| import com.iformall.common.ResultData; | |||
| import com.iformall.domain.po.NeuPosOrderMasterExt; | |||
| import com.iformall.domain.po.WxActivity; | |||
| import com.iformall.domain.vo.NeuPosOrderDataBVo; | |||
| import com.iformall.domain.vo.NeuPosSumDataBVo; | |||
| import com.iformall.domain.vo.WxCouponOrderBVo; | |||
| import com.iformall.enums.EnumCouponOrderStatus; | |||
| import com.iformall.service.NeuPosOrderService; | |||
| import com.iformall.utils.DateUtils; | |||
| @@ -20,9 +24,13 @@ import org.springframework.web.bind.annotation.ModelAttribute; | |||
| import org.springframework.web.bind.annotation.RequestMapping; | |||
| import org.springframework.web.bind.annotation.RestController; | |||
| import java.util.HashMap; | |||
| import java.util.List; | |||
| import java.util.Map; | |||
| import javax.servlet.http.HttpServletRequest; | |||
| import javax.servlet.http.HttpServletResponse; | |||
| /** | |||
| * @author gongbiao | |||
| */ | |||
| @@ -104,6 +112,21 @@ public class NeuPosAdminController extends BaseController { | |||
| return new ResultData(maplist); | |||
| } | |||
| @GetMapping("exportPayTypeOrderSum") | |||
| @ApiImplicitParams({ | |||
| @ApiImplicitParam(name = "tenantId", value = "租户号", dataType = "String", paramType = "query", required = true)}) | |||
| public void exportPayTypeOrderSum(@ModelAttribute NeuPosOrderMasterExt example,String tenantId, HttpServletRequest request, HttpServletResponse response) { | |||
| if (!tenantValid(tenantId)) { | |||
| return; | |||
| } | |||
| setDate(example); | |||
| example.setOrgId(24); | |||
| List<Map> maplist = neuPosOrderService.queryShopPayOrderSum(example); | |||
| if (null != maplist) { | |||
| neuPosOrderService.exportData(maplist,"pos交易汇总",new NeuPosSumDataBVo(), request, response); | |||
| } | |||
| } | |||
| @ApiOperation("流水记录") | |||
| @GetMapping("orderlist") | |||
| @ApiImplicitParams({ | |||
| @@ -119,4 +142,33 @@ public class NeuPosAdminController extends BaseController { | |||
| PageInfo<Map> maplist = neuPosOrderService.queryOrderList(example,pageNum,pageSize); | |||
| return new ResultData(maplist); | |||
| } | |||
| @GetMapping("exportOrderlist") | |||
| @ApiImplicitParams({ | |||
| @ApiImplicitParam(name = "pageNum", value = "页数", dataType = "int", paramType = "query", required = true), | |||
| @ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "int", paramType = "query", required = true), | |||
| @ApiImplicitParam(name = "tenantId", value = "租户号", dataType = "String", paramType = "query", required = true)}) | |||
| public void exportOrderlist(@ModelAttribute NeuPosOrderMasterExt example,String tenantId, HttpServletRequest request, HttpServletResponse response) { | |||
| if (!tenantValid(tenantId)) { | |||
| return; | |||
| } | |||
| setDate(example); | |||
| example.setOrgId(24); | |||
| PageInfo<Map> maplist = neuPosOrderService.queryOrderList(example,1,60000); | |||
| List<Map> payTypeMap = neuPosOrderService.selectPayTypeList(); | |||
| Map<Integer,String> typeMap = new HashMap<Integer,String>(); | |||
| for (Map payt:payTypeMap) { | |||
| String payttye = (String)payt.get("pay_type"); | |||
| typeMap.put(Integer.parseInt(payttye), (String)payt.get("name")); | |||
| } | |||
| if (null != maplist && null != maplist.getList()) { | |||
| maplist.getList().parallelStream().forEach(c -> { | |||
| if (typeMap.containsKey(c.get("payType"))) { | |||
| c.put("payTypeName",typeMap.get(c.get("payType"))); | |||
| } | |||
| }); | |||
| neuPosOrderService.exportData(maplist.getList(),"pos交易明细",new NeuPosOrderDataBVo(), request, response); | |||
| } | |||
| } | |||
| } | |||
| @@ -0,0 +1,50 @@ | |||
| package com.iformall.domain.vo; | |||
| import cn.afterturn.easypoi.excel.annotation.Excel; | |||
| import com.baomidou.mybatisplus.annotation.TableField; | |||
| import com.fasterxml.jackson.annotation.JsonIgnoreProperties; | |||
| import com.iformall.domain.po.WxCouponOrder; | |||
| import lombok.Data; | |||
| import lombok.EqualsAndHashCode; | |||
| import lombok.ToString; | |||
| import java.io.Serializable; | |||
| import java.math.BigDecimal; | |||
| import java.math.RoundingMode; | |||
| import java.text.DecimalFormat; | |||
| import java.util.Date; | |||
| import java.util.List; | |||
| @JsonIgnoreProperties(value = {"handler"}) | |||
| @Data | |||
| @ToString(callSuper = true) | |||
| public class NeuPosOrderDataBVo implements Serializable { | |||
| private static final long serialVersionUID = 6687954932922444531L; | |||
| @Excel(name = "交易单号", width = 20, orderNum = "1", prefix = "`") | |||
| private String orderNumber; | |||
| /** 基础购买到的券信息 */ | |||
| @Excel(name = "POSsn", width = 20, orderNum = "1", prefix = "`") | |||
| private String serialNo; | |||
| @Excel(name = "账单金额", width = 50, orderNum = "2") | |||
| private String orderAmount; | |||
| @Excel(name = "折扣", width = 50, orderNum = "2") | |||
| private String discountAmount; | |||
| @Excel(name = "支付方式", width = 50,orderNum = "2") | |||
| private String payTypeName; | |||
| @Excel(name = "交易时间", width = 50, exportFormat = "yyyy-MM-dd HH:mm:ss",orderNum = "2") | |||
| private Date paidTime; | |||
| // @Excel(name = "状态", width = 20, replace = {"待使用_0", "已核销_1", "已过期_2", "已退款_3"}, orderNum = "14") | |||
| // @io.swagger.annotations.ApiModelProperty(value = "状态:0,待使用 1,已核销 2,已过期 3,已作废 ", name = "couponOrderStatus") | |||
| // private Integer couponOrderStatus; | |||
| // | |||
| // @Excel(name = "核销/过期/退款时间", width = 20, exportFormat = "yyyy-MM-dd HH:mm:ss", orderNum = "10") | |||
| // @io.swagger.annotations.ApiModelProperty(value = "", name = "updateDate") | |||
| // private Date updateDate; | |||
| } | |||
| @@ -0,0 +1,53 @@ | |||
| package com.iformall.domain.vo; | |||
| import cn.afterturn.easypoi.excel.annotation.Excel; | |||
| import com.baomidou.mybatisplus.annotation.TableField; | |||
| import com.fasterxml.jackson.annotation.JsonIgnoreProperties; | |||
| import com.iformall.domain.po.WxCouponOrder; | |||
| import lombok.Data; | |||
| import lombok.EqualsAndHashCode; | |||
| import lombok.ToString; | |||
| import java.io.Serializable; | |||
| import java.math.BigDecimal; | |||
| import java.math.RoundingMode; | |||
| import java.text.DecimalFormat; | |||
| import java.util.Date; | |||
| import java.util.List; | |||
| @JsonIgnoreProperties(value = {"handler"}) | |||
| @Data | |||
| @ToString(callSuper = true) | |||
| public class NeuPosSumDataBVo implements Serializable { | |||
| private static final long serialVersionUID = 6687954932922444531L; | |||
| @Excel(name = "支付方式", width = 20, orderNum = "1", prefix = "`") | |||
| private String payTypeName; | |||
| /** 基础购买到的券信息 */ | |||
| @Excel(name = "消费金额", width = 20, orderNum = "1", prefix = "`") | |||
| private String payAmount; | |||
| @Excel(name = "折扣金额", width = 50, orderNum = "2") | |||
| private String discountAmount; | |||
| @Excel(name = "消费笔数", width = 50, orderNum = "2") | |||
| private String payCount; | |||
| @Excel(name = "退款金额", width = 50, orderNum = "2") | |||
| private String refundAmount; | |||
| @Excel(name = "退款笔数", width = 50, orderNum = "2") | |||
| private String refundCount; | |||
| @Excel(name = "实收金额", width = 50, orderNum = "2") | |||
| private String amount; | |||
| // @Excel(name = "状态", width = 20, replace = {"待使用_0", "已核销_1", "已过期_2", "已退款_3"}, orderNum = "14") | |||
| // @io.swagger.annotations.ApiModelProperty(value = "状态:0,待使用 1,已核销 2,已过期 3,已作废 ", name = "couponOrderStatus") | |||
| // private Integer couponOrderStatus; | |||
| // | |||
| // @Excel(name = "核销/过期/退款时间", width = 20, exportFormat = "yyyy-MM-dd HH:mm:ss", orderNum = "10") | |||
| // @io.swagger.annotations.ApiModelProperty(value = "", name = "updateDate") | |||
| // private Date updateDate; | |||
| } | |||
| @@ -1,9 +1,12 @@ | |||
| package com.iformall.service; | |||
| import java.util.*; | |||
| import javax.servlet.http.HttpServletRequest; | |||
| import javax.servlet.http.HttpServletResponse; | |||
| import com.github.pagehelper.PageInfo; | |||
| import com.iformall.domain.po.NeuPosOrderMasterExt; | |||
| import com.iformall.domain.po.PosOrder; | |||
| public interface NeuPosOrderService { | |||
| @@ -29,4 +32,6 @@ public interface NeuPosOrderService { | |||
| List<Map> selectPayTypeList(); | |||
| PageInfo<Map> queryOrderList(NeuPosOrderMasterExt example,Integer pageIndex, Integer pageSize); | |||
| void exportData(List datas,String fileName,Object voObject, HttpServletRequest request, HttpServletResponse response); | |||
| } | |||
| @@ -3,7 +3,9 @@ package com.iformall.service.impl; | |||
| import com.github.pagehelper.PageHelper; | |||
| import com.github.pagehelper.PageInfo; | |||
| import com.iformall.domain.po.NeuPosOrderMasterExt; | |||
| import com.iformall.domain.vo.WxCouponOrderBVo; | |||
| import com.iformall.mapper.NeuPosOrderMasterExtMapper; | |||
| import com.iformall.service.ExcelService; | |||
| import com.iformall.service.NeuPosOrderService; | |||
| import java.math.BigDecimal; | |||
| @@ -11,6 +13,10 @@ import java.util.ArrayList; | |||
| import java.util.HashMap; | |||
| import java.util.List; | |||
| import java.util.Map; | |||
| import javax.servlet.http.HttpServletRequest; | |||
| import javax.servlet.http.HttpServletResponse; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.stereotype.Service; | |||
| @@ -18,28 +24,31 @@ import org.springframework.stereotype.Service; | |||
| public class NeuPosOrderServiceImpl implements NeuPosOrderService { | |||
| @Autowired | |||
| NeuPosOrderMasterExtMapper posOrderMapper; | |||
| NeuPosOrderMasterExtMapper neuPosOrderMasterExtMapper; | |||
| @Autowired | |||
| ExcelService excelService; | |||
| @Override | |||
| public PageInfo<Map> queryShopPayTypeTradeList(NeuPosOrderMasterExt example,Integer pageIndex, Integer pageSize) { | |||
| return PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> posOrderMapper.queryShopPayTypeTradeList(example)); | |||
| return PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> neuPosOrderMasterExtMapper.queryShopPayTypeTradeList(example)); | |||
| } | |||
| @Override | |||
| public List<Map> selectShopList(Integer orgId) { | |||
| return posOrderMapper.selectShopList(orgId); | |||
| return neuPosOrderMasterExtMapper.selectShopList(orgId); | |||
| } | |||
| @Override | |||
| public PageInfo<Map> queryShopPayOrderList(NeuPosOrderMasterExt example,Integer pageIndex, Integer pageSize) { | |||
| List<String> orgPayType = posOrderMapper.selectOrgPayType(example.getOrgId()); | |||
| List<String> orgPayType = neuPosOrderMasterExtMapper.selectOrgPayType(example.getOrgId()); | |||
| example.setPayTypeList(orgPayType); | |||
| PageInfo<Map> pageInfo = PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> posOrderMapper.queryShopPayOrderList(example)); | |||
| PageInfo<Map> pageInfo = PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> neuPosOrderMasterExtMapper.queryShopPayOrderList(example)); | |||
| if (null == pageInfo || null == pageInfo.getList() || pageInfo.getList().size()<=0 ) { | |||
| return pageInfo; | |||
| } | |||
| List<Map> payOrderList = pageInfo.getList(); | |||
| List<Map> payTypeMap = posOrderMapper.selectPayTypeList(); | |||
| List<Map> payTypeMap = neuPosOrderMasterExtMapper.selectPayTypeList(); | |||
| Map<Integer,String> typeMap = new HashMap<Integer,String>(); | |||
| for (Map payt:payTypeMap) { | |||
| String payttye = (String)payt.get("pay_type"); | |||
| @@ -63,18 +72,23 @@ public class NeuPosOrderServiceImpl implements NeuPosOrderService { | |||
| @Override | |||
| public List<Map> queryShopPayOrderSum(NeuPosOrderMasterExt example) { | |||
| return posOrderMapper.queryShopPayOrderSum(example); | |||
| return neuPosOrderMasterExtMapper.queryShopPayOrderSum(example); | |||
| } | |||
| @Override | |||
| public List<Map> selectPayTypeList() { | |||
| return posOrderMapper.selectPayTypeList(); | |||
| return neuPosOrderMasterExtMapper.selectPayTypeList(); | |||
| } | |||
| @Override | |||
| public PageInfo<Map> queryOrderList(NeuPosOrderMasterExt example,Integer pageIndex, Integer pageSize) { | |||
| return PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> posOrderMapper.queryOrderListByConditions(example)); | |||
| return PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> neuPosOrderMasterExtMapper.queryOrderListByConditions(example)); | |||
| } | |||
| @Override | |||
| public void exportData(List datas, String fileName,Object voObject,HttpServletRequest request, HttpServletResponse response) { | |||
| excelService.exportCsv(datas, null, "", voObject.getClass(), fileName + ".csv", response, false); | |||
| } | |||