瀏覽代碼

Merge branch 'master' of lsp/kmall-pt-general into master

张创标 4 年之前
父節點
當前提交
eac6b9eddd

+ 164 - 0
kmall-admin/src/main/java/com/kmall/admin/controller/SalesDataUploadController.java

@@ -0,0 +1,164 @@
+package com.kmall.admin.controller;
+
+import java.util.Date;
+import java.util.List;
+import java.util.Map;
+
+import com.kmall.admin.entity.SalesDataDownloadEntity;
+import com.kmall.admin.entity.SalesDataUploadEntity;
+import com.kmall.admin.fromcomm.entity.SysUserEntity;
+import com.kmall.admin.service.SalesDataUploadService;
+import com.kmall.admin.utils.ShiroUtils;
+import com.kmall.common.fileserver.util.FileManager;
+import com.kmall.common.utils.*;
+import com.kmall.common.utils.excel.FileUtil;
+import org.apache.shiro.SecurityUtils;
+import org.apache.shiro.authz.annotation.RequiresPermissions;
+import org.apache.tools.ant.util.FileUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.http.ResponseEntity;
+import org.springframework.stereotype.Controller;
+import org.springframework.web.bind.annotation.*;
+import org.springframework.web.multipart.MultipartFile;
+
+/**
+ * 销售数据上传表Controller
+ *
+ * @author emato
+ * @email admin@qhdswl.com
+ * @date 2020-11-16 14:11:53
+ */
+@Controller
+@RequestMapping("salesdataupload")
+public class SalesDataUploadController {
+    @Autowired
+    private SalesDataUploadService salesDataUploadService;
+
+    /**
+     * 查看列表
+     */
+    @RequestMapping("/list")
+//    @RequiresPermissions("salesdataupload:list")
+    @ResponseBody
+    public R list(@RequestParam Map<String, Object> params) {
+        //查询列表数据
+        Query query = new Query(params);
+
+        List<SalesDataUploadEntity> salesDataUploadList = salesDataUploadService.queryList(query);
+        int total = salesDataUploadService.queryTotal(query);
+
+        PageUtils pageUtil = new PageUtils(salesDataUploadList, total, query.getLimit(), query.getPage());
+
+        return R.ok().put("page", pageUtil);
+    }
+
+    /**
+     * 查看信息
+     */
+    @RequestMapping("/info/{fileId}")
+    @RequiresPermissions("salesdataupload:info")
+    @ResponseBody
+    public R info(@PathVariable("fileId") Integer fileId) {
+        SalesDataUploadEntity salesDataUpload = salesDataUploadService.queryObject(fileId);
+
+        return R.ok().put("salesDataUpload", salesDataUpload);
+    }
+
+    /**
+     * 保存
+     */
+    @RequestMapping("/save")
+//    @RequiresPermissions("salesdataupload:save")
+    @ResponseBody
+    public R save(@RequestBody SalesDataUploadEntity salesDataUpload) {
+        salesDataUploadService.save(salesDataUpload);
+
+        return R.ok();
+    }
+
+    /**
+     * 修改
+     */
+    @RequestMapping("/update")
+    @RequiresPermissions("salesdataupload:update")
+    @ResponseBody
+    public R update(@RequestBody SalesDataUploadEntity salesDataUpload) {
+        salesDataUploadService.update(salesDataUpload);
+
+        return R.ok();
+    }
+
+    /**
+     * 删除
+     */
+    @RequestMapping("/delete")
+//    @RequiresPermissions("salesdataupload:delete")
+    @ResponseBody
+    public R delete(@RequestBody Integer[]fileIds) {
+        salesDataUploadService.deleteBatch(fileIds);
+
+        return R.ok();
+    }
+
+    /**
+     * 查看所有列表
+     */
+    @RequestMapping("/queryAll")
+    @ResponseBody
+    public R queryAll(@RequestParam Map<String, Object> params) {
+
+        List<SalesDataUploadEntity> list = salesDataUploadService.queryList(params);
+
+        return R.ok().put("list", list);
+    }
+
+    /**
+     * 上传文件
+     * @param file
+     * @return
+     * @throws Exception
+     */
+    @RequestMapping("/upload")
+    @ResponseBody
+    public R upload(@RequestParam("file") MultipartFile file) throws Exception {
+        if (file.isEmpty()) {
+            throw new RRException("上传文件不能为空");
+        }
+
+        //上传文件
+        String url = FileManager.upload(file);
+
+        SalesDataUploadEntity salesDataUploadEntity = new SalesDataUploadEntity();
+        salesDataUploadEntity.setFileName(file.getOriginalFilename());
+        salesDataUploadEntity.setFileType(file.getContentType());
+        salesDataUploadEntity.setUploadAddress(url);
+        salesDataUploadEntity.setCreaterSn(ShiroUtils.getUserId().intValue());
+        salesDataUploadEntity.setCreaterTime(new Date());
+        salesDataUploadService.save(salesDataUploadEntity);
+
+        R r = R.ok();
+        r.put("url", url);
+        r.put("salesDataUpload", salesDataUploadEntity);
+        return r;
+    }
+
+    /**
+     * 文件下载
+     * @param filePath
+     * @return
+     * @throws Exception
+     */
+    @RequestMapping("/download")
+    public ResponseEntity<byte[]> download(@RequestParam("filePath") String filePath, @RequestParam("fileName") String fileName, @RequestParam("fileId") String fileId) throws Exception {
+        if(StringUtils.isNotEmpty(filePath)){
+            SalesDataDownloadEntity salesDataDownloadEntity = new SalesDataDownloadEntity();
+            salesDataDownloadEntity.setFileId(Integer.valueOf(fileId));
+            salesDataDownloadEntity.setDownloadSn(ShiroUtils.getUserId().intValue());
+            salesDataDownloadEntity.setDownloadTime(new Date());
+            salesDataUploadService.saveSalesDownload(salesDataDownloadEntity);
+
+            return FileManager.download(filePath, fileName);
+        }
+        return null;
+    }
+}

+ 20 - 0
kmall-admin/src/main/java/com/kmall/admin/dao/SalesDataUploadDao.java

@@ -0,0 +1,20 @@
+package com.kmall.admin.dao;
+
+import com.kmall.admin.entity.SalesDataDownloadEntity;
+import com.kmall.admin.entity.SalesDataUploadEntity;
+import com.kmall.manager.dao.BaseDao;
+
+import java.util.Map;
+
+/**
+ * 销售数据上传表Dao
+ *
+ * @author emato
+ * @email admin@qhdswl.com
+ * @date 2020-11-16 14:11:53
+ */
+public interface SalesDataUploadDao extends BaseDao<SalesDataUploadEntity> {
+
+    int saveSalesDownload(SalesDataDownloadEntity salesDataDownload);
+
+}

+ 86 - 0
kmall-admin/src/main/java/com/kmall/admin/entity/SalesDataDownloadEntity.java

@@ -0,0 +1,86 @@
+package com.kmall.admin.entity;
+
+import java.io.Serializable;
+import java.util.Date;
+
+/**
+ * 销售数据下载表实体
+ * 表名 mall_sales_data_download
+ *
+ * @author emato
+ * @email admin@qhdswl.com
+ * @date 2020-11-16 17:53:31
+ */
+public class SalesDataDownloadEntity implements Serializable {
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * 下载编号
+     */
+    private Integer id;
+    /**
+     * 下载文件编号
+     */
+    private Integer fileId;
+    /**
+     * 下载人编号
+     */
+    private Integer downloadSn;
+    /**
+     * 下载时间
+     */
+    private Date downloadTime;
+
+    /**
+     * 设置:下载编号
+     */
+    public void setId(Integer id) {
+        this.id = id;
+    }
+
+    /**
+     * 获取:下载编号
+     */
+    public Integer getId() {
+        return id;
+    }
+    /**
+     * 设置:下载文件编号
+     */
+    public void setFileId(Integer fileId) {
+        this.fileId = fileId;
+    }
+
+    /**
+     * 获取:下载文件编号
+     */
+    public Integer getFileId() {
+        return fileId;
+    }
+    /**
+     * 设置:下载人编号
+     */
+    public void setDownloadSn(Integer downloadSn) {
+        this.downloadSn = downloadSn;
+    }
+
+    /**
+     * 获取:下载人编号
+     */
+    public Integer getDownloadSn() {
+        return downloadSn;
+    }
+    /**
+     * 设置:下载时间
+     */
+    public void setDownloadTime(Date downloadTime) {
+        this.downloadTime = downloadTime;
+    }
+
+    /**
+     * 获取:下载时间
+     */
+    public Date getDownloadTime() {
+        return downloadTime;
+    }
+}

+ 132 - 0
kmall-admin/src/main/java/com/kmall/admin/entity/SalesDataUploadEntity.java

@@ -0,0 +1,132 @@
+package com.kmall.admin.entity;
+
+import java.io.Serializable;
+import java.util.Date;
+
+/**
+ * 销售数据上传表实体
+ * 表名 mall_sales_data_upload
+ *
+ * @author emato
+ * @email admin@qhdswl.com
+ * @date 2020-11-16 14:11:53
+ */
+public class SalesDataUploadEntity implements Serializable {
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * 上传文件编号
+     */
+    private Integer fileId;
+    /**
+     * 文件名称
+     */
+    private String fileName;
+    /**
+     * 文件类型
+     */
+    private String fileType;
+    /**
+     * 上传地址
+     */
+    private String uploadAddress;
+    /**
+     * 添加人编号
+     */
+    private Integer createrSn;
+    /**
+     * 添加人姓名
+     */
+    private String username;
+    /**
+     * 加入时间
+     */
+    private Date createrTime;
+
+    /**
+     * 设置:上传文件编号
+     */
+    public void setFileId(Integer fileId) {
+        this.fileId = fileId;
+    }
+
+    /**
+     * 获取:上传文件编号
+     */
+    public Integer getFileId() {
+        return fileId;
+    }
+    /**
+     * 设置:文件名称
+     */
+    public void setFileName(String fileName) {
+        this.fileName = fileName;
+    }
+
+    /**
+     * 获取:文件名称
+     */
+    public String getFileName() {
+        return fileName;
+    }
+    /**
+     * 设置:文件类型
+     */
+    public void setFileType(String fileType) {
+        this.fileType = fileType;
+    }
+
+    /**
+     * 获取:文件类型
+     */
+    public String getFileType() {
+        return fileType;
+    }
+    /**
+     * 设置:上传地址
+     */
+    public void setUploadAddress(String uploadAddress) {
+        this.uploadAddress = uploadAddress;
+    }
+
+    /**
+     * 获取:上传地址
+     */
+    public String getUploadAddress() {
+        return uploadAddress;
+    }
+    /**
+     * 设置:添加人编号
+     */
+    public void setCreaterSn(Integer createrSn) {
+        this.createrSn = createrSn;
+    }
+
+    /**
+     * 获取:添加人编号
+     */
+    public Integer getCreaterSn() {
+        return createrSn;
+    }
+    /**
+     * 设置:加入时间
+     */
+    public void setCreaterTime(Date createrTime) {
+        this.createrTime = createrTime;
+    }
+
+    /**
+     * 获取:加入时间
+     */
+    public Date getCreaterTime() {
+        return createrTime;
+    }
+
+    public String getUsername() {
+        return username;
+    }
+
+    public void setUsername(String username) {
+        this.username = username;
+    }
+}

+ 80 - 0
kmall-admin/src/main/java/com/kmall/admin/service/SalesDataUploadService.java

@@ -0,0 +1,80 @@
+package com.kmall.admin.service;
+
+import com.kmall.admin.entity.SalesDataDownloadEntity;
+import com.kmall.admin.entity.SalesDataUploadEntity;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 销售数据上传表Service接口
+ *
+ * @author emato
+ * @email admin@qhdswl.com
+ * @date 2020-11-16 14:11:53
+ */
+public interface SalesDataUploadService {
+
+    /**
+     * 根据主键查询实体
+     *
+     * @param fileId 主键
+     * @return 实体
+     */
+    SalesDataUploadEntity queryObject(Integer fileId);
+
+    /**
+     * 分页查询
+     *
+     * @param map 参数
+     * @return list
+     */
+    List<SalesDataUploadEntity> queryList(Map<String, Object> map);
+
+    /**
+     * 分页统计总数
+     *
+     * @param map 参数
+     * @return 总数
+     */
+    int queryTotal(Map<String, Object> map);
+
+    /**
+     * 保存实体
+     *
+     * @param salesDataUpload 实体
+     * @return 保存条数
+     */
+    int save(SalesDataUploadEntity salesDataUpload);
+
+    /**
+     * 根据主键更新实体
+     *
+     * @param salesDataUpload 实体
+     * @return 更新条数
+     */
+    int update(SalesDataUploadEntity salesDataUpload);
+
+    /**
+     * 根据主键删除
+     *
+     * @param fileId
+     * @return 删除条数
+     */
+    int delete(Integer fileId);
+
+    /**
+     * 根据主键批量删除
+     *
+     * @param fileIds
+     * @return 删除条数
+     */
+    int deleteBatch(Integer[]fileIds);
+
+    /**
+     * 保存销售下载记录
+     * @param salesDataDownload
+     * @return
+     */
+    int saveSalesDownload(SalesDataDownloadEntity salesDataDownload);
+}

+ 1 - 0
kmall-admin/src/main/java/com/kmall/admin/service/impl/OrderServiceImpl.java

@@ -2152,6 +2152,7 @@ public class OrderServiceImpl implements OrderService {
             // 生成取票码
             PickUpCodeEntity pickUpCodeEntity = new PickUpCodeEntity();
             pickUpCodeEntity.setOrderSn(order.getOrder_sn());
+            pickUpCodeEntity.setPickUpCodeSn(cashierEntity.getCashierSn());//取货码前段
             pickUpCodeService.save(pickUpCodeEntity);
 
             resultObj.put("code",pickUpCodeEntity.getPickUpCodeSn()); // 系统中累加

+ 6 - 1
kmall-admin/src/main/java/com/kmall/admin/service/impl/PickUpCodeServiceImpl.java

@@ -5,6 +5,7 @@ import com.kmall.admin.entity.PickUpCodeEntity;
 import com.kmall.admin.service.PickUpCodeService;
 import com.kmall.admin.utils.ShiroUtils;
 import org.apache.commons.lang.RandomStringUtils;
+import org.apache.commons.lang.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
@@ -61,7 +62,11 @@ public class PickUpCodeServiceImpl implements PickUpCodeService {
         //生成一个 5 位的随机字符串
         String randomCode = RandomStringUtils.randomAlphanumeric(5).toUpperCase();
         //K: 跨境电商 , Y:一般贸易
-        pickUpCode.setPickUpCodeSn(pickUpCodeSn);
+        if(StringUtils.isNotEmpty(pickUpCode.getPickUpCodeSn())){
+            pickUpCode.setPickUpCodeSn(pickUpCode.getPickUpCodeSn()+"-"+pickUpCodeSn);
+        }else{
+            pickUpCode.setPickUpCodeSn(pickUpCodeSn);
+        }
         //  pickUpCode.setPickUpCodeSn("Y-");
         pickUpCode.setPickUpCodeStatus("0");
         if (pickUpCode.getPickUpCodeCreatetime()==null){

+ 64 - 0
kmall-admin/src/main/java/com/kmall/admin/service/impl/SalesDataUploadServiceImpl.java

@@ -0,0 +1,64 @@
+package com.kmall.admin.service.impl;
+
+import com.kmall.admin.dao.SalesDataUploadDao;
+import com.kmall.admin.entity.SalesDataDownloadEntity;
+import com.kmall.admin.entity.SalesDataUploadEntity;
+import com.kmall.admin.service.SalesDataUploadService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 销售数据上传表Service实现类
+ *
+ * @author emato
+ * @email admin@qhdswl.com
+ * @date 2020-11-16 14:11:53
+ */
+@Service("salesDataUploadService")
+public class SalesDataUploadServiceImpl implements SalesDataUploadService {
+    @Autowired
+    private SalesDataUploadDao salesDataUploadDao;
+
+    @Override
+    public SalesDataUploadEntity queryObject(Integer fileId) {
+        return salesDataUploadDao.queryObject(fileId);
+    }
+
+    @Override
+    public List<SalesDataUploadEntity> queryList(Map<String, Object> map) {
+        return salesDataUploadDao.queryList(map);
+    }
+
+    @Override
+    public int queryTotal(Map<String, Object> map) {
+        return salesDataUploadDao.queryTotal(map);
+    }
+
+    @Override
+    public int save(SalesDataUploadEntity salesDataUpload) {
+        return salesDataUploadDao.save(salesDataUpload);
+    }
+
+    @Override
+    public int update(SalesDataUploadEntity salesDataUpload) {
+        return salesDataUploadDao.update(salesDataUpload);
+    }
+
+    @Override
+    public int delete(Integer fileId) {
+        return salesDataUploadDao.delete(fileId);
+    }
+
+    @Override
+    public int deleteBatch(Integer[]fileIds) {
+        return salesDataUploadDao.deleteBatch(fileIds);
+    }
+
+    @Override
+    public int saveSalesDownload(SalesDataDownloadEntity salesDataDownload) {
+        return salesDataUploadDao.saveSalesDownload(salesDataDownload);
+    }
+}

+ 115 - 0
kmall-admin/src/main/resources/mybatis/mapper/SalesDataUploadDao.xml

@@ -0,0 +1,115 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+
+<mapper namespace="com.kmall.admin.dao.SalesDataUploadDao">
+
+    <resultMap type="com.kmall.admin.entity.SalesDataUploadEntity" id="salesDataUploadMap">
+        <result property="fileId" column="file_id"/>
+        <result property="fileName" column="file_name"/>
+        <result property="fileType" column="file_type"/>
+        <result property="uploadAddress" column="upload_address"/>
+        <result property="createrSn" column="creater_sn"/>
+        <result property="createrTime" column="creater_time"/>
+    </resultMap>
+
+	<select id="queryObject" resultType="com.kmall.admin.entity.SalesDataUploadEntity">
+		select
+			u.file_id,
+			u.file_name,
+			u.file_type,
+			u.upload_address,
+			u.creater_sn,
+			u.creater_time,
+			su.username
+		from mall_sales_data_upload u
+		left join sys_user su
+		on su.user_id = u.creater_sn
+		where file_id = #{id}
+	</select>
+
+	<select id="queryList" resultType="com.kmall.admin.entity.SalesDataUploadEntity">
+		select
+			u.file_id,
+			u.file_name,
+			u.file_type,
+			u.upload_address,
+			u.creater_sn,
+			u.creater_time,
+			su.username
+		from mall_sales_data_upload u
+		left join sys_user su
+		on su.user_id = u.creater_sn
+		WHERE 1=1
+		<if test="name != null and name.trim() != ''">
+			AND u.file_name LIKE concat('%',#{name},'%')
+		</if>
+        <choose>
+            <when test="sidx != null and sidx.trim() != ''">
+                order by ${sidx} ${order}
+            </when>
+			<otherwise>
+                order by file_id desc
+			</otherwise>
+        </choose>
+		<if test="offset != null and limit != null">
+			limit #{offset}, #{limit}
+		</if>
+	</select>
+	
+ 	<select id="queryTotal" resultType="int">
+		select count(*) from mall_sales_data_upload
+		WHERE 1=1
+        <if test="name != null and name.trim() != ''">
+            AND file_name LIKE concat('%',#{name},'%')
+        </if>
+	</select>
+	 
+	<insert id="save" parameterType="com.kmall.admin.entity.SalesDataUploadEntity" useGeneratedKeys="true" keyProperty="fileId">
+		insert into mall_sales_data_upload(
+			`file_name`,
+			`file_type`,
+			`upload_address`,
+			`creater_sn`,
+			`creater_time`)
+		values(
+			#{fileName},
+			#{fileType},
+			#{uploadAddress},
+			#{createrSn},
+			#{createrTime})
+	</insert>
+	<insert id="saveSalesDownload" parameterType="com.kmall.admin.entity.SalesDataDownloadEntity" useGeneratedKeys="true" keyProperty="id">
+		insert into mall_sales_data_download(
+			`file_id`,
+			`download_sn`,
+			`download_time`)
+		values(
+			#{fileId},
+			#{downloadSn},
+			#{downloadTime})
+	</insert>
+
+	<update id="update" parameterType="com.kmall.admin.entity.SalesDataUploadEntity">
+		update mall_sales_data_upload 
+		<set>
+			<if test="fileName != null">`file_name` = #{fileName}, </if>
+			<if test="fileType != null">`file_type` = #{fileType}, </if>
+			<if test="uploadAddress != null">`upload_address` = #{uploadAddress}, </if>
+			<if test="createrSn != null">`creater_sn` = #{createrSn}, </if>
+			<if test="createrTime != null">`creater_time` = #{createrTime}</if>
+		</set>
+		where file_id = #{fileId}
+	</update>
+	
+	<delete id="delete">
+		delete from mall_sales_data_upload where file_id = #{value}
+	</delete>
+	
+	<delete id="deleteBatch">
+		delete from mall_sales_data_upload where file_id in 
+		<foreach item="fileId" collection="array" open="(" separator="," close=")">
+			#{fileId}
+		</foreach>
+	</delete>
+
+</mapper>

+ 1 - 1
kmall-admin/src/main/resources/mybatis/mapper/statistics/MonthlyCustomersDao.xml

@@ -184,7 +184,7 @@
 		SELECT
 			sum( og.number ) AS sales,
 			cg.NAME AS cgname,
-			sum( o.order_price ) AS totalSales,
+			sum(  og.actual_payment_amount/ (1+og.goods_rate) ) + sum(og.discounted_price)AS totalSales,
 			DATE_FORMAT(o.pay_time,'%Y-%m') as yearAndMonth
 		FROM
 			mall_order o

+ 72 - 0
kmall-admin/src/main/webapp/WEB-INF/page/sale/salesdataupload.html

@@ -0,0 +1,72 @@
+<!DOCTYPE html>
+<html>
+<head>
+    <title>销售数据上传表</title>
+    #parse("sys/header.html")
+</head>
+<body>
+<div id="rrapp" v-cloak>
+	<div v-show="showList">
+        <Row :gutter="16">
+            <div class="search-group">
+                <i-col span="4">
+                    <i-input v-model="q.name" @on-enter="query" placeholder="名称"/>
+                </i-col>
+                <i-button @click="query">查询</i-button>
+                <i-button @click="reloadSearch">重置</i-button>
+            </div>
+            <div class="buttons-group">
+                #if($shiro.hasPermission("salesdataupload:save"))
+                <i-button type="info" @click="add"><i class="fa fa-plus"></i>&nbsp;新增</i-button>
+                #end
+                #if($shiro.hasPermission("salesdataupload:update"))
+                <i-button type="warning" @click="update"><i class="fa fa-pencil-square-o"></i>&nbsp;修改</i-button>
+                #end
+                <!--#if($shiro.hasPermission("salesdataupload:delete"))
+                <i-button type="error" @click="del"><i class="fa fa-trash-o"></i>&nbsp;删除</i-button>
+                #end-->
+                <i-button type="error" @click="del"><i class="fa fa-trash-o"></i>&nbsp;删除</i-button>
+                <i-col style="display: inline-grid;">
+                    <Upload :show-upload-list="false" :on-success="uploadExcelSuccess" :on-error="uploadExcelError" :on-format-error="uploadExcelFormatError"
+                            :format="['xlsx','xls']"
+                            action="../salesdataupload/upload">
+                        <i-button type="ghost" icon="ios-cloud-upload-outline">销售数据导入</i-button>
+                    </Upload>
+                </i-col>
+                <i-button type="primary" @click="download"><i class="fa fa-cloud-download"></i>&nbsp;下载</i-button>
+            </div>
+        </Row>
+	    <table id="jqGrid"></table>
+	    <div id="jqGridPager"></div>
+    </div>
+
+    <Card v-show="!showList">
+        <p slot="title">{{title}}</p>
+		<i-form ref="formValidate" :model="salesDataUpload" :rules="ruleValidate" :label-width="80">
+            <Form-item label="文件名称" prop="fileName">
+                <i-input v-model="salesDataUpload.fileName" placeholder="文件名称"/>
+            </Form-item>
+            <Form-item label="文件类型" prop="fileType">
+                <i-input v-model="salesDataUpload.fileType" placeholder="文件类型"/>
+            </Form-item>
+            <Form-item label="上传地址" prop="uploadAddress">
+                <i-input v-model="salesDataUpload.uploadAddress" placeholder="上传地址"/>
+            </Form-item>
+            <Form-item label="添加人编号" prop="createrSn">
+                <i-input v-model="salesDataUpload.createrSn" placeholder="添加人编号"/>
+            </Form-item>
+            <Form-item label="加入时间" prop="createrTime">
+                <i-input v-model="salesDataUpload.createrTime" placeholder="加入时间"/>
+            </Form-item>
+            <Form-item>
+                <i-button type="primary" @click="handleSubmit('formValidate')">提交</i-button>
+                <i-button type="warning" @click="reload" style="margin-left: 8px"/>返回</i-button>
+                <i-button type="ghost" @click="handleReset('formValidate')" style="margin-left: 8px">重置</i-button>
+            </Form-item>
+        </i-form>
+	</Card>
+</div>
+
+<script src="${rc.contextPath}/js/sale/salesdataupload.js?_${date.systemTime}"></script>
+</body>
+</html>

+ 8 - 4
kmall-admin/src/main/webapp/js/sale/sale.js

@@ -567,7 +567,7 @@ let vm = new Vue({
         // 支付码
         parCode : "",
         // 总件数
-        totalCount:0,
+        totalCount:0
     },
     methods: {
 
@@ -1137,7 +1137,12 @@ function printArea(content) {
         + '</div>');
     doc.close();
     var frameWindow = iframe.contentWindow;
-    if(!vm.firstPrint){
+
+    frameWindow.focus();
+    frameWindow.print();
+    frameWindow.print();
+    alert('打印小票完成');
+    /*if(!vm.firstPrint){
         setTimeout(function() {
             // frameWindow.close();
             frameWindow.focus();
@@ -1152,8 +1157,7 @@ function printArea(content) {
         frameWindow.print();
         frameWindow.print();
         alert('打印小票完成');
-    }
-
+    }*/
 }
 
 function printArea2(content) {

+ 173 - 0
kmall-admin/src/main/webapp/js/sale/salesdataupload.js

@@ -0,0 +1,173 @@
+$(function () {
+    $("#jqGrid").jqGrid({
+        url: '../salesdataupload/list',
+        datatype: "json",
+        colModel: [
+			{label: 'fileId', name: 'fileId', index: 'file_id', key: true, hidden: true, align: 'center'},
+			{label: '文件名称', name: 'fileName', index: 'file_name', width: 80, align: 'center'},
+			{label: '文件类型', name: 'fileType', index: 'file_type', width: 80, align: 'center'},
+			{label: '上传地址', name: 'uploadAddress', index: 'upload_address', width: 80 ,align: 'center'},
+			{label: '添加人', name: 'username', index: 'username', width: 80, align: 'center'},
+			{label: '上传时间', name: 'createrTime', index: 'creater_time', width: 80, align: 'center',
+				formatter: function (value) {
+					return transDate(value, 'yyyy-MM-dd hh:mm:ss');
+				}
+			}],
+		viewrecords: true,
+        height: 550,
+        rowNum: 10,
+        rowList: [10, 30, 50],
+        rownumbers: true,
+        rownumWidth: 25,
+        autowidth: true,
+        multiselect: true,
+        pager: "#jqGridPager",
+        jsonReader: {
+            root: "page.list",
+            page: "page.currPage",
+            total: "page.totalPage",
+            records: "page.totalCount"
+        },
+        prmNames: {
+            page: "page",
+            rows: "limit",
+            order: "order"
+        },
+        gridComplete: function () {
+            $("#jqGrid").closest(".ui-jqgrid-bdiv").css({"overflow-x": "hidden"});
+        }
+    });
+});
+
+let vm = new Vue({
+	el: '#rrapp',
+	data: {
+        showList: true,
+        title: null,
+		salesDataUpload: {},
+		ruleValidate: {
+			name: [
+				{required: true, message: '名称不能为空', trigger: 'blur'}
+			]
+		},
+		q: {
+		    name: ''
+		}
+	},
+	methods: {
+		query: function () {
+			vm.reload();
+		},
+		add: function () {
+			vm.showList = false;
+			vm.title = "新增";
+			vm.salesDataUpload = {};
+		},
+		update: function (event) {
+            let fileId = getSelectedRow();
+			if (fileId == null) {
+				return;
+			}
+			vm.showList = false;
+            vm.title = "修改";
+
+            vm.getInfo(fileId)
+		},
+		saveOrUpdate: function (event) {
+            let url = vm.salesDataUpload.fileId == null ? "../salesdataupload/save" : "../salesdataupload/update";
+			$.ajax({
+				type: "POST",
+			    url: url,
+			    contentType: "application/json",
+			    data: JSON.stringify(vm.salesDataUpload),
+                success: function (r) {
+                    if (r.code === 0) {
+                        alert('操作成功', function (index) {
+                            vm.reload();
+                        });
+                    } else {
+                        alert(r.msg);
+                    }
+                }
+			});
+		},
+		del: function (event) {
+            let fileIds = getSelectedRows();
+			if (fileIds == null){
+				return;
+			}
+
+			confirm('确定要删除选中的记录?', function () {
+				$.ajax({
+					type: "POST",
+				    url: "../salesdataupload/delete",
+				    contentType: "application/json",
+				    data: JSON.stringify(fileIds),
+				    success: function (r) {
+						if (r.code == 0) {
+							alert('操作成功', function (index) {
+								$("#jqGrid").trigger("reloadGrid");
+							});
+						} else {
+							alert(r.msg);
+						}
+					}
+				});
+			});
+		},
+		getInfo: function(fileId){
+			$.get("../salesdataupload/info/"+fileId, function (r) {
+                vm.salesDataUpload = r.salesDataUpload;
+            });
+		},
+        reloadSearch: function() {
+            vm.q = {
+                name: ''
+            }
+            vm.reload();
+		},
+		reload: function (event) {
+			vm.showList = true;
+            let page = $("#jqGrid").jqGrid('getGridParam', 'page');
+			$("#jqGrid").jqGrid('setGridParam', {
+                postData: {'name': vm.q.name},
+                page: page
+            }).trigger("reloadGrid");
+            vm.handleReset('formValidate');
+		},
+        handleSubmit: function (name) {
+            handleSubmitValidate(this, name, function () {
+                vm.saveOrUpdate()
+            });
+        },
+        handleReset: function (name) {
+            handleResetForm(this, name);
+        },
+		uploadExcelSuccess: function (data) {
+			if(data.code==0){
+				alert('导入成功', function (index) {
+					$("#jqGrid").trigger("reloadGrid");
+				});
+			}else{
+				alert(data.msg);
+			}
+		},
+		uploadExcelError: function () {
+			alert('上传出现异常,请重试!');
+		},
+		uploadExcelFormatError: function (file) {
+			this.$Notice.warning({
+				title: '文件格式不正确',
+				desc: '文件 ' + file.name + ' 格式不正确,请上传 xls 或 xlsx 格式的文件。'
+			});
+		},
+		download: function (event){
+			debugger;
+			let fileData = getSelectedRowData();
+			if (fileData.length != 1 && fileData.length != undefined){
+				return;
+			}
+			window.location.href = "../salesdataupload/download?filePath="+fileData.uploadAddress+"&fileName="+fileData.fileName+"&fileId="+fileData.fileId;
+		}
+	}
+});