1
0
فهرست منبع

[lsp]1.merge代码

lsp 4 سال پیش
والد
کامیت
ad5953ac7f
36فایلهای تغییر یافته به همراه3308 افزوده شده و 13 حذف شده
  1. 56 0
      kmall-admin/pom.xml
  2. 193 0
      kmall-admin/src/main/java/com/kmall/admin/controller/GoodsLabelHeadController.java
  3. 65 0
      kmall-admin/src/main/java/com/kmall/admin/controller/exportPDF/ExportPDFController.java
  4. 10 1
      kmall-admin/src/main/java/com/kmall/admin/dao/GoodsDao.java
  5. 16 0
      kmall-admin/src/main/java/com/kmall/admin/dao/GoodsLabelHeadDao.java
  6. 222 0
      kmall-admin/src/main/java/com/kmall/admin/entity/GoodsLabelHeadEntity.java
  7. 73 0
      kmall-admin/src/main/java/com/kmall/admin/service/GoodsLabelHeadService.java
  8. 10 1
      kmall-admin/src/main/java/com/kmall/admin/service/GoodsService.java
  9. 59 0
      kmall-admin/src/main/java/com/kmall/admin/service/impl/GoodsLabelHeadServiceImpl.java
  10. 14 0
      kmall-admin/src/main/java/com/kmall/admin/service/impl/GoodsServiceImpl.java
  11. 77 0
      kmall-admin/src/main/java/com/kmall/admin/utils/pdf/BarcodeUtil.java
  12. 56 0
      kmall-admin/src/main/java/com/kmall/admin/utils/pdf/PdfUtil.java
  13. 34 0
      kmall-admin/src/main/java/com/kmall/admin/utils/pdf/ViewPDF.java
  14. 159 0
      kmall-admin/src/main/java/com/kmall/admin/utils/pdf/type/PDFWrite.java
  15. 224 0
      kmall-admin/src/main/java/com/kmall/admin/utils/pdf/type/PDFWrite_12.java
  16. 224 0
      kmall-admin/src/main/java/com/kmall/admin/utils/pdf/type/PDFWrite_18.java
  17. 216 0
      kmall-admin/src/main/java/com/kmall/admin/utils/pdf/type/PDFWrite_2.java
  18. 233 0
      kmall-admin/src/main/java/com/kmall/admin/utils/pdf/type/PDFWrite_36.java
  19. 218 0
      kmall-admin/src/main/java/com/kmall/admin/utils/pdf/type/PDFWrite_4.java
  20. 222 0
      kmall-admin/src/main/java/com/kmall/admin/utils/pdf/type/PDFWrite_9.java
  21. 188 0
      kmall-admin/src/main/java/com/kmall/admin/utils/pdf/type/PDFWrite_nohead_36.java
  22. 29 0
      kmall-admin/src/main/resources/mybatis/mapper/GoodsDao.xml
  23. 143 0
      kmall-admin/src/main/resources/mybatis/mapper/GoodsLabelHeadDao.xml
  24. BIN
      kmall-admin/src/main/resources/static/font/ams1015.ttf
  25. 2 1
      kmall-admin/src/main/webapp/WEB-INF/page/sale/monthlyCustomers2.html
  26. 91 0
      kmall-admin/src/main/webapp/WEB-INF/page/shop/goodsexportpdf.html
  27. 82 0
      kmall-admin/src/main/webapp/WEB-INF/page/shop/goodslabelhead.html
  28. 1 1
      kmall-admin/src/main/webapp/WEB-INF/page/shop/goodstransportinfodetail.html
  29. 1 1
      kmall-admin/src/main/webapp/js/sale/monthlyCustomers2.js
  30. 111 0
      kmall-admin/src/main/webapp/js/shop/goodsexportpdf.js
  31. 176 0
      kmall-admin/src/main/webapp/js/shop/goodslabelhead.js
  32. 11 2
      kmall-admin/src/main/webapp/js/shop/goodstransportinfodetail.js
  33. BIN
      kmall-admin/src/main/webapp/statics/font/ams1015.ttf
  34. 83 0
      kmall-api/src/main/java/com/kmall/api/entity/exportpdf/PDFGoodsDto.java
  35. 2 0
      kmall-manager/src/main/resources/conf/print.properties
  36. 7 6
      kmall-manager/src/main/resources/spring/spring-manager-context.xml

+ 56 - 0
kmall-admin/pom.xml

@@ -72,6 +72,55 @@
             </exclusions>
         </dependency>
 
+        <dependency>
+            <groupId>com.itextpdf</groupId>
+            <artifactId>kernel</artifactId>
+            <version>7.0.3</version>
+        </dependency>
+        <dependency>
+            <groupId>com.itextpdf</groupId>
+            <artifactId>io</artifactId>
+            <version>7.0.3</version>
+        </dependency>
+        <dependency>
+            <groupId>com.itextpdf</groupId>
+            <artifactId>layout</artifactId>
+            <version>7.0.3</version>
+        </dependency>
+        <dependency>
+            <groupId>com.itextpdf</groupId>
+            <artifactId>font-asian</artifactId>
+            <version>7.0.3</version>
+        </dependency>
+        <dependency>
+            <groupId>com.lowagie</groupId>
+            <artifactId>itext</artifactId>
+            <version>2.1.7</version>
+        </dependency>
+
+        <!--         https://mvnrepository.com/artifact/com.itextpdf/itextpdf -->
+        <dependency>
+            <groupId>com.itextpdf</groupId>
+            <artifactId>itextpdf</artifactId>
+            <version>5.5.13</version>
+        </dependency>
+        <!-- https://mvnrepository.com/artifact/com.itextpdf/itext-asian -->
+        <dependency>
+            <groupId>com.itextpdf</groupId>
+            <artifactId>itext-asian</artifactId>
+            <version>5.2.0</version>
+        </dependency>
+        <dependency>
+            <groupId>net.sf.barcode4j</groupId>
+            <artifactId>barcode4j-light</artifactId>
+            <version>2.0</version>
+        </dependency>
+        <dependency>
+            <groupId>org.springframework</groupId>
+            <artifactId>spring-test</artifactId>
+            <version>4.3.7.RELEASE</version>
+            <scope>compile</scope>
+        </dependency>
 
     </dependencies>
 
@@ -95,6 +144,13 @@
                     <include>**/*.properties</include>
                 </includes>
             </resource>
+            <resource>
+                <directory>src/main/resources</directory>
+                <filtering>false</filtering>
+                <includes>
+                    <include>**/*.ttf</include>
+                </includes>
+            </resource>
         </resources>
 
         <plugins>

+ 193 - 0
kmall-admin/src/main/java/com/kmall/admin/controller/GoodsLabelHeadController.java

@@ -0,0 +1,193 @@
+package com.kmall.admin.controller;
+
+import java.util.Date;
+import java.util.List;
+import java.util.Map;
+import java.util.Objects;
+
+import com.kmall.admin.entity.GoodsLabelHeadEntity;
+import com.kmall.admin.entity.SysOssEntity;
+import com.kmall.admin.fromcomm.entity.SysUserEntity;
+import com.kmall.admin.service.GoodsLabelHeadService;
+import com.kmall.admin.utils.ShiroUtils;
+import com.kmall.common.constant.Dict;
+import com.kmall.common.fileserver.util.FileManager;
+import com.kmall.common.utils.PageUtils;
+import com.kmall.common.utils.Query;
+import com.kmall.common.utils.R;
+import com.kmall.common.utils.RRException;
+import org.apache.shiro.SecurityUtils;
+import org.apache.shiro.authz.annotation.RequiresPermissions;
+import org.springframework.beans.factory.annotation.Autowired;
+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-09-11 14:24:36
+ */
+@RestController
+@RequestMapping("goodslabelhead")
+public class GoodsLabelHeadController {
+    @Autowired
+    private GoodsLabelHeadService goodsLabelHeadService;
+
+    /**
+     * 查看列表
+     */
+    @RequestMapping("/list")
+//    @RequiresPermissions("goodslabelhead:list")
+    @ResponseBody
+    public R list(@RequestParam Map<String, Object> params) {
+        //查询列表数据
+        String merchSn = null;
+        Integer storeId = null;
+        SysUserEntity sysUser = (SysUserEntity) SecurityUtils.getSubject().getPrincipal();
+        if(!"1".equals(sysUser.getRoleType())){
+            merchSn = sysUser.getMerchSn();
+            storeId = sysUser.getStoreId();
+        }
+        params.put("merchSn",merchSn);
+        params.put("storeId",storeId);
+        Query query = new Query(params);
+        List<GoodsLabelHeadEntity> goodsLabelHeadList = goodsLabelHeadService.queryList(query);
+        int total = goodsLabelHeadService.queryTotal(query);
+
+        PageUtils pageUtil = new PageUtils(goodsLabelHeadList, total, query.getLimit(), query.getPage());
+
+        return R.ok().put("page", pageUtil);
+    }
+
+    /**
+     * 查看信息
+     */
+    @RequestMapping("/info/{id}")
+//    @RequiresPermissions("goodslabelhead:info")
+    @ResponseBody
+    public R info(@PathVariable("id") Integer id) {
+        GoodsLabelHeadEntity goodsLabelHead = goodsLabelHeadService.queryObject(id);
+
+        return R.ok().put("goodsLabelHead", goodsLabelHead);
+    }
+
+    /**
+     * 保存
+     */
+    @RequestMapping("/save")
+//    @RequiresPermissions("goodslabelhead:save")
+    @ResponseBody
+    public R save(@RequestBody GoodsLabelHeadEntity goodsLabelHead) {
+        goodsLabelHeadService.save(goodsLabelHead);
+
+        return R.ok();
+    }
+
+    /**
+     * 修改
+     */
+    @RequestMapping("/update")
+//    @RequiresPermissions("goodslabelhead:update")
+    @ResponseBody
+    public R update(@RequestBody GoodsLabelHeadEntity goodsLabelHead) {
+        goodsLabelHeadService.update(goodsLabelHead);
+
+        return R.ok();
+    }
+
+    /**
+     * 删除
+     */
+    @RequestMapping("/delete")
+//    @RequiresPermissions("goodslabelhead:delete")
+    @ResponseBody
+    public R delete(@RequestBody Integer[]ids) {
+        goodsLabelHeadService.deleteBatch(ids);
+
+        return R.ok();
+    }
+
+    /**
+     * 查看所有列表
+     */
+    @RequestMapping("/queryAll")
+    @ResponseBody
+    public R queryAll(@RequestParam Map<String, Object> params) {
+        String merchSn = null;
+        Integer storeId = null;
+        SysUserEntity sysUser = (SysUserEntity) SecurityUtils.getSubject().getPrincipal();
+        if(!"1".equals(sysUser.getRoleType())){
+            merchSn = sysUser.getMerchSn();
+            storeId = sysUser.getStoreId();
+        }
+        params.put("merchSn",merchSn);
+        params.put("storeId",storeId);
+        List<GoodsLabelHeadEntity> list = goodsLabelHeadService.queryList(params);
+
+        return R.ok().put("list", list);
+    }
+
+
+
+
+    /**
+     * 上传文件
+     */
+    @RequestMapping("/upload")
+    public R upload(@RequestParam("file") MultipartFile file) throws Exception {
+        if (file.isEmpty()) {
+            throw new RRException("上传文件不能为空");
+        }
+//        int AllowImgFileSize=0; //允许上传图片文件的大小 0为无限制 单位:KB
+//        Long size = file.getSize();
+//        int ImgFileSize=Math.round(size/1024*100)/100;//取得图片文件的大小
+//        if(ImgFileSize > 200){
+//            throw new RRException("上传图片,不能超过 300k");
+//        }
+        //上传文件
+        String url = FileManager.upload(file);
+
+        //保存文件信息
+        GoodsLabelHeadEntity goodsLabelHeadEntity = new GoodsLabelHeadEntity();
+        String merchSn = null;
+        Integer storeId = null;
+        SysUserEntity sysUser = (SysUserEntity) SecurityUtils.getSubject().getPrincipal();
+        if(!"1".equals(sysUser.getRoleType())){
+            merchSn = sysUser.getMerchSn();
+            storeId = sysUser.getStoreId();
+        }
+        goodsLabelHeadEntity.setMerchSn(merchSn);
+        goodsLabelHeadEntity.setCreaterSn(ShiroUtils.getUserId().toString());
+        goodsLabelHeadEntity.setCreateTime(new Date());
+        goodsLabelHeadEntity.setLabelHeadUrl(url);
+        goodsLabelHeadEntity.setIsValid(Dict.isValid.item_0.getItem());
+        goodsLabelHeadEntity.setLabelHeadName(file.getOriginalFilename());
+        goodsLabelHeadEntity.setStoreId(storeId);
+
+        goodsLabelHeadService.save(goodsLabelHeadEntity);
+        R r = R.ok();
+        r.put("url", url);
+        r.put("goodsLabelHead", goodsLabelHeadEntity);
+        return r;
+    }
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+}

+ 65 - 0
kmall-admin/src/main/java/com/kmall/admin/controller/exportPDF/ExportPDFController.java

@@ -0,0 +1,65 @@
+package com.kmall.admin.controller.exportPDF;
+
+import com.kmall.admin.service.GoodsService;
+import com.kmall.admin.utils.pdf.ViewPDF;
+import com.kmall.api.entity.exportpdf.PDFGoodsDto;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.stereotype.Controller;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.servlet.ModelAndView;
+
+import javax.annotation.Resource;
+import java.util.*;
+
+/**
+ * @author zhangchuangbiao
+ * @version 1.0
+ * 2020-09-14 16:06
+ */
+@Controller
+@RequestMapping("pdf")
+public class ExportPDFController {
+
+    @Autowired
+    private GoodsService goodsService;
+
+    @Value("${font.url}")
+    private String fontUrl;
+
+    @Value("${upload.dir}")
+    private String uploadDir;
+
+
+    //打印pdf
+    @RequestMapping("/printPdf")
+    public ModelAndView printPdf(String head ,String type,String sku,String storeId,String headUrl,String prodBarcode) throws Exception {
+
+        PDFGoodsDto pdfGoodsDto = goodsService.queryForPDFData(sku,storeId,prodBarcode);
+
+        if("1".equals(head)){
+            Map<String, Object> model = new HashMap<>();
+            model.put("dto", pdfGoodsDto);
+            model.put("type",type);
+            model.put("head",head);
+            model.put("fontUrl",fontUrl);
+            model.put("uploadDir",uploadDir);
+            model.put("headUrl",headUrl);
+            return new ModelAndView(new ViewPDF(), model);
+        }else if ("0".equals(head)){
+            Map<String, Object> model = new HashMap<>();
+            model.put("dto", pdfGoodsDto);
+            model.put("type",type);
+            model.put("head",head);
+            model.put("fontUrl",fontUrl);
+            model.put("uploadDir",uploadDir);
+            return new ModelAndView(new ViewPDF(), model);
+        }else{
+            return null;
+        }
+
+
+    }
+}
+
+

+ 10 - 1
kmall-admin/src/main/java/com/kmall/admin/dao/GoodsDao.java

@@ -3,7 +3,7 @@ package com.kmall.admin.dao;
 import com.kmall.admin.dto.GoodsDetailsDto;
 import com.kmall.admin.dto.GoodsPanoramaDto;
 import com.kmall.admin.entity.GoodsEntity;
-import com.kmall.common.utils.print.ticket.item.Goods;
+import com.kmall.api.entity.exportpdf.PDFGoodsDto;
 import com.kmall.manager.dao.BaseDao;
 import org.apache.ibatis.annotations.Param;
 
@@ -39,4 +39,13 @@ public interface GoodsDao extends BaseDao<GoodsEntity> {
     GoodsPanoramaDto searchGoodsPanoramaDtoByKeyword(@Param("keyword") String keyword);
 
     List<GoodsEntity> queryExportList(Map<String, Object> params);
+
+    /**
+     * 查询pdf需要的数据
+     * @param sku sku
+     * @param storeId 门店id
+     * @param prodBarcode
+     * @return
+     */
+    PDFGoodsDto queryForPDFData(@Param("sku") String sku, @Param("storeId") String storeId, @Param("prodBarcode") String prodBarcode);
 }

+ 16 - 0
kmall-admin/src/main/java/com/kmall/admin/dao/GoodsLabelHeadDao.java

@@ -0,0 +1,16 @@
+package com.kmall.admin.dao;
+
+
+import com.kmall.admin.entity.GoodsLabelHeadEntity;
+import com.kmall.manager.dao.BaseDao;
+
+/**
+ * 标签头维护表Dao
+ *
+ * @author emato
+ * @email admin@qhdswl.com
+ * @date 2020-09-11 14:24:36
+ */
+public interface GoodsLabelHeadDao extends BaseDao<GoodsLabelHeadEntity> {
+
+}

+ 222 - 0
kmall-admin/src/main/java/com/kmall/admin/entity/GoodsLabelHeadEntity.java

@@ -0,0 +1,222 @@
+package com.kmall.admin.entity;
+
+import java.io.Serializable;
+import java.util.Date;
+
+/**
+ * 标签头维护表实体
+ * 表名 mall_goods_label_head
+ *
+ * @author emato
+ * @email admin@qhdswl.com
+ * @date 2020-09-11 14:24:36
+ */
+public class GoodsLabelHeadEntity implements Serializable {
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * 编号
+     */
+    private Integer id;
+    /**
+     * 商户编号
+     */
+    private String merchSn;
+    /**
+     * 门店编号
+     */
+    private Integer storeId;
+    /**
+     * 标签头名称
+     */
+    private String labelHeadName;
+    /**
+     * 标签头url
+     */
+    private String labelHeadUrl;
+    /**
+     * 排序
+     */
+    private Integer sortOrder;
+    /**
+     * 是否有效,0:有效,1:无效
+     */
+    private String isValid;
+    /**
+     * 创建人编号
+     */
+    private String createrSn;
+    /**
+     * 创建时间,yyyy-MM-dd HH:mm:ss
+     */
+    private Date createTime;
+    /**
+     * 修改人编号
+     */
+    private String moderSn;
+    /**
+     * 修改时间,yyyy-MM-dd HH:mm:ss
+     */
+    private Date modTime;
+    /**
+     * 时间戳
+     */
+    private Date tstm;
+
+    /**
+     * 设置:编号
+     */
+    public void setId(Integer id) {
+        this.id = id;
+    }
+
+    /**
+     * 获取:编号
+     */
+    public Integer getId() {
+        return id;
+    }
+    /**
+     * 设置:商户编号
+     */
+    public void setMerchSn(String merchSn) {
+        this.merchSn = merchSn;
+    }
+
+    /**
+     * 获取:商户编号
+     */
+    public String getMerchSn() {
+        return merchSn;
+    }
+    /**
+     * 设置:门店编号
+     */
+    public void setStoreId(Integer storeId) {
+        this.storeId = storeId;
+    }
+
+    /**
+     * 获取:门店编号
+     */
+    public Integer getStoreId() {
+        return storeId;
+    }
+    /**
+     * 设置:标签头名称
+     */
+    public void setLabelHeadName(String labelHeadName) {
+        this.labelHeadName = labelHeadName;
+    }
+
+    /**
+     * 获取:标签头名称
+     */
+    public String getLabelHeadName() {
+        return labelHeadName;
+    }
+    /**
+     * 设置:标签头url
+     */
+    public void setLabelHeadUrl(String labelHeadUrl) {
+        this.labelHeadUrl = labelHeadUrl;
+    }
+
+    /**
+     * 获取:标签头url
+     */
+    public String getLabelHeadUrl() {
+        return labelHeadUrl;
+    }
+    /**
+     * 设置:排序
+     */
+    public void setSortOrder(Integer sortOrder) {
+        this.sortOrder = sortOrder;
+    }
+
+    /**
+     * 获取:排序
+     */
+    public Integer getSortOrder() {
+        return sortOrder;
+    }
+    /**
+     * 设置:是否有效,0:有效,1:无效
+     */
+    public void setIsValid(String isValid) {
+        this.isValid = isValid;
+    }
+
+    /**
+     * 获取:是否有效,0:有效,1:无效
+     */
+    public String getIsValid() {
+        return isValid;
+    }
+    /**
+     * 设置:创建人编号
+     */
+    public void setCreaterSn(String createrSn) {
+        this.createrSn = createrSn;
+    }
+
+    /**
+     * 获取:创建人编号
+     */
+    public String getCreaterSn() {
+        return createrSn;
+    }
+    /**
+     * 设置:创建时间,yyyy-MM-dd HH:mm:ss
+     */
+    public void setCreateTime(Date createTime) {
+        this.createTime = createTime;
+    }
+
+    /**
+     * 获取:创建时间,yyyy-MM-dd HH:mm:ss
+     */
+    public Date getCreateTime() {
+        return createTime;
+    }
+    /**
+     * 设置:修改人编号
+     */
+    public void setModerSn(String moderSn) {
+        this.moderSn = moderSn;
+    }
+
+    /**
+     * 获取:修改人编号
+     */
+    public String getModerSn() {
+        return moderSn;
+    }
+    /**
+     * 设置:修改时间,yyyy-MM-dd HH:mm:ss
+     */
+    public void setModTime(Date modTime) {
+        this.modTime = modTime;
+    }
+
+    /**
+     * 获取:修改时间,yyyy-MM-dd HH:mm:ss
+     */
+    public Date getModTime() {
+        return modTime;
+    }
+    /**
+     * 设置:时间戳
+     */
+    public void setTstm(Date tstm) {
+        this.tstm = tstm;
+    }
+
+    /**
+     * 获取:时间戳
+     */
+    public Date getTstm() {
+        return tstm;
+    }
+}

+ 73 - 0
kmall-admin/src/main/java/com/kmall/admin/service/GoodsLabelHeadService.java

@@ -0,0 +1,73 @@
+package com.kmall.admin.service;
+
+
+import com.kmall.admin.entity.GoodsLabelHeadEntity;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 标签头维护表Service接口
+ *
+ * @author emato
+ * @email admin@qhdswl.com
+ * @date 2020-09-11 14:24:36
+ */
+public interface GoodsLabelHeadService {
+
+    /**
+     * 根据主键查询实体
+     *
+     * @param id 主键
+     * @return 实体
+     */
+    GoodsLabelHeadEntity queryObject(Integer id);
+
+    /**
+     * 分页查询
+     *
+     * @param map 参数
+     * @return list
+     */
+    List<GoodsLabelHeadEntity> queryList(Map<String, Object> map);
+
+    /**
+     * 分页统计总数
+     *
+     * @param map 参数
+     * @return 总数
+     */
+    int queryTotal(Map<String, Object> map);
+
+    /**
+     * 保存实体
+     *
+     * @param goodsLabelHead 实体
+     * @return 保存条数
+     */
+    int save(GoodsLabelHeadEntity goodsLabelHead);
+
+    /**
+     * 根据主键更新实体
+     *
+     * @param goodsLabelHead 实体
+     * @return 更新条数
+     */
+    int update(GoodsLabelHeadEntity goodsLabelHead);
+
+    /**
+     * 根据主键删除
+     *
+     * @param id
+     * @return 删除条数
+     */
+    int delete(Integer id);
+
+    /**
+     * 根据主键批量删除
+     *
+     * @param ids
+     * @return 删除条数
+     */
+    int deleteBatch(Integer[]ids);
+}

+ 10 - 1
kmall-admin/src/main/java/com/kmall/admin/service/GoodsService.java

@@ -4,7 +4,7 @@ import com.kmall.admin.dto.GoodsDetailsDto;
 import com.kmall.admin.dto.GoodsDto;
 import com.kmall.admin.dto.GoodsPanoramaDto;
 import com.kmall.admin.entity.GoodsEntity;
-import com.kmall.common.utils.print.ticket.item.Goods;
+import com.kmall.api.entity.exportpdf.PDFGoodsDto;
 
 import java.util.List;
 import java.util.Map;
@@ -142,4 +142,13 @@ public interface GoodsService {
      * @return
      */
     List<GoodsEntity> queryExportList(Map<String, Object> params);
+
+    /**
+     * 查出pdf需要的需要
+     * @param sku 商品sku
+     * @param storeId
+     * @param prodBarcode
+     * @return
+     */
+    PDFGoodsDto queryForPDFData(String sku, String storeId, String prodBarcode);
 }

+ 59 - 0
kmall-admin/src/main/java/com/kmall/admin/service/impl/GoodsLabelHeadServiceImpl.java

@@ -0,0 +1,59 @@
+package com.kmall.admin.service.impl;
+
+import com.kmall.admin.dao.GoodsLabelHeadDao;
+import com.kmall.admin.entity.GoodsLabelHeadEntity;
+import com.kmall.admin.service.GoodsLabelHeadService;
+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-09-11 14:24:36
+ */
+@Service("goodsLabelHeadService")
+public class GoodsLabelHeadServiceImpl implements GoodsLabelHeadService {
+    @Autowired
+    private GoodsLabelHeadDao goodsLabelHeadDao;
+
+    @Override
+    public GoodsLabelHeadEntity queryObject(Integer id) {
+        return goodsLabelHeadDao.queryObject(id);
+    }
+
+    @Override
+    public List<GoodsLabelHeadEntity> queryList(Map<String, Object> map) {
+        return goodsLabelHeadDao.queryList(map);
+    }
+
+    @Override
+    public int queryTotal(Map<String, Object> map) {
+        return goodsLabelHeadDao.queryTotal(map);
+    }
+
+    @Override
+    public int save(GoodsLabelHeadEntity goodsLabelHead) {
+        return goodsLabelHeadDao.save(goodsLabelHead);
+    }
+
+    @Override
+    public int update(GoodsLabelHeadEntity goodsLabelHead) {
+        return goodsLabelHeadDao.update(goodsLabelHead);
+    }
+
+    @Override
+    public int delete(Integer id) {
+        return goodsLabelHeadDao.delete(id);
+    }
+
+    @Override
+    public int deleteBatch(Integer[]ids) {
+        return goodsLabelHeadDao.deleteBatch(ids);
+    }
+}

+ 14 - 0
kmall-admin/src/main/java/com/kmall/admin/service/impl/GoodsServiceImpl.java

@@ -10,6 +10,7 @@ import com.kmall.admin.dto.GoodsPanoramaDto;
 import com.kmall.admin.entity.*;
 import com.kmall.admin.service.GoodsService;
 import com.kmall.admin.utils.ShiroUtils;
+import com.kmall.api.entity.exportpdf.PDFGoodsDto;
 import com.kmall.common.constant.Dict;
 import com.kmall.admin.fromcomm.entity.SysUserEntity;
 import com.kmall.common.utils.*;
@@ -1043,6 +1044,19 @@ public class GoodsServiceImpl implements GoodsService {
 
         return goodsDao.queryExportList(params);
     }
+
+    /**
+     * 查出pdf需要的需要
+     *
+     * @param sku 商品sku
+     * @param storeId
+     * @param prodBarcode
+     * @return
+     */
+    @Override
+    public PDFGoodsDto queryForPDFData(String sku, String storeId, String prodBarcode) {
+        return goodsDao.queryForPDFData(sku,storeId,prodBarcode);
+    }
 /*  @Override
     @Transactional
     public int uploadExcel(MultipartFile file) {

+ 77 - 0
kmall-admin/src/main/java/com/kmall/admin/utils/pdf/BarcodeUtil.java

@@ -0,0 +1,77 @@
+package com.kmall.admin.utils.pdf;
+
+
+import org.apache.commons.lang3.ObjectUtils;
+import org.krysalis.barcode4j.HumanReadablePlacement;
+import org.krysalis.barcode4j.impl.code128.Code128Bean;
+import org.krysalis.barcode4j.output.bitmap.BitmapCanvasProvider;
+
+import javax.imageio.stream.FileImageOutputStream;
+import java.awt.image.BufferedImage;
+import java.io.ByteArrayOutputStream;
+import java.io.File;
+import java.io.IOException;
+
+public class BarcodeUtil {
+
+
+    /**
+     * 生成code128条形码
+     *
+     * @param height        条形码的高度
+     * @param width         条形码的宽度
+     * @param message       要生成的文本
+     * @param withQuietZone 是否两边留白
+     * @param hideText      隐藏可读文本
+     * @return 图片对应的字节码
+     */
+    public static byte[] generateBarCode128(String message, Double height, Double width, boolean withQuietZone, boolean hideText) {
+        Code128Bean bean = new Code128Bean();
+        // 分辨率
+        int dpi = 512;
+        // 设置两侧是否留白
+        bean.doQuietZone(withQuietZone);
+
+        // 设置条形码高度和宽度
+        bean.setBarHeight((double) ObjectUtils.defaultIfNull(height, 9.0D));
+        if (width != null) {
+            bean.setModuleWidth(width);
+        }
+        // 设置文本位置(包括是否显示)
+        if (hideText) {
+            bean.setMsgPosition(HumanReadablePlacement.HRP_NONE);
+        }
+        // 设置图片类型
+        String format = "image/png";
+
+        ByteArrayOutputStream ous = new ByteArrayOutputStream();
+        BitmapCanvasProvider canvas = new BitmapCanvasProvider(ous, format, dpi,
+                BufferedImage.TYPE_BYTE_BINARY, false, 0);
+
+        // 生产条形码
+        bean.generateBarcode(canvas, message);
+        try {
+            canvas.finish();
+        } catch (IOException e) {
+            //ByteArrayOutputStream won't happen
+        }
+
+        return ous.toByteArray();
+    }
+
+    //byte数组到图片到硬盘上
+    public static void byte2image(byte[] data, String path){
+        if(data.length<3||path.equals("")) return;//判断输入的byte是否为空
+        try{
+            FileImageOutputStream imageOutput = new FileImageOutputStream(new File(path));//打开输入流
+            imageOutput.write(data, 0, data.length);//将byte写入硬盘
+            imageOutput.close();
+            System.out.println("Make Picture success,Please find image in " + path);
+        } catch(Exception ex) {
+            System.out.println("Exception: " + ex);
+            ex.printStackTrace();
+        }
+    }
+
+
+}

+ 56 - 0
kmall-admin/src/main/java/com/kmall/admin/utils/pdf/PdfUtil.java

@@ -0,0 +1,56 @@
+package com.kmall.admin.utils.pdf;
+
+import com.itextpdf.text.DocumentException;
+import com.kmall.admin.utils.pdf.type.*;
+import com.kmall.api.entity.exportpdf.PDFGoodsDto;
+import com.lowagie.text.Document;
+import com.lowagie.text.pdf.PdfWriter;
+
+import java.io.IOException;
+
+public class PdfUtil {
+
+  public void createPDF(Document document, PdfWriter writer, PDFGoodsDto pdfGoodsDto,
+                        String type, String fontUrl, String uploadDir,String head, String headUrl) throws IOException, com.lowagie.text.DocumentException {
+
+      switch (type){
+          case "1":
+              PDFWrite pdfWrite = new PDFWrite();
+              pdfWrite.write(document,writer,pdfGoodsDto,fontUrl,uploadDir,headUrl);
+              break;
+          case "2":
+              PDFWrite_2 pdfWrite2 = new PDFWrite_2();
+              pdfWrite2.write(document,writer,pdfGoodsDto,fontUrl,uploadDir,headUrl);
+              break;
+          case "4":
+              PDFWrite_4 pdfWrite4 = new PDFWrite_4();
+              pdfWrite4.write(document,writer,pdfGoodsDto,fontUrl,uploadDir,headUrl);;
+              break;
+          case "9":
+              PDFWrite_9 pdfWrite9 = new PDFWrite_9();
+              pdfWrite9.write(document,writer,pdfGoodsDto,fontUrl,uploadDir,headUrl);
+              break;
+          case "12":
+              PDFWrite_12 pdfWrite12 = new PDFWrite_12();
+              pdfWrite12.write(document,writer,pdfGoodsDto,fontUrl,uploadDir,headUrl);
+              break;
+          case "18":
+              PDFWrite_18 pdfWrite18 = new PDFWrite_18();
+              pdfWrite18.write(document,writer,pdfGoodsDto,fontUrl,uploadDir,headUrl);
+              break;
+          case "36":
+              if ("1".equals(head)) {
+                  PDFWrite_36 pdfWrite36 = new PDFWrite_36();
+                  pdfWrite36.write(document,writer,pdfGoodsDto,fontUrl,uploadDir,headUrl);
+              }else if ("0".equals(head)){
+                  PDFWrite_nohead_36 pdfWrite_nohead_36 = new PDFWrite_nohead_36();
+                  pdfWrite_nohead_36.write(document, writer, pdfGoodsDto, fontUrl, uploadDir);
+              }
+              break;
+          default:
+              break;
+      }
+
+
+  }
+}

+ 34 - 0
kmall-admin/src/main/java/com/kmall/admin/utils/pdf/ViewPDF.java

@@ -0,0 +1,34 @@
+package com.kmall.admin.utils.pdf;
+
+import com.kmall.api.entity.exportpdf.PDFGoodsDto;
+import com.lowagie.text.Document;
+import com.lowagie.text.pdf.PdfWriter;
+import org.springframework.web.servlet.view.document.AbstractPdfView;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.util.Date;
+import java.util.Map;
+
+public class ViewPDF extends AbstractPdfView {
+
+  @Override
+  protected void buildPdfDocument(Map<String, Object> model, Document document, PdfWriter writer,
+                                  HttpServletRequest request, HttpServletResponse response) throws Exception {
+
+      String fileName = new Date().getTime()+"_quotation.pdf"; // 设置response方式,使执行此controller时候自动出现下载页面,而非直接使用excel打开
+      response.setCharacterEncoding("UTF-8");
+      response.setContentType("application/pdf");
+      response.setHeader("Content-Disposition","filename=" + new String(fileName.getBytes(), "iso8859-1"));
+
+
+      PdfUtil pdfUtil = new PdfUtil();
+      String type = (String) model.get("type");
+      PDFGoodsDto pdfGoodsDto = (PDFGoodsDto) model.get("dto");
+      String fontUrl = (String) model.get("fontUrl");
+      String uploadDir = (String) model.get("uploadDir");
+      String head = (String) model.get("head");
+      String headUrl = (String) model.get("headUrl");
+      pdfUtil.createPDF(document,writer,pdfGoodsDto,type,fontUrl,uploadDir,head,headUrl);
+  }
+}

+ 159 - 0
kmall-admin/src/main/java/com/kmall/admin/utils/pdf/type/PDFWrite.java

@@ -0,0 +1,159 @@
+package com.kmall.admin.utils.pdf.type;
+
+import com.kmall.api.entity.exportpdf.PDFGoodsDto;
+import com.lowagie.text.*;
+import com.lowagie.text.pdf.BaseFont;
+import com.lowagie.text.pdf.PdfPCell;
+import com.lowagie.text.pdf.PdfPTable;
+import com.lowagie.text.pdf.PdfWriter;
+
+import java.io.FileOutputStream;
+import java.io.IOException;
+/**
+ * @author zhangchuangbiao
+ * @version 1.0
+ * 2020-09-11 09:51
+ */
+public class PDFWrite {
+
+
+    public void write(Document doc, PdfWriter writer, PDFGoodsDto pdfGoodsDto
+            , String fontUrl, String uploadDir, String headUrl) throws IOException, DocumentException {
+        // 设置字体
+        BaseFont bfHei = BaseFont.createFont(fontUrl,BaseFont.IDENTITY_H,BaseFont.NOT_EMBEDDED);
+        Font FontChinese11 = new Font(bfHei, 11);
+
+        String path = uploadDir;
+        FileOutputStream out = new FileOutputStream(path);
+
+        doc.setMargins(0,0,0,0);
+
+        writer.setPdfVersion(PdfWriter.PDF_VERSION_1_2);//版本(默认1.4)
+        doc.open();// 打开文档
+        // -----------------------标签头----------------------
+        PdfPTable table1 = new PdfPTable(1);
+
+        Image img = Image.getInstance(headUrl);
+        img.setAlignment(Image.MIDDLE);  //设置图片居中
+        img.setBorder(Image.BOX);
+        img.setBorderWidth(10);
+//        img.setBorderColor(BaseColor.WHITE);
+
+        img.scaleToFit(595, 842);// 设置图片大小
+
+        doc.add(img); //添加img
+
+        // --------------产品名称-------------------------------
+        PdfPTable pdfPTable2 = new PdfPTable(1);
+        Font font = new Font(bfHei, 60);
+        Paragraph tParagraph = new Paragraph(pdfGoodsDto.getProductName(), font);
+        PdfPCell nameCell = new PdfPCell(tParagraph);
+        nameCell.setBorder(0);
+        nameCell.setHorizontalAlignment(Element.ALIGN_CENTER); // 水平居中
+        nameCell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 垂直居中
+        pdfPTable2.addCell(nameCell);
+        doc.add(pdfPTable2);
+
+        Paragraph blankRow31 = new Paragraph(18f, " ", FontChinese11);
+        doc.add(blankRow31);
+
+        // --------------产品英文名称-------------------------------
+        PdfPTable pdfPTable3 = new PdfPTable(1);
+        font = new Font(bfHei, 30);
+        Paragraph englistPararaph = new Paragraph(pdfGoodsDto.getEnglishName(), font);
+        PdfPCell englishNameCell = new PdfPCell(englistPararaph);
+        englishNameCell.setBorder(0);
+        englishNameCell.setHorizontalAlignment(Element.ALIGN_CENTER); // 水平居中
+        englishNameCell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 垂直居中
+        pdfPTable3.addCell(englishNameCell);
+        doc.add(pdfPTable3);
+
+
+        // --------------大价格-------------------------------
+        PdfPTable pdfPTable4 = new PdfPTable(2);
+
+        pdfPTable4.setWidths(new int[]{20,10});
+
+        font = new Font(bfHei, 120);
+        Paragraph bigPrice = new Paragraph("¥"+pdfGoodsDto.getPrice().substring(0,pdfGoodsDto.getPrice().indexOf(".")), font);
+
+        PdfPCell priceCell = new PdfPCell(bigPrice);
+        priceCell.setBorder(0);
+        priceCell.setHorizontalAlignment(Element.ALIGN_RIGHT); // 水平居中
+        priceCell.setVerticalAlignment(Element.ALIGN_CENTER); // 垂直居中
+        pdfPTable4.addCell(priceCell);
+        // --------------小价格-------------------------------
+        font = new Font(bfHei, 90);
+        Paragraph smallPrice = new Paragraph(pdfGoodsDto.getPrice().substring(pdfGoodsDto.getPrice().indexOf(".")), font);
+
+        PdfPCell smallPriceCell = new PdfPCell(smallPrice);
+        smallPriceCell.setBorder(0);
+        smallPriceCell.setHorizontalAlignment(Element.ALIGN_LEFT); // 水平居中
+        smallPriceCell.setVerticalAlignment(Element.ALIGN_CENTER); // 垂直居中
+        pdfPTable4.addCell(smallPriceCell);
+
+        doc.add(pdfPTable4);
+
+        // --------------空格--------------
+        blankRow31 = new Paragraph(18f, " ", FontChinese11);
+        doc.add(blankRow31);
+
+        // --------------底部1-------------------------------
+        PdfPTable pdfPTable5 = new PdfPTable(1);
+        font = new Font(bfHei, 40);
+        Paragraph advice = new Paragraph("比建议零售价省¥"+pdfGoodsDto.getSavings(), font);
+        PdfPCell adviceCell = new PdfPCell(advice);
+        adviceCell.setBorder(0);
+        adviceCell.setHorizontalAlignment(Element.ALIGN_CENTER); // 水平居中
+        adviceCell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 垂直居中
+        pdfPTable5.addCell(adviceCell);
+        doc.add(pdfPTable5);
+
+        // --------------空格--------------
+        blankRow31 = new Paragraph(18f, " ", FontChinese11);
+        doc.add(blankRow31);
+
+        // --------------底部2-------------------------------
+        PdfPTable pdfPTable6 = new PdfPTable(1);
+        font = new Font(bfHei, 26);
+        Paragraph tax = new Paragraph("税率:"+pdfGoodsDto.getStartFax(), font);
+        PdfPCell taxCell = new PdfPCell(tax);
+        taxCell.setBorder(0);
+        taxCell.setHorizontalAlignment(Element.ALIGN_CENTER); // 水平居中
+        taxCell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 垂直居中
+        pdfPTable6.addCell(taxCell);
+        doc.add(pdfPTable6);
+
+        // --------------空格--------------
+        blankRow31 = new Paragraph(18f, " ", FontChinese11);
+        doc.add(blankRow31);
+
+        // --------------底部左边PLU-------------------------------
+        PdfPTable pdfPTable7 = new PdfPTable(2);
+        font = new Font(bfHei, 20);
+        Paragraph PLU = new Paragraph(pdfGoodsDto.getPlu(), font);
+        PdfPCell pluCell = new PdfPCell(PLU);
+        pluCell.setBorder(0);
+        pluCell.setHorizontalAlignment(Element.ALIGN_LEFT); // 水平居中
+        pluCell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 垂直居中
+        // --------------底部右边条形码-------------------------------
+        Paragraph barCode = new Paragraph(pdfGoodsDto.getBarCode(), font);
+        PdfPCell barCodeCell = new PdfPCell(barCode);
+        barCodeCell.setBorder(0);
+        barCodeCell.setHorizontalAlignment(Element.ALIGN_RIGHT); // 水平居中
+        barCodeCell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 垂直居中
+        pdfPTable7.addCell(pluCell);
+        pdfPTable7.addCell(barCodeCell);
+        doc.add(pdfPTable7);
+
+
+        doc.setMargins(10, 20, 30, 40);// 页边空白
+
+
+        doc.close();  //记得关闭document
+
+    }
+
+
+
+}

+ 224 - 0
kmall-admin/src/main/java/com/kmall/admin/utils/pdf/type/PDFWrite_12.java

@@ -0,0 +1,224 @@
+package com.kmall.admin.utils.pdf.type;
+import com.kmall.api.entity.exportpdf.PDFGoodsDto;
+import com.lowagie.text.*;
+import com.lowagie.text.pdf.*;
+
+import java.io.FileOutputStream;
+import java.io.IOException;
+
+/**
+ * @author zhangchuangbiao
+ * @version 1.0
+ * 2020-09-11 09:51
+ */
+public class PDFWrite_12 {
+
+
+    public void write(Document doc, PdfWriter writer, PDFGoodsDto pdfGoodsDto
+            , String fontUrl, String uploadDir, String headUrl) throws IOException, DocumentException {
+
+        // 设置字体
+        BaseFont bfHei = BaseFont.createFont(fontUrl,BaseFont.IDENTITY_H,BaseFont.NOT_EMBEDDED);
+        Font FontChinese11 = new Font(bfHei, 11);
+
+        String path = uploadDir;
+        FileOutputStream out = new FileOutputStream(path);
+
+        doc.setMargins(0,0,0,0);
+
+        writer.setPdfVersion(PdfWriter.PDF_VERSION_1_2);//版本(默认1.4)
+        doc.open();// 打开文档
+
+        // -----------------------标签头----------------------
+//        PdfPTable table = getPdfPTable(FontChinese11, bfHei, doc);
+        getPdfPTable(FontChinese11, bfHei, doc,pdfGoodsDto,headUrl);
+        getPdfPTable(FontChinese11, bfHei, doc,pdfGoodsDto,headUrl);
+        getPdfPTable(FontChinese11, bfHei, doc,pdfGoodsDto,headUrl);
+        getPdfPTable(FontChinese11, bfHei, doc,pdfGoodsDto,headUrl);
+
+
+        doc.close();  //记得关闭document
+
+    }
+
+    private static void getPdfPTable(Font fontChinese11, BaseFont bfHei, Document doc, PDFGoodsDto pdfGoodsDto,String headUrl) throws IOException, DocumentException {
+        PdfPTable table = new PdfPTable(3);
+        table = new PdfPTable(3);
+
+        for (int i = 0; i < 3; i++) {
+            Image img = Image.getInstance(headUrl);
+            img.setAlignment(Image.ALIGN_CENTER);  //设置图片居中
+
+            PdfPCell p = new PdfPCell(img,true);
+            p.setPaddingLeft(2);
+            p.setPaddingRight(2);
+            p.setPaddingTop(2);
+            p.setBorder(0);
+            p.setCellEvent((cell,position,canvases)->{
+                PdfContentByte canvas = canvases[PdfPTable.LINECANVAS];
+                cellRight(position, canvas);
+                canvas.moveTo(position.getLeft(), position.getTop());
+                canvas.lineTo(position.getRight(), position.getTop());
+            });
+
+            table.setWidthPercentage(100f);
+            table.addCell(p);
+        }
+        doc.add(table);
+
+        // --------------产品名称-------------------------------
+        table = new PdfPTable(3);
+
+        for (int i = 0; i < 3; i++) {
+            setTable(bfHei, table, 16, pdfGoodsDto.getProductName());
+        }
+
+        doc.add(table);
+
+        Paragraph blankRow31 = new Paragraph(18f, " ", fontChinese11);
+        PdfPCell nextLine = new PdfPCell(blankRow31);
+        nextLine.setBorder(0);
+        nextLine.setCellEvent((cell,position,canvases)->{
+            PdfContentByte canvas = canvases[PdfPTable.LINECANVAS];
+            cellRight(position, canvas);
+        });
+        doc.add(nextLine);
+
+
+
+        // --------------产品英文名称-------------------------------
+        table = new PdfPTable(3);
+
+        for (int i = 0; i < 3; i++) {
+            setTable(bfHei, table, 12, pdfGoodsDto.getEnglishName());
+        }
+        doc.add(table);
+
+
+        table = new PdfPTable(3);
+
+        for (int i = 0; i < 3; i++) {
+            PdfPTable pdfPTable4 = new PdfPTable(2);
+            pdfPTable4.setWidths(new int[]{10,6});
+
+
+
+            // --------------大价格-------------------------------
+            Font font = new Font(bfHei, 44);
+            Paragraph bigPrice = new Paragraph("¥"+pdfGoodsDto.getPrice().substring(0,pdfGoodsDto.getPrice().indexOf(".")), font);
+            PdfPCell priceCell = new PdfPCell(bigPrice);
+            setBasisStyle(priceCell, Element.ALIGN_RIGHT, Element.ALIGN_CENTER);
+            pdfPTable4.addCell(priceCell);
+
+            // --------------小价格-------------------------------
+            font = new Font(bfHei, 30);
+            Paragraph smallPrice = new Paragraph(pdfGoodsDto.getPrice().substring(pdfGoodsDto.getPrice().indexOf(".")), font);
+            PdfPCell smallPriceCell = new PdfPCell(smallPrice);
+            setBasisStyle(smallPriceCell, Element.ALIGN_LEFT, Element.ALIGN_CENTER);
+            pdfPTable4.addCell(smallPriceCell);
+
+            PdfPCell p = new PdfPCell(pdfPTable4);
+            p.setBorder(0);
+            p.setCellEvent((cell,position,canvases)->{
+                PdfContentByte canvas = canvases[PdfPTable.LINECANVAS];
+                cellRight(position, canvas);
+            });
+            table.setWidthPercentage(100f);
+            table.addCell(p);
+        }
+
+
+        doc.add(table);
+
+        // --------------空格--------------
+        doc.add(nextLine);
+
+        // --------------底部1-------------------------------
+        table = new PdfPTable(3);
+
+        for (int i = 0; i < 3; i++) {
+            setTable(bfHei, table, 12, "比建议零售价省¥"+pdfGoodsDto.getSavings());
+        }
+
+        doc.add(table);
+
+
+        // --------------底部2-------------------------------
+        table = new PdfPTable(3);
+        for (int i = 0; i < 3; i++) {
+            setTable(bfHei, table, 10, "税率:"+pdfGoodsDto.getStartFax());
+        }
+        doc.add(table);
+
+        table = new PdfPTable(3);
+        for (int i = 0; i < 3; i++) {
+            // --------------底部左边PLU-------------------------------
+            PdfPTable pdfPTable7 = new PdfPTable(2);
+            Font font = new Font(bfHei, 9);
+            Paragraph PLU = new Paragraph(pdfGoodsDto.getPlu(), font);
+            PdfPCell pluCell = new PdfPCell(PLU);
+            setBasisStyle(pluCell, Element.ALIGN_LEFT, Element.ALIGN_MIDDLE);
+            pluCell.setPaddingLeft(20);
+            // --------------底部右边条形码-------------------------------
+            Paragraph barCode = new Paragraph(pdfGoodsDto.getBarCode(), font);
+            PdfPCell barCodeCell = new PdfPCell(barCode);
+            setBasisStyle(barCodeCell, Element.ALIGN_RIGHT, Element.ALIGN_MIDDLE);
+            barCodeCell.setPaddingRight(20);
+            pdfPTable7.addCell(pluCell);
+            pdfPTable7.addCell(barCodeCell);
+            PdfPCell p = new PdfPCell(pdfPTable7);
+            p.setBorder(0);
+            p.setCellEvent((cell,position,canvases)->{
+                PdfContentByte canvas = canvases[PdfPTable.LINECANVAS];
+                cellRight(position, canvas);
+            });
+            table.setWidthPercentage(100f);
+            table.addCell(p);
+        }
+        doc.add(table);
+        doc.add(nextLine);
+        doc.add(nextLine);
+        doc.add(nextLine);
+
+    }
+
+    // 绘制右边边框虚线
+    private static void cellRight(Rectangle position, PdfContentByte canvas) {
+        canvas.saveState();
+        canvas.setLineWidth(0.5f);
+        canvas.setLineDash(new float[]{5.0f, 5.0f}, 0);
+        canvas.moveTo(position.getRight(), position.getTop());
+        canvas.lineTo(position.getRight(), position.getBottom());
+        canvas.stroke();
+    }
+
+    // 去除边框,设置水平垂直居中
+    private static void setBasisStyle(PdfPCell pluCell, int alignLeft, int alignMiddle) {
+        pluCell.setBorder(0);
+        pluCell.setHorizontalAlignment(alignLeft); // 水平居中
+        pluCell.setVerticalAlignment(alignMiddle); // 垂直居中
+    }
+
+    private static void setTable(BaseFont bfHei, PdfPTable table, int i2, String s) {
+        Font font = new Font(bfHei, i2); // 设置字体
+        PdfPTable pdfPTable3 = new PdfPTable(1);
+        Paragraph pararaph = new Paragraph(s, font); // 段落
+        PdfPCell nameCell = new PdfPCell(pararaph); // 单元Cell
+        setBasisStyle(nameCell, Element.ALIGN_CENTER, Element.ALIGN_MIDDLE);
+        pdfPTable3.addCell(nameCell);
+
+        // 创建PCell来存储PTable,用来去除边框
+        PdfPCell p = new PdfPCell(pdfPTable3);
+        p.setBorder(0);
+        // 设置虚线边框
+        p.setCellEvent((cell, position, canvases) -> {
+            PdfContentByte canvas = canvases[PdfPTable.LINECANVAS];
+            cellRight(position, canvas);
+        });
+        // 填充满
+        table.setWidthPercentage(100f);
+        table.addCell(p);
+    }
+
+
+}

+ 224 - 0
kmall-admin/src/main/java/com/kmall/admin/utils/pdf/type/PDFWrite_18.java

@@ -0,0 +1,224 @@
+package com.kmall.admin.utils.pdf.type;
+
+import com.kmall.api.entity.exportpdf.PDFGoodsDto;
+import com.lowagie.text.*;
+import com.lowagie.text.pdf.*;
+
+import java.io.FileOutputStream;
+import java.io.IOException;
+
+/**
+ * @author zhangchuangbiao
+ * @version 1.0
+ * 2020-09-11 09:51
+ */
+public class PDFWrite_18 {
+
+
+    public void write(com.lowagie.text.Document doc, com.lowagie.text.pdf.PdfWriter writer, PDFGoodsDto pdfGoodsDto
+            , String fontUrl, String uploadDir, String headUrl) throws IOException, com.lowagie.text.DocumentException {
+
+        // 设置字体
+        com.lowagie.text.pdf.BaseFont bfHei = com.lowagie.text.pdf.BaseFont.createFont(fontUrl, com.lowagie.text.pdf.BaseFont.IDENTITY_H, com.lowagie.text.pdf.BaseFont.NOT_EMBEDDED);
+        com.lowagie.text.Font FontChinese11 = new com.lowagie.text.Font(bfHei, 11);
+
+        String path = uploadDir;
+        FileOutputStream out = new FileOutputStream(path);
+
+        doc.setMargins(0,0,0,0);
+
+        writer.setPdfVersion(com.lowagie.text.pdf.PdfWriter.PDF_VERSION_1_2);//版本(默认1.4)
+        doc.open();// 打开文档
+
+        // -----------------------标签头----------------------
+        getPdfPTable(FontChinese11, bfHei, doc,pdfGoodsDto,headUrl);
+        getPdfPTable(FontChinese11, bfHei, doc,pdfGoodsDto,headUrl);
+        getPdfPTable(FontChinese11, bfHei, doc,pdfGoodsDto,headUrl);
+
+
+        doc.close();  //记得关闭document
+
+    }
+
+    private static void getPdfPTable(com.lowagie.text.Font fontChinese11, BaseFont bfHei, Document doc,
+                                     PDFGoodsDto pdfGoodsDto, String headUrl) throws IOException, com.lowagie.text.DocumentException {
+        PdfPTable table = new PdfPTable(3);
+        table = new PdfPTable(6);
+
+        for (int i = 0; i < 6; i++) {
+            Image img = Image.getInstance(headUrl);
+            img.setAlignment(Image.ALIGN_CENTER);  //设置图片居中
+
+            PdfPCell p = new PdfPCell(img,true);
+            p.setPaddingLeft(2);
+            p.setPaddingRight(2);
+            p.setPaddingTop(2);
+            p.setBorder(0);
+            p.setCellEvent((cell,position,canvases)->{
+                PdfContentByte canvas = canvases[PdfPTable.LINECANVAS];
+                cellRight(position, canvas);
+                canvas.moveTo(position.getLeft(), position.getTop());
+                canvas.lineTo(position.getRight(), position.getTop());
+            });
+
+            table.setWidthPercentage(100f);
+            table.addCell(p);
+        }
+        doc.add(table);
+
+        // --------------产品名称-------------------------------
+        table = new PdfPTable(6);
+
+        for (int i = 0; i < 6; i++) {
+            setTable(bfHei, table, 16, pdfGoodsDto.getProductName());
+        }
+
+        doc.add(table);
+
+        Paragraph blankRow31 = new Paragraph(18f, " ", fontChinese11);
+        PdfPCell nextLine = new PdfPCell(blankRow31);
+        nextLine.setBorder(0);
+        nextLine.setCellEvent((cell,position,canvases)->{
+            PdfContentByte canvas = canvases[PdfPTable.LINECANVAS];
+            cellRight(position, canvas);
+        });
+//        doc.add(nextLine);
+
+
+
+        // --------------产品英文名称-------------------------------
+        table = new PdfPTable(6);
+
+        for (int i = 0; i < 6; i++) {
+            setTable(bfHei, table, 10, pdfGoodsDto.getEnglishName());
+        }
+        doc.add(table);
+
+
+        table = new PdfPTable(6);
+
+        for (int i = 0; i < 6; i++) {
+            PdfPTable pdfPTable4 = new PdfPTable(2);
+            pdfPTable4.setWidths(new int[]{10,6});
+
+
+
+            // --------------大价格-------------------------------
+            Font font = new Font(bfHei, 28);
+            Paragraph bigPrice = new Paragraph("¥"+pdfGoodsDto.getPrice().substring(0,pdfGoodsDto.getPrice().indexOf(".")), font);
+            PdfPCell priceCell = new PdfPCell(bigPrice);
+            setBasisStyle(priceCell, Element.ALIGN_RIGHT, Element.ALIGN_CENTER);
+            pdfPTable4.addCell(priceCell);
+
+            // --------------小价格-------------------------------
+            font = new Font(bfHei, 20);
+            Paragraph smallPrice = new Paragraph(pdfGoodsDto.getPrice().substring(pdfGoodsDto.getPrice().indexOf(".")), font);
+            PdfPCell smallPriceCell = new PdfPCell(smallPrice);
+            setBasisStyle(smallPriceCell, Element.ALIGN_LEFT, Element.ALIGN_CENTER);
+            pdfPTable4.addCell(smallPriceCell);
+
+            PdfPCell p = new PdfPCell(pdfPTable4);
+            p.setBorder(0);
+            p.setCellEvent((cell,position,canvases)->{
+                PdfContentByte canvas = canvases[PdfPTable.LINECANVAS];
+                cellRight(position, canvas);
+            });
+            table.setWidthPercentage(100f);
+            table.addCell(p);
+        }
+
+
+        doc.add(table);
+
+        // --------------空格--------------
+
+//        doc.add(nextLine);
+
+        // --------------底部1-------------------------------
+        table = new PdfPTable(6);
+
+        for (int i = 0; i < 6; i++) {
+            setTable(bfHei, table, 10, "比建议零售价省¥"+pdfGoodsDto.getSavings());
+        }
+
+        doc.add(table);
+
+
+        // --------------底部2-------------------------------
+        table = new PdfPTable(6);
+        for (int i = 0; i < 6; i++) {
+            setTable(bfHei, table, 8, "税率:"+pdfGoodsDto.getStartFax());
+        }
+        doc.add(table);
+
+        table = new PdfPTable(6);
+        for (int i = 0; i < 6; i++) {
+            // --------------底部左边PLU-------------------------------
+            PdfPTable pdfPTable7 = new PdfPTable(2);
+            Font font = new Font(bfHei, 7);
+            Paragraph PLU = new Paragraph(pdfGoodsDto.getPlu(), font);
+            PdfPCell pluCell = new PdfPCell(PLU);
+            setBasisStyle(pluCell, Element.ALIGN_LEFT, Element.ALIGN_MIDDLE);
+            pluCell.setPaddingLeft(10);
+            // --------------底部右边条形码-------------------------------
+            Paragraph barCode = new Paragraph(pdfGoodsDto.getBarCode(), font);
+            PdfPCell barCodeCell = new PdfPCell(barCode);
+            setBasisStyle(barCodeCell, Element.ALIGN_RIGHT, Element.ALIGN_MIDDLE);
+            barCodeCell.setPaddingRight(10);
+            pdfPTable7.addCell(pluCell);
+            pdfPTable7.addCell(barCodeCell);
+            PdfPCell p = new PdfPCell(pdfPTable7);
+            p.setBorder(0);
+            p.setCellEvent((cell,position,canvases)->{
+                PdfContentByte canvas = canvases[PdfPTable.LINECANVAS];
+                cellRight(position, canvas);
+            });
+            table.setWidthPercentage(100f);
+            table.addCell(p);
+        }
+        doc.add(table);
+
+//        doc.add(nextLine);
+
+    }
+
+    // 绘制右边边框虚线
+    private static void cellRight(Rectangle position, PdfContentByte canvas) {
+        canvas.saveState();
+        canvas.setLineWidth(0.5f);
+        canvas.setLineDash(new float[]{5.0f, 5.0f}, 0);
+        canvas.moveTo(position.getRight(), position.getTop());
+        canvas.lineTo(position.getRight(), position.getBottom());
+        canvas.stroke();
+    }
+
+    // 去除边框,设置水平垂直居中
+    private static void setBasisStyle(PdfPCell pluCell, int alignLeft, int alignMiddle) {
+        pluCell.setBorder(0);
+        pluCell.setHorizontalAlignment(alignLeft); // 水平居中
+        pluCell.setVerticalAlignment(alignMiddle); // 垂直居中
+    }
+
+    private static void setTable(BaseFont bfHei, PdfPTable table, int i2, String s) {
+        Font font = new Font(bfHei, i2); // 设置字体
+        PdfPTable pdfPTable3 = new PdfPTable(1);
+        Paragraph pararaph = new Paragraph(s, font); // 段落
+        PdfPCell nameCell = new PdfPCell(pararaph); // 单元Cell
+        setBasisStyle(nameCell, Element.ALIGN_CENTER, Element.ALIGN_MIDDLE);
+        pdfPTable3.addCell(nameCell);
+
+        // 创建PCell来存储PTable,用来去除边框
+        PdfPCell p = new PdfPCell(pdfPTable3);
+        p.setBorder(0);
+        // 设置虚线边框
+        p.setCellEvent((cell, position, canvases) -> {
+            PdfContentByte canvas = canvases[PdfPTable.LINECANVAS];
+            cellRight(position, canvas);
+        });
+        // 填充满
+        table.setWidthPercentage(100f);
+        table.addCell(p);
+    }
+
+
+}

+ 216 - 0
kmall-admin/src/main/java/com/kmall/admin/utils/pdf/type/PDFWrite_2.java

@@ -0,0 +1,216 @@
+package com.kmall.admin.utils.pdf.type;
+
+import com.kmall.api.entity.exportpdf.PDFGoodsDto;
+import com.lowagie.text.*;
+import com.lowagie.text.pdf.*;
+
+import java.io.FileOutputStream;
+import java.io.IOException;
+/**
+ * @author zhangchuangbiao
+ * @version 1.0
+ * 2020-09-11 09:51
+ */
+public class PDFWrite_2 {
+
+
+    public void write(Document doc, PdfWriter writer, PDFGoodsDto pdfGoodsDto
+            , String fontUrl, String uploadDir, String headUrl) throws IOException, DocumentException {
+        // 设置字体
+        BaseFont bfHei = BaseFont.createFont(fontUrl,BaseFont.IDENTITY_H,BaseFont.NOT_EMBEDDED);
+        Font FontChinese11 = new Font(bfHei, 11);
+
+        String path = uploadDir;
+        FileOutputStream out = new FileOutputStream(path);
+
+        doc.setMargins(0,0,0,0);
+
+        writer.setPdfVersion(PdfWriter.PDF_VERSION_1_2);//版本(默认1.4)
+        doc.open();// 打开文档
+        // -----------------------标签头----------------------
+        getPdfPTable(FontChinese11, bfHei, doc,pdfGoodsDto,headUrl);
+
+        doc.close();  //记得关闭document
+
+    }
+
+    private static void getPdfPTable(Font fontChinese11, BaseFont bfHei, Document doc, PDFGoodsDto pdfGoodsDto,String headUrl) throws IOException, DocumentException {
+        PdfPTable table = new PdfPTable(2);
+
+        for (int i = 0; i < 2; i++) {
+            Image img = Image.getInstance(headUrl);
+            img.setAlignment(Image.ALIGN_CENTER);  //设置图片居中
+
+            PdfPCell p = new PdfPCell(img,true);
+            p.setPaddingLeft(2);
+            p.setPaddingRight(2);
+            p.setPaddingTop(2);
+            p.setBorder(0);
+            p.setCellEvent((cell,position,canvases)->{
+                PdfContentByte canvas = canvases[PdfPTable.LINECANVAS];
+                cellRight(position, canvas);
+                canvas.moveTo(position.getLeft(), position.getTop());
+                canvas.lineTo(position.getRight(), position.getTop());
+            });
+
+            table.setWidthPercentage(100f);
+            table.addCell(p);
+        }
+        doc.add(table);
+
+        // --------------产品名称-------------------------------
+        table = new PdfPTable(2);
+
+        for (int i = 0; i < 2; i++) {
+            setTable(bfHei, table, 40, pdfGoodsDto.getProductName());
+        }
+
+        doc.add(table);
+
+        Paragraph blankRow31 = new Paragraph(18f, " ", fontChinese11);
+        PdfPCell nextLine = new PdfPCell(blankRow31);
+        nextLine.setBorder(0);
+        nextLine.setCellEvent((cell,position,canvases)->{
+            PdfContentByte canvas = canvases[PdfPTable.LINECANVAS];
+            cellRight(position, canvas);
+        });
+        doc.add(nextLine);
+
+
+
+        // --------------产品英文名称-------------------------------
+        table = new PdfPTable(2);
+
+        for (int i = 0; i < 2; i++) {
+            setTable(bfHei, table, 20, pdfGoodsDto.getEnglishName());
+        }
+        doc.add(table);
+
+
+        table = new PdfPTable(2);
+
+        for (int i = 0; i < 2; i++) {
+            PdfPTable pdfPTable4 = new PdfPTable(2);
+            pdfPTable4.setWidths(new int[]{10,6});
+
+
+
+            // --------------大价格-------------------------------
+            Font font = new Font(bfHei, 66);
+            Paragraph bigPrice = new Paragraph("¥"+pdfGoodsDto.getPrice().substring(0,pdfGoodsDto.getPrice().indexOf(".")), font);
+            PdfPCell priceCell = new PdfPCell(bigPrice);
+            setBasisStyle(priceCell, Element.ALIGN_RIGHT, Element.ALIGN_CENTER);
+            pdfPTable4.addCell(priceCell);
+
+            // --------------小价格-------------------------------
+            font = new Font(bfHei, 44);
+            Paragraph smallPrice = new Paragraph(pdfGoodsDto.getPrice().substring(pdfGoodsDto.getPrice().indexOf(".")), font);
+            PdfPCell smallPriceCell = new PdfPCell(smallPrice);
+            setBasisStyle(smallPriceCell, Element.ALIGN_LEFT, Element.ALIGN_CENTER);
+            pdfPTable4.addCell(smallPriceCell);
+
+            PdfPCell p = new PdfPCell(pdfPTable4);
+            p.setBorder(0);
+            p.setCellEvent((cell,position,canvases)->{
+                PdfContentByte canvas = canvases[PdfPTable.LINECANVAS];
+                cellRight(position, canvas);
+            });
+            table.setWidthPercentage(100f);
+            table.addCell(p);
+        }
+
+
+        doc.add(table);
+
+        // --------------空格--------------
+
+        doc.add(nextLine);
+
+        // --------------底部1-------------------------------
+        table = new PdfPTable(2);
+
+        for (int i = 0; i < 2; i++) {
+            setTable(bfHei, table, 20, "比建议零售价省¥"+pdfGoodsDto.getSavings());
+        }
+
+        doc.add(table);
+
+
+        // --------------底部2-------------------------------
+        table = new PdfPTable(2);
+        for (int i = 0; i < 2; i++) {
+            setTable(bfHei, table, 16, "税率:"+pdfGoodsDto.getStartFax());
+        }
+        doc.add(table);
+
+        table = new PdfPTable(2);
+        for (int i = 0; i < 2; i++) {
+            // --------------底部左边PLU-------------------------------
+            PdfPTable pdfPTable7 = new PdfPTable(2);
+            Font font = new Font(bfHei, 12);
+            Paragraph PLU = new Paragraph(pdfGoodsDto.getPlu(), font);
+            PdfPCell pluCell = new PdfPCell(PLU);
+            setBasisStyle(pluCell, Element.ALIGN_LEFT, Element.ALIGN_MIDDLE);
+            pluCell.setPaddingLeft(20);
+            // --------------底部右边条形码-------------------------------
+            Paragraph barCode = new Paragraph(pdfGoodsDto.getBarCode(), font);
+            PdfPCell barCodeCell = new PdfPCell(barCode);
+            setBasisStyle(barCodeCell, Element.ALIGN_RIGHT, Element.ALIGN_MIDDLE);
+            barCodeCell.setPaddingRight(20);
+            pdfPTable7.addCell(pluCell);
+            pdfPTable7.addCell(barCodeCell);
+            PdfPCell p = new PdfPCell(pdfPTable7);
+            p.setBorder(0);
+            p.setCellEvent((cell,position,canvases)->{
+                PdfContentByte canvas = canvases[PdfPTable.LINECANVAS];
+                cellRight(position, canvas);
+            });
+            table.setWidthPercentage(100f);
+            table.addCell(p);
+        }
+        doc.add(table);
+
+        doc.add(nextLine);
+
+    }
+
+    // 绘制右边边框虚线
+    private static void cellRight(Rectangle position, PdfContentByte canvas) {
+        canvas.saveState();
+        canvas.setLineWidth(0.5f);
+        canvas.setLineDash(new float[]{5.0f, 5.0f}, 0);
+        canvas.moveTo(position.getRight(), position.getTop());
+        canvas.lineTo(position.getRight(), position.getBottom());
+        canvas.stroke();
+    }
+
+    // 去除边框,设置水平垂直居中
+    private static void setBasisStyle(PdfPCell pluCell, int alignLeft, int alignMiddle) {
+        pluCell.setBorder(0);
+        pluCell.setHorizontalAlignment(alignLeft); // 水平居中
+        pluCell.setVerticalAlignment(alignMiddle); // 垂直居中
+    }
+
+    private static void setTable(BaseFont bfHei, PdfPTable table, int i2, String s) {
+        Font font = new Font(bfHei, i2); // 设置字体
+        PdfPTable pdfPTable3 = new PdfPTable(1);
+        Paragraph pararaph = new Paragraph(s, font); // 段落
+        PdfPCell nameCell = new PdfPCell(pararaph); // 单元Cell
+        setBasisStyle(nameCell, Element.ALIGN_CENTER, Element.ALIGN_MIDDLE);
+        pdfPTable3.addCell(nameCell);
+
+        // 创建PCell来存储PTable,用来去除边框
+        PdfPCell p = new PdfPCell(pdfPTable3);
+        p.setBorder(0);
+        // 设置虚线边框
+        p.setCellEvent((cell, position, canvases) -> {
+            PdfContentByte canvas = canvases[PdfPTable.LINECANVAS];
+            cellRight(position, canvas);
+        });
+        // 填充满
+        table.setWidthPercentage(100f);
+        table.addCell(p);
+    }
+
+
+}

+ 233 - 0
kmall-admin/src/main/java/com/kmall/admin/utils/pdf/type/PDFWrite_36.java

@@ -0,0 +1,233 @@
+package com.kmall.admin.utils.pdf.type;
+
+import com.kmall.api.entity.exportpdf.PDFGoodsDto;
+import com.lowagie.text.*;
+import com.lowagie.text.pdf.*;
+
+import java.io.FileOutputStream;
+import java.io.IOException;
+
+/**
+ * @author zhangchuangbiao
+ * @version 1.0
+ * 2020-09-11 09:51
+ */
+public class PDFWrite_36 {
+
+
+    public void write(Document doc, PdfWriter writer, PDFGoodsDto pdfGoodsDto
+            , String fontUrl, String uploadDir, String headUrl) throws IOException, DocumentException {
+
+        // 设置字体
+        BaseFont bfHei = BaseFont.createFont(fontUrl,BaseFont.IDENTITY_H,BaseFont.NOT_EMBEDDED);
+        Font FontChinese11 = new Font(bfHei, 11);
+
+        String path = uploadDir;
+        FileOutputStream out = new FileOutputStream(path);
+
+        doc.setMargins(0,0,0,0);
+
+        writer.setPdfVersion(PdfWriter.PDF_VERSION_1_2);//版本(默认1.4)
+        doc.open();// 打开文档
+
+        // -----------------------标签头----------------------
+        getPdfPTable(FontChinese11, bfHei, doc,pdfGoodsDto,headUrl);
+        getPdfPTable(FontChinese11, bfHei, doc,pdfGoodsDto,headUrl);
+        getPdfPTable(FontChinese11, bfHei, doc,pdfGoodsDto,headUrl);
+        getPdfPTable(FontChinese11, bfHei, doc,pdfGoodsDto,headUrl);
+        getPdfPTable(FontChinese11, bfHei, doc,pdfGoodsDto,headUrl);
+        getPdfPTable(FontChinese11, bfHei, doc,pdfGoodsDto,headUrl);
+
+
+        doc.close();  //记得关闭document
+
+    }
+
+    private static void getPdfPTable(Font fontChinese11, BaseFont bfHei, Document doc, PDFGoodsDto pdfGoodsDto,String headUrl) throws IOException, DocumentException {
+        PdfPTable table = new PdfPTable(3);
+        table = new PdfPTable(6);
+
+        for (int i = 0; i < 6; i++) {
+            Image img = Image.getInstance(headUrl);
+            img.setAlignment(Image.ALIGN_CENTER);  //设置图片居中
+
+            PdfPCell p = new PdfPCell(img,true);
+            p.setPaddingLeft(2);
+            p.setPaddingRight(2);
+            p.setPaddingTop(2);
+            p.setBorder(0);
+            p.setCellEvent((cell,position,canvases)->{
+                PdfContentByte canvas = canvases[PdfPTable.LINECANVAS];
+                cellRight(position, canvas);
+                canvas.moveTo(position.getLeft(), position.getTop());
+                canvas.lineTo(position.getRight(), position.getTop());
+            });
+
+            table.setWidthPercentage(100f);
+            table.addCell(p);
+        }
+        doc.add(table);
+
+
+        // --------------产品名称-------------------------------
+        table = new PdfPTable(6);
+
+        for (int i = 0; i < 6; i++) {
+            setTable(bfHei, table, 11, pdfGoodsDto.getProductName());
+        }
+
+        doc.add(table);
+
+
+        Paragraph blankRow31 = new Paragraph(18f, " ", fontChinese11);
+        PdfPCell nextLine = new PdfPCell(blankRow31);
+        nextLine.setBorder(0);
+        nextLine.setCellEvent((cell,position,canvases)->{
+            PdfContentByte canvas = canvases[PdfPTable.LINECANVAS];
+            cellRight(position, canvas);
+        });
+//        doc.add(nextLine);
+
+
+
+        // --------------产品英文名称-------------------------------
+        table = new PdfPTable(6);
+
+        for (int i = 0; i < 6; i++) {
+            setTable(bfHei, table, 7, pdfGoodsDto.getEnglishName());
+        }
+        doc.add(table);
+
+
+
+        table = new PdfPTable(6);
+
+        for (int i = 0; i < 6; i++) {
+            PdfPTable pdfPTable4 = new PdfPTable(2);
+            pdfPTable4.setWidths(new int[]{10,6});
+
+
+
+            // --------------大价格-------------------------------
+            Font font = new Font(bfHei, 20);
+            Paragraph bigPrice = new Paragraph("¥"+pdfGoodsDto.getPrice().substring(0,pdfGoodsDto.getPrice().indexOf(".")), font);
+            PdfPCell priceCell = new PdfPCell(bigPrice);
+            setBasisStyle(priceCell, Element.ALIGN_RIGHT, Element.ALIGN_CENTER);
+            pdfPTable4.addCell(priceCell);
+
+            // --------------小价格-------------------------------
+            font = new Font(bfHei, 14);
+            Paragraph smallPrice = new Paragraph(pdfGoodsDto.getPrice().substring(pdfGoodsDto.getPrice().indexOf(".")), font);
+            PdfPCell smallPriceCell = new PdfPCell(smallPrice);
+            setBasisStyle(smallPriceCell, Element.ALIGN_LEFT, Element.ALIGN_CENTER);
+            pdfPTable4.addCell(smallPriceCell);
+
+            PdfPCell p = new PdfPCell(pdfPTable4);
+            p.setBorder(0);
+            p.setCellEvent((cell,position,canvases)->{
+                PdfContentByte canvas = canvases[PdfPTable.LINECANVAS];
+                cellRight(position, canvas);
+            });
+            table.setWidthPercentage(100f);
+            table.addCell(p);
+        }
+
+
+        doc.add(table);
+
+
+        // --------------空格--------------
+
+//        doc.add(nextLine);
+
+        // --------------底部1-------------------------------
+        table = new PdfPTable(6);
+
+        for (int i = 0; i < 6; i++) {
+            setTable(bfHei, table, 8, "比建议零售价省¥"+pdfGoodsDto.getSavings());
+        }
+
+        doc.add(table);
+
+
+
+        // --------------底部2-------------------------------
+        table = new PdfPTable(6);
+        for (int i = 0; i < 6; i++) {
+            setTable(bfHei, table, 6, "税率:"+pdfGoodsDto.getStartFax());
+        }
+        doc.add(table);
+
+
+        table = new PdfPTable(6);
+        for (int i = 0; i < 6; i++) {
+            // --------------底部左边PLU-------------------------------
+            PdfPTable pdfPTable7 = new PdfPTable(2);
+            Font font = new Font(bfHei, 5);
+            Paragraph PLU = new Paragraph(pdfGoodsDto.getPlu(), font);
+            PdfPCell pluCell = new PdfPCell(PLU);
+            setBasisStyle(pluCell, Element.ALIGN_LEFT, Element.ALIGN_MIDDLE);
+            pluCell.setPaddingLeft(10);
+            // --------------底部右边条形码-------------------------------
+            Paragraph barCode = new Paragraph(pdfGoodsDto.getBarCode(), font);
+            PdfPCell barCodeCell = new PdfPCell(barCode);
+            setBasisStyle(barCodeCell, Element.ALIGN_RIGHT, Element.ALIGN_MIDDLE);
+            barCodeCell.setPaddingRight(10);
+            pdfPTable7.addCell(pluCell);
+            pdfPTable7.addCell(barCodeCell);
+            PdfPCell p = new PdfPCell(pdfPTable7);
+            p.setBorder(0);
+            p.setCellEvent((cell,position,canvases)->{
+                PdfContentByte canvas = canvases[PdfPTable.LINECANVAS];
+                cellRight(position, canvas);
+            });
+            table.setWidthPercentage(100f);
+            table.addCell(p);
+        }
+        doc.add(table);
+
+
+//        doc.add(nextLine);
+
+    }
+
+    // 绘制右边边框虚线
+    private static void cellRight(Rectangle position, PdfContentByte canvas) {
+        canvas.saveState();
+        canvas.setLineWidth(0.5f);
+        canvas.setLineDash(new float[]{5.0f, 5.0f}, 0);
+        canvas.moveTo(position.getRight(), position.getTop());
+        canvas.lineTo(position.getRight(), position.getBottom());
+        canvas.stroke();
+    }
+
+    // 去除边框,设置水平垂直居中
+    private static void setBasisStyle(PdfPCell pluCell, int alignLeft, int alignMiddle) {
+        pluCell.setBorder(0);
+        pluCell.setHorizontalAlignment(alignLeft); // 水平居中
+        pluCell.setVerticalAlignment(alignMiddle); // 垂直居中
+    }
+
+    private static void setTable(BaseFont bfHei, PdfPTable table, int i2, String s) {
+        Font font = new Font(bfHei, i2); // 设置字体
+        PdfPTable pdfPTable3 = new PdfPTable(1);
+        Paragraph pararaph = new Paragraph(s, font); // 段落
+        PdfPCell nameCell = new PdfPCell(pararaph); // 单元Cell
+        setBasisStyle(nameCell, Element.ALIGN_CENTER, Element.ALIGN_MIDDLE);
+        pdfPTable3.addCell(nameCell);
+
+        // 创建PCell来存储PTable,用来去除边框
+        PdfPCell p = new PdfPCell(pdfPTable3);
+        p.setBorder(0);
+        // 设置虚线边框
+        p.setCellEvent((cell, position, canvases) -> {
+            PdfContentByte canvas = canvases[PdfPTable.LINECANVAS];
+            cellRight(position, canvas);
+        });
+        // 填充满
+        table.setWidthPercentage(100f);
+        table.addCell(p);
+    }
+
+
+}

+ 218 - 0
kmall-admin/src/main/java/com/kmall/admin/utils/pdf/type/PDFWrite_4.java

@@ -0,0 +1,218 @@
+package com.kmall.admin.utils.pdf.type;
+
+import com.kmall.api.entity.exportpdf.PDFGoodsDto;
+import com.lowagie.text.*;
+import com.lowagie.text.pdf.*;
+
+import java.io.FileOutputStream;
+import java.io.IOException;
+/**
+ * @author zhangchuangbiao
+ * @version 1.0
+ * 2020-09-11 09:51
+ */
+public class PDFWrite_4 {
+
+
+    public void write(Document doc, PdfWriter writer, PDFGoodsDto pdfGoodsDto
+            , String fontUrl, String uploadDir, String headUrl) throws IOException, DocumentException {
+        // 设置字体
+        BaseFont bfHei = BaseFont.createFont(fontUrl,BaseFont.IDENTITY_H,BaseFont.NOT_EMBEDDED);
+        Font FontChinese11 = new Font(bfHei, 11);
+
+        String path = uploadDir;
+        FileOutputStream out = new FileOutputStream(path);
+
+        doc.setMargins(0,0,0,0);
+
+        writer.setPdfVersion(PdfWriter.PDF_VERSION_1_2);//版本(默认1.4)
+        doc.open();// 打开文档
+        // -----------------------标签头----------------------
+//        PdfPTable table = getPdfPTable(FontChinese11, bfHei, doc);
+        getPdfPTable(FontChinese11, bfHei, doc,pdfGoodsDto,headUrl);
+        getPdfPTable(FontChinese11, bfHei, doc,pdfGoodsDto,headUrl);
+
+        doc.close();  //记得关闭document
+
+    }
+
+    private static void getPdfPTable(Font fontChinese11, BaseFont bfHei, Document doc, PDFGoodsDto pdfGoodsDto,String headUrl) throws IOException, DocumentException {
+        PdfPTable table = new PdfPTable(2);
+
+        for (int i = 0; i < 2; i++) {
+            Image img = Image.getInstance(headUrl);
+            img.setAlignment(Image.ALIGN_CENTER);  //设置图片居中
+
+            PdfPCell p = new PdfPCell(img,true);
+            p.setPaddingLeft(2);
+            p.setPaddingRight(2);
+            p.setPaddingTop(2);
+            p.setBorder(0);
+            p.setCellEvent((cell,position,canvases)->{
+                PdfContentByte canvas = canvases[PdfPTable.LINECANVAS];
+                cellRight(position, canvas);
+                canvas.moveTo(position.getLeft(), position.getTop());
+                canvas.lineTo(position.getRight(), position.getTop());
+            });
+
+            table.setWidthPercentage(100f);
+            table.addCell(p);
+        }
+        doc.add(table);
+
+        // --------------产品名称-------------------------------
+        table = new PdfPTable(2);
+
+        for (int i = 0; i < 2; i++) {
+            setTable(bfHei, table, 40, pdfGoodsDto.getProductName());
+        }
+
+        doc.add(table);
+
+        Paragraph blankRow31 = new Paragraph(18f, " ", fontChinese11);
+        PdfPCell nextLine = new PdfPCell(blankRow31);
+        nextLine.setBorder(0);
+        nextLine.setCellEvent((cell,position,canvases)->{
+            PdfContentByte canvas = canvases[PdfPTable.LINECANVAS];
+            cellRight(position, canvas);
+        });
+        doc.add(nextLine);
+
+
+
+        // --------------产品英文名称-------------------------------
+        table = new PdfPTable(2);
+
+        for (int i = 0; i < 2; i++) {
+            setTable(bfHei, table, 20, pdfGoodsDto.getEnglishName());
+        }
+        doc.add(table);
+
+
+        table = new PdfPTable(2);
+
+        for (int i = 0; i < 2; i++) {
+            PdfPTable pdfPTable4 = new PdfPTable(2);
+            pdfPTable4.setWidths(new int[]{10,6});
+
+
+
+            // --------------大价格-------------------------------
+            Font font = new Font(bfHei, 66);
+            Paragraph bigPrice = new Paragraph("¥"+pdfGoodsDto.getPrice().substring(0,pdfGoodsDto.getPrice().indexOf(".")), font);
+            PdfPCell priceCell = new PdfPCell(bigPrice);
+            setBasisStyle(priceCell, Element.ALIGN_RIGHT, Element.ALIGN_CENTER);
+            pdfPTable4.addCell(priceCell);
+
+            // --------------小价格-------------------------------
+            font = new Font(bfHei, 44);
+            Paragraph smallPrice = new Paragraph(pdfGoodsDto.getPrice().substring(pdfGoodsDto.getPrice().indexOf(".")), font);
+            PdfPCell smallPriceCell = new PdfPCell(smallPrice);
+            setBasisStyle(smallPriceCell, Element.ALIGN_LEFT, Element.ALIGN_CENTER);
+            pdfPTable4.addCell(smallPriceCell);
+
+            PdfPCell p = new PdfPCell(pdfPTable4);
+            p.setBorder(0);
+            p.setCellEvent((cell,position,canvases)->{
+                PdfContentByte canvas = canvases[PdfPTable.LINECANVAS];
+                cellRight(position, canvas);
+            });
+            table.setWidthPercentage(100f);
+            table.addCell(p);
+        }
+
+
+        doc.add(table);
+
+        // --------------空格--------------
+
+        doc.add(nextLine);
+
+        // --------------底部1-------------------------------
+        table = new PdfPTable(2);
+
+        for (int i = 0; i < 2; i++) {
+            setTable(bfHei, table, 20, "比建议零售价省¥"+pdfGoodsDto.getSavings());
+        }
+
+        doc.add(table);
+
+
+        // --------------底部2-------------------------------
+        table = new PdfPTable(2);
+        for (int i = 0; i < 2; i++) {
+            setTable(bfHei, table, 16, "税率:"+pdfGoodsDto.getStartFax());
+        }
+        doc.add(table);
+
+        table = new PdfPTable(2);
+        for (int i = 0; i < 2; i++) {
+            // --------------底部左边PLU-------------------------------
+            PdfPTable pdfPTable7 = new PdfPTable(2);
+            Font font = new Font(bfHei, 12);
+            Paragraph PLU = new Paragraph(pdfGoodsDto.getPlu(), font);
+            PdfPCell pluCell = new PdfPCell(PLU);
+            setBasisStyle(pluCell, Element.ALIGN_LEFT, Element.ALIGN_MIDDLE);
+            pluCell.setPaddingLeft(20);
+            // --------------底部右边条形码-------------------------------
+            Paragraph barCode = new Paragraph(pdfGoodsDto.getBarCode(), font);
+            PdfPCell barCodeCell = new PdfPCell(barCode);
+            setBasisStyle(barCodeCell, Element.ALIGN_RIGHT, Element.ALIGN_MIDDLE);
+            barCodeCell.setPaddingRight(20);
+            pdfPTable7.addCell(pluCell);
+            pdfPTable7.addCell(barCodeCell);
+            PdfPCell p = new PdfPCell(pdfPTable7);
+            p.setBorder(0);
+            p.setCellEvent((cell,position,canvases)->{
+                PdfContentByte canvas = canvases[PdfPTable.LINECANVAS];
+                cellRight(position, canvas);
+            });
+            table.setWidthPercentage(100f);
+            table.addCell(p);
+        }
+        doc.add(table);
+
+        doc.add(nextLine);
+
+    }
+
+    // 绘制右边边框虚线
+    private static void cellRight(Rectangle position, PdfContentByte canvas) {
+        canvas.saveState();
+        canvas.setLineWidth(0.5f);
+        canvas.setLineDash(new float[]{5.0f, 5.0f}, 0);
+        canvas.moveTo(position.getRight(), position.getTop());
+        canvas.lineTo(position.getRight(), position.getBottom());
+        canvas.stroke();
+    }
+
+    // 去除边框,设置水平垂直居中
+    private static void setBasisStyle(PdfPCell pluCell, int alignLeft, int alignMiddle) {
+        pluCell.setBorder(0);
+        pluCell.setHorizontalAlignment(alignLeft); // 水平居中
+        pluCell.setVerticalAlignment(alignMiddle); // 垂直居中
+    }
+
+    private static void setTable(BaseFont bfHei, PdfPTable table, int i2, String s) {
+        Font font = new Font(bfHei, i2); // 设置字体
+        PdfPTable pdfPTable3 = new PdfPTable(1);
+        Paragraph pararaph = new Paragraph(s, font); // 段落
+        PdfPCell nameCell = new PdfPCell(pararaph); // 单元Cell
+        setBasisStyle(nameCell, Element.ALIGN_CENTER, Element.ALIGN_MIDDLE);
+        pdfPTable3.addCell(nameCell);
+
+        // 创建PCell来存储PTable,用来去除边框
+        PdfPCell p = new PdfPCell(pdfPTable3);
+        p.setBorder(0);
+        // 设置虚线边框
+        p.setCellEvent((cell, position, canvases) -> {
+            PdfContentByte canvas = canvases[PdfPTable.LINECANVAS];
+            cellRight(position, canvas);
+        });
+        // 填充满
+        table.setWidthPercentage(100f);
+        table.addCell(p);
+    }
+
+
+}

+ 222 - 0
kmall-admin/src/main/java/com/kmall/admin/utils/pdf/type/PDFWrite_9.java

@@ -0,0 +1,222 @@
+package com.kmall.admin.utils.pdf.type;
+
+import com.kmall.api.entity.exportpdf.PDFGoodsDto;
+import com.lowagie.text.*;
+import com.lowagie.text.pdf.*;
+
+import java.io.FileOutputStream;
+import java.io.IOException;
+
+/**
+ * @author zhangchuangbiao
+ * @version 1.0
+ * 2020-09-11 09:51
+ */
+public class PDFWrite_9 {
+
+
+    public void write(Document doc, PdfWriter writer, PDFGoodsDto pdfGoodsDto
+            , String fontUrl, String uploadDir, String headUrl) throws IOException, DocumentException {
+        // 设置字体
+        BaseFont bfHei = BaseFont.createFont(fontUrl,BaseFont.IDENTITY_H,BaseFont.NOT_EMBEDDED);
+        Font FontChinese11 = new Font(bfHei, 11);
+
+        String path = uploadDir;
+        FileOutputStream out = new FileOutputStream(path);
+
+        doc.setMargins(0,0,0,0);
+
+        writer.setPdfVersion(PdfWriter.PDF_VERSION_1_2);//版本(默认1.4)
+        doc.open();// 打开文档
+        // -----------------------标签头----------------------
+//        PdfPTable table = getPdfPTable(FontChinese11, bfHei, doc);
+        getPdfPTable(FontChinese11, bfHei, doc,pdfGoodsDto,headUrl);
+        getPdfPTable(FontChinese11, bfHei, doc,pdfGoodsDto,headUrl);
+        getPdfPTable(FontChinese11, bfHei, doc,pdfGoodsDto,headUrl);
+
+
+        doc.close();  //记得关闭document
+
+    }
+
+    private static void getPdfPTable(Font fontChinese11, BaseFont bfHei, Document doc, PDFGoodsDto pdfGoodsDto,String headUrl) throws IOException, DocumentException {
+        PdfPTable table = new PdfPTable(3);
+        table = new PdfPTable(3);
+
+        for (int i = 0; i < 3; i++) {
+            Image img = Image.getInstance(headUrl);
+            img.setAlignment(Image.ALIGN_CENTER);  //设置图片居中
+
+            PdfPCell p = new PdfPCell(img,true);
+            p.setPaddingLeft(2);
+            p.setPaddingRight(2);
+            p.setPaddingTop(2);
+            p.setBorder(0);
+            p.setCellEvent((cell,position,canvases)->{
+                PdfContentByte canvas = canvases[PdfPTable.LINECANVAS];
+                cellRight(position, canvas);
+                canvas.moveTo(position.getLeft(), position.getTop());
+                canvas.lineTo(position.getRight(), position.getTop());
+            });
+
+            table.setWidthPercentage(100f);
+            table.addCell(p);
+        }
+        doc.add(table);
+
+        // --------------产品名称-------------------------------
+        table = new PdfPTable(3);
+
+        for (int i = 0; i < 3; i++) {
+            setTable(bfHei, table, 22, pdfGoodsDto.getProductName());
+        }
+
+        doc.add(table);
+
+        Paragraph blankRow31 = new Paragraph(18f, " ", fontChinese11);
+        PdfPCell nextLine = new PdfPCell(blankRow31);
+        nextLine.setBorder(0);
+        nextLine.setCellEvent((cell,position,canvases)->{
+            PdfContentByte canvas = canvases[PdfPTable.LINECANVAS];
+            cellRight(position, canvas);
+        });
+        doc.add(nextLine);
+
+
+
+        // --------------产品英文名称-------------------------------
+        table = new PdfPTable(3);
+
+        for (int i = 0; i < 3; i++) {
+            setTable(bfHei, table, 14, pdfGoodsDto.getEnglishName());
+        }
+        doc.add(table);
+
+
+        table = new PdfPTable(3);
+
+        for (int i = 0; i < 3; i++) {
+            PdfPTable pdfPTable4 = new PdfPTable(2);
+            pdfPTable4.setWidths(new int[]{10,6});
+
+
+
+            // --------------大价格-------------------------------
+            Font font = new Font(bfHei, 54);
+            Paragraph bigPrice = new Paragraph("¥"+pdfGoodsDto.getPrice().substring(0,pdfGoodsDto.getPrice().indexOf(".")), font);
+            PdfPCell priceCell = new PdfPCell(bigPrice);
+            setBasisStyle(priceCell, Element.ALIGN_RIGHT, Element.ALIGN_CENTER);
+            pdfPTable4.addCell(priceCell);
+
+            // --------------小价格-------------------------------
+            font = new Font(bfHei, 40);
+            Paragraph smallPrice = new Paragraph(pdfGoodsDto.getPrice().substring(pdfGoodsDto.getPrice().indexOf(".")), font);
+            PdfPCell smallPriceCell = new PdfPCell(smallPrice);
+            setBasisStyle(smallPriceCell, Element.ALIGN_LEFT, Element.ALIGN_CENTER);
+            pdfPTable4.addCell(smallPriceCell);
+
+            PdfPCell p = new PdfPCell(pdfPTable4);
+            p.setBorder(0);
+            p.setCellEvent((cell,position,canvases)->{
+                PdfContentByte canvas = canvases[PdfPTable.LINECANVAS];
+                cellRight(position, canvas);
+            });
+            table.setWidthPercentage(100f);
+            table.addCell(p);
+        }
+
+
+        doc.add(table);
+
+        // --------------空格--------------
+        doc.add(nextLine);
+
+        // --------------底部1-------------------------------
+        table = new PdfPTable(3);
+
+        for (int i = 0; i < 3; i++) {
+            setTable(bfHei, table, 16, "比建议零售价省¥"+pdfGoodsDto.getSavings());
+        }
+
+        doc.add(table);
+
+
+        // --------------底部2-------------------------------
+        table = new PdfPTable(3);
+        for (int i = 0; i < 3; i++) {
+            setTable(bfHei, table, 10, "税率:"+pdfGoodsDto.getStartFax());
+        }
+        doc.add(table);
+
+        table = new PdfPTable(3);
+        for (int i = 0; i < 3; i++) {
+            // --------------底部左边PLU-------------------------------
+            PdfPTable pdfPTable7 = new PdfPTable(2);
+            Font font = new Font(bfHei, 9);
+            Paragraph PLU = new Paragraph(pdfGoodsDto.getPlu(), font);
+            PdfPCell pluCell = new PdfPCell(PLU);
+            setBasisStyle(pluCell, Element.ALIGN_LEFT, Element.ALIGN_MIDDLE);
+            pluCell.setPaddingLeft(20);
+            // --------------底部右边条形码-------------------------------
+            Paragraph barCode = new Paragraph(pdfGoodsDto.getBarCode(), font);
+            PdfPCell barCodeCell = new PdfPCell(barCode);
+            setBasisStyle(barCodeCell, Element.ALIGN_RIGHT, Element.ALIGN_MIDDLE);
+            barCodeCell.setPaddingRight(20);
+            pdfPTable7.addCell(pluCell);
+            pdfPTable7.addCell(barCodeCell);
+            PdfPCell p = new PdfPCell(pdfPTable7);
+            p.setBorder(0);
+            p.setCellEvent((cell,position,canvases)->{
+                PdfContentByte canvas = canvases[PdfPTable.LINECANVAS];
+                cellRight(position, canvas);
+            });
+            table.setWidthPercentage(100f);
+            table.addCell(p);
+        }
+        doc.add(table);
+        doc.add(nextLine);
+        doc.add(nextLine);
+        doc.add(nextLine);
+
+    }
+
+    // 绘制右边边框虚线
+    private static void cellRight(Rectangle position, PdfContentByte canvas) {
+        canvas.saveState();
+        canvas.setLineWidth(0.5f);
+        canvas.setLineDash(new float[]{5.0f, 5.0f}, 0);
+        canvas.moveTo(position.getRight(), position.getTop());
+        canvas.lineTo(position.getRight(), position.getBottom());
+        canvas.stroke();
+    }
+
+    // 去除边框,设置水平垂直居中
+    private static void setBasisStyle(PdfPCell pluCell, int alignLeft, int alignMiddle) {
+        pluCell.setBorder(0);
+        pluCell.setHorizontalAlignment(alignLeft); // 水平居中
+        pluCell.setVerticalAlignment(alignMiddle); // 垂直居中
+    }
+
+    private static void setTable(BaseFont bfHei, PdfPTable table, int i2, String s) {
+        Font font = new Font(bfHei, i2); // 设置字体
+        PdfPTable pdfPTable3 = new PdfPTable(1);
+        Paragraph pararaph = new Paragraph(s, font); // 段落
+        PdfPCell nameCell = new PdfPCell(pararaph); // 单元Cell
+        setBasisStyle(nameCell, Element.ALIGN_CENTER, Element.ALIGN_MIDDLE);
+        pdfPTable3.addCell(nameCell);
+
+        // 创建PCell来存储PTable,用来去除边框
+        PdfPCell p = new PdfPCell(pdfPTable3);
+        p.setBorder(0);
+        // 设置虚线边框
+        p.setCellEvent((cell, position, canvases) -> {
+            PdfContentByte canvas = canvases[PdfPTable.LINECANVAS];
+            cellRight(position, canvas);
+        });
+        // 填充满
+        table.setWidthPercentage(100f);
+        table.addCell(p);
+    }
+
+
+}

+ 188 - 0
kmall-admin/src/main/java/com/kmall/admin/utils/pdf/type/PDFWrite_nohead_36.java

@@ -0,0 +1,188 @@
+package com.kmall.admin.utils.pdf.type;
+
+import com.kmall.admin.utils.pdf.BarcodeUtil;
+import com.kmall.api.entity.exportpdf.PDFGoodsDto;
+import com.kmall.common.fileserver.util.FileManager;
+import com.lowagie.text.*;
+import com.lowagie.text.Font;
+import com.lowagie.text.Image;
+import com.lowagie.text.pdf.*;
+
+import java.awt.*;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.util.UUID;
+
+/**
+ * @author zhangchuangbiao
+ * @version 1.0
+ * 2020-09-11 09:51
+ */
+public class PDFWrite_nohead_36 {
+
+
+    public void write(Document doc, PdfWriter writer, PDFGoodsDto pdfGoodsDto
+            , String fontUrl, String uploadDir) throws IOException, DocumentException {
+
+        // 设置字体
+        BaseFont bfHei = BaseFont.createFont(fontUrl,BaseFont.IDENTITY_H,BaseFont.NOT_EMBEDDED);
+        Font FontChinese11 = new Font(bfHei, 11);
+
+        String path = uploadDir;
+        FileOutputStream out = new FileOutputStream(path);
+
+
+        writer.setPdfVersion(PdfWriter.PDF_VERSION_1_2);//版本(默认1.4)
+        doc.open();// 打开文档
+        doc.setMargins(0,0,0,0);
+
+        // -----------------------标签头----------------------
+        for (int i = 0; i < 9; i++) {
+            getPdfPTable(FontChinese11, bfHei, doc,pdfGoodsDto);
+        }
+
+        doc.close();  //记得关闭document
+
+    }
+
+    private static void getPdfPTable(Font fontChinese11, BaseFont bfHei, Document doc, PDFGoodsDto pdfGoodsDto) throws IOException, DocumentException {
+        PdfPTable table = new PdfPTable(4);
+
+        // --------------产品名称-------------------------------
+        table = new PdfPTable(4);
+
+        for (int i = 0; i < 4; i++) {
+            setTable(bfHei, table, 10, pdfGoodsDto.getProductName());
+        }
+
+        doc.add(table);
+
+
+
+        // --------------产品英文名称-------------------------------
+        table = new PdfPTable(4);
+
+        for (int i = 0; i < 4; i++) {
+            setTable(bfHei, table, 7, pdfGoodsDto.getEnglishName());
+        }
+        doc.add(table);
+
+
+
+        table = new PdfPTable(4);
+
+        for (int i = 0; i < 4; i++) {
+           PdfPTable pdfPTable4 = new PdfPTable(1);
+            Font font = new Font(bfHei, 20);
+            Paragraph bigPrice = new Paragraph("¥"+pdfGoodsDto.getPrice().substring(0,pdfGoodsDto.getPrice().indexOf(".")), font);
+            bigPrice.setAlignment(Element.ALIGN_BOTTOM);
+            // --------------小价格-------------------------------
+            font = new Font(bfHei, 10);
+            Paragraph smallPrice = new Paragraph(pdfGoodsDto.getPrice().substring(pdfGoodsDto.getPrice().indexOf(".")), font);
+            smallPrice.setAlignment(Element.ALIGN_BOTTOM);
+            smallPrice.setIndentationLeft(50);
+            bigPrice.add(smallPrice);
+
+
+
+            PdfPCell priceCell = new PdfPCell(bigPrice);
+            priceCell.setBorder(0);
+            priceCell.setHorizontalAlignment(Element.ALIGN_LEFT); // 水平居中
+            priceCell.setVerticalAlignment(Element.ALIGN_BOTTOM); // 垂直居中
+            pdfPTable4.addCell(priceCell);
+
+
+            // ----------------test-----------------------
+            PdfPTable pdfPTable8 = new PdfPTable(2);
+            pdfPTable8.setWidths(new int[]{10,8});
+            font = new Font(bfHei, 6);
+            // --------------左上的字-------------------------------
+            Paragraph leftParagraph1 = new Paragraph("\n建议零售价省¥"+pdfGoodsDto.getSavings()+"\n\n", font);
+            font = new Font(bfHei, 4.5f);
+            Paragraph leftParagraph2 = new Paragraph("税率:"+pdfGoodsDto.getStartFax()+"\n", font);
+            leftParagraph1.add(leftParagraph2);
+            PdfPCell leftCell1 = new PdfPCell(leftParagraph1);
+            leftCell1.setBorder(0);
+            leftCell1.setHorizontalAlignment(Element.ALIGN_LEFT); // 水平居中
+            leftCell1.setVerticalAlignment(Element.ALIGN_MIDDLE); // 垂直居中
+            pdfPTable8.addCell(leftCell1);
+            pdfPTable8.addCell(priceCell);
+
+            PdfPCell p = new PdfPCell(pdfPTable8);
+            p.setBorder(0);
+            table.setWidthPercentage(110f);
+            table.addCell(p);
+        }
+
+
+        doc.add(table);
+        String dtoBarCode = pdfGoodsDto.getBarCode();
+        table = new PdfPTable(4);
+        byte[] bytes = BarcodeUtil.generateBarCode128(dtoBarCode, 9.0d, 1.28d, false, true);
+        String uploadUrl = FileManager.upload(dtoBarCode + UUID.randomUUID().toString(), bytes, String.valueOf(bytes.length));
+        for (int i = 0; i < 4; i++) {
+            // --------------底部黑色和条形码区域-------------------------------
+            PdfPTable pdfPTable7 = new PdfPTable(2);
+            Font font = new Font(bfHei, 5.5f);
+            font.setColor(Color.WHITE);
+            Paragraph PLU = new Paragraph(pdfGoodsDto.getPlu(), font);
+            Paragraph blankParagraph = new Paragraph("                        ", font);
+            Paragraph barCode = new Paragraph(dtoBarCode.substring(dtoBarCode.length()-4), font);
+            blankParagraph.add(barCode);
+            PLU.add(blankParagraph);
+            PLU.setAlignment(Element.ALIGN_CENTER);
+
+            PdfPCell pluCell = new PdfPCell(PLU);
+            pluCell.setBackgroundColor(Color.BLACK);
+            pluCell.setBorder(0);
+            pluCell.setFixedHeight(10.5f);
+            pluCell.setHorizontalAlignment(Element.ALIGN_LEFT); // 水平居中
+            pluCell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 垂直居中
+            // -------------条形码图片
+
+            Image img = Image.getInstance(uploadUrl);
+            img.setAlignment(Image.ALIGN_CENTER);  //设置图片居中
+            img.setBorder(Image.NO_BORDER);
+            img.setBorderColor(Color.WHITE);
+            img.scaleAbsolute(72,10.5f);
+            PdfPCell imgCell = new PdfPCell(img,false);
+            imgCell.setBorder(0);
+            pdfPTable7.addCell(pluCell);
+            pdfPTable7.addCell(imgCell);
+            PdfPCell p = new PdfPCell(pdfPTable7);
+            p.setBorder(0);
+            table.setWidthPercentage(110f);
+            table.addCell(p);
+        }
+        doc.add(table);
+        table = new PdfPTable(1);
+        Paragraph blankRow = new Paragraph("\n");
+        PdfPCell nextLine = new PdfPCell(blankRow);
+        nextLine.setBorder(0);
+        nextLine.setFixedHeight(8.5f);
+        table.addCell(nextLine);
+        doc.add(table);
+
+
+
+    }
+
+
+    // 去除边框,设置水平垂直居中
+    private static void setBasisStyle(PdfPCell pluCell, int alignLeft, int alignMiddle) {
+        pluCell.setBorder(0);
+        pluCell.setHorizontalAlignment(alignLeft); // 水平居中
+        pluCell.setVerticalAlignment(alignMiddle); // 垂直居中
+    }
+
+    private static void setTable(BaseFont bfHei, PdfPTable table, int i2, String s) {
+        Font font = new Font(bfHei, i2); // 设置字体
+        Paragraph paragraph = new Paragraph(s, font); // 段落
+        PdfPCell nameCell = new PdfPCell(paragraph); // 单元Cell
+        setBasisStyle(nameCell, Element.ALIGN_CENTER, Element.ALIGN_MIDDLE);
+        table.setWidthPercentage(110f);
+        table.addCell(nameCell);
+    }
+
+
+}

+ 29 - 0
kmall-admin/src/main/resources/mybatis/mapper/GoodsDao.xml

@@ -686,4 +686,33 @@
         </if>
 
     </select>
+
+    <select id="queryForPDFData" resultType="com.kmall.api.entity.exportpdf.PDFGoodsDto">
+        select
+            g.name as productName,
+            g.english_name as englishName,
+            rela.retail_price as price,
+            (rela.market_price - rela.retail_price ) as savings,
+            g.goods_rate as startFax,
+            g.goods_rate as endFax,
+            g.plu as plu,
+            g.prod_barcode as barCode
+        from
+            mall_goods g
+        left join mall_product_store_rela rela on g.id = rela.goods_id
+        <where>
+            <if test="sku != null and storeId != ''">
+               and g.sku = #{sku}
+            </if>
+            <if test="prodBarcode != null and prodBarcode != ''">
+                and g.prod_barcode = #{prodBarcode}
+            </if>
+            <if test="storeId != null and storeId != ''">
+               and rela.store_id = #{storeId}
+            </if>
+        </where>
+
+
+    </select>
+
 </mapper>

+ 143 - 0
kmall-admin/src/main/resources/mybatis/mapper/GoodsLabelHeadDao.xml

@@ -0,0 +1,143 @@
+<?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.GoodsLabelHeadDao">
+
+    <resultMap type="com.kmall.admin.entity.GoodsLabelHeadEntity" id="goodsLabelHeadMap">
+        <result property="id" column="id"/>
+        <result property="merchSn" column="merch_sn"/>
+        <result property="storeId" column="store_id"/>
+        <result property="labelHeadName" column="label_head_name"/>
+        <result property="labelHeadUrl" column="label_head_url"/>
+        <result property="sortOrder" column="sort_order"/>
+        <result property="isValid" column="is_valid"/>
+        <result property="createrSn" column="creater_sn"/>
+        <result property="createTime" column="create_time"/>
+        <result property="moderSn" column="moder_sn"/>
+        <result property="modTime" column="mod_time"/>
+        <result property="tstm" column="tstm"/>
+    </resultMap>
+
+	<select id="queryObject" resultType="com.kmall.admin.entity.GoodsLabelHeadEntity">
+		select
+			`id`,
+			`merch_sn`,
+			`store_id`,
+			`label_head_name`,
+			`label_head_url`,
+			`sort_order`,
+			`is_valid`,
+			`creater_sn`,
+			`create_time`,
+			`moder_sn`,
+			`mod_time`,
+			`tstm`
+		from mall_goods_label_head
+		where id = #{id}
+	</select>
+
+	<select id="queryList" resultType="com.kmall.admin.entity.GoodsLabelHeadEntity">
+		select
+    		`id`,
+    		`merch_sn`,
+    		`store_id`,
+    		`label_head_name`,
+    		`label_head_url`,
+    		`sort_order`,
+    		`is_valid`,
+    		`creater_sn`,
+    		`create_time`,
+    		`moder_sn`,
+    		`mod_time`,
+    		`tstm`
+		from mall_goods_label_head
+		WHERE 1=1
+		and is_valid='0'
+		<if test="merchSn != null and merchSn.trim() != ''">
+			AND merch_sn=#{merchSn}
+		</if>
+		<if test="merchSn != null and merchSn.trim() != '' and storeId != null and storeId.trim() != ''">
+			AND store_id=#{storeId} AND store_id IS NULL AND merch_sn=#{merchSn}
+		</if>
+        <choose>
+            <when test="sidx != null and sidx.trim() != ''">
+                order by ${sidx} ${order}
+            </when>
+			<otherwise>
+                order by sort_order desc
+			</otherwise>
+        </choose>
+		<if test="offset != null and limit != null">
+			limit #{offset}, #{limit}
+		</if>
+	</select>
+	
+ 	<select id="queryTotal" resultType="int">
+		select count(*) from mall_goods_label_head
+		WHERE 1=1
+		and is_valid='0'
+		<if test="merchSn != null and merchSn.trim() != ''">
+			AND merch_sn=#{merchSn}
+		</if>
+		<if test="merchSn != null and merchSn.trim() != '' and storeId != null and storeId.trim() != ''">
+			AND store_id=#{storeId} AND store_id IS NULL AND merch_sn=#{merchSn}
+		</if>
+	</select>
+	 
+	<insert id="save" parameterType="com.kmall.admin.entity.GoodsLabelHeadEntity" useGeneratedKeys="true" keyProperty="id">
+		insert into mall_goods_label_head(
+			`merch_sn`,
+			`store_id`,
+			`label_head_name`,
+			`label_head_url`,
+			`sort_order`,
+			`is_valid`,
+			`creater_sn`,
+			`create_time`,
+			`moder_sn`,
+			`mod_time`,
+			`tstm`)
+		values(
+			#{merchSn},
+			#{storeId},
+			#{labelHeadName},
+			#{labelHeadUrl},
+			#{sortOrder},
+			#{isValid},
+			#{createrSn},
+			#{createTime},
+			#{moderSn},
+			#{modTime},
+			#{tstm})
+	</insert>
+	 
+	<update id="update" parameterType="com.kmall.admin.entity.GoodsLabelHeadEntity">
+		update mall_goods_label_head 
+		<set>
+			<if test="merchSn != null">`merch_sn` = #{merchSn}, </if>
+			<if test="storeId != null">`store_id` = #{storeId}, </if>
+			<if test="labelHeadName != null">`label_head_name` = #{labelHeadName}, </if>
+			<if test="labelHeadUrl != null">`label_head_url` = #{labelHeadUrl}, </if>
+			<if test="sortOrder != null">`sort_order` = #{sortOrder}, </if>
+			<if test="isValid != null">`is_valid` = #{isValid}, </if>
+			<if test="createrSn != null">`creater_sn` = #{createrSn}, </if>
+			<if test="createTime != null">`create_time` = #{createTime}, </if>
+			<if test="moderSn != null">`moder_sn` = #{moderSn}, </if>
+			<if test="modTime != null">`mod_time` = #{modTime}, </if>
+			<if test="tstm != null">`tstm` = #{tstm}</if>
+		</set>
+		where id = #{id}
+	</update>
+	
+	<delete id="delete">
+		delete from mall_goods_label_head where id = #{value}
+	</delete>
+	
+	<delete id="deleteBatch">
+		delete from mall_goods_label_head where id in 
+		<foreach item="id" collection="array" open="(" separator="," close=")">
+			#{id}
+		</foreach>
+	</delete>
+
+</mapper>

BIN
kmall-admin/src/main/resources/static/font/ams1015.ttf


+ 2 - 1
kmall-admin/src/main/webapp/WEB-INF/page/sale/monthlyCustomers2.html

@@ -40,8 +40,9 @@
             <span>日期:</span>
             <input type="month" name="startMonth" id="startMonth"/>&nbsp;
             <input type="month" name="endMonth" id="endMonth" />&nbsp;
+            <span>预定月份数</span>
+                <input type="number" name="monthNumber" id="monthNumber">;
             <input type="button" name="queryButton" value="导出选中的数据" onclick="exportSelectedMonthData()" />
-            <input type="number" name="monthNumber" id="monthNumber">;
             </div>
         </div>
     </header>

+ 91 - 0
kmall-admin/src/main/webapp/WEB-INF/page/shop/goodsexportpdf.html

@@ -0,0 +1,91 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+    <meta charset="UTF-8">
+    <title>Monthly Sales Growth</title>
+    #parse("sys/header.html")
+    <style>
+        .coldiv {
+            background-color: #f8f8f9;
+        }
+
+        body {
+            color: #515a6e;
+        }
+
+        #refreshTime, #storeId, #categoryId {
+            width: 100px;
+        }
+
+        #merchSn {
+            width: 300px;
+        }
+
+        i {
+            font-size: 20px;
+        }
+
+        input {
+            border: 1px #dcdee2 solid;
+            border-radius: 5px;
+            outline-color: #5cadff;
+        }
+    </style>
+</head>
+<body>
+<div id="rrapp" v-cloak>
+<header class="main-header">
+    <div class="container-fluid  coldiv">
+        <Row :gutter="16">
+        <div class="row" style="border:0;margin-bottom:10px">
+<!--            <i-button  v-bind:disabled="selectButtonDisabled"  @click="selectLabelHead" >选择标签头</i-button>-->
+            <i-button type="primary" @click="exportPdf"><i class="fa fa-cloud-download"></i>&nbsp;导出pdf</i-button>
+            <i-col span="3">
+                <i-select v-model="q.storeId" placeholder="门店" filterable label-in-value>
+                    <i-option v-for="store in stores" :value="store.id"
+                              :key="store.id">{{store.storeName}}
+                    </i-option>
+                </i-select>
+            </i-col>
+
+            <i-col span="3">
+                <i-input v-model="q.sku"  placeholder="sku"/>
+            </i-col>
+
+            <i-col span="3">
+                <i-input v-model="q.barCode"  placeholder="条形码"/>
+            </i-col>
+
+            <i-col span="3">
+                <i-select v-model="q.isHead" placeholder="是否标签头" @on-change="changeHead" filterable label-in-value>
+                    <i-option v-for="isHead in isHeads" :value="isHead.id"
+                              :key="isHead.id">{{isHead.name}}
+                    </i-option>
+                </i-select>
+            </i-col>
+
+            <i-col span="3">
+                <i-select v-model="q.pdfType" placeholder="打印规格" filterable label-in-value>
+                    <i-option v-for="pdfType in pdfTypes" :value="pdfType.id"
+                              :key="pdfType.id">{{pdfType.name}}
+                    </i-option>
+                </i-select>
+            </i-col>
+            <i-col span="3">
+                <i-select v-bind:disabled="selectButtonDisabled" v-model="q.headUrl" placeholder="选择标签头" filterable label-in-value>
+                    <i-option v-for="label in labels" :value="label.labelHeadUrl"
+                              :key="label.labelHeadUrl">{{label.labelHeadName}}
+                    </i-option>
+                </i-select>
+            </i-col>
+            <i-input v-model="q.headUrl" type="hidden"/>
+
+        </div>
+        </Row>
+    </div>
+</header>
+
+<script src="${rc.contextPath}/js/shop/goodsexportpdf.js"></script>
+</div>
+</body>
+</html>

+ 82 - 0
kmall-admin/src/main/webapp/WEB-INF/page/shop/goodslabelhead.html

@@ -0,0 +1,82 @@
+<!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">
+<!--                <i-button type="info" @click="add"><i class="fa fa-plus"></i>&nbsp;新增</i-button>-->
+<!--                <i-button type="warning" @click="update"><i class="fa fa-pencil-square-o"></i>&nbsp;修改</i-button>-->
+                <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="['jpg','jpeg','png']"
+                            action="../goodslabelhead/upload">
+                        <i-button type="ghost" icon="ios-cloud-upload-outline">标签头导入</i-button>
+                    </Upload>
+                </i-col>
+            </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="goodsLabelHead" :rules="ruleValidate" :label-width="80">
+            <Form-item label="商户编号" prop="merchSn">
+                <i-input v-model="goodsLabelHead.merchSn" placeholder="商户编号"/>
+            </Form-item>
+            <Form-item label="门店编号" prop="storeId">
+                <i-input v-model="goodsLabelHead.storeId" placeholder="门店编号"/>
+            </Form-item>
+            <Form-item label="标签头名称" prop="labelHeadName">
+                <i-input v-model="goodsLabelHead.labelHeadName" placeholder="标签头名称"/>
+            </Form-item>
+            <Form-item label="标签头url" prop="labelHeadUrl">
+                <i-input v-model="goodsLabelHead.labelHeadUrl" placeholder="标签头url"/>
+            </Form-item>
+            <Form-item label="排序" prop="sortOrder">
+                <i-input v-model="goodsLabelHead.sortOrder" placeholder="排序"/>
+            </Form-item>
+            <Form-item label="是否有效,0:有效,1:无效" prop="isValid">
+                <i-input v-model="goodsLabelHead.isValid" placeholder="是否有效,0:有效,1:无效"/>
+            </Form-item>
+            <Form-item label="创建人编号" prop="createrSn">
+                <i-input v-model="goodsLabelHead.createrSn" placeholder="创建人编号"/>
+            </Form-item>
+            <Form-item label="创建时间,yyyy-MM-dd HH:mm:ss" prop="createTime">
+                <i-input v-model="goodsLabelHead.createTime" placeholder="创建时间,yyyy-MM-dd HH:mm:ss"/>
+            </Form-item>
+            <Form-item label="修改人编号" prop="moderSn">
+                <i-input v-model="goodsLabelHead.moderSn" placeholder="修改人编号"/>
+            </Form-item>
+            <Form-item label="修改时间,yyyy-MM-dd HH:mm:ss" prop="modTime">
+                <i-input v-model="goodsLabelHead.modTime" placeholder="修改时间,yyyy-MM-dd HH:mm:ss"/>
+            </Form-item>
+            <Form-item label="时间戳" prop="tstm">
+                <i-input v-model="goodsLabelHead.tstm" 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/shop/goodslabelhead.js?_${date.systemTime}"></script>
+</body>
+</html>

+ 1 - 1
kmall-admin/src/main/webapp/WEB-INF/page/shop/goodstransportinfodetail.html

@@ -59,7 +59,7 @@
                 <i-input v-model="goodsTransportInfoDetail.originCountry" placeholder="原产地"/>
             </Form-item>
             <Form-item label="数量" prop="num">
-                <i-input type="number" v-model="goodsTransportInfoDetail.num" placeholder="数量"/>
+                <i-input v-model="goodsTransportInfoDetail.num" placeholder="数量"/>
             </Form-item>
             <!--<Form-item label="创建人编号" prop="createrSn">-->
                 <!--<i-input v-model="goodsTransportInfoDetail.createrSn" placeholder="创建人编号"/>-->

+ 1 - 1
kmall-admin/src/main/webapp/js/sale/monthlyCustomers2.js

@@ -220,7 +220,7 @@ function exportSelectedMonthData(){
         endMonth:endMonth,
         monthNumber:monthNumber
     };
-    console.log(param+321313112);
+    console.log(param);
     exportFile('#rrapp', '../monthly/exportSelectedMonthData', param);
     // $.ajax({
     //     url: "../monthly/exportSelectedMonthData",

+ 111 - 0
kmall-admin/src/main/webapp/js/shop/goodsexportpdf.js

@@ -0,0 +1,111 @@
+$(function () {
+
+});
+
+let vm = new Vue({
+    el: '#rrapp',
+    data: {
+        selectButtonDisabled:true,
+        q: {
+            storeId: '',
+            barCode: '',
+            sku: '',
+            isHead: '0',
+            pdfType: '36',
+            headUrl: ''
+        },
+        stores: [],
+        labels:[],
+        isHeads: [{
+            id: '0',
+            name: '无标签头'
+        }, {
+        	id: '1',
+			name: '有标签头'
+        }],
+
+        pdfTypes: [ {id: '36',
+            name: '36规格'}
+        ]
+
+
+    },
+    methods: {
+        changeHead:function(){
+            console.log(vm.q)
+            console.log(vm.selectButtonDisabled)
+            if (vm.q.isHead=='0'){
+                vm.pdfTypes=[ {id: '36',
+                    name: '36规格'}
+                ];
+                vm.q.pdfType='36';
+                vm.selectButtonDisabled=!vm.selectButtonDisabled;
+            }else {
+                vm.pdfTypes=[{
+                    id: '1',
+                    name: '1规格'
+                }, {
+                    id: '2',
+                    name: '2规格'
+                }, {
+                    id: '4',
+                    name: '4规格'
+                }, {
+                    id: '9',
+                    name: '9规格'
+                }, {
+                    id: '12',
+                    name: '12规格'
+                }, {
+                    id: '18',
+                    name: '18规格'
+                }, {id: '36',
+                    name: '36规格'}
+                ]
+                vm.selectButtonDisabled=!vm.selectButtonDisabled;
+            }
+
+        },
+		selectLabelHead: function () {
+
+
+
+
+			alert("selectLabelHead")
+		},
+
+		exportPdf: function () {
+
+            window.open("../pdf/printPdf?type="+vm.q.pdfType+"&sku="+vm.q.sku+"&barCode="+vm.q.barCode+"&head="+vm.q.isHead+"&headUrl="+vm.q.headUrl+"&storeId="+vm.q.storeId);
+
+            $.get("../pdf/printPdf?type="+vm.q.pdfType+"&sku="+vm.q.sku+"&barCode="+vm.q.barCode+"&head="+vm.q.isHead+"&headUrl="+vm.q.headUrl+"&storeId="+vm.q.storeId, function (r) {
+                vm.mall2OrderingEarlyWarningReminds = r.mall2OrderingEarlyWarningReminds;
+            });
+			alert("exportPdf")
+		}
+
+	},
+    mounted() {
+
+        $.get("../store/queryAll", function (r) {
+            vm.stores = r.list;
+        });
+
+        $.ajax({
+            type: "POST",
+            url: "../goodslabelhead/list",
+            contentType: "application/json",
+            success: function (r) {
+                if (r.code === 0) {
+                    console.log(r);
+                    vm.labels = r.page.list
+                } else {
+                    alert(r.msg);
+                }
+            }
+        });
+
+
+    }
+
+});

+ 176 - 0
kmall-admin/src/main/webapp/js/shop/goodslabelhead.js

@@ -0,0 +1,176 @@
+$(function () {
+    $("#jqGrid").jqGrid({
+        url: '../goodslabelhead/list',
+        datatype: "json",
+        colModel: [
+			{label: 'id', name: 'id', index: 'id', key: true, hidden: true},
+			{label: '商户编号', name: 'merchSn', index: 'merch_sn', width: 80},
+			{label: '门店编号', name: 'storeId', index: 'store_id', width: 80},
+			{label: '标签头名称', name: 'labelHeadName', index: 'label_head_name', width: 80},
+			{label: '标签头url', name: 'labelHeadUrl', index: 'label_head_url', width: 80},
+			// {label: '排序', name: 'sortOrder', index: 'sort_order', width: 80},
+			{label: '是否有效', name: 'isValid', index: 'is_valid', width: 80,formatter: function (value) {
+				if (value == '0') {
+					return '有效';
+				} else if (value == '1') {
+					return '无效';
+				}
+				return '';
+			}}
+			// {label: '创建人编号', name: 'createrSn', index: 'creater_sn', width: 80},
+			// {label: '创建时间', name: 'createTime', index: 'create_time', width: 80},
+			// {label: '修改人编号', name: 'moderSn', index: 'moder_sn', width: 80},
+			// {label: '修改时间', name: 'modTime', index: 'mod_time', width: 80},
+			// {label: '时间戳', name: 'tstm', index: 'tstm', width: 80}
+			],
+		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,
+		goodsLabelHead: {},
+		ruleValidate: {
+			name: [
+				{required: true, message: '名称不能为空', trigger: 'blur'}
+			]
+		},
+		q: {
+		    name: ''
+		}
+	},
+	methods: {
+		query: function () {
+			vm.reload();
+		},
+		add: function () {
+			vm.showList = false;
+			vm.title = "新增";
+			vm.goodsLabelHead = {};
+		},
+		update: function (event) {
+            let id = getSelectedRow();
+			if (id == null) {
+				return;
+			}
+			vm.showList = false;
+            vm.title = "修改";
+
+            vm.getInfo(id)
+		},
+		saveOrUpdate: function (event) {
+            let url = vm.goodsLabelHead.id == null ? "../goodslabelhead/save" : "../goodslabelhead/update";
+			$.ajax({
+				type: "POST",
+			    url: url,
+			    contentType: "application/json",
+			    data: JSON.stringify(vm.goodsLabelHead),
+                success: function (r) {
+                    if (r.code === 0) {
+                        alert('操作成功', function (index) {
+                            vm.reload();
+                        });
+                    } else {
+                        alert(r.msg);
+                    }
+                }
+			});
+		},
+		uploadExcelSuccess: function (data) {
+			// console.log(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 + ' 格式不正确,请上传 jpg 或 jpeg 或 png 格式的文件。'
+			});
+		},
+		del: function (event) {
+            let ids = getSelectedRows();
+			if (ids == null){
+				return;
+			}
+
+			confirm('确定要删除选中的记录?', function () {
+				$.ajax({
+					type: "POST",
+				    url: "../goodslabelhead/delete",
+				    contentType: "application/json",
+				    data: JSON.stringify(ids),
+				    success: function (r) {
+						if (r.code == 0) {
+							alert('操作成功', function (index) {
+								$("#jqGrid").trigger("reloadGrid");
+							});
+						} else {
+							alert(r.msg);
+						}
+					}
+				});
+			});
+		},
+		getInfo: function(id){
+			$.get("../goodslabelhead/info/"+id, function (r) {
+                vm.goodsLabelHead = r.goodsLabelHead;
+            });
+		},
+        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);
+        }
+	}
+});

+ 11 - 2
kmall-admin/src/main/webapp/js/shop/goodstransportinfodetail.js

@@ -61,9 +61,9 @@ let vm = new Vue({
 		goodsTransportInfoDetail: {},
         ruleValidate: {
             sku:{required: true, message: 'sku不能为空', trigger: 'blur'},
-            supplierId:{ type:"number",  required: true, message: '供应商id不能为空', trigger: 'blur'},
+            supplierId:{   required: true, message: '供应商id不能为空', trigger: 'blur'},
             originCountry:{required: true, message: '原产地不能为空', trigger: 'blur'},
-            num:{ type:"number", required: true, message: '数量不能为空', trigger: 'blur'}
+            num:{ required: true, message: '数量不能为空', trigger: 'blur'}
         },
 		q: {
             wayStatus: null,
@@ -90,6 +90,15 @@ let vm = new Vue({
             vm.getInfo(transItemId)
 		},
 		saveOrUpdate: function (event) {
+            var re =  /^[1-9]+[0-9]*]*$/;
+            if (!re.test(vm.goodsTransportInfoDetail.num)) {
+                alert("数量请输入数字");
+                return false;
+            }
+            if (!re.test(vm.goodsTransportInfoDetail.supplierId)) {
+                alert("供应商id请输入数字");
+                return false;
+            }
             let url = vm.goodsTransportInfoDetail.transItemId == null ? "../goodstransportinfodetail/save" : "../goodstransportinfodetail/update";
 			$.ajax({
 				type: "POST",

BIN
kmall-admin/src/main/webapp/statics/font/ams1015.ttf


+ 83 - 0
kmall-api/src/main/java/com/kmall/api/entity/exportpdf/PDFGoodsDto.java

@@ -0,0 +1,83 @@
+package com.kmall.api.entity.exportpdf;
+
+/**
+ * @author zhangchuangbiao
+ * @version 1.0
+ * 2020-09-14 16:35
+ */
+public class PDFGoodsDto {
+
+    private String productName; // 产品名称
+    private String englishName; // 产品英文名称
+    private String price; // 价格
+    private String savings; // 节约价格
+    private String startFax; // 开始税率
+    private String endFax; // 结束税率
+    private String plu;
+    private String barCode;
+
+
+    public String getProductName() {
+        return productName;
+    }
+
+    public void setProductName(String productName) {
+        this.productName = productName;
+    }
+
+    public String getEnglishName() {
+        return englishName;
+    }
+
+    public void setEnglishName(String englishName) {
+        this.englishName = englishName;
+    }
+
+    public String getPrice() {
+        return price;
+    }
+
+    public void setPrice(String price) {
+        this.price = price;
+    }
+
+    public String getSavings() {
+        return savings;
+    }
+
+    public void setSavings(String savings) {
+        this.savings = savings;
+    }
+
+    public String getStartFax() {
+        return startFax;
+    }
+
+    public void setStartFax(String startFax) {
+        this.startFax = startFax;
+    }
+
+    public String getEndFax() {
+        return endFax;
+    }
+
+    public void setEndFax(String endFax) {
+        this.endFax = endFax;
+    }
+
+    public String getPlu() {
+        return plu;
+    }
+
+    public void setPlu(String plu) {
+        this.plu = plu;
+    }
+
+    public String getBarCode() {
+        return barCode;
+    }
+
+    public void setBarCode(String barCode) {
+        this.barCode = barCode;
+    }
+}

+ 2 - 0
kmall-manager/src/main/resources/conf/print.properties

@@ -0,0 +1,2 @@
+font.url=/static/font/ams1015.ttf
+upload.dir=E:/demo/code_1.pdf

+ 7 - 6
kmall-manager/src/main/resources/spring/spring-manager-context.xml

@@ -5,13 +5,13 @@
        xmlns:aop="http://www.springframework.org/schema/aop"
        xmlns:mvc="http://www.springframework.org/schema/mvc"
        xsi:schemaLocation="
-        http://www.springframework.org/schema/beans 
-        http://www.springframework.org/schema/beans/spring-beans-4.2.xsd        
-        http://www.springframework.org/schema/context 
+        http://www.springframework.org/schema/beans
+        http://www.springframework.org/schema/beans/spring-beans-4.2.xsd
+        http://www.springframework.org/schema/context
         http://www.springframework.org/schema/context/spring-context-4.2.xsd
-     	http://www.springframework.org/schema/aop 
+     	http://www.springframework.org/schema/aop
      	http://www.springframework.org/schema/aop/spring-aop-4.2.xsd
-		http://www.springframework.org/schema/mvc 
+		http://www.springframework.org/schema/mvc
      	http://www.springframework.org/schema/mvc/spring-mvc-4.2.xsd">
 
 
@@ -34,10 +34,11 @@
                 <value>classpath:conf/common.properties</value>
                 <value>classpath:conf/express-sf.properties</value>
                 <value>classpath:conf/alipay.properties</value>
+                <value>classpath:conf/print.properties</value>
             </list>
         </property>
         <property name="fileEncoding" value="UTF-8"/>
     </bean>
 
 
-</beans>
+</beans>