Helius
2022-01-27 bcca71194b658250f934828edee0bad5600e1834
add fenxiao export
1 files added
8 files modified
210 ■■■■■ changed files
zq-erp/pom.xml 4 ●●●● patch | view | raw | blame | history
zq-erp/src/main/java/com/matrix/system/fenxiao/action/FenXiaoOrderAction.java 54 ●●●●● patch | view | raw | blame | history
zq-erp/src/main/java/com/matrix/system/fenxiao/dao/ShopSalesmanOrderDao.java 5 ●●●●● patch | view | raw | blame | history
zq-erp/src/main/java/com/matrix/system/fenxiao/service/ShopSalesmanOrderService.java 7 ●●●● patch | view | raw | blame | history
zq-erp/src/main/java/com/matrix/system/fenxiao/vo/FenxiaoOrderListExportVo.java 40 ●●●●● patch | view | raw | blame | history
zq-erp/src/main/java/com/matrix/system/fenxiao/vo/LoadFenxiaoOrderBasicVo.java 3 ●●●●● patch | view | raw | blame | history
zq-erp/src/main/resources/mybatis/mapper/fenxiao/ShopSalesmanOrderDao.xml 68 ●●●●● patch | view | raw | blame | history
zq-erp/src/main/resources/templates/views/admin/fenxiao/fenxiao-order.html 16 ●●●● patch | view | raw | blame | history
zq-erp/src/main/resources/templates/views/admin/shop/shopUser-list.html 13 ●●●●● patch | view | raw | blame | history
zq-erp/pom.xml
@@ -413,11 +413,11 @@
                    <exclude>config/xcx/*</exclude>
                    <exclude>config/xcshop/*</exclude>
                    <!--
                    <!---->
                    <exclude>config/config.json</exclude>
                    <exclude>config/application.properties</exclude>
                    <exclude>config/system.properties</exclude>
                    -->
                    <exclude>**/*.woff</exclude>
zq-erp/src/main/java/com/matrix/system/fenxiao/action/FenXiaoOrderAction.java
@@ -1,19 +1,33 @@
package com.matrix.system.fenxiao.action;
import com.matrix.core.pojo.AjaxResult;
import com.matrix.core.tools.DateUtil;
import com.matrix.core.tools.excl.ExcelSheetPO;
import com.matrix.core.tools.excl.ExcelUtil;
import com.matrix.core.tools.excl.ExcelVersion;
import com.matrix.system.common.tools.ResponseHeadUtil;
import com.matrix.system.fenxiao.dto.LoadFenxiaoOrderBasicDto;
import com.matrix.system.fenxiao.dto.LoadFenxiaoOrderListDto;
import com.matrix.system.fenxiao.dto.LoadSetOrderListDtoDto;
import com.matrix.system.fenxiao.dto.UpdateSetOrderDoneDto;
import com.matrix.system.fenxiao.service.ShopSalesmanOrderService;
import com.matrix.system.fenxiao.vo.FenxiaoOrderListExportVo;
import com.matrix.system.fenxiao.vo.LoadFenxiaoOrderBasicVo;
import com.matrix.system.fenxiao.vo.LoadFenxiaoOrderListVo;
import com.matrix.system.fenxiao.vo.LoadSetOrderListDtoVo;
import com.matrix.system.hive.bean.SysProjServices;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiResponse;
import io.swagger.annotations.ApiResponses;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.OutputStream;
import java.net.URLEncoder;
import java.util.ArrayList;
import java.util.List;
@RestController
@RequestMapping(value = "/fenXiao/fenXiaoOrder")
@@ -70,7 +84,45 @@
    AjaxResult loadSetOrderList(@RequestBody LoadSetOrderListDtoDto loadSetOrderListDto) {
        return shopSalesmanOrderService.loadSetOrderList(loadSetOrderListDto);
    }
    @RequestMapping(value = "/exportExcel")
    public void exportExcel(HttpServletResponse response, LoadFenxiaoOrderListDto loadFenxiaoOrderListDto) throws IOException {
        List<ExcelSheetPO> res = new ArrayList<>();
        ExcelSheetPO orderSheet = new ExcelSheetPO();
        String title = "分销订单明细";
        orderSheet.setSheetName(title);
        orderSheet.setTitle(title);
        String[] header = {"订单编号","实付金额(元)", "订单状态", "下单门店","客户", "推广员","收益类型","收益金额", "结算状态", "结算编号", "结算时间", "结算人"};
        orderSheet.setHeaders(header);
        List<FenxiaoOrderListExportVo> dataList = shopSalesmanOrderService.findFenxiaoOrderList(loadFenxiaoOrderListDto);
        List<List<Object>> list = new ArrayList<>();
        if (dataList.size() > 0) {
            for (FenxiaoOrderListExportVo item : dataList) {
                List<Object> temp = new ArrayList<>();
                temp.add(item.getOrderNo());
                temp.add(item.getActualBalance());
                temp.add(item.getOrderState());
                temp.add(item.getAddress());
                temp.add(item.getCustom());
                temp.add(item.getParentSale());
                temp.add(item.getProfitType());
                temp.add(item.getProfitBalance());
                temp.add(item.getSettleType());
                temp.add(item.getSettleNo());
                temp.add(DateUtil.dateToString(item.getSettleTime(), DateUtil.DATE_FORMAT_MM));
                temp.add(item.getSettler());
                list.add(temp);
            }
        }
        orderSheet.setDataList(list);
        res.add(orderSheet);
        response = ResponseHeadUtil.setExcelHead(response);
        response.setHeader("Content-Disposition",
                "attachment;filename=" + URLEncoder.encode(title + DateUtil.getTimeMark() + ".xlsx".trim(), "UTF-8"));
        OutputStream os = response.getOutputStream();
        ExcelUtil.createWorkbookAtOutStream(ExcelVersion.V2007, res, os, true);
    }
    
    
    
zq-erp/src/main/java/com/matrix/system/fenxiao/dao/ShopSalesmanOrderDao.java
@@ -6,12 +6,15 @@
import com.matrix.system.fenxiao.dto.LoadFenxiaoOrderListDto;
import com.matrix.system.fenxiao.dto.LoadSetOrderListDtoDto;
import com.matrix.system.fenxiao.entity.ShopSalesmanOrder;
import com.matrix.system.fenxiao.vo.FenxiaoOrderListExportVo;
import com.matrix.system.fenxiao.vo.LoadFenxiaoOrderBasicVo;
import com.matrix.system.fenxiao.vo.LoadFenxiaoOrderListVo;
import com.matrix.system.fenxiao.vo.LoadSetOrderListDtoVo;
import com.matrix.system.shopXcx.api.dto.SaleOrderDto;
import com.matrix.system.shopXcx.vo.SalesOrderVo;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
 * @description 分销订单
@@ -36,4 +39,6 @@
    IPage<LoadSetOrderListDtoVo> findSetOrderList(Page<LoadSetOrderListDtoVo> page,
            @Param("record")LoadSetOrderListDtoDto loadSetOrderListDto);
    List<FenxiaoOrderListExportVo> selectFenxiaoOrderListNoPage(@Param("record")LoadFenxiaoOrderListDto loadFenxiaoOrderListDto);
}
zq-erp/src/main/java/com/matrix/system/fenxiao/service/ShopSalesmanOrderService.java
@@ -6,6 +6,7 @@
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.matrix.system.fenxiao.vo.FenxiaoOrderListExportVo;
import com.matrix.system.hive.bean.SysVipInfo;
import com.matrix.system.hive.dao.SysVipInfoDao;
import com.matrix.core.constance.MatrixConstance;
@@ -179,7 +180,9 @@
    }
    public List<FenxiaoOrderListExportVo> findFenxiaoOrderList(LoadFenxiaoOrderListDto loadFenxiaoOrderListDto) {
        QueryUtil.setQueryLimitCom(loadFenxiaoOrderListDto);
        return  shopSalesmanOrderDao.selectFenxiaoOrderListNoPage(loadFenxiaoOrderListDto);
    }
}
zq-erp/src/main/java/com/matrix/system/fenxiao/vo/FenxiaoOrderListExportVo.java
New file
@@ -0,0 +1,40 @@
package com.matrix.system.fenxiao.vo;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.math.BigDecimal;
import java.util.Date;
@Data
public class FenxiaoOrderListExportVo {
    @ApiModelProperty(value = "订单编号")
    private String orderNo;
    @ApiModelProperty(value = "订单状态")
    private String orderState;
    @ApiModelProperty(value = "实付金额(元)")
    private BigDecimal actualBalance;
    @ApiModelProperty(value = "下单门店")
    private String address;
    @ApiModelProperty(value = "客户")
    private String custom;
    @ApiModelProperty(value = "客户openId")
    private String customUserId;
    @ApiModelProperty(value = "推广员")
    private String parentSale;
    @ApiModelProperty(value = "收益类型")
    private String profitType;
    @ApiModelProperty(value = "收益金额")
    private BigDecimal profitBalance;
    @ApiModelProperty(value = "结算状态")
    private String settleType;
    @ApiModelProperty(value = "结算编号")
    private String settleNo;
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm", timezone = "GMT+8")
    @ApiModelProperty(value = "结算时间")
    private Date settleTime;
    @ApiModelProperty(value = "结算人")
    private String settler;
}
zq-erp/src/main/java/com/matrix/system/fenxiao/vo/LoadFenxiaoOrderBasicVo.java
@@ -17,4 +17,7 @@
    @ApiModelProperty(value = "待结算订单")
    private Integer waitOrderNum;
    @ApiModelProperty(value = "订单金额")
    private BigDecimal orderBalance;
}
zq-erp/src/main/resources/mybatis/mapper/fenxiao/ShopSalesmanOrderDao.xml
@@ -76,7 +76,10 @@
                        WHERE order_status = 1 and company_id=#{companyId} ) a) waitNum,
            (SELECT COUNT(*)
                FROM shop_salesman_order
                WHERE order_status = 1 and company_id=#{companyId}) waitOrderNum
                WHERE order_status = 1 and company_id=#{companyId}) waitOrderNum,
            (select sum(order_money) from shop_salesman_order a
                inner join shop_order b on a.order_id=b.ID
             where a.company_id=#{companyId}) orderBalance
        FROM
            shop_salesman_order
        where company_id=#{companyId}
@@ -171,4 +174,67 @@
        </if>
    </select>
    <select id="selectFenxiaoOrderListNoPage" resultType="com.matrix.system.fenxiao.vo.FenxiaoOrderListExportVo">
        SELECT
        a.id id,
        d.order_no,
        d.order_money actualBalance,
        f.shop_name address,
        case when d.order_status = 1 then '待付款'
            when d.order_status = 2 then '待配送'
            when d.order_status = 3 then '待收货'
            when d.order_status = 4 then '待评价'
            when d.order_status = 5 then '已评价'
            when d.order_status = 6 then '申请退款'
            when d.order_status = 7 then '退款成功'
            when d.order_status = 8 then '退款拒绝'
            when d.order_status = 9 then '已取消' end  orderState,
        b.nick_name custom,
        b.id customUserId,
        e.nick_name parentSale,
        case when a.revenue_type = 1 then '推广收益'
             when a.revenue_type = 2 then '邀请收益' end profitType,
        a.amount profitBalance,
        case when a.order_status = 1 then '待结算'
            when a.order_status = 2 then '已结算'
            when a.order_status = 3 then '已退款' end settleType,
        c.order_no settleNo,
        c.create_time settleTime,
        g.su_name settler
        FROM
        shop_salesman_order a
        LEFT JOIN sys_vip_info b on a.user_id = b.id
        LEFT JOIN shop_saleman_settlement c on a.settlement_id = c.id
        LEFT JOIN shop_order d on d.id = a.order_id
        LEFT JOIN sys_vip_info e on a.sales_user_id = e.id
        LEFT JOIN sys_shop_info f on f.id = d.store_id
        LEFT JOIN sys_users g on c.user_id = g.su_id
        <where>
            a.company_id = #{record.companyId}
            <if test="record.userName != null and record.userName != ''">
                and b.nick_name like concat('%',#{record.userName},'%')
            </if>
            <if test="record.ddType != null and record.ddType != ''">
                and d.order_status = #{record.ddType}
            </if>
            <if test="record.startTime != null ">
                and a.create_time >= #{record.startTime}
            </if>
            <if test="record.endTime != null">
                and  #{record.endTime} >= a.create_time
            </if>
            <if test="record.tgy != null and record.tgy != ''">
                and e.nick_name like concat('%',#{record.tgy},'%')
            </if>
            <if test="record.orderType != null and record.orderType != ''">
                and a.order_status = #{record.orderType}
            </if>
            <if test="record.jsbh != null and record.jsbh != ''">
                and c.order_no = #{record.jsbh}
            </if>
            <if test="record.ddh != null and record.ddh != ''">
                and d.order_no = #{record.ddh}
            </if>
        </where>
    </select>
</mapper>
zq-erp/src/main/resources/templates/views/admin/fenxiao/fenxiao-order.html
@@ -53,12 +53,12 @@
<div class="panel-body" id="app" v-cloak>
        <el-row>
                <el-card class="box-card" style="background-color: #0a628f;">
                    <div style="padding:10px;font-size: 20px;">¥{{basicdetail.balance}}</div>
                    <div style="padding:10px;font-size: 20px;">¥{{basicdetail.orderBalance}}</div>
                    <div>订单总金额</div>
                </el-card >
                <el-card class="box-card" style="background-color: #0f9aef;">
                    <div style="padding:10px;font-size: 20px;">¥{{basicdetail.balance}}</div>
                    <div>待计算金额</div>
                    <div>待结算金额</div>
                </el-card >
                <el-card class="box-card" style="background: #67C23A;">
                    <div style="padding:10px;font-size: 20px;">{{basicdetail.waitNum}}人</div>
@@ -152,7 +152,7 @@
                            </el-form-item>
                            <el-button type="primary" @click="search" >搜索</el-button>
                            <el-button @click="resetForm('form')">重置</el-button>
                            <el-button>导出</el-button>
                            <el-button @click="excelExport">导出</el-button>
                        </el-form>
                    </el-col>
                </el-row>
@@ -686,6 +686,16 @@
                    }
                });
            },
            excelExport() {
                var jsonParam = this.getRequestParam();
                var param = "";
                Object.keys(jsonParam).forEach(function(key){
                    if (jsonParam[key]) {
                        param += key + "=" + jsonParam[key] + "&";
                    }
                });
                window.location.href=basePath+"/fenXiao/fenXiaoOrder/exportExcel?"+param;
            }
        }
    })
</script>
zq-erp/src/main/resources/templates/views/admin/shop/shopUser-list.html
@@ -130,7 +130,7 @@
                        <th data-field="totalScore" data-align="center">获得总积分</th>
                        <th data-field="currentScore" data-align="center">可兑换积分</th>
                        <th data-field="isSales" data-align="center" data-formatter="buildIsSales">是否为销售员</th>
                        <th data-align="center"  data-width="195px" data-field="userId" data-formatter="buildOperate">操作</th>
                        <th data-align="center"  data-width="195px" data-field="userId" data-formatter="buildOperation">操作</th>
                    </tr>
                    </thead>
                </table>
@@ -189,13 +189,18 @@
    var btns = [];
    btns[0] = "", btns[1] = "";
    function buildOperate(value, row, index){
    function buildOperation(value, row, index) {
        var html = "";
        html += '<div class="btn-group">'
        html += '</div>';
        html += '<a class="text-info" href="javascript:void(0)" onClick="setSalesMan(\''+row.id+'\')">设置推广员</a>&nbsp;&nbsp;'
        return html;
    }
    function setSalesMan(val) {
        MTools.handleItem(basePath + "/fenXiao/fenXiaoUser/setSaleMan?id=" + val, "确定将该用户设置为推广员?",
            function () {
                myGrid.serchData();
            });
    }