Jelajahi Sumber

客诉 word 导出

turujie 2 tahun lalu
induk
melakukan
4abfd6293f
19 mengubah file dengan 1100 tambahan dan 9 penghapusan
  1. 24 0
      business-common/pom.xml
  2. 28 0
      business-common/src/main/java/com/rongwei/bscommon/sys/dao/ComCustomerDao.java
  3. 10 0
      business-common/src/main/java/com/rongwei/bscommon/sys/dao/ExportDao.java
  4. 25 0
      business-common/src/main/java/com/rongwei/bscommon/sys/service/ComCustomerService.java
  5. 12 0
      business-common/src/main/java/com/rongwei/bscommon/sys/service/ExportService.java
  6. 42 0
      business-common/src/main/java/com/rongwei/bscommon/sys/service/impl/ComCustomerServiceImpl.java
  7. 202 0
      business-common/src/main/java/com/rongwei/bscommon/sys/service/impl/ExportServiceImpl.java
  8. 41 0
      business-common/src/main/java/com/rongwei/bscommon/sys/utils/AsposeWordsUtils.java
  9. 6 6
      business-common/src/main/java/com/rongwei/bscommon/sys/utils/CodeGeneration.java
  10. 380 0
      business-entity/src/main/java/com/bsentity/domin/ComCustomerDo.java
  11. 51 0
      business-entity/src/main/java/com/bsentity/dto/ComExportMasterDto.java
  12. 62 0
      business-entity/src/main/java/com/bsentity/dto/ComProductExportDto.java
  13. 28 0
      business-entity/src/main/java/com/bsentity/vo/ComProTempWordVo.java
  14. 130 0
      business-entity/src/main/resources/mybatis/ComCustomerDao.xml
  15. 4 0
      business-entity/src/main/resources/mybatis/ExportDao.xml
  16. 37 0
      business-server/src/main/java/com/rongwei/controller/ExportController.java
  17. 5 3
      business-server/src/main/resources/bootstrap.yml
  18. 13 0
      business-server/src/main/resources/license.xml
  19. TEMPAT SAMPAH
      business-server/src/main/resources/template/comProductlistTemp.docx

+ 24 - 0
business-common/pom.xml

@@ -34,5 +34,29 @@
             <version>${mysql.version}</version>
         </dependency>
 
+
+        <dependency>
+            <groupId>org.apache.velocity</groupId>
+            <artifactId>velocity-engine-core</artifactId>
+            <version>2.0</version>
+        </dependency>
+
+<!--        <dependency>-->
+<!--            <groupId>com.baomidou</groupId>-->
+<!--            <artifactId>mybatis-plus-boot-starter</artifactId>-->
+<!--            <version>3.2.0</version>-->
+<!--        </dependency>-->
+
+
+        <dependency>
+            <groupId>com.aspose</groupId>
+            <artifactId>aspose-words</artifactId>
+            <version>18.9</version>
+        </dependency>
+        <dependency>
+            <groupId>org.springframework</groupId>
+            <artifactId>spring-core</artifactId>
+            <version>5.1.4.RELEASE</version>
+        </dependency>
     </dependencies>
 </project>

+ 28 - 0
business-common/src/main/java/com/rongwei/bscommon/sys/dao/ComCustomerDao.java

@@ -0,0 +1,28 @@
+package com.rongwei.bscommon.sys.dao;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.bsentity.domin.ComCustomerDo;
+import com.bsentity.dto.ComExportMasterDto;
+import com.bsentity.dto.ComProductExportDto;
+import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+/**
+ * <p>
+ * 客诉单 Mapper 接口
+ * </p>
+ *
+ * @author trj
+ * @since 2023-07-12
+ */
+
+@Mapper
+public interface ComCustomerDao extends BaseMapper<ComCustomerDo> {
+    ComExportMasterDto getCustomerByIds(@Param("ids") List<String> ids);
+
+    List<ComProductExportDto> getProductByIds(@Param("ids") List<String> ids);
+
+    void updatePrintNoByIds(@Param("ids") List<String> ids , @Param("printNo") String printNo);
+}

+ 10 - 0
business-common/src/main/java/com/rongwei/bscommon/sys/dao/ExportDao.java

@@ -0,0 +1,10 @@
+package com.rongwei.bscommon.sys.dao;
+
+import org.apache.ibatis.annotations.Mapper;
+
+/**
+ * @author Trj
+ */
+@Mapper
+public interface ExportDao {
+}

+ 25 - 0
business-common/src/main/java/com/rongwei/bscommon/sys/service/ComCustomerService.java

@@ -0,0 +1,25 @@
+package com.rongwei.bscommon.sys.service;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.bsentity.domin.ComCustomerDo;
+import com.bsentity.dto.ComExportMasterDto;
+import com.bsentity.dto.ComProductExportDto;
+
+import java.util.List;
+
+/**
+ * <p>
+ * 客诉单 服务类
+ * </p>
+ *
+ * @author trj
+ * @since 2023-07-12
+ */
+public interface ComCustomerService extends IService<ComCustomerDo> {
+    ComExportMasterDto getCustomerByIds(List<String> ids);
+
+    List<ComProductExportDto> getProductByIds(List<String> ids);
+
+    void updatePrintNoByIds(List<String> ids,String printNo);
+
+}

+ 12 - 0
business-common/src/main/java/com/rongwei/bscommon/sys/service/ExportService.java

@@ -0,0 +1,12 @@
+package com.rongwei.bscommon.sys.service;
+
+import javax.servlet.http.HttpServletResponse;
+import java.util.List;
+
+/**
+ * @author Trj
+ */
+public interface ExportService {
+
+    void exportComProductListTempWord(List<String> ids, HttpServletResponse response);
+}

+ 42 - 0
business-common/src/main/java/com/rongwei/bscommon/sys/service/impl/ComCustomerServiceImpl.java

@@ -0,0 +1,42 @@
+package com.rongwei.bscommon.sys.service.impl;
+
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.bsentity.domin.ComCustomerDo;
+import com.bsentity.dto.ComExportMasterDto;
+import com.bsentity.dto.ComProductExportDto;
+import com.rongwei.bscommon.sys.dao.ComCustomerDao;
+import com.rongwei.bscommon.sys.service.ComCustomerService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+
+/**
+ * <p>
+ * 客诉单 服务实现类
+ * </p>
+ *
+ * @author trj
+ * @since 2023-07-12
+ */
+@Service
+public class ComCustomerServiceImpl extends ServiceImpl<ComCustomerDao,ComCustomerDo> implements ComCustomerService {
+
+
+    @Override
+    public ComExportMasterDto getCustomerByIds(List<String> ids) {
+
+        return baseMapper.getCustomerByIds(ids);
+    }
+
+    @Override
+    public List<ComProductExportDto> getProductByIds(List<String> ids) {
+
+        return baseMapper.getProductByIds(ids);
+    }
+
+    @Override
+    public void updatePrintNoByIds(List<String> ids,String printNo) {
+        baseMapper.updatePrintNoByIds(ids,printNo);
+    }
+}

+ 202 - 0
business-common/src/main/java/com/rongwei/bscommon/sys/service/impl/ExportServiceImpl.java

@@ -0,0 +1,202 @@
+package com.rongwei.bscommon.sys.service.impl;
+
+import cn.hutool.core.date.DateUtil;
+import cn.hutool.core.util.ArrayUtil;
+import cn.hutool.core.util.ObjectUtil;
+import cn.hutool.core.util.StrUtil;
+import com.aspose.words.Document;
+import com.aspose.words.MailMergeCleanupOptions;
+import com.aspose.words.net.System.Data.DataRow;
+import com.aspose.words.net.System.Data.DataTable;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.bsentity.domin.ComCustomerDo;
+import com.bsentity.dto.ComExportMasterDto;
+import com.bsentity.dto.ComProductExportDto;
+import com.bsentity.vo.ComProTempWordVo;
+import com.rongwei.bscommon.sys.service.ComCustomerService;
+import com.rongwei.bscommon.sys.service.ExportService;
+import com.rongwei.bscommon.sys.utils.AsposeWordsUtils;
+import com.rongwei.rwcommon.base.exception.CustomException;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.core.io.ClassPathResource;
+import org.springframework.stereotype.Service;
+
+import javax.servlet.http.HttpServletResponse;
+import java.math.BigDecimal;
+import java.util.*;
+import java.util.function.Function;
+
+/**
+ * @author Trj
+ */
+@Service("export")
+public class ExportServiceImpl implements ExportService {
+    private final Logger log = LoggerFactory.getLogger(this.getClass().getName());
+
+
+    @Autowired
+    private ComCustomerService comCustomerService;
+
+
+    /**
+     * 利用 aspose 框架实现 word 模板导出
+     *
+     * @param ids
+     * @param response
+     */
+    @Override
+    public void exportComProductListTempWord(List<String> ids, HttpServletResponse response) {
+        boolean wordLicense = AsposeWordsUtils.getWordLicense();
+        ClassPathResource classPathResource = new ClassPathResource("template/comProductlistTemp.docx");
+        try {
+            //  获取导出数据
+            ComProTempWordVo problemTrackingAndResolutionWordDataVo = getComProTempWordVo(ids);
+
+            Document doc = new Document(classPathResource.getInputStream());
+            doc.getMailMerge().setCleanupOptions(MailMergeCleanupOptions.REMOVE_UNUSED_FIELDS);
+
+            // 子表数据填充
+            problemTrackingAndResolutionWordDataVo.getListData().forEach(info -> {
+                try {
+                    doc.getMailMerge().executeWithRegions(info);
+                } catch (Exception e) {
+                    e.printStackTrace();
+                    throw new CustomException("客诉单word导出异常");
+                }
+            });
+            // 单独数据合并
+            doc.getMailMerge().execute(problemTrackingAndResolutionWordDataVo.getSingleDataMap().keySet().stream().toArray(String[]::new),
+                    problemTrackingAndResolutionWordDataVo.getSingleDataMap().values()
+                            .stream().map((Function<Object, String>) Object::toString).toArray(String[]::new));
+
+            // 设置打印编号
+            comCustomerService.updatePrintNoByIds(ids,problemTrackingAndResolutionWordDataVo.getSingleDataMap().get("PRINTNO"));
+
+            response.setContentType("application/octet-stream;charset=ISO8859-1");
+            response.setHeader("Content-Disposition", "attachment;filename=comProductlistTemp.docx");
+            // 返回给前端 输出流文件
+            doc.save(response.getOutputStream(), com.aspose.words.SaveFormat.DOCX);
+
+        } catch (Exception e) {
+            e.printStackTrace();
+            throw new CustomException("客诉单word导出异常");
+        }
+    }
+
+    /**
+     * 数据准备
+     *
+     * @param ids 主表id集合
+     * @return 模板数据
+     */
+    private ComProTempWordVo getComProTempWordVo(List<String> ids) {
+        // 表单数据
+        Map<String, String> wordMap;
+
+        ComProTempWordVo vo = new ComProTempWordVo();
+        // 子表数据
+        List<DataTable> listData = new ArrayList<>();
+
+        if (ArrayUtil.isEmpty(ids)) {
+            return vo;
+        }
+        // 查询主表数据
+        ComExportMasterDto comExportMasterDto = comCustomerService.getCustomerByIds(ids);
+        if (ObjectUtil.isEmpty(comExportMasterDto)) {
+            return vo;
+        }
+        // 数据清洗
+        wordMap = comDtosToMap(comExportMasterDto);
+
+
+        /*****************************客诉产品信息*************************************/
+        // 根据id 查询 客诉单信息
+        List<ComProductExportDto> comProductExportDtos = comCustomerService.getProductByIds(ids);
+        if (ArrayUtil.isEmpty(comProductExportDtos)) {
+            return vo;
+        }
+
+        //子表模板
+        DataTable productDataTable = new DataTable("productlist");
+        productDataTable.getColumns().add("NO");
+        productDataTable.getColumns().add("ORIORDERNO");
+        productDataTable.getColumns().add("ALLOY");
+        productDataTable.getColumns().add("ISSTATUS");
+        productDataTable.getColumns().add("SPECIFICATIONS");
+        productDataTable.getColumns().add("MRAWEIGHT");
+        productDataTable.getColumns().add("DEFECT");
+        productDataTable.getColumns().add("TOTALMARWEIGHT");
+
+        // 计算 MRA重量总和
+        BigDecimal totalMraWeight = comProductExportDtos.stream().map(ComProductExportDto::getMraWeight).reduce(BigDecimal.ONE, BigDecimal::add);
+        wordMap.put("TOTALMARWEIGHT",totalMraWeight.toString());
+        vo.setSingleDataMap(wordMap);
+        // 填充数据
+        comProductExportDtos.forEach(comProductExportDto -> {
+            DataRow dataRow = productDataTable.newRow();
+            dataRow.set("NO", comProductExportDto.getNo());
+            dataRow.set("ORIORDERNO", comProductExportDto.getOriOrderNo());
+            dataRow.set("ALLOY", comProductExportDto.getAlloy());
+            dataRow.set("ISSTATUS", comProductExportDto.getIsStatus());
+            dataRow.set("SPECIFICATIONS", comProductExportDto.getSpecifications());
+            dataRow.set("MRAWEIGHT", comProductExportDto.getMraWeight());
+            dataRow.set("DEFECT", comProductExportDto.getDefect());
+            dataRow.set("TOTALMARWEIGHT", totalMraWeight);
+            productDataTable.getRows().add(dataRow);
+        });
+        listData.add(productDataTable);
+        vo.setListData(listData);
+        return vo;
+    }
+
+    /**
+     * 将查询的表单数据,转换成MAP
+     *
+     * @param comExportMasterDto 表单数据
+     * @return Map<String, String>
+     */
+    private Map<String, String> comDtosToMap(ComExportMasterDto comExportMasterDto) {
+        Map<String, String> wordMap = new HashMap<>();
+        String printNo = null;
+        //  最大 打印号
+        ComCustomerDo comCustomerDo = comCustomerService.getBaseMapper()
+                .selectOne(
+                        new LambdaQueryWrapper<ComCustomerDo>()
+                                .select(ComCustomerDo::getPrintNo)
+                                .orderByDesc(ComCustomerDo::getPrintNo)
+                                .last("LIMIT 1")
+
+                );
+
+        // 编号:规则(MRA+年份+序号)。例如,当年导出的第一个MRA就是MRA23001,导出的第二个就是MRA23002,按照年份以此递增
+        String year = String.valueOf(DateUtil.year(new Date())).substring(2);
+        if (ObjectUtil.isEmpty(comCustomerDo)) {
+            printNo = "MRA" + year + "001";
+        }else  {
+            printNo = comCustomerDo.getPrintNo();
+            // 不为空
+            String number = printNo.substring(3);
+            Integer no = Integer.parseInt(number) + 1;
+            String y = String.valueOf(no).substring(0, 2);
+            //  跨年了。年份加一,从001开始计算
+            if (y.equals(year)) {
+                // 未跨年
+                printNo = "MRA" + no;
+            } else {
+                printNo = "MRA" + year + "001";
+            }
+
+        }
+
+        wordMap.put("PRINTNO", printNo);
+        wordMap.put("COMNO", comExportMasterDto.getComNo());
+        wordMap.put("CUSTOMERNAME", comExportMasterDto.getCustomerName());
+        wordMap.put("CUSTOMERUSERNAME", comExportMasterDto.getCustomerUserName());
+        wordMap.put("PRODUCTENGINEERNAME", comExportMasterDto.getProductEngineerName());
+        wordMap.put("CREATEUSERNAME", comExportMasterDto.getCreateUserName());
+        wordMap.put("DATENOW", DateUtil.formatDate(comExportMasterDto.getDateNow()));
+        return wordMap;
+    }
+}

+ 41 - 0
business-common/src/main/java/com/rongwei/bscommon/sys/utils/AsposeWordsUtils.java

@@ -0,0 +1,41 @@
+package com.rongwei.bscommon.sys.utils;
+
+import com.aspose.cells.License;
+import org.springframework.stereotype.Component;
+
+import java.io.InputStream;
+
+/**
+ * AsposeWordsUtils class
+ *
+ * @author XH
+ * @date 2022/08/01
+ */
+@Component
+public class AsposeWordsUtils {
+    public static boolean getExcelLicense() {
+        boolean result = false;
+        try {
+            InputStream is = AsposeWordsUtils.class.getClassLoader().getResourceAsStream("license.xml");
+            License aposeLic = new License();
+            aposeLic.setLicense(is);
+            result = true;
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        return result;
+    }
+    public static boolean getWordLicense() {
+        boolean result = false;
+        try {
+            InputStream is = AsposeWordsUtils.class.getClassLoader().getResourceAsStream("license.xml");
+            com.aspose.words.License aposeLic = new com.aspose.words.License();
+            aposeLic.setLicense(is);
+            result = true;
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        return result;
+    }
+
+}

+ 6 - 6
business-common/src/main/java/com/rongwei/bscommon/sys/utils/CodeGeneration.java

@@ -26,14 +26,14 @@ public class CodeGeneration {
         //全局配置
         GlobalConfig gc = new GlobalConfig();
         String oPath = System.getProperty("user.dir");//得到当前项目的路径
-        gc.setOutputDir("C:\\Users\\admin\\Desktop");   //生成文件输出根目录
+        gc.setOutputDir("C:\\Users\\Trj\\Desktop");   //生成文件输出根目录
         gc.setOpen(false);//生成完成后不弹出文件框
         gc.setFileOverride(true);  //文件覆盖
         gc.setActiveRecord(false);// 不需要ActiveRecord特性的请改为false
         gc.setEnableCache(false);// XML 二级缓存
         gc.setBaseResultMap(true);// XML ResultMap
         gc.setBaseColumnList(false);// XML columList
-        gc.setAuthor("fpy");// 作者
+        gc.setAuthor("trj");// 作者
 
         // 自定义文件命名,注意 %s 会自动填充表实体属性!
         gc.setControllerName("%sController");
@@ -48,14 +48,14 @@ public class CodeGeneration {
         dsc.setDbType(DbType.MYSQL);   //设置数据库类型,我是postgresql
         dsc.setDriverName("com.mysql.cj.jdbc.Driver");
         dsc.setUsername("root");
-        dsc.setPassword("Incontrol@Rgs!2021");
-        dsc.setUrl("jdbc:mysql://49.73.84.232:3306/rgs002268?characterEncoding=utf8&failOverReadOnly=false&autoReconnect=true&roundRobinLoadBalance=true&serverTimezone=GMT%2B8&useSSL=false");  //指定数据库
+        dsc.setPassword("root123456");
+        dsc.setUrl("jdbc:mysql://58.209.81.25:3306/incontrol_question_pre?characterEncoding=utf8&failOverReadOnly=false&autoReconnect=true&roundRobinLoadBalance=true&serverTimezone=GMT%2B8&useSSL=false");  //指定数据库
         autoGenerator.setDataSource(dsc);
 
         // 3、包的配置
         PackageConfig pc = new PackageConfig();
         // pc.setModuleName("blog"); // 生成到指定模块中
-        pc.setParent("cn.com");
+        pc.setParent("busniessentity.sys");
         pc.setEntity("entity");
         pc.setMapper("mapper");
         pc.setService("service");
@@ -65,7 +65,7 @@ public class CodeGeneration {
         // 4、策略配置
         StrategyConfig strategy = new StrategyConfig();
         // 设置要映射的表名(重要,需要修改的地方)
-        strategy.setInclude("qc_models_material_type");
+        strategy.setInclude("com_customer");
         strategy.setNaming(NamingStrategy.underline_to_camel); // 自动转换表名的驼峰命名法
         strategy.setColumnNaming(NamingStrategy.no_change); // 自动转换列名的驼峰命名法
         strategy.setEntityLombokModel(true); // 是否使用lombox

+ 380 - 0
business-entity/src/main/java/com/bsentity/domin/ComCustomerDo.java

@@ -0,0 +1,380 @@
+package com.bsentity.domin;
+
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.rongwei.rwcommon.base.BaseDo;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.experimental.Accessors;
+
+import java.io.Serializable;
+import java.math.BigDecimal;
+import java.util.Date;
+
+/**
+ * 投诉单信息
+ * @author Trj
+ * @date 2023-07-12
+ */
+@Data
+@EqualsAndHashCode(callSuper = false)
+@Accessors(chain = true)
+@TableName("com_customer")
+public class ComCustomerDo extends BaseDo implements Serializable {
+
+    public static final Long serialVersionUID = 1L;
+    /**
+     * 主键ID
+     */
+    @TableId("ID")
+    private String id;
+
+    /**
+     * 租户ID
+     */
+    @TableField("TENANTID")
+    private String tenantid;
+
+    /**
+     * 扩展json格式配置
+     */
+    @TableField("ROPTION")
+    private String roption;
+
+
+
+    /**
+     * 投诉编号
+     */
+    @TableField("COMNO")
+    private String comno;
+
+    /**
+     * 客户名称
+     */
+    @TableField("CUSTOMERNAME")
+    private String customername;
+
+    /**
+     * 发货日期
+     */
+    @TableField("DELIVERYDATE")
+    private Date deliverydate;
+
+    /**
+     * 投诉日期
+     */
+    @TableField("COMDATE")
+    private Date comdate;
+
+    /**
+     * 生效日期
+     */
+    @TableField("TAKEEFFECTDATE")
+    private Date takeeffectdate;
+
+    /**
+     * 投诉信息
+     */
+    @TableField("COMMSG")
+    private String commsg;
+
+    /**
+     * 投诉有效性
+     */
+    @TableField("ISEFFECTIVE")
+    private String iseffective;
+
+    /**
+     * 有无其他费用
+     */
+    @TableField("ISOTHEREXPENSES")
+    private String isotherexpenses;
+
+    /**
+     * 其他费用(美元)
+     */
+    @TableField("OTHEREXPENSESUSD")
+    private BigDecimal otherexpensesusd;
+
+    /**
+     * 其他费用(人民币)
+     */
+    @TableField("OTHEREXPENSESRMB")
+    private BigDecimal otherexpensesrmb;
+
+    /**
+     * 确认内容
+     */
+    @TableField("CONFIRMCONTENT")
+    private String confirmcontent;
+
+    /**
+     * 结果:字典 CONRESULT
+     */
+    @TableField("CONRESULT")
+    private String conresult;
+
+    /**
+     * 说明
+     */
+    @TableField("INSTRUCTIONS")
+    private String instructions;
+
+    /**
+     * 处理最终状态
+     */
+    @TableField("FINALSTATE")
+    private String finalstate;
+
+    /**
+     * 是否与MRA一致
+     */
+    @TableField("ISCONSISTENTMRA")
+    private String isconsistentmra;
+
+    /**
+     * 登记附件
+     */
+    @TableField("FILESIGNIN")
+    private String filesignin;
+
+    /**
+     * 产品工程师审核附件
+     */
+    @TableField("FILEPRODUCTENGINEER")
+    private String fileproductengineer;
+
+    /**
+     * 客服附件
+     */
+    @TableField("FILECUSTOMERSERVICE")
+    private String filecustomerservice;
+
+    /**
+     * 财务预估附件
+     */
+    @TableField("FILEFINANCE")
+    private String filefinance;
+
+    /**
+     * 领导审核附件
+     */
+    @TableField("FILELEADEXAMINE")
+    private String fileleadexamine;
+
+    /**
+     * 最终处理附件
+     */
+    @TableField("FILEFINALLY")
+    private String filefinally;
+
+    /**
+     * 财务复核附件
+     */
+    @TableField("FILEFINANCERECHECK")
+    private String filefinancerecheck;
+
+    /**
+     * 是否进入PPM
+     */
+    @TableField("ISENTERPPM")
+    private String isenterppm;
+
+    /**
+     * PPM年月
+     */
+    @TableField("PPMDATE")
+    private Date ppmdate;
+
+    /**
+     * 市场负责人
+     */
+    @TableField("MARKETINGMANAGER")
+    private String marketingmanager;
+
+    /**
+     * 市场负责人ID
+     */
+    @TableField("MARKETINGMANAGERID")
+    private String marketingmanagerid;
+
+    /**
+     * MRA出发日期
+     */
+    @TableField("MRASETOUTDATE")
+    private Date mrasetoutdate;
+
+    /**
+     * 客户ID
+     */
+    @TableField("CUSTOMERID")
+    private String customerid;
+
+    /**
+     * 产品工程师ID
+     */
+    @TableField("PRODUCTENGINEERID")
+    private String productengineerid;
+
+    /**
+     * 产品工程师名称
+     */
+    @TableField("PRODUCTENGINEERNAME")
+    private String productengineername;
+
+    /**
+     * 客服ID
+     */
+    @TableField("CUSTOMERSERVICEID")
+    private String customerserviceid;
+
+    /**
+     * 客服名称
+     */
+    @TableField("CUSTOMERSERVICENAME")
+    private String customerservicename;
+
+    /**
+     * 产品技术经理ID
+
+
+     */
+    @TableField("PRODUCTTECHINCALMANAGERID")
+    private String producttechincalmanagerid;
+
+    /**
+     * 产品技术经理名称
+     */
+    @TableField("PRODUCTTECHINCALMANAGERNAME")
+    private String producttechincalmanagername;
+
+    /**
+     * 工艺质量经理ID
+     */
+    @TableField("PROCESSQUALITYMANAGERID")
+    private String processqualitymanagerid;
+
+    /**
+     * 工艺质量经理名称
+     */
+    @TableField("PROCESSQUALITYMANAGERNAME")
+    private String processqualitymanagername;
+
+    /**
+     * 流程ID
+     */
+    @TableField("PROCESSINSTID")
+    private String processinstid;
+
+    /**
+     * 流程状态
+     */
+    @TableField("PROCESSINSTSTATUS")
+    private String processinststatus;
+
+    /**
+     * 表单状态
+     */
+    @TableField("STATUS")
+    private String status;
+
+    /**
+     * 预估计算合计(人民币)
+     */
+    @TableField("COMPUTECOSTRMB")
+    private BigDecimal computecostrmb;
+
+    /**
+     * 预估计算合计(美元)
+     */
+    @TableField("COMPUTECOSTUSD")
+    private BigDecimal computecostusd;
+
+    /**
+     * 预估金额总计(人民币)
+     */
+    @TableField("TOTALCOSTRMB")
+    private BigDecimal totalcostrmb;
+
+    /**
+     * 预估金额总计(美元)
+     */
+    @TableField("PRICETOTALUSD")
+    private BigDecimal pricetotalusd;
+
+    /**
+     * 预估其他费用(人民币)
+     */
+    @TableField("OTHERCOSTRMB")
+    private BigDecimal othercostrmb;
+
+    /**
+     * 预估其他费用(美元)
+     */
+    @TableField("OTHERCOSTUSD")
+    private BigDecimal othercostusd;
+
+    /**
+     * 复核计算总计(人民币)
+     */
+    @TableField("RECHECKCOMPUTECOSTRMB")
+    private BigDecimal recheckcomputecostrmb;
+
+    /**
+     * 复核计算总计(美元)
+     */
+    @TableField("RECHECKCOMPUTECOSTUSD")
+    private BigDecimal recheckcomputecostusd;
+
+    /**
+     * 复核金额总计(人民币)
+     */
+    @TableField("RECHECKTOTALCOSTRMB")
+    private BigDecimal rechecktotalcostrmb;
+
+    /**
+     * 复核金额总计(美元)
+     */
+    @TableField("RECHECKPRICETOTALUSD")
+    private BigDecimal recheckpricetotalusd;
+
+    /**
+     * 复核其他费用(人民币)
+     */
+    @TableField("RECHECKOTHERCOSTRMB")
+    private BigDecimal recheckothercostrmb;
+
+    /**
+     * 复核其他费用(美元)
+     */
+    @TableField("RECHECKOTHERCOSTUSD")
+    private BigDecimal recheckothercostusd;
+
+    /**
+     * 总计投诉重量
+     */
+    @TableField("COMWEIGHT")
+    private BigDecimal comweight;
+
+    /**
+     * 总计最终重量
+     */
+    @TableField("FINALWEIGHT")
+    private BigDecimal finalweight;
+
+    /**
+     * 投诉类型
+     */
+    @TableField("COMTYPE")
+    private String comtype;
+
+
+    /**
+     * 投诉单打印编号
+     */
+    @TableField("PRINTNO")
+    private String printNo;
+
+}

+ 51 - 0
business-entity/src/main/java/com/bsentity/dto/ComExportMasterDto.java

@@ -0,0 +1,51 @@
+package com.bsentity.dto;
+
+import lombok.Data;
+
+import java.io.Serializable;
+import java.util.Date;
+
+/**
+ * 客诉单导出 word 后端业务处理数据
+ * @author Trj
+ */
+@Data
+public class ComExportMasterDto implements Serializable {
+    public static final Long serialVersionUID = 1L;
+
+    /**
+     * 打印编号
+     */
+    private String printNo;
+
+    /**
+     * 投诉编号
+     */
+    private String comNo;
+
+    /**
+     * 客户名称
+     */
+    private String customerName;
+
+
+    /**
+     * 收件人
+     */
+    private String customerUserName;
+
+    /**
+     * 联系人
+     */
+    private String productEngineerName;
+
+    /**
+     * 发件人
+     */
+    private String createUserName;
+
+    /**
+     * 日期
+     */
+    private Date dateNow;
+}

+ 62 - 0
business-entity/src/main/java/com/bsentity/dto/ComProductExportDto.java

@@ -0,0 +1,62 @@
+package com.bsentity.dto;
+
+import lombok.Data;
+
+import java.io.Serializable;
+import java.math.BigDecimal;
+
+/**
+ * 投诉产品信息
+ *
+ * @author Trj
+ */
+@Data
+public class ComProductExportDto implements Serializable {
+    public static final Long serialVersionUID = 1L;
+
+
+    /**
+     * 编号
+     */
+    private Integer no;
+
+    /**
+     * 订单号
+     */
+    private String oriOrderNo;
+
+    /**
+     * 合金
+     */
+    private String alloy;
+
+    /**
+     * 状态
+     */
+    private String isStatus;
+
+    /**
+     * 规格
+     */
+    private String specifications;
+
+
+    /**
+     * 允许退回重量
+     */
+    private BigDecimal mraWeight;
+
+    /**
+     * 退回原因
+     */
+    private String defect;
+
+
+    public BigDecimal getMraWeight() {
+        if (this.mraWeight != null && this.mraWeight.compareTo(BigDecimal.ZERO) != 0){
+            return mraWeight;
+        }else{
+            return BigDecimal.ZERO;
+        }
+    }
+}

+ 28 - 0
business-entity/src/main/java/com/bsentity/vo/ComProTempWordVo.java

@@ -0,0 +1,28 @@
+package com.bsentity.vo;
+
+import com.aspose.words.net.System.Data.DataTable;
+import lombok.Data;
+
+import java.io.Serializable;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 客诉单Word导出 - 模板vo
+ *
+ * @author Trj
+ */
+@Data
+public class ComProTempWordVo implements Serializable {
+    private static final Long serialVersionUID = 1L;
+
+    /**
+     *  模板 主表信息
+     */
+    private Map<String, String> singleDataMap;
+
+    /**
+     * 模板表格信息
+     */
+    private List<DataTable> listData;
+}

+ 130 - 0
business-entity/src/main/resources/mybatis/ComCustomerDao.xml

@@ -0,0 +1,130 @@
+<?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.rongwei.bscommon.sys.dao.ComCustomerDao">
+
+    <!-- 通用查询映射结果 -->
+    <resultMap id="BaseResultMap" type="com.bsentity.domin.ComCustomerDo">
+        <id column="ID" property="id" />
+        <result column="TENANTID" property="tenantid" />
+        <result column="ROPTION" property="roption" />
+        <result column="DELETED" property="deleted" />
+        <result column="REMARK" property="remark" />
+        <result column="CREATEDATE" property="createdate" />
+        <result column="CREATEUSERID" property="createuserid" />
+        <result column="MODIFYDATE" property="modifydate" />
+        <result column="MODIFYUSERID" property="modifyuserid" />
+        <result column="CREATEUSERNAME" property="createusername" />
+        <result column="MODIFYUSERNAME" property="modifyusername" />
+        <result column="COMNO" property="comno" />
+        <result column="CUSTOMERNAME" property="customername" />
+        <result column="DELIVERYDATE" property="deliverydate" />
+        <result column="COMDATE" property="comdate" />
+        <result column="TAKEEFFECTDATE" property="takeeffectdate" />
+        <result column="COMMSG" property="commsg" />
+        <result column="ISEFFECTIVE" property="iseffective" />
+        <result column="ISOTHEREXPENSES" property="isotherexpenses" />
+        <result column="OTHEREXPENSESUSD" property="otherexpensesusd" />
+        <result column="OTHEREXPENSESRMB" property="otherexpensesrmb" />
+        <result column="CONFIRMCONTENT" property="confirmcontent" />
+        <result column="CONRESULT" property="conresult" />
+        <result column="INSTRUCTIONS" property="instructions" />
+        <result column="FINALSTATE" property="finalstate" />
+        <result column="ISCONSISTENTMRA" property="isconsistentmra" />
+        <result column="FILESIGNIN" property="filesignin" />
+        <result column="FILEPRODUCTENGINEER" property="fileproductengineer" />
+        <result column="FILECUSTOMERSERVICE" property="filecustomerservice" />
+        <result column="FILEFINANCE" property="filefinance" />
+        <result column="FILELEADEXAMINE" property="fileleadexamine" />
+        <result column="FILEFINALLY" property="filefinally" />
+        <result column="FILEFINANCERECHECK" property="filefinancerecheck" />
+        <result column="ISENTERPPM" property="isenterppm" />
+        <result column="PPMDATE" property="ppmdate" />
+        <result column="MARKETINGMANAGER" property="marketingmanager" />
+        <result column="MARKETINGMANAGERID" property="marketingmanagerid" />
+        <result column="MRASETOUTDATE" property="mrasetoutdate" />
+        <result column="CUSTOMERID" property="customerid" />
+        <result column="PRODUCTENGINEERID" property="productengineerid" />
+        <result column="PRODUCTENGINEERNAME" property="productengineername" />
+        <result column="CUSTOMERSERVICEID" property="customerserviceid" />
+        <result column="CUSTOMERSERVICENAME" property="customerservicename" />
+        <result column="PRODUCTTECHINCALMANAGERID" property="producttechincalmanagerid" />
+        <result column="PRODUCTTECHINCALMANAGERNAME" property="producttechincalmanagername" />
+        <result column="PROCESSQUALITYMANAGERID" property="processqualitymanagerid" />
+        <result column="PROCESSQUALITYMANAGERNAME" property="processqualitymanagername" />
+        <result column="PROCESSINSTID" property="processinstid" />
+        <result column="PROCESSINSTSTATUS" property="processinststatus" />
+        <result column="STATUS" property="status" />
+        <result column="COMPUTECOSTRMB" property="computecostrmb" />
+        <result column="COMPUTECOSTUSD" property="computecostusd" />
+        <result column="TOTALCOSTRMB" property="totalcostrmb" />
+        <result column="PRICETOTALUSD" property="pricetotalusd" />
+        <result column="OTHERCOSTRMB" property="othercostrmb" />
+        <result column="OTHERCOSTUSD" property="othercostusd" />
+        <result column="RECHECKCOMPUTECOSTRMB" property="recheckcomputecostrmb" />
+        <result column="RECHECKCOMPUTECOSTUSD" property="recheckcomputecostusd" />
+        <result column="RECHECKTOTALCOSTRMB" property="rechecktotalcostrmb" />
+        <result column="RECHECKPRICETOTALUSD" property="recheckpricetotalusd" />
+        <result column="RECHECKOTHERCOSTRMB" property="recheckothercostrmb" />
+        <result column="RECHECKOTHERCOSTUSD" property="recheckothercostusd" />
+        <result column="COMWEIGHT" property="comweight" />
+        <result column="FINALWEIGHT" property="finalweight" />
+        <result column="COMTYPE" property="comtype" />
+        <result column="PRINTNO" property="printNo" />
+    </resultMap>
+
+
+    <!-- 通过主表ids 查询 客户、客诉单信息 -->
+    <select id="getCustomerByIds" resultType="com.bsentity.dto.ComExportMasterDto">
+        SELECT
+            m.PRINTNO,GROUP_CONCAT(m.COMNO SEPARATOR '、') as comNo,m.CUSTOMERNAME,m.CREATEUSERNAME,m.PRODUCTENGINEERNAME,c.CUSTOMERUSERNAME ,DATE_FORMAT(NOW(),'%Y-%m-%d') AS DATENOW
+        FROM
+            com_customer m
+                LEFT JOIN com_customer_config c ON m.CUSTOMERID = c.ID
+        <where>
+            m.DELETED  = '0'
+            AND c.DELETED = '0'
+            <if test="ids != null and ids.size > 0" >
+                AND m.ID IN
+                <foreach collection="ids" item="id" open="(" separator="," close=")">
+                    #{id}
+                </foreach>
+            </if>
+        </where>
+        GROUP BY m.CUSTOMERID
+        ORDER BY m.PRINTNO
+    </select>
+
+    <!-- 根据主表id, 查询商品信息   -->
+    <select id="getProductByIds" resultType="com.bsentity.dto.ComProductExportDto">
+        SELECT
+            (@row_number:=@row_number+1) as NO , p.ORIORDERNO , p.ALLOY , p.ISSTATUS , CONCAT(p.THICK,"*",p.WIDE,"*",p.LONGS) AS specifications , p.MRAWEIGHT , p.DEFECT
+        FROM
+            com_metal_product p,
+            (SELECT @row_number:=0) as t
+        <where>
+            p.DELETED = '0'
+            <if test="ids != null and ids.size > 0" >
+                AND p.CUSTOMERID IN
+                <foreach collection="ids" item="id" open="(" separator="," close=")">
+                    #{id}
+                </foreach>
+            </if>
+        </where>
+        ORDER BY p.ORIORDERNO
+    </select>
+
+
+
+    <update id="updatePrintNoByIds">
+        UPDATE com_customer SET PRINTNO = #{printNo}
+        <where>
+            <if test="ids != null  and ids.size > 0">
+                ID IN
+                <foreach collection="ids" item="id" open="(" separator="," close=")">
+                    #{id}
+                </foreach>
+            </if>
+        </where>
+    </update>
+
+</mapper>

+ 4 - 0
business-entity/src/main/resources/mybatis/ExportDao.xml

@@ -0,0 +1,4 @@
+<?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.rongwei.bscommon.sys.dao.ExportDao">
+</mapper>

+ 37 - 0
business-server/src/main/java/com/rongwei/controller/ExportController.java

@@ -0,0 +1,37 @@
+package com.rongwei.controller;
+
+import com.bsentity.vo.ComProTempWordVo;
+import com.rongwei.bscommon.sys.dao.ExportDao;
+import com.rongwei.bscommon.sys.service.ExportService;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import javax.servlet.http.HttpServletResponse;
+import java.util.List;
+
+/**
+ * 导出
+ * @author Trj
+ */
+
+@RestController
+@RequestMapping("export")
+public class ExportController {
+    private final Logger log = LoggerFactory.getLogger(this.getClass().getName());
+
+
+    @Autowired
+    private ExportService exportService;
+
+    @PostMapping("word/ptar")
+    public void  comProductListTempWord(@RequestBody List<String> ids , HttpServletResponse response){
+        log.info("客诉单id Word导出 接口入参:{}",ids);
+
+        exportService.exportComProductListTempWord(ids,response);
+    }
+}

+ 5 - 3
business-server/src/main/resources/bootstrap.yml

@@ -1,18 +1,20 @@
 spring:
+  main:
+    allow-bean-definition-overriding: true
   profiles:
     active: dev
   application:
-    name: rw-business-server
+    name: rw-comCustomer-server
   jta:
     atomikos:
       properties:
-        log-base-name: rwbusinesslog
+        log-base-name: rwComCustomerLog
   servlet:
     multipart:
       max-file-size: 100MB
       max-request-size: 1000MB
 server:
-  port: 9689
+  port: 9890
 
 management:
   endpoints:

+ 13 - 0
business-server/src/main/resources/license.xml

@@ -0,0 +1,13 @@
+<License>
+    <Data>
+        <Products>
+            <Product>Aspose.Total for Java</Product>
+            <Product>Aspose.Words for Java</Product>
+        </Products>
+        <EditionType>Enterprise</EditionType>
+        <SubscriptionExpiry>20991231</SubscriptionExpiry>
+        <LicenseExpiry>20991231</LicenseExpiry>
+        <SerialNumber>8bfe198c-7f0c-4ef8-8ff0-acc3237bf0d7</SerialNumber>
+    </Data>
+    <Signature>sNLLKGMUdF0r8O1kKilWAGdgfs2BvJb/2Xp8p5iuDVfZXmhppo+d0Ran1P9TKdjV4ABwAgKXxJ3jcQTqE/2IRfqwnPf8itN8aFZlV3TJPYeD3yWE7IT55Gz6EijUpC7aKeoohTb4w2fpox58wWoF3SNp6sK6jDfiAUGEHYJ9pjU=</Signature>
+</License>

TEMPAT SAMPAH
business-server/src/main/resources/template/comProductlistTemp.docx