瀏覽代碼

报价单

lyhzzz 2 年之前
父節點
當前提交
2167e29362
共有 55 個文件被更改,包括 1295 次插入57 次删除
  1. 11 0
      pom.xml
  2. 6 0
      src/main/java/com/fdkankan/sale/common/CacheUtil.java
  3. 8 0
      src/main/java/com/fdkankan/sale/common/RequestBase.java
  4. 4 0
      src/main/java/com/fdkankan/sale/common/ResultCode.java
  5. 22 0
      src/main/java/com/fdkankan/sale/controller/FaultController.java
  6. 6 0
      src/main/java/com/fdkankan/sale/controller/RepairInfoController.java
  7. 55 5
      src/main/java/com/fdkankan/sale/controller/RepairInvoiceController.java
  8. 66 0
      src/main/java/com/fdkankan/sale/controller/RepairPayController.java
  9. 3 0
      src/main/java/com/fdkankan/sale/controller/RepairSaleController.java
  10. 90 0
      src/main/java/com/fdkankan/sale/entity/MailTemplate.java
  11. 0 2
      src/main/java/com/fdkankan/sale/entity/Repair.java
  12. 51 0
      src/main/java/com/fdkankan/sale/entity/RepairFault.java
  13. 17 0
      src/main/java/com/fdkankan/sale/entity/RepairInvoice.java
  14. 7 0
      src/main/java/com/fdkankan/sale/entity/RepairPay.java
  15. 1 1
      src/main/java/com/fdkankan/sale/generate/AutoGenerate.java
  16. 18 0
      src/main/java/com/fdkankan/sale/mapper/IMailTemplateMapper.java
  17. 18 0
      src/main/java/com/fdkankan/sale/mapper/IRepairFaultMapper.java
  18. 2 0
      src/main/java/com/fdkankan/sale/mapper/IRepairMapper.java
  19. 2 1
      src/main/java/com/fdkankan/sale/pay/wx/WechatPayService.java
  20. 25 0
      src/main/java/com/fdkankan/sale/service/IExcelService.java
  21. 17 0
      src/main/java/com/fdkankan/sale/service/IMailTemplateService.java
  22. 4 0
      src/main/java/com/fdkankan/sale/service/IPriceListService.java
  23. 21 0
      src/main/java/com/fdkankan/sale/service/IRepairFaultService.java
  24. 6 1
      src/main/java/com/fdkankan/sale/service/IRepairInvoiceService.java
  25. 1 1
      src/main/java/com/fdkankan/sale/service/IRepairLogService.java
  26. 5 0
      src/main/java/com/fdkankan/sale/service/IRepairPayService.java
  27. 3 4
      src/main/java/com/fdkankan/sale/service/IRepairService.java
  28. 2 0
      src/main/java/com/fdkankan/sale/service/ISysUserService.java
  29. 64 0
      src/main/java/com/fdkankan/sale/service/impl/ExcelServiceImpl.java
  30. 32 0
      src/main/java/com/fdkankan/sale/service/impl/MailTemplateServiceImpl.java
  31. 1 1
      src/main/java/com/fdkankan/sale/service/impl/PartServiceImpl.java
  32. 17 0
      src/main/java/com/fdkankan/sale/service/impl/PriceListServiceImpl.java
  33. 8 0
      src/main/java/com/fdkankan/sale/service/impl/RepairCustomerService.java
  34. 36 0
      src/main/java/com/fdkankan/sale/service/impl/RepairFaultServiceImpl.java
  35. 8 0
      src/main/java/com/fdkankan/sale/service/impl/RepairInfoService.java
  36. 82 5
      src/main/java/com/fdkankan/sale/service/impl/RepairInvoiceServiceImpl.java
  37. 5 7
      src/main/java/com/fdkankan/sale/service/impl/RepairLogServiceImpl.java
  38. 38 0
      src/main/java/com/fdkankan/sale/service/impl/RepairPayServiceImpl.java
  39. 33 5
      src/main/java/com/fdkankan/sale/service/impl/RepairPersonnelService.java
  40. 10 9
      src/main/java/com/fdkankan/sale/service/impl/RepairSaleService.java
  41. 32 9
      src/main/java/com/fdkankan/sale/service/impl/RepairServiceImpl.java
  42. 13 0
      src/main/java/com/fdkankan/sale/service/impl/SysUserServiceImpl.java
  43. 2 1
      src/main/java/com/fdkankan/sale/service/impl/UploadService.java
  44. 95 0
      src/main/java/com/fdkankan/sale/util/SendMailUtils.java
  45. 1 0
      src/main/java/com/fdkankan/sale/vo/request/CheckRegisterParam.java
  46. 24 0
      src/main/java/com/fdkankan/sale/vo/request/RepairInfoListParam.java
  47. 10 0
      src/main/java/com/fdkankan/sale/vo/request/RepairPayParam.java
  48. 12 0
      src/main/java/com/fdkankan/sale/vo/response/PriceListVo.java
  49. 131 1
      src/main/java/com/fdkankan/sale/vo/response/RepairInvoiceVo.java
  50. 94 0
      src/main/java/com/fdkankan/sale/vo/response/RepairPayVo.java
  51. 7 1
      src/main/java/com/fdkankan/sale/vo/response/RepairerVo.java
  52. 6 0
      src/main/resources/bootstrap.yml
  53. 5 0
      src/main/resources/mapper/sale/MailTemplateMapper.xml
  54. 5 0
      src/main/resources/mapper/sale/RepairFaultMapper.xml
  55. 53 3
      src/main/resources/mapper/sale/RepairMapper.xml

+ 11 - 0
pom.xml

@@ -140,6 +140,17 @@
             <version>3.10.3</version>
             <version>3.10.3</version>
         </dependency>
         </dependency>
 
 
+        <dependency>
+            <groupId>com.sun.mail</groupId>
+            <artifactId>javax.mail</artifactId>
+            <version>1.5.4</version>
+        </dependency>
+
+        <dependency>
+            <groupId>com.alibaba</groupId>
+            <artifactId>easyexcel</artifactId>
+            <version>3.1.0</version>
+        </dependency>
 
 
     </dependencies>
     </dependencies>
 
 

+ 6 - 0
src/main/java/com/fdkankan/sale/common/CacheUtil.java

@@ -1,5 +1,7 @@
 package com.fdkankan.sale.common;
 package com.fdkankan.sale.common;
 
 
+import com.fdkankan.sale.vo.request.RepairInvoiceParam;
+import com.fdkankan.sale.vo.request.RepairPayParam;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.beans.factory.annotation.Value;
 
 
 public class CacheUtil {
 public class CacheUtil {
@@ -9,4 +11,8 @@ public class CacheUtil {
     public static  String bucket;
     public static  String bucket;
     public static  String host;
     public static  String host;
     public static  String mainUrl;
     public static  String mainUrl;
+
+    public static RepairInvoiceParam invoiceParam = new RepairInvoiceParam();
+    public static RepairPayParam payParam = new RepairPayParam();
+
 }
 }

+ 8 - 0
src/main/java/com/fdkankan/sale/common/RequestBase.java

@@ -13,6 +13,14 @@ public class RequestBase implements Serializable {
 
 
     private int pageSize = 10;
     private int pageSize = 10;
 
 
+    private String orderBy = "id";
+
+    /**
+     * DESC-降序
+     * ASC-升序
+     */
+    private String sortBy = "DESC";
+
     private String startTime;
     private String startTime;
 
 
     private String endTime;
     private String endTime;

+ 4 - 0
src/main/java/com/fdkankan/sale/common/ResultCode.java

@@ -15,6 +15,9 @@ public enum ResultCode  {
     DATA_TOO_LONG(4009, "长度超出限制!"),
     DATA_TOO_LONG(4009, "长度超出限制!"),
 
 
     DEL_ROLE_ERROR(50035, "该角色已关联用户,不可删除。请先修改相关用户的角色!"),
     DEL_ROLE_ERROR(50035, "该角色已关联用户,不可删除。请先修改相关用户的角色!"),
+    MAIL_SEND_ERROR(50033, "邮件发送失败!"),
+    MAIL_TEMPLATE_ERROR(50006, "邮件发送模板不存在"),
+
     UPDATE_MYSELF_PASSWORD(50039, "只能修改自己的密码!"),
     UPDATE_MYSELF_PASSWORD(50039, "只能修改自己的密码!"),
     OLD_PASSWORD_ERROR(50037, "原密码错误"),
     OLD_PASSWORD_ERROR(50037, "原密码错误"),
     PART_NOT_EXITS(60001, "备件不存在"),
     PART_NOT_EXITS(60001, "备件不存在"),
@@ -30,6 +33,7 @@ public enum ResultCode  {
     ORDER_COMMENT_EXITS(60011, "该订单已评论"),
     ORDER_COMMENT_EXITS(60011, "该订单已评论"),
     ORDER_INVOICE_EXITS(60012, "该订单已申请开票"),
     ORDER_INVOICE_EXITS(60012, "该订单已申请开票"),
     ORDER_NOt_PAY(60013, "该订单未支付"),
     ORDER_NOt_PAY(60013, "该订单未支付"),
+    ORDER_INVOICE_OPEN(60013, "该订单已开票"),
 
 
 
 
 
 

+ 22 - 0
src/main/java/com/fdkankan/sale/controller/FaultController.java

@@ -0,0 +1,22 @@
+package com.fdkankan.sale.controller;
+
+import com.fdkankan.sale.common.Result;
+import com.fdkankan.sale.common.ResultData;
+import com.fdkankan.sale.service.IFaultService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+@RestController
+@RequestMapping("sale/fault")
+public class FaultController {
+
+    @Autowired
+    IFaultService faultService;
+
+    @GetMapping("/allList")
+    public ResultData allList(){
+        return ResultData.ok(faultService.list());
+    }
+}

+ 6 - 0
src/main/java/com/fdkankan/sale/controller/RepairInfoController.java

@@ -5,6 +5,7 @@ import com.fdkankan.sale.common.ResultData;
 import com.fdkankan.sale.exception.BusinessException;
 import com.fdkankan.sale.exception.BusinessException;
 import com.fdkankan.sale.service.IRepairService;
 import com.fdkankan.sale.service.IRepairService;
 import com.fdkankan.sale.service.impl.RepairInfoService;
 import com.fdkankan.sale.service.impl.RepairInfoService;
+import com.fdkankan.sale.vo.request.RepairInfoListParam;
 import lombok.Data;
 import lombok.Data;
 import org.apache.commons.lang3.StringUtils;
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -34,4 +35,9 @@ public class RepairInfoController {
 
 
         return ResultData.ok(repairInfoService.getProcessByRepairId(repairId));
         return ResultData.ok(repairInfoService.getProcessByRepairId(repairId));
     }
     }
+
+    @PostMapping("/list")
+    public ResultData list(@RequestBody RepairInfoListParam param){
+        return ResultData.ok(repairInfoService.pageList(param));
+    }
 }
 }

+ 55 - 5
src/main/java/com/fdkankan/sale/controller/RepairInvoiceController.java

@@ -1,16 +1,26 @@
 package com.fdkankan.sale.controller;
 package com.fdkankan.sale.controller;
 
 
 
 
+import com.alibaba.excel.EasyExcel;
+import com.alibaba.excel.ExcelWriter;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.dtflys.forest.annotation.Get;
+import com.fdkankan.sale.common.CacheUtil;
+import com.fdkankan.sale.common.PageInfo;
+import com.fdkankan.sale.common.ResultCode;
 import com.fdkankan.sale.common.ResultData;
 import com.fdkankan.sale.common.ResultData;
 import com.fdkankan.sale.entity.RepairInvoice;
 import com.fdkankan.sale.entity.RepairInvoice;
+import com.fdkankan.sale.exception.BusinessException;
+import com.fdkankan.sale.service.IExcelService;
 import com.fdkankan.sale.service.IRepairInvoiceService;
 import com.fdkankan.sale.service.IRepairInvoiceService;
 import com.fdkankan.sale.vo.request.RepairInvoiceParam;
 import com.fdkankan.sale.vo.request.RepairInvoiceParam;
+import com.fdkankan.sale.vo.response.RepairInvoiceVo;
 import org.springframework.beans.factory.annotation.Autowired;
 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.*;
 
 
-import org.springframework.web.bind.annotation.RestController;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.io.IOException;
 
 
 /**
 /**
  * <p>
  * <p>
@@ -26,11 +36,51 @@ public class RepairInvoiceController extends BaseController {
 
 
     @Autowired
     @Autowired
     IRepairInvoiceService repairInvoiceService;
     IRepairInvoiceService repairInvoiceService;
+    @Autowired
+    IExcelService excelService;
 
 
     @PostMapping("/list")
     @PostMapping("/list")
     public ResultData list(@RequestBody RepairInvoiceParam param){
     public ResultData list(@RequestBody RepairInvoiceParam param){
+        CacheUtil.invoiceParam = param;
+        return ResultData.ok(PageInfo.PageInfo(repairInvoiceService.pageList(param)));
+    }
+
+    @PostMapping("/open")
+    public ResultData open(@RequestBody RepairInvoice param  ){
+        repairInvoiceService.open(param,getUserId());
+        return ResultData.ok();
+    }
+
+    /**
+     * 导出发票申请
+     */
+    @PostMapping("/export")
+    public void export(HttpServletRequest request, HttpServletResponse response) throws Exception {
+        RepairInvoiceParam param = CacheUtil.invoiceParam ;
+        param.setPageNum(1);
+        param.setPageSize(500);
+        Page<RepairInvoiceVo> voPage = repairInvoiceService.pageList(param);
+
+        ExcelWriter excelWriter = null;
+        try {
+            excelWriter = EasyExcel.write(response.getOutputStream(),RepairInvoiceVo.class).build();
+            for (int pageNum = 1; pageNum <= voPage.getPages(); pageNum ++ ) {
+                if(pageNum >1){
+                    param.setPageNum(pageNum);
+                    voPage = repairInvoiceService.pageList(param);
+                }
+                excelService.commonExport(request,response,"开票申请数据",voPage.getRecords(),excelWriter);
+            }
+
+        }catch (Exception e){
+            e.printStackTrace();
+        }finally {
+            if(excelWriter != null){
+                excelWriter.finish();
+            }
+        }
 
 
-        return ResultData.ok(repairInvoiceService.pageList(param));
     }
     }
+
 }
 }
 
 

+ 66 - 0
src/main/java/com/fdkankan/sale/controller/RepairPayController.java

@@ -0,0 +1,66 @@
+package com.fdkankan.sale.controller;
+
+import com.alibaba.excel.EasyExcel;
+import com.alibaba.excel.ExcelWriter;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.fdkankan.sale.common.CacheUtil;
+import com.fdkankan.sale.common.PageInfo;
+import com.fdkankan.sale.common.ResultData;
+import com.fdkankan.sale.service.IExcelService;
+import com.fdkankan.sale.service.IRepairPayService;
+import com.fdkankan.sale.vo.request.RepairInvoiceParam;
+import com.fdkankan.sale.vo.request.RepairPayParam;
+import com.fdkankan.sale.vo.response.RepairInvoiceVo;
+import com.fdkankan.sale.vo.response.RepairPayVo;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+@RestController
+@RequestMapping("/sale/repairPay")
+public class RepairPayController {
+
+    @Autowired
+    IRepairPayService repairPayService;
+    @Autowired
+    IExcelService excelService;
+
+    @PostMapping("/list")
+    public ResultData list(@RequestBody RepairPayParam param){
+        CacheUtil.payParam = param;
+        return ResultData.ok(PageInfo.PageInfo(repairPayService.pageList(param)));
+    }
+
+    /**
+     * 导出发票申请
+     */
+    @PostMapping("/export")
+    public void export(HttpServletRequest request, HttpServletResponse response) throws Exception {
+        RepairPayParam param =CacheUtil.payParam  ;
+        param.setPageNum(1);
+        param.setPageSize(500);
+        Page<RepairPayVo> voPage = repairPayService.pageList(param);
+
+        ExcelWriter excelWriter = null;
+        try {
+            excelWriter = EasyExcel.write(response.getOutputStream(),RepairPayVo.class).build();
+            for (int pageNum = 1; pageNum <= voPage.getPages(); pageNum ++ ) {
+                if(pageNum >1){
+                    param.setPageNum(pageNum);
+                    voPage = repairPayService.pageList(param);
+                }
+                excelService.commonExport(request,response,"开票申请数据",voPage.getRecords(),excelWriter);
+            }
+
+        }catch (Exception e){
+            e.printStackTrace();
+        }finally {
+            if(excelWriter != null){
+                excelWriter.finish();
+            }
+        }
+
+    }
+}

+ 3 - 0
src/main/java/com/fdkankan/sale/controller/RepairSaleController.java

@@ -29,6 +29,8 @@ public class RepairSaleController extends BaseController{
 
 
     @Autowired
     @Autowired
     RepairSaleService repairSaleService;
     RepairSaleService repairSaleService;
+    @Autowired
+    IRepairService repairService;
 
 
     /**
     /**
      * 售后工程师
      * 售后工程师
@@ -62,6 +64,7 @@ public class RepairSaleController extends BaseController{
         LambdaUpdateWrapper<Repair> wrapper = new LambdaUpdateWrapper<>();
         LambdaUpdateWrapper<Repair> wrapper = new LambdaUpdateWrapper<>();
         wrapper.eq(Repair::getRepairId,param.getRepairId());
         wrapper.eq(Repair::getRepairId,param.getRepairId());
         wrapper.set(Repair::getRemark,param.getRemark());
         wrapper.set(Repair::getRemark,param.getRemark());
+        repairService.update(wrapper);
         return ResultData.ok();
         return ResultData.ok();
     }
     }
 
 

+ 90 - 0
src/main/java/com/fdkankan/sale/entity/MailTemplate.java

@@ -0,0 +1,90 @@
+package com.fdkankan.sale.entity;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableLogic;
+import com.baomidou.mybatisplus.annotation.TableName;
+import java.io.Serializable;
+import java.util.Date;
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * <p>
+ * 
+ * </p>
+ *
+ * @author 
+ * @since 2023-02-23
+ */
+@Getter
+@Setter
+@TableName("t_mail_template")
+public class MailTemplate implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    @TableId(value = "id", type = IdType.AUTO)
+    private Integer id;
+
+    /**
+     * 发件人邮箱
+     */
+    @TableField("send_mail")
+    private String sendMail;
+
+    /**
+     * 发件人邮箱密码
+     */
+    @TableField("send_password")
+    private String sendPassword;
+
+    /**
+     * 发件人主机
+     */
+    @TableField("send_host")
+    private String sendHost;
+
+    /**
+     * 收件主题
+     */
+    @TableField("subject")
+    private String subject;
+
+    /**
+     * 邮件内容
+     */
+    @TableField("msg")
+    private String msg;
+
+    @TableField("rec_status")
+    @TableLogic(value = "A",delval = "I")
+    private String recStatus;
+
+    @TableField("create_time")
+    private Date createTime;
+
+    @TableField("update_time")
+    private Date updateTime;
+
+    /**
+     * 备注
+     */
+    @TableField("remark")
+    private String remark;
+
+    /**
+     * 0订单发票,1深时演示场景,2验证码,3权益会员过期
+     */
+    @TableField("type")
+    private Integer type;
+
+    /**
+     * zh 中文,en英文
+     */
+    @TableField("lang")
+    private String lang;
+
+
+}

+ 0 - 2
src/main/java/com/fdkankan/sale/entity/Repair.java

@@ -56,8 +56,6 @@ public class Repair implements Serializable {
     @TableField("fault_img")
     @TableField("fault_img")
     private String faultImg;
     private String faultImg;
 
 
-
-
     /**
     /**
      * 状态0待接单,1待检测,2待报价,3待确认,4已取消,5待备料,6待回收,7维修中,8待测试,9已完成,10待收货,11已发货,12已评价
      * 状态0待接单,1待检测,2待报价,3待确认,4已取消,5待备料,6待回收,7维修中,8待测试,9已完成,10待收货,11已发货,12已评价
      */
      */

+ 51 - 0
src/main/java/com/fdkankan/sale/entity/RepairFault.java

@@ -0,0 +1,51 @@
+package com.fdkankan.sale.entity;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableLogic;
+import com.baomidou.mybatisplus.annotation.TableName;
+import java.io.Serializable;
+import java.util.Date;
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * <p>
+ * 
+ * </p>
+ *
+ * @author 
+ * @since 2023-02-23
+ */
+@Getter
+@Setter
+@TableName("t_repair_fault")
+public class RepairFault implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    @TableId(value = "repair_fault_id", type = IdType.AUTO)
+    private Integer repairFaultId;
+
+    @TableField("repair_id")
+    private String repairId;
+
+    @TableField("repair_register_id")
+    private Integer repairRegisterId;
+
+    @TableField("fault_id")
+    private Integer faultId;
+
+    @TableField("rec_status")
+    @TableLogic(value = "A",delval = "I")
+    private String recStatus;
+
+    @TableField("create_time")
+    private Date createTime;
+
+    @TableField("update_time")
+    private Date updateTime;
+
+
+}

+ 17 - 0
src/main/java/com/fdkankan/sale/entity/RepairInvoice.java

@@ -94,6 +94,21 @@ public class RepairInvoice implements Serializable {
      */
      */
     @TableField("phone")
     @TableField("phone")
     private String phone;
     private String phone;
+    /**
+     * 企业电话
+     */
+    @TableField("invoice_no")
+    private String invoiceNo;
+    /**
+     * 企业电话
+     */
+    @TableField("tracking_num")
+    private String trackingNum;
+    /**
+     * 企业电话
+     */
+    @TableField("e_invoice_img")
+    private String eInvoiceImg;
 
 
     @TableField("rec_status")
     @TableField("rec_status")
     @TableLogic(value = "A",delval = "I")
     @TableLogic(value = "A",delval = "I")
@@ -105,5 +120,7 @@ public class RepairInvoice implements Serializable {
     @TableField("update_time")
     @TableField("update_time")
     private String updateTime;
     private String updateTime;
 
 
+    @TableField("sys_user_id")
+    private Long sysUserId;
 
 
 }
 }

+ 7 - 0
src/main/java/com/fdkankan/sale/entity/RepairPay.java

@@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.annotation.TableId;
 import com.baomidou.mybatisplus.annotation.TableLogic;
 import com.baomidou.mybatisplus.annotation.TableLogic;
 import com.baomidou.mybatisplus.annotation.TableName;
 import com.baomidou.mybatisplus.annotation.TableName;
 import java.io.Serializable;
 import java.io.Serializable;
+import java.math.BigDecimal;
 import java.util.Date;
 import java.util.Date;
 import lombok.Getter;
 import lombok.Getter;
 import lombok.Setter;
 import lombok.Setter;
@@ -71,6 +72,12 @@ public class RepairPay implements Serializable {
     @TableField("create_time")
     @TableField("create_time")
     private String createTime;
     private String createTime;
 
 
+    @TableField("pay_time")
+    private String payTime;
+
+    @TableField("pay_amount")
+    private BigDecimal payAmount;
+
     @TableField("update_time")
     @TableField("update_time")
     private String updateTime;
     private String updateTime;
 
 

+ 1 - 1
src/main/java/com/fdkankan/sale/generate/AutoGenerate.java

@@ -18,7 +18,7 @@ public class AutoGenerate {
         String path =System.getProperty("user.dir");
         String path =System.getProperty("user.dir");
 
 
         generate(path,"sale", getTables(new String[]{
         generate(path,"sale", getTables(new String[]{
-                "t_repair_invoice"
+                "t_repair_fault"
         }));
         }));
 
 
 //        generate(path,"goods", getTables(new String[]{
 //        generate(path,"goods", getTables(new String[]{

+ 18 - 0
src/main/java/com/fdkankan/sale/mapper/IMailTemplateMapper.java

@@ -0,0 +1,18 @@
+package com.fdkankan.sale.mapper;
+
+import com.fdkankan.sale.entity.MailTemplate;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.apache.ibatis.annotations.Mapper;
+
+/**
+ * <p>
+ *  Mapper 接口
+ * </p>
+ *
+ * @author 
+ * @since 2023-02-23
+ */
+@Mapper
+public interface IMailTemplateMapper extends BaseMapper<MailTemplate> {
+
+}

+ 18 - 0
src/main/java/com/fdkankan/sale/mapper/IRepairFaultMapper.java

@@ -0,0 +1,18 @@
+package com.fdkankan.sale.mapper;
+
+import com.fdkankan.sale.entity.RepairFault;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.apache.ibatis.annotations.Mapper;
+
+/**
+ * <p>
+ *  Mapper 接口
+ * </p>
+ *
+ * @author 
+ * @since 2023-02-23
+ */
+@Mapper
+public interface IRepairFaultMapper extends BaseMapper<RepairFault> {
+
+}

+ 2 - 0
src/main/java/com/fdkankan/sale/mapper/IRepairMapper.java

@@ -3,6 +3,7 @@ package com.fdkankan.sale.mapper;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.fdkankan.sale.entity.Repair;
 import com.fdkankan.sale.entity.Repair;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.fdkankan.sale.vo.request.RepairInfoListParam;
 import com.fdkankan.sale.vo.request.RepairParam;
 import com.fdkankan.sale.vo.request.RepairParam;
 import com.fdkankan.sale.vo.response.RepairerVo;
 import com.fdkankan.sale.vo.response.RepairerVo;
 import org.apache.ibatis.annotations.Mapper;
 import org.apache.ibatis.annotations.Mapper;
@@ -26,4 +27,5 @@ public interface IRepairMapper extends BaseMapper<Repair> {
 
 
     Page<RepairerVo> testOrderList(Page<Object> page, RepairParam param);
     Page<RepairerVo> testOrderList(Page<Object> page, RepairParam param);
 
 
+    Page<RepairerVo> pageInfoList(Page<Object> page, RepairInfoListParam param);
 }
 }

+ 2 - 1
src/main/java/com/fdkankan/sale/pay/wx/WechatPayService.java

@@ -58,14 +58,15 @@ public class WechatPayService {
             throw new BusinessException(ResultCode.ORDER_PAY_ERROR);
             throw new BusinessException(ResultCode.ORDER_PAY_ERROR);
         }
         }
         String orderSn = "sale_"+DateUtil.getDate();
         String orderSn = "sale_"+DateUtil.getDate();
+        BigDecimal amount = priceListService.getAmountByRepairId(param.getRepairId());
 
 
         repairPay = new RepairPay();
         repairPay = new RepairPay();
         repairPay.setRepairId(param.getRepairId());
         repairPay.setRepairId(param.getRepairId());
         repairPay.setPayType(1);
         repairPay.setPayType(1);
         repairPay.setOrderSn(orderSn);
         repairPay.setOrderSn(orderSn);
+        repairPay.setPayAmount(amount);
         repairPayService.save(repairPay);
         repairPayService.save(repairPay);
 
 
-        BigDecimal amount = priceListService.getAmountByRepairId(param.getRepairId());
         String subject = "维修订单";
         String subject = "维修订单";
         BigDecimal totalFee = amount.multiply(new BigDecimal(100));
         BigDecimal totalFee = amount.multiply(new BigDecimal(100));
         String body = subject;
         String body = subject;

+ 25 - 0
src/main/java/com/fdkankan/sale/service/IExcelService.java

@@ -0,0 +1,25 @@
+package com.fdkankan.sale.service;
+
+import com.alibaba.excel.ExcelWriter;
+import org.springframework.web.multipart.MultipartFile;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.io.IOException;
+import java.util.List;
+
+/**
+ * <p>
+ * TODO
+ * </p>
+ *
+ * @author dengsixing
+ * @since 2022/6/6
+ **/
+public interface IExcelService {
+
+    void commonExport(HttpServletRequest request, HttpServletResponse response, String name, List<?> result, ExcelWriter excelWriter) throws Exception ;
+
+    void commonExport(HttpServletRequest request, HttpServletResponse response,String name,List<?> result,Class<?> clazz) throws Exception;
+
+}

+ 17 - 0
src/main/java/com/fdkankan/sale/service/IMailTemplateService.java

@@ -0,0 +1,17 @@
+package com.fdkankan.sale.service;
+
+import com.fdkankan.sale.entity.MailTemplate;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+/**
+ * <p>
+ *  服务类
+ * </p>
+ *
+ * @author 
+ * @since 2023-02-23
+ */
+public interface IMailTemplateService extends IService<MailTemplate> {
+
+    Boolean sendMail(String invoiceEmail, MailTemplate mailTemplate, String eInvoiceImg);
+}

+ 4 - 0
src/main/java/com/fdkankan/sale/service/IPriceListService.java

@@ -19,4 +19,8 @@ public interface IPriceListService extends IService<PriceList> {
     List<PriceList> getByRepairId(String repairId);
     List<PriceList> getByRepairId(String repairId);
 
 
     BigDecimal getAmountByRepairId(String repairId);
     BigDecimal getAmountByRepairId(String repairId);
+
+    void updateStatusByRepairId(String repairId);
+
+    List<PriceList> getByRepairIdAndStatus(String repairId, Integer status);
 }
 }

+ 21 - 0
src/main/java/com/fdkankan/sale/service/IRepairFaultService.java

@@ -0,0 +1,21 @@
+package com.fdkankan.sale.service;
+
+import com.fdkankan.sale.entity.RepairFault;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+import java.util.List;
+
+/**
+ * <p>
+ *  服务类
+ * </p>
+ *
+ * @author 
+ * @since 2023-02-23
+ */
+public interface IRepairFaultService extends IService<RepairFault> {
+
+    void delByRepairId(String repairId);
+
+    List<RepairFault> getByFaultId(Integer faultId);
+}

+ 6 - 1
src/main/java/com/fdkankan/sale/service/IRepairInvoiceService.java

@@ -1,8 +1,10 @@
 package com.fdkankan.sale.service;
 package com.fdkankan.sale.service;
 
 
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.fdkankan.sale.entity.RepairInvoice;
 import com.fdkankan.sale.entity.RepairInvoice;
 import com.baomidou.mybatisplus.extension.service.IService;
 import com.baomidou.mybatisplus.extension.service.IService;
 import com.fdkankan.sale.vo.request.RepairInvoiceParam;
 import com.fdkankan.sale.vo.request.RepairInvoiceParam;
+import com.fdkankan.sale.vo.response.RepairInvoiceVo;
 
 
 /**
 /**
  * <p>
  * <p>
@@ -16,5 +18,8 @@ public interface IRepairInvoiceService extends IService<RepairInvoice> {
 
 
     RepairInvoice getByRepairId(String repairId);
     RepairInvoice getByRepairId(String repairId);
 
 
-    Object pageList(RepairInvoiceParam param);
+    Page<RepairInvoiceVo> pageList(RepairInvoiceParam param);
+
+    void open(RepairInvoice repairInvoice, Long userId);
+
 }
 }

+ 1 - 1
src/main/java/com/fdkankan/sale/service/IRepairLogService.java

@@ -18,7 +18,7 @@ public interface IRepairLogService extends IService<RepairLog> {
 
 
     void saveBySysUser(Long sysUserId, String repairId,Integer repairStatus,String remark);
     void saveBySysUser(Long sysUserId, String repairId,Integer repairStatus,String remark);
 
 
-    RepairLog getByRepairIdAndStatus(String repairId, Integer status);
+    List<RepairLog> getByRepairIdAndStatus(String repairId, Integer status);
 
 
     List<RepairLog> getByRepairId(String repairId);
     List<RepairLog> getByRepairId(String repairId);
 
 

+ 5 - 0
src/main/java/com/fdkankan/sale/service/IRepairPayService.java

@@ -1,7 +1,10 @@
 package com.fdkankan.sale.service;
 package com.fdkankan.sale.service;
 
 
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.fdkankan.sale.entity.RepairPay;
 import com.fdkankan.sale.entity.RepairPay;
 import com.baomidou.mybatisplus.extension.service.IService;
 import com.baomidou.mybatisplus.extension.service.IService;
+import com.fdkankan.sale.vo.request.RepairPayParam;
+import com.fdkankan.sale.vo.response.RepairPayVo;
 
 
 /**
 /**
  * <p>
  * <p>
@@ -18,4 +21,6 @@ public interface IRepairPayService extends IService<RepairPay> {
     RepairPay getByOrderSn(String out_trade_no);
     RepairPay getByOrderSn(String out_trade_no);
 
 
     void updatePayStatus(String out_trade_no, String trade_no, String openid);
     void updatePayStatus(String out_trade_no, String trade_no, String openid);
+
+    Page<RepairPayVo> pageList(RepairPayParam param);
 }
 }

+ 3 - 4
src/main/java/com/fdkankan/sale/service/IRepairService.java

@@ -6,10 +6,7 @@ import com.fdkankan.sale.common.PageInfo;
 import com.fdkankan.sale.entity.OrderReceiving;
 import com.fdkankan.sale.entity.OrderReceiving;
 import com.fdkankan.sale.entity.Repair;
 import com.fdkankan.sale.entity.Repair;
 import com.baomidou.mybatisplus.extension.service.IService;
 import com.baomidou.mybatisplus.extension.service.IService;
-import com.fdkankan.sale.vo.request.CheckRegisterParam;
-import com.fdkankan.sale.vo.request.OrderReceivingParam;
-import com.fdkankan.sale.vo.request.RecordingParam;
-import com.fdkankan.sale.vo.request.RepairParam;
+import com.fdkankan.sale.vo.request.*;
 import com.fdkankan.sale.vo.response.RepairerVo;
 import com.fdkankan.sale.vo.response.RepairerVo;
 
 
 /**
 /**
@@ -39,4 +36,6 @@ public interface IRepairService extends IService<Repair> {
     void updateCommentStatus(String repairId);
     void updateCommentStatus(String repairId);
 
 
     void updateInvoiceStatus(String repairId);
     void updateInvoiceStatus(String repairId);
+
+    Page<RepairerVo> pageInfoList(RepairInfoListParam param);
 }
 }

+ 2 - 0
src/main/java/com/fdkankan/sale/service/ISysUserService.java

@@ -34,4 +34,6 @@ public interface ISysUserService extends IService<SysUser> {
     void saveByRedisKey(String redisKey);
     void saveByRedisKey(String redisKey);
 
 
     SysUser getByManageId(Long userId);
     SysUser getByManageId(Long userId);
+
+    HashMap<Long, SysUser> getMapByIds(Set<Long> userIds);
 }
 }

+ 64 - 0
src/main/java/com/fdkankan/sale/service/impl/ExcelServiceImpl.java

@@ -0,0 +1,64 @@
+package com.fdkankan.sale.service.impl;
+
+import com.alibaba.excel.EasyExcel;
+import com.alibaba.excel.ExcelWriter;
+import com.alibaba.excel.write.metadata.WriteSheet;
+import com.fdkankan.sale.service.IExcelService;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.web.multipart.MultipartFile;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.net.URLEncoder;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+
+/**
+ * <p>
+ * TODO
+ * </p>
+ *
+ * @author dengsixing
+ * @since 2022/6/6
+ **/
+@Service
+@Slf4j
+public class ExcelServiceImpl implements IExcelService {
+
+
+    public void commonExport(HttpServletRequest request, HttpServletResponse response,String name,List<?> result,ExcelWriter excelWriter) throws Exception {
+        response.setContentType("application/vnd.ms-excel");
+        response.setCharacterEncoding("utf-8");
+        String fileName = name  + ".xlsx";
+        fileName = URLEncoder.encode(fileName, "UTF-8");
+        response.setHeader("Content-disposition", "attachment;filename=" + fileName);
+        WriteSheet writeSheet = EasyExcel.writerSheet(name).build();
+        excelWriter.write(result, writeSheet);
+    }
+
+    public void commonExport(HttpServletRequest request, HttpServletResponse response,String name,List<?> result,Class<?> clazz) throws Exception {
+        response.setContentType("application/vnd.ms-excel");
+        response.setCharacterEncoding("utf-8");
+        String fileName = name  + ".xlsx";
+        fileName = URLEncoder.encode(fileName, "UTF-8");
+        response.setHeader("Content-disposition", "attachment;filename=" + fileName);
+        ExcelWriter excelWriter = null;
+        try {
+            excelWriter = EasyExcel.write(response.getOutputStream(), clazz).build();
+            WriteSheet writeSheet = EasyExcel.writerSheet(name).build();
+            excelWriter.write(result, writeSheet);
+        }catch (Exception e){
+            e.printStackTrace();
+        }finally {
+            if(excelWriter != null){
+                excelWriter.finish();
+            }
+        }
+    }
+
+
+}

+ 32 - 0
src/main/java/com/fdkankan/sale/service/impl/MailTemplateServiceImpl.java

@@ -0,0 +1,32 @@
+package com.fdkankan.sale.service.impl;
+
+import com.fdkankan.sale.common.ResultCode;
+import com.fdkankan.sale.entity.MailTemplate;
+import com.fdkankan.sale.exception.BusinessException;
+import com.fdkankan.sale.mapper.IMailTemplateMapper;
+import com.fdkankan.sale.service.IMailTemplateService;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.fdkankan.sale.util.SendMailUtils;
+import org.springframework.stereotype.Service;
+
+/**
+ * <p>
+ *  服务实现类
+ * </p>
+ *
+ * @author 
+ * @since 2023-02-23
+ */
+@Service
+public class MailTemplateServiceImpl extends ServiceImpl<IMailTemplateMapper, MailTemplate> implements IMailTemplateService {
+
+
+    @Override
+    public Boolean sendMail(String email , MailTemplate mailTemplate, String file) {
+        if(mailTemplate == null){
+            throw new BusinessException(ResultCode.MAIL_TEMPLATE_ERROR);
+        }
+        return SendMailUtils.sendMail(mailTemplate.getSendMail(), mailTemplate.getSendPassword(), mailTemplate.getSendHost(),
+                email, mailTemplate.getSubject(), mailTemplate.getMsg(), file);
+    }
+}

+ 1 - 1
src/main/java/com/fdkankan/sale/service/impl/PartServiceImpl.java

@@ -50,7 +50,7 @@ public class PartServiceImpl extends ServiceImpl<IPartMapper, Part> implements I
             throw new BusinessException(ResultCode.MISSING_REQUIRED_PARAMETERS);
             throw new BusinessException(ResultCode.MISSING_REQUIRED_PARAMETERS);
         }
         }
         LambdaQueryWrapper<Part> wrapper = getWrapper(param);
         LambdaQueryWrapper<Part> wrapper = getWrapper(param);
-        wrapper.eq(Part::getCameraType,0);
+        wrapper.eq(Part::getCameraType,param.getCameraType());
         wrapper.eq(Part::getStatus,0);
         wrapper.eq(Part::getStatus,0);
         return this.list(wrapper);
         return this.list(wrapper);
     }
     }

+ 17 - 0
src/main/java/com/fdkankan/sale/service/impl/PriceListServiceImpl.java

@@ -1,6 +1,7 @@
 package com.fdkankan.sale.service.impl;
 package com.fdkankan.sale.service.impl;
 
 
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
 import com.fdkankan.sale.entity.PriceList;
 import com.fdkankan.sale.entity.PriceList;
 import com.fdkankan.sale.mapper.IPriceListMapper;
 import com.fdkankan.sale.mapper.IPriceListMapper;
 import com.fdkankan.sale.service.IPriceListService;
 import com.fdkankan.sale.service.IPriceListService;
@@ -37,4 +38,20 @@ public class PriceListServiceImpl extends ServiceImpl<IPriceListMapper, PriceLis
         }
         }
         return amount;
         return amount;
     }
     }
+
+    @Override
+    public void updateStatusByRepairId(String repairId) {
+        LambdaUpdateWrapper<PriceList> wrapper = new LambdaUpdateWrapper<>();
+        wrapper.eq(PriceList::getRepairId,repairId);
+        wrapper.set(PriceList::getStatus,1);
+        this.update(wrapper);
+    }
+
+    @Override
+    public List<PriceList> getByRepairIdAndStatus(String repairId, Integer status) {
+        LambdaQueryWrapper<PriceList> wrapper = new LambdaQueryWrapper<>();
+        wrapper.eq(PriceList::getRepairId,repairId);
+        wrapper.eq(PriceList::getStatus,1);
+        return list(wrapper);
+    }
 }
 }

+ 8 - 0
src/main/java/com/fdkankan/sale/service/impl/RepairCustomerService.java

@@ -28,6 +28,8 @@ public class RepairCustomerService {
     IRepairInvoiceService repairInvoiceService;
     IRepairInvoiceService repairInvoiceService;
     @Autowired
     @Autowired
     IRepairPayService repairPayService;
     IRepairPayService repairPayService;
+    @Autowired
+    IPriceListService priceListService;
 
 
     public Object getRepairByOpenId(String openId) {
     public Object getRepairByOpenId(String openId) {
         List<Customer> list = customerService.getByOpenId(openId);
         List<Customer> list = customerService.getByOpenId(openId);
@@ -50,12 +52,18 @@ public class RepairCustomerService {
         if(repair == null){
         if(repair == null){
             throw new BusinessException(ResultCode.ORDER_PAY_NOT_EXITS);
             throw new BusinessException(ResultCode.ORDER_PAY_NOT_EXITS);
         }
         }
+        if(repair.getStatus() != 3){
+            throw new BusinessException(ResultCode.REPAIR_STATUS_NOT_EXITS);
+        }
         Integer repairStatus = 5;
         Integer repairStatus = 5;
         String remark = "确认维修";
         String remark = "确认维修";
         if(param.getConfirm() == 1 ){
         if(param.getConfirm() == 1 ){
             repairStatus = 4;
             repairStatus = 4;
             remark = "取消维修";
             remark = "取消维修";
         }
         }
+        if(repairStatus == 5){
+            priceListService.updateStatusByRepairId(repair.getRepairId());
+        }
         repairLogService.saveBySysUser(null,repair.getRepairId(),repairStatus,remark);
         repairLogService.saveBySysUser(null,repair.getRepairId(),repairStatus,remark);
     }
     }
 
 

+ 36 - 0
src/main/java/com/fdkankan/sale/service/impl/RepairFaultServiceImpl.java

@@ -0,0 +1,36 @@
+package com.fdkankan.sale.service.impl;
+
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.fdkankan.sale.entity.RepairFault;
+import com.fdkankan.sale.mapper.IRepairFaultMapper;
+import com.fdkankan.sale.service.IRepairFaultService;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+
+/**
+ * <p>
+ *  服务实现类
+ * </p>
+ *
+ * @author 
+ * @since 2023-02-23
+ */
+@Service
+public class RepairFaultServiceImpl extends ServiceImpl<IRepairFaultMapper, RepairFault> implements IRepairFaultService {
+
+    @Override
+    public void delByRepairId(String repairId) {
+        LambdaQueryWrapper<RepairFault> wrapper = new LambdaQueryWrapper<>();
+        wrapper.eq(RepairFault::getRepairId,repairId);
+        this.remove(wrapper);
+    }
+
+    @Override
+    public List<RepairFault> getByFaultId(Integer faultId) {
+        LambdaQueryWrapper<RepairFault> wrapper = new LambdaQueryWrapper<>();
+        wrapper.eq(RepairFault::getFaultId,faultId);
+        return this.list(wrapper);
+    }
+}

+ 8 - 0
src/main/java/com/fdkankan/sale/service/impl/RepairInfoService.java

@@ -1,6 +1,9 @@
 package com.fdkankan.sale.service.impl;
 package com.fdkankan.sale.service.impl;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.fdkankan.sale.common.PageInfo;
 import com.fdkankan.sale.entity.*;
 import com.fdkankan.sale.entity.*;
 import com.fdkankan.sale.service.*;
 import com.fdkankan.sale.service.*;
+import com.fdkankan.sale.vo.request.RepairInfoListParam;
 import com.fdkankan.sale.vo.response.*;
 import com.fdkankan.sale.vo.response.*;
 
 
 import com.fdkankan.sale.common.ResultCode;
 import com.fdkankan.sale.common.ResultCode;
@@ -91,4 +94,9 @@ public class RepairInfoService {
         }
         }
         return repairLogList;
         return repairLogList;
     }
     }
+
+    public Object pageList(RepairInfoListParam param) {
+        Page<RepairerVo> page = repairService.pageInfoList(param);
+        return PageInfo.PageInfo(page);
+    }
 }
 }

+ 82 - 5
src/main/java/com/fdkankan/sale/service/impl/RepairInvoiceServiceImpl.java

@@ -1,18 +1,22 @@
 package com.fdkankan.sale.service.impl;
 package com.fdkankan.sale.service.impl;
 
 
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
-import com.fdkankan.sale.common.PageInfo;
+import com.fdkankan.sale.common.ResultCode;
+import com.fdkankan.sale.entity.MailTemplate;
 import com.fdkankan.sale.entity.RepairInvoice;
 import com.fdkankan.sale.entity.RepairInvoice;
+import com.fdkankan.sale.exception.BusinessException;
 import com.fdkankan.sale.mapper.IRepairInvoiceMapper;
 import com.fdkankan.sale.mapper.IRepairInvoiceMapper;
+import com.fdkankan.sale.service.IMailTemplateService;
 import com.fdkankan.sale.service.IRepairInvoiceService;
 import com.fdkankan.sale.service.IRepairInvoiceService;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.fdkankan.sale.vo.request.RepairInvoiceParam;
 import com.fdkankan.sale.vo.request.RepairInvoiceParam;
 import com.fdkankan.sale.vo.response.RepairInvoiceVo;
 import com.fdkankan.sale.vo.response.RepairInvoiceVo;
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.stereotype.Service;
 
 
-import java.util.List;
-
 /**
 /**
  * <p>
  * <p>
  *  服务实现类
  *  服务实现类
@@ -24,6 +28,10 @@ import java.util.List;
 @Service
 @Service
 public class RepairInvoiceServiceImpl extends ServiceImpl<IRepairInvoiceMapper, RepairInvoice> implements IRepairInvoiceService {
 public class RepairInvoiceServiceImpl extends ServiceImpl<IRepairInvoiceMapper, RepairInvoice> implements IRepairInvoiceService {
 
 
+    @Autowired
+    IMailTemplateService mailTemplateService;
+
+
     @Override
     @Override
     public RepairInvoice getByRepairId(String repairId) {
     public RepairInvoice getByRepairId(String repairId) {
         LambdaQueryWrapper<RepairInvoice> wrapper = new LambdaQueryWrapper<>();
         LambdaQueryWrapper<RepairInvoice> wrapper = new LambdaQueryWrapper<>();
@@ -32,8 +40,77 @@ public class RepairInvoiceServiceImpl extends ServiceImpl<IRepairInvoiceMapper,
     }
     }
 
 
     @Override
     @Override
-    public Object pageList(RepairInvoiceParam param) {
+    public Page<RepairInvoiceVo> pageList(RepairInvoiceParam param) {
         Page<RepairInvoiceVo> voList = this.getBaseMapper().pageList(new Page<>(param.getPageNum(),param.getPageSize()),param);
         Page<RepairInvoiceVo> voList = this.getBaseMapper().pageList(new Page<>(param.getPageNum(),param.getPageSize()),param);
-        return PageInfo.PageInfo(voList);
+        return voList;
+    }
+
+    @Override
+    public void open(RepairInvoice param, Long userId) {
+        if(param.getInvoiceId() == null ){
+            throw new BusinessException(ResultCode.MISSING_REQUIRED_PARAMETERS);
+        }
+        RepairInvoice repairInvoice = this.getById(param.getInvoiceId());
+        if(repairInvoice == null ){
+            throw new BusinessException(ResultCode.MISSING_REQUIRED_PARAMETERS);
+        }
+        if(repairInvoice.getStatus() == 1){
+            throw new BusinessException(ResultCode.ORDER_INVOICE_OPEN);
+        }
+        if(repairInvoice.getInvoiceType() == 0){ //普通发票邮件发送,专用发票邮寄
+            if(StringUtils.isBlank(param.getInvoiceNo()) || StringUtils.isBlank(param.getEInvoiceImg())){
+                throw new BusinessException(ResultCode.MISSING_REQUIRED_PARAMETERS);
+            }
+            LambdaUpdateWrapper<RepairInvoice> wrapper = new LambdaUpdateWrapper<>();
+            wrapper.eq(RepairInvoice::getInvoiceId,param.getInvoiceId());
+            wrapper.set(RepairInvoice::getInvoiceNo,param.getInvoiceNo());
+            wrapper.set(RepairInvoice::getEInvoiceImg,param.getEInvoiceImg());
+            wrapper.set(RepairInvoice::getStatus,1);
+            wrapper.set(RepairInvoice::getSysUserId,userId);
+            this.update(wrapper);
+
+            MailTemplate mailTemplate = this.setMailMsg(repairInvoice.getRepairId(),repairInvoice.getInvoiceEmail());
+            Boolean mail = mailTemplateService.sendMail(repairInvoice.getInvoiceEmail(), mailTemplate,param.getEInvoiceImg());
+            if(!mail){
+                throw new BusinessException(ResultCode.MAIL_SEND_ERROR);
+            }
+
+        }
+        if(repairInvoice.getInvoiceType() == 1){ //普通发票邮件发送,专用发票邮寄
+            if(StringUtils.isBlank(param.getInvoiceNo()) || StringUtils.isBlank(param.getTrackingNum())){
+                throw new BusinessException(ResultCode.MISSING_REQUIRED_PARAMETERS);
+            }
+            LambdaUpdateWrapper<RepairInvoice> wrapper = new LambdaUpdateWrapper<>();
+            wrapper.eq(RepairInvoice::getInvoiceId,param.getInvoiceId());
+            wrapper.set(RepairInvoice::getTrackingNum,param.getTrackingNum());
+            wrapper.set(RepairInvoice::getInvoiceNo,param.getInvoiceNo());
+            wrapper.set(RepairInvoice::getStatus,1);
+            wrapper.set(RepairInvoice::getSysUserId,userId);
+            this.update(wrapper);
+        }
+
+    }
+
+
+    private MailTemplate setMailMsg(String orderNum, String userName) {
+        MailTemplate mailTemplate = mailTemplateService.getById(1);
+        if(mailTemplate != null){
+            String subject = mailTemplate.getSubject();
+            if(StringUtils.isNotBlank(orderNum)){
+                subject = subject.replace("${ordernum}",orderNum);
+            }
+            mailTemplate.setSubject(subject);
+
+            String msg = mailTemplate.getMsg();
+            if(StringUtils.isNotBlank(orderNum)){
+                msg = msg.replace("${ordernum}",orderNum);
+            }
+            if(StringUtils.isNotBlank(userName)){
+                msg = msg.replace("${username}",userName);
+            }
+            mailTemplate.setMsg(msg);
+
+        }
+        return mailTemplate;
     }
     }
 }
 }

+ 5 - 7
src/main/java/com/fdkankan/sale/service/impl/RepairLogServiceImpl.java

@@ -34,25 +34,23 @@ public class RepairLogServiceImpl extends ServiceImpl<IRepairLogMapper, RepairLo
      */
      */
     @Override
     @Override
     public void saveBySysUser(Long sysUserId, String repairId,Integer repairStatus,String remark) {
     public void saveBySysUser(Long sysUserId, String repairId,Integer repairStatus,String remark) {
-        RepairLog repairLog = this.getByRepairIdAndStatus(repairId, repairStatus);
-        if(repairLog == null){
-            repairLog = new RepairLog();
-        }
+        RepairLog repairLog = new RepairLog();
         repairLog.setRepairId(repairId);
         repairLog.setRepairId(repairId);
         repairLog.setRepairStatus(repairStatus);
         repairLog.setRepairStatus(repairStatus);
         repairLog.setSysUserId(sysUserId);
         repairLog.setSysUserId(sysUserId);
         repairLog.setRemark(remark);
         repairLog.setRemark(remark);
-        this.saveOrUpdate(repairLog);
+        repairLog.setUpdateTime(null);
+        this.save(repairLog);
         repairService.updateRepairStatus(repairId,repairStatus);
         repairService.updateRepairStatus(repairId,repairStatus);
 
 
     }
     }
 
 
     @Override
     @Override
-    public RepairLog getByRepairIdAndStatus(String repairId, Integer status) {
+    public List<RepairLog> getByRepairIdAndStatus(String repairId, Integer status) {
         LambdaQueryWrapper<RepairLog> wrapper = new LambdaQueryWrapper<>();
         LambdaQueryWrapper<RepairLog> wrapper = new LambdaQueryWrapper<>();
         wrapper.eq(RepairLog::getRepairId,repairId);
         wrapper.eq(RepairLog::getRepairId,repairId);
         wrapper.eq(RepairLog::getRepairStatus,status);
         wrapper.eq(RepairLog::getRepairStatus,status);
-        return this.getOne(wrapper);
+        return this.list(wrapper);
     }
     }
 
 
     @Override
     @Override

+ 38 - 0
src/main/java/com/fdkankan/sale/service/impl/RepairPayServiceImpl.java

@@ -2,13 +2,22 @@ package com.fdkankan.sale.service.impl;
 
 
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
 import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.fdkankan.common.constant.PayStatus;
 import com.fdkankan.common.constant.PayStatus;
 import com.fdkankan.sale.entity.RepairPay;
 import com.fdkankan.sale.entity.RepairPay;
 import com.fdkankan.sale.mapper.IRepairPayMapper;
 import com.fdkankan.sale.mapper.IRepairPayMapper;
 import com.fdkankan.sale.service.IRepairPayService;
 import com.fdkankan.sale.service.IRepairPayService;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.fdkankan.sale.util.DateUtil;
+import com.fdkankan.sale.vo.request.RepairPayParam;
+import com.fdkankan.sale.vo.response.RepairPayVo;
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.beans.BeanUtils;
 import org.springframework.stereotype.Service;
 import org.springframework.stereotype.Service;
 
 
+import java.util.ArrayList;
+import java.util.List;
+
 /**
 /**
  * <p>
  * <p>
  *  服务实现类
  *  服务实现类
@@ -42,6 +51,35 @@ public class RepairPayServiceImpl extends ServiceImpl<IRepairPayMapper, RepairPa
         wrapper.set(RepairPay::getWxPayOpenId,openid);
         wrapper.set(RepairPay::getWxPayOpenId,openid);
         wrapper.set(RepairPay::getTradeNo,trade_no);
         wrapper.set(RepairPay::getTradeNo,trade_no);
         wrapper.set(RepairPay::getPayStatus,1);
         wrapper.set(RepairPay::getPayStatus,1);
+        wrapper.set(RepairPay::getPayTime, DateUtil.getDate());
         this.update(wrapper);
         this.update(wrapper);
     }
     }
+
+    @Override
+    public Page<RepairPayVo> pageList(RepairPayParam param) {
+        LambdaQueryWrapper<RepairPay> wrapper = new LambdaQueryWrapper<>();
+        if(StringUtils.isNotBlank(param.getRepairId())){
+            wrapper.eq(RepairPay::getRepairId,param.getRepairId());
+        }
+        if(StringUtils.isNotBlank(param.getTradeNo())){
+            wrapper.eq(RepairPay::getTradeNo,param.getTradeNo());
+        }
+        if(StringUtils.isNotBlank(param.getStartTime())){
+            wrapper.between(RepairPay:: getPayTime,param.getStartTime(),param.getEndTime());
+        }
+        wrapper.orderByDesc(RepairPay::getCreateTime);
+        Page<RepairPay> page = this.page(new Page<>(param.getPageNum(), param.getPageSize()), wrapper);
+        List<RepairPayVo> listVo = new ArrayList<>();
+        for (RepairPay record : page.getRecords()) {
+            RepairPayVo vo = new RepairPayVo();
+            BeanUtils.copyProperties(record,vo);
+            listVo.add(vo);
+        }
+        Page<RepairPayVo> pageVo = new Page<>(param.getPageNum(), param.getPageSize());
+        pageVo.setTotal(page.getTotal());
+        pageVo.setRecords(listVo);
+        return pageVo;
+    }
+
+
 }
 }

+ 33 - 5
src/main/java/com/fdkankan/sale/service/impl/RepairPersonnelService.java

@@ -1,4 +1,6 @@
 package com.fdkankan.sale.service.impl;
 package com.fdkankan.sale.service.impl;
+import java.math.BigDecimal;
+import java.util.Date;
 
 
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
 import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
@@ -45,6 +47,12 @@ public class RepairPersonnelService {
     IRepairRegisterService repairRegisterService;
     IRepairRegisterService repairRegisterService;
     @Autowired
     @Autowired
     IRepairRegisterPartService repairRegisterPartService;
     IRepairRegisterPartService repairRegisterPartService;
+    @Autowired
+    IRepairFaultService repairFaultService;
+    @Autowired
+    IPriceListService priceListService;
+    @Autowired
+    IPartService partService;
 
 
 
 
 
 
@@ -94,16 +102,36 @@ public class RepairPersonnelService {
         HashMap<Integer,Integer> partIdMap = new HashMap<>();
         HashMap<Integer,Integer> partIdMap = new HashMap<>();
         registerParts.forEach(entity -> partIdMap.putIfAbsent(entity.getPartId(),entity.getId()));
         registerParts.forEach(entity -> partIdMap.putIfAbsent(entity.getPartId(),entity.getId()));
 
 
-        for (RepairRegisterPartVo part : param.getPartList()) {
+        for (RepairRegisterPartVo partVo : param.getPartList()) {
+            Part part = partService.getById(partVo.getId());
+            if(part == null){
+                continue;
+            }
             RepairRegisterPart repairRegisterPart = new RepairRegisterPart();
             RepairRegisterPart repairRegisterPart = new RepairRegisterPart();
             repairRegisterPart.setRepairId(repair.getRepairId());
             repairRegisterPart.setRepairId(repair.getRepairId());
             repairRegisterPart.setRepairRegisterId(repairRegister.getRepairRegisterId());
             repairRegisterPart.setRepairRegisterId(repairRegister.getRepairRegisterId());
-            repairRegisterPart.setPartId(part.getPartId());
-            repairRegisterPart.setPartCount(part.getPartCount());
-            if(partIdMap.get(part.getPartId())!=null){
-                repairRegisterPart.setId(partIdMap.get(part.getPartId()));
+            repairRegisterPart.setPartId(partVo.getPartId());
+            repairRegisterPart.setPartCount(partVo.getPartCount());
+            if(partIdMap.get(partVo.getPartId())!=null){
+                repairRegisterPart.setId(partIdMap.get(partVo.getPartId()));
             }
             }
             repairRegisterPartService.saveOrUpdate(repairRegisterPart);
             repairRegisterPartService.saveOrUpdate(repairRegisterPart);
+
+            PriceList priceList = new PriceList();
+            priceList.setRepairId(repair.getRepairId());
+            priceList.setName(part.getPartName());
+            priceList.setPrice(part.getPartPrice());
+            priceList.setCount(partVo.getPartCount());
+            priceListService.save(priceList);
+
+        }
+        repairFaultService.delByRepairId(repair.getRepairId());
+        for (Integer faultId : param.getFaultIds()) {
+            RepairFault fault = new RepairFault();
+            fault.setRepairId(repair.getRepairId());
+            fault.setRepairRegisterId(repairRegister.getRepairRegisterId());
+            fault.setFaultId(faultId);
+            repairFaultService.save(fault);
         }
         }
 
 
         repairLogService.saveBySysUser(userId,repair.getRepairId(),2,"维修登记");
         repairLogService.saveBySysUser(userId,repair.getRepairId(),2,"维修登记");

+ 10 - 9
src/main/java/com/fdkankan/sale/service/impl/RepairSaleService.java

@@ -1,6 +1,7 @@
 package com.fdkankan.sale.service.impl;
 package com.fdkankan.sale.service.impl;
 import java.util.Date;
 import java.util.Date;
 
 
+import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
 import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
@@ -12,6 +13,7 @@ import com.fdkankan.sale.service.*;
 import com.fdkankan.sale.util.DateUtil;
 import com.fdkankan.sale.util.DateUtil;
 import com.fdkankan.sale.util.StatusUtil;
 import com.fdkankan.sale.util.StatusUtil;
 import com.fdkankan.sale.vo.request.*;
 import com.fdkankan.sale.vo.request.*;
+import com.fdkankan.sale.vo.response.PriceListVo;
 import com.fdkankan.sale.vo.response.RepairerVo;
 import com.fdkankan.sale.vo.response.RepairerVo;
 import org.apache.commons.lang3.StringUtils;
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.BeanUtils;
 import org.springframework.beans.BeanUtils;
@@ -128,26 +130,25 @@ public class RepairSaleService {
         if(repair == null){
         if(repair == null){
             throw new BusinessException(ResultCode.REPAIR_NOT_EXITS);
             throw new BusinessException(ResultCode.REPAIR_NOT_EXITS);
         }
         }
-        //修改删除工单之前的报价单
-        List<PriceList> priceListDb = this.getPriceList(param.getRepairId());
-        if(priceListDb !=null && priceListDb.size() >0){
-            List<Integer> priceListIds = priceListDb.stream().map(PriceList::getPriceListId).collect(Collectors.toList());
-            priceListService.removeByIds(priceListIds);
-        }
 
 
         List<PriceList> priceLists = param.getPriceLists();
         List<PriceList> priceLists = param.getPriceLists();
         for (PriceList priceList : priceLists) {
         for (PriceList priceList : priceLists) {
             priceList.setRepairId(param.getRepairId());
             priceList.setRepairId(param.getRepairId());
         }
         }
-        priceListService.saveBatch(priceLists);
+        priceListService.saveOrUpdateBatch(priceLists);
         repairLogService.saveBySysUser(userId,param.getRepairId(),3,"维修报价");
         repairLogService.saveBySysUser(userId,param.getRepairId(),3,"维修报价");
     }
     }
 
 
-    public List<PriceList> getPriceList(String repairId) {
+    public PriceListVo getPriceList(String repairId) {
         if(StringUtils.isBlank(repairId)){
         if(StringUtils.isBlank(repairId)){
             throw new BusinessException(ResultCode.MISSING_REQUIRED_PARAMETERS);
             throw new BusinessException(ResultCode.MISSING_REQUIRED_PARAMETERS);
         }
         }
-        return priceListService.getByRepairId(repairId);
+        List<PriceList> priceLists = priceListService.getByRepairId(repairId);
+        List<RepairLog> repairLogs = repairLogService.getByRepairIdAndStatus(repairId, 3);
+        PriceListVo priceListVo = new PriceListVo();
+        priceListVo.setPriceLists(priceLists);
+        priceListVo.setCount(repairLogs.size() +1);
+        return priceListVo;
     }
     }
 
 
     public void payRegister(PayRegisterParam param,Long userId) {
     public void payRegister(PayRegisterParam param,Long userId) {

+ 32 - 9
src/main/java/com/fdkankan/sale/service/impl/RepairServiceImpl.java

@@ -13,10 +13,7 @@ import com.fdkankan.sale.service.*;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.fdkankan.sale.util.DateUtil;
 import com.fdkankan.sale.util.DateUtil;
 import com.fdkankan.sale.util.StatusUtil;
 import com.fdkankan.sale.util.StatusUtil;
-import com.fdkankan.sale.vo.request.CheckRegisterParam;
-import com.fdkankan.sale.vo.request.OrderReceivingParam;
-import com.fdkankan.sale.vo.request.RecordingParam;
-import com.fdkankan.sale.vo.request.RepairParam;
+import com.fdkankan.sale.vo.request.*;
 import com.fdkankan.sale.vo.response.RepairerVo;
 import com.fdkankan.sale.vo.response.RepairerVo;
 import org.apache.commons.lang3.StringUtils;
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.BeanUtils;
 import org.springframework.beans.BeanUtils;
@@ -42,6 +39,8 @@ public class RepairServiceImpl extends ServiceImpl<IRepairMapper, Repair> implem
     ISysUserService sysUserService;
     ISysUserService sysUserService;
     @Autowired
     @Autowired
     IRepairPayService repairPayService;
     IRepairPayService repairPayService;
+    @Autowired
+    IRepairFaultService repairFaultService;
 
 
     @Override
     @Override
     public void updateRepairStatus(String repairId, Integer status) {
     public void updateRepairStatus(String repairId, Integer status) {
@@ -82,10 +81,8 @@ public class RepairServiceImpl extends ServiceImpl<IRepairMapper, Repair> implem
         List<RepairLog> repairLogs = repairLogService.getByRepairId(repair.getRepairId());
         List<RepairLog> repairLogs = repairLogService.getByRepairId(repair.getRepairId());
 
 
         Set<Long> sysUserIds = repairLogs.stream().map(RepairLog::getSysUserId).collect(Collectors.toSet());
         Set<Long> sysUserIds = repairLogs.stream().map(RepairLog::getSysUserId).collect(Collectors.toSet());
-        List<SysUser> sysUsers = sysUserService.listByIds(sysUserIds);
-        HashMap<Long,SysUser> userMap = new HashMap<>();
+        HashMap<Long,SysUser> userMap = sysUserService.getMapByIds(sysUserIds);
 
 
-        sysUsers.forEach(entity -> userMap.putIfAbsent(entity.getId(),entity));
         for (RepairLog repairLog : repairLogs) {
         for (RepairLog repairLog : repairLogs) {
             SysUser sysUser = userMap.get(repairLog.getSysUserId());
             SysUser sysUser = userMap.get(repairLog.getSysUserId());
             if(sysUser == null){
             if(sysUser == null){
@@ -97,10 +94,10 @@ public class RepairServiceImpl extends ServiceImpl<IRepairMapper, Repair> implem
                     repairerVo.setOrderReceivingTime(repairLog.getCreateTime());
                     repairerVo.setOrderReceivingTime(repairLog.getCreateTime());
                     break;
                     break;
                 case 2 :  //维修检测
                 case 2 :  //维修检测
-                    repairerVo.setRepairerName(sysUser.getNickName());
+                    repairerVo.setRepairManName(sysUser.getNickName());
                     break;
                     break;
                 case 8 :  //维修完成
                 case 8 :  //维修完成
-                    repairerVo.setRepairerName(sysUser.getNickName());
+                    repairerVo.setRepairManName(sysUser.getNickName());
                     repairerVo.setRepairOverTime(repairLog.getCreateTime());
                     repairerVo.setRepairOverTime(repairLog.getCreateTime());
                     break;
                     break;
             }
             }
@@ -133,4 +130,30 @@ public class RepairServiceImpl extends ServiceImpl<IRepairMapper, Repair> implem
         wrapper.set(Repair::getInvoiceStatus,1);
         wrapper.set(Repair::getInvoiceStatus,1);
         this.update(wrapper);
         this.update(wrapper);
     }
     }
+
+    @Override
+    public Page<RepairerVo> pageInfoList(RepairInfoListParam param) {
+        if(param.getFaultId() != null){
+            List<RepairFault> list = repairFaultService.getByFaultId(param.getFaultId());
+            if(list.size() >0){
+                Set<String> repairIds = list.stream().map(RepairFault::getRepairId).collect(Collectors.toSet());
+                param.setRepairIds(repairIds);
+            }
+        }
+        Page<RepairerVo> page = getBaseMapper().pageInfoList(new Page<>(param.getPageNum(), param.getPageSize()), param);
+
+        Set<Long> saleIds = page.getRecords().stream().map(RepairerVo::getSaleId).collect(Collectors.toSet());
+        Set<Long> repairManIds = page.getRecords().stream().map(RepairerVo::getRepairManId).collect(Collectors.toSet());
+        repairManIds.addAll(saleIds);
+        HashMap<Long,SysUser> userMap = sysUserService.getMapByIds(repairManIds);
+        for (RepairerVo record : page.getRecords()) {
+            if(record.getSaleId() !=null && userMap.get(record.getSaleId()) !=null){
+                record.setSaleName(userMap.get(record.getSaleId()).getNickName());
+            }
+            if(record.getRepairManId() !=null && userMap.get(record.getRepairManId()) !=null){
+                record.setRepairManName(userMap.get(record.getRepairManId()).getNickName());
+            }
+        }
+        return page;
+    }
 }
 }

+ 13 - 0
src/main/java/com/fdkankan/sale/service/impl/SysUserServiceImpl.java

@@ -163,4 +163,17 @@ public class SysUserServiceImpl extends ServiceImpl<ISysUserMapper, SysUser> imp
         wrapper.eq(SysUser::getManageId,userId);
         wrapper.eq(SysUser::getManageId,userId);
         return this.getOne(wrapper);
         return this.getOne(wrapper);
     }
     }
+
+    @Override
+    public HashMap<Long, SysUser> getMapByIds(Set<Long> userIds) {
+        HashMap<Long,SysUser> map = new HashMap<>();
+        if(userIds == null || userIds.size() <= 0){
+            return map;
+        }
+        LambdaQueryWrapper<SysUser> wrapper = new LambdaQueryWrapper<>();
+        wrapper.eq(SysUser::getId,userIds);
+        List<SysUser> list = this.list(wrapper);
+        list.forEach(entity -> map.put(entity.getId(),entity));
+        return map;
+    }
 }
 }

+ 2 - 1
src/main/java/com/fdkankan/sale/service/impl/UploadService.java

@@ -42,7 +42,8 @@ public class UploadService {
             //重新生成文件名
             //重新生成文件名
             fileName = UUID.randomUUID().toString().replace("-","") ;
             fileName = UUID.randomUUID().toString().replace("-","") ;
 
 
-            localFile = new File(String.format(FilePath.file_path,CacheUtil.environment,fileName +suffixName));
+            localFile = File.createTempFile(fileName ,suffixName);
+            //localFile = new File(String.format(FilePath.file_path,CacheUtil.environment,fileName +suffixName));
             if(!localFile.getParentFile().exists()){
             if(!localFile.getParentFile().exists()){
                 localFile.mkdirs();
                 localFile.mkdirs();
             }
             }

+ 95 - 0
src/main/java/com/fdkankan/sale/util/SendMailUtils.java

@@ -0,0 +1,95 @@
+package com.fdkankan.sale.util;
+
+import com.sun.mail.util.MailSSLSocketFactory;
+import org.apache.commons.lang3.StringUtils;
+
+import javax.activation.DataHandler;
+import javax.activation.DataSource;
+import javax.activation.FileDataSource;
+import javax.mail.*;
+import javax.mail.internet.*;
+import java.util.Properties;
+
+/**
+ * Created by Hb_zzZ on 2020/3/16.
+ */
+public class SendMailUtils {
+
+
+    /**
+     * 发送带附件的邮件
+     * @param  from      发件人
+     * @param  pass      发件人密码
+     * @param  host      发件人主机
+     * @param receive    收件人
+     * @param subject    邮件主题
+     * @param msg        邮件内容
+     * @param filename   附件地址
+     *
+     */
+    public static boolean sendMail(String from,String pass,String host,
+                                   String receive, String subject, String msg, String filename) {
+        if (StringUtils.isEmpty(receive)) {
+            return false;
+        }
+        try {
+            // 获取系统属性
+            Properties properties = System.getProperties();
+            // 设置邮件服务器
+            properties.setProperty("mail.smtp.host", host);
+            properties.setProperty("mail.debug", "true");
+            properties.put("mail.smtp.auth", "true");
+            MailSSLSocketFactory sf = new MailSSLSocketFactory();
+            sf.setTrustAllHosts(true);
+            properties.put("mail.smtp.ssl.enable", "true");
+            properties.put("mail.smtp.ssl.socketFactory", sf);
+            // 获取默认session对象
+            Session session = Session.getDefaultInstance(properties, new Authenticator() {
+                public PasswordAuthentication getPasswordAuthentication() { // qq邮箱服务器账户、第三方登录授权码
+                    return new PasswordAuthentication(from, pass); // 发件人邮件用户名、密码
+                }
+            });
+            // 创建默认的 MimeMessage 对象
+            MimeMessage message = new MimeMessage(session);
+            // Set From: 头部头字段
+            message.setFrom(new InternetAddress(from));
+            // Set To: 头部头字段
+            message.addRecipient(Message.RecipientType.TO, new InternetAddress(receive));
+            // Set Subject: 主题文字
+            message.setSubject(subject);
+            // 创建消息部分
+            BodyPart messageBodyPart = new MimeBodyPart();
+            // 消息
+            messageBodyPart.setText(msg);
+            // 创建多重消息
+            MimeMultipart multipart = new MimeMultipart("mixed");
+
+            if(StringUtils.isNotEmpty(filename)){
+                // 附件部分
+                messageBodyPart = new MimeBodyPart();
+                // 设置要发送附件的文件路径
+                DataSource source = new FileDataSource(filename);
+                messageBodyPart.setDataHandler(new DataHandler(source));
+                // messageBodyPart.setFileName(filename);
+                // 处理附件名称中文(附带文件路径)乱码问题
+                messageBodyPart.setFileName(MimeUtility.encodeText(filename));
+                multipart.addBodyPart(messageBodyPart);
+            }
+            //html代码部分
+            MimeBodyPart htmlPart = new MimeBodyPart();
+            multipart.addBodyPart(htmlPart);
+            //html代码
+            htmlPart.setContent(msg, "text/html;charset=utf-8");
+            // 发送完整消息
+            message.setContent(multipart);
+            // 发送消息
+            Transport.send(message, new  Address[]{new InternetAddress(receive)});
+            // System.out.println("Sent message successfully....");
+            return true;
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        return false;
+    }
+
+}

+ 1 - 0
src/main/java/com/fdkankan/sale/vo/request/CheckRegisterParam.java

@@ -11,4 +11,5 @@ import java.util.List;
 @Data
 @Data
 public class CheckRegisterParam extends RepairRegister {
 public class CheckRegisterParam extends RepairRegister {
     private List<RepairRegisterPartVo> partList;
     private List<RepairRegisterPartVo> partList;
+    private List<Integer> faultIds;
 }
 }

+ 24 - 0
src/main/java/com/fdkankan/sale/vo/request/RepairInfoListParam.java

@@ -0,0 +1,24 @@
+package com.fdkankan.sale.vo.request;
+
+import com.fdkankan.sale.common.RequestBase;
+import lombok.Data;
+
+import java.util.List;
+import java.util.Set;
+
+@Data
+public class RepairInfoListParam extends RequestBase {
+    private Integer receiverType;  //报修方式,0 系统录单,1公众号报修
+    private Integer cameraType;    //相机类型 0看看,1看见,2深时
+    private String cameraSnCode;
+    private String customerName;
+    private Integer warrantyType;  //保修类型 0保修期内,1保修期外,2非保修项目
+    private Integer faultId;        //故障类型Id
+
+    private Integer saleId;
+    private Integer repairManId;
+    private Integer status;
+    private Integer payStatus;
+    private Integer commentStatus;
+    private Set<String> repairIds;
+}

+ 10 - 0
src/main/java/com/fdkankan/sale/vo/request/RepairPayParam.java

@@ -0,0 +1,10 @@
+package com.fdkankan.sale.vo.request;
+
+import com.fdkankan.sale.common.RequestBase;
+import lombok.Data;
+
+@Data
+public class RepairPayParam extends RequestBase {
+    private String repairId;
+    private String tradeNo;
+}

+ 12 - 0
src/main/java/com/fdkankan/sale/vo/response/PriceListVo.java

@@ -0,0 +1,12 @@
+package com.fdkankan.sale.vo.response;
+
+import com.fdkankan.sale.entity.PriceList;
+import lombok.Data;
+
+import java.util.List;
+
+@Data
+public class PriceListVo {
+    private Integer count;
+    private List<PriceList> priceLists;
+}

+ 131 - 1
src/main/java/com/fdkankan/sale/vo/response/RepairInvoiceVo.java

@@ -1,10 +1,140 @@
 package com.fdkankan.sale.vo.response;
 package com.fdkankan.sale.vo.response;
 
 
+import com.alibaba.excel.annotation.ExcelIgnore;
+import com.alibaba.excel.annotation.ExcelProperty;
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableLogic;
 import com.fdkankan.sale.entity.RepairInvoice;
 import com.fdkankan.sale.entity.RepairInvoice;
 import lombok.Data;
 import lombok.Data;
 
 
+import java.math.BigDecimal;
+
 @Data
 @Data
-public class RepairInvoiceVo extends RepairInvoice {
+public class RepairInvoiceVo  {
+
+    @ExcelProperty("订单编号")
     private String orderSn;
     private String orderSn;
+
+    @ExcelIgnore
+    private Integer invoiceId;
+
+    /**
+     * 工单id
+     */
+    @ExcelProperty("工单编号")
+    private String repairId;
+
+    @ExcelProperty("支付时间")
     private String payTime;
     private String payTime;
+
+    @ExcelProperty("开票申请时间")
+    private String createTime;
+    /**
+     * 开票金额
+     */
+    @ExcelProperty("开票金额")
+    private BigDecimal invoiceAmount;
+
+    /**
+     * 发票类型 0 普通发票,1专用发票
+     */
+    @ExcelIgnore
+    private Integer invoiceType;
+
+    @ExcelProperty("开票类型")
+    private String invoiceTypeStr;
+
+    /**
+     * 发票抬头
+     */
+    @ExcelProperty("发票抬头")
+    private String invoiceHead;
+
+    /**
+     * 税号
+     */
+    @ExcelProperty("纳税人识别号")
+    private String invoiceNum;
+
+    /**
+     * 收件邮箱
+     */
+    @ExcelProperty("邮箱")
+    private String invoiceEmail;
+
+    /**
+     * 0未开票,1已开票
+     */
+    @ExcelIgnore
+    private Integer status;
+    /**
+     * 0未开票,1已开票
+     */
+    @ExcelProperty("开票状态")
+    private String statusStr;
+
+    /**
+     * 开户银行
+     */
+    @ExcelProperty("开户银行")
+    private String bank;
+
+    /**
+     * 银行账号
+     */
+    @ExcelProperty("银行账号")
+    private String bankAccount;
+
+    /**
+     * 企业地址
+     */
+    @ExcelProperty("收货地址")
+    private String address;
+
+    /**
+     * 企业电话
+     */
+    @ExcelProperty("收件人电话")
+    private String phone;
+    /**
+     * 发票编号
+     */
+    @ExcelProperty("发票编号")
+    private String invoiceNo;
+
+    @ExcelProperty("快递单号")
+    private String trackingNum;
+    /**
+     * 企业电话
+     */
+    @ExcelIgnore
+    private String eInvoiceImg;
+
+    @ExcelIgnore
+    private String updateTime;
+
+
+    public String getStatusStr() {
+        if(status == null){
+            return "";
+        }
+        switch (status){
+            case 0 :return "未开票";
+            case 1 :return "已开票";
+        }
+        return statusStr;
+    }
+
+    public String getInvoiceTypeStr() {
+        if(invoiceType == null){
+            return "";
+        }
+        switch (invoiceType){
+            case 0 :return "普通发票";
+            case 1 :return "专用发票";
+        }
+        return invoiceTypeStr;
+    }
 }
 }

+ 94 - 0
src/main/java/com/fdkankan/sale/vo/response/RepairPayVo.java

@@ -0,0 +1,94 @@
+package com.fdkankan.sale.vo.response;
+
+import com.alibaba.excel.annotation.ExcelIgnore;
+import com.alibaba.excel.annotation.ExcelProperty;
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableLogic;
+import lombok.Data;
+
+import java.math.BigDecimal;
+
+@Data
+public class RepairPayVo {
+
+    @ExcelProperty("下单时间")
+    private String createTime;
+
+    @ExcelProperty("订单号")
+    private String orderSn;
+
+    @ExcelProperty("OpenId")
+    private String wxPayOpenId;
+
+    @ExcelProperty("维修单号")
+    private String repairId;
+
+    @ExcelProperty("订单金额(元)")
+    private BigDecimal payAmount;
+
+
+    @ExcelProperty("支付时间")
+    private String payTime;
+
+    @ExcelIgnore
+    private Integer payId;
+
+    /**
+     * 0银行转账,1微信,2支付宝
+     */
+    @ExcelIgnore
+    private Integer payType;
+
+    @ExcelProperty("支付方式")
+    private String payTypeStr;
+
+    /**
+     * 付款凭证,截图
+     */
+    @ExcelIgnore
+    private String payImg;
+
+    @ExcelProperty("交易号")
+    private String tradeNo;
+    /**
+     * 支付状态 0 未支付,1支付成功,2支付失败
+     */
+    @ExcelIgnore
+    private Integer payStatus;
+
+    @ExcelProperty("订单状态")
+    private String payStatusStr;
+
+    @ExcelIgnore
+    private String updateTime;
+
+    @ExcelIgnore
+    private Long sysUserId;
+
+
+    public String getPayTypeStr() {
+        if(payType == null){
+            return "";
+        }
+        switch (payType){
+            case 0 :return "银行转账";
+            case 1 :return "微信";
+            case 2 :return "支付宝";
+        }
+        return payTypeStr;
+    }
+
+    public String getPayStatusStr() {
+        if(payStatus == null){
+            return "";
+        }
+        switch (payStatus){
+            case 0 :return "未支付";
+            case 1 :return "支付成功";
+            case 2 :return "支付失败";
+        }
+        return payStatusStr;
+    }
+}

+ 7 - 1
src/main/java/com/fdkankan/sale/vo/response/RepairerVo.java

@@ -3,6 +3,8 @@ package com.fdkankan.sale.vo.response;
 import com.fdkankan.sale.entity.Repair;
 import com.fdkankan.sale.entity.Repair;
 import lombok.Data;
 import lombok.Data;
 
 
+import java.util.List;
+
 @Data
 @Data
 public class RepairerVo extends Repair {
 public class RepairerVo extends Repair {
     private String orderReceivingTime;
     private String orderReceivingTime;
@@ -10,7 +12,7 @@ public class RepairerVo extends Repair {
     private String customerName;
     private String customerName;
 
 
     private String saleName;
     private String saleName;
-    private String repairerName;
+    private String repairManName;
     private String testerName;
     private String testerName;
     private String supplyAdminName;
     private String supplyAdminName;
 
 
@@ -18,5 +20,9 @@ public class RepairerVo extends Repair {
     private String repairOverTime;
     private String repairOverTime;
     private String testPassTime;
     private String testPassTime;
 
 
+    private Integer warrantyType;
+    private Long saleId;
+    private Long repairManId;
+
 }
 }
 
 

+ 6 - 0
src/main/resources/bootstrap.yml

@@ -1,6 +1,12 @@
 spring:
 spring:
   profiles:
   profiles:
     active: dev
     active: dev
+  servlet:
+    multipart:
+      # 设置单个文件大小
+      max-file-size: 1024MB
+      # 设置单次请求文件的总大小
+      max-request-size: 1024MB
 logging:
 logging:
   config: classpath:logback-spring.xml
   config: classpath:logback-spring.xml
 mybatis-plus:
 mybatis-plus:

+ 5 - 0
src/main/resources/mapper/sale/MailTemplateMapper.xml

@@ -0,0 +1,5 @@
+<?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.fdkankan.sale.mapper.IMailTemplateMapper">
+
+</mapper>

+ 5 - 0
src/main/resources/mapper/sale/RepairFaultMapper.xml

@@ -0,0 +1,5 @@
+<?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.fdkankan.sale.mapper.IRepairFaultMapper">
+
+</mapper>

+ 53 - 3
src/main/resources/mapper/sale/RepairMapper.xml

@@ -11,8 +11,8 @@
         <foreach item="status" collection="param.statusList" open="(" separator="," close=")">
         <foreach item="status" collection="param.statusList" open="(" separator="," close=")">
             #{status}
             #{status}
         </foreach>
         </foreach>
-        <if test="param.statusParam !=0 ">
-            o.sale_id = #{param.userId}
+        <if test="param.statusParam !=0 and param.userId !=null ">
+            and o.sys_user_id = #{param.userId}
         </if>
         </if>
         <if test="param.repairId != null and param.repairId != ''">
         <if test="param.repairId != null and param.repairId != ''">
             and r.repair_id like  concat ('%',#{param.repairId},'%')
             and r.repair_id like  concat ('%',#{param.repairId},'%')
@@ -77,7 +77,7 @@
     </select>
     </select>
 
 
     <select id="testOrderList" resultType="com.fdkankan.sale.vo.response.RepairerVo">
     <select id="testOrderList" resultType="com.fdkankan.sale.vo.response.RepairerVo">
-        select  r.*,rr.check_result,o.create_time as orderReceivingTime,s.nick_name as testerName,c.customer_name,
+        select  r.*,rr.check_result,o.create_time as orderReceivingTime, s.nick_name as testerName,c.customer_name,
         from t_repair r
         from t_repair r
         left join  t_order_receiving o on r.repair_id = o.repair_id
         left join  t_order_receiving o on r.repair_id = o.repair_id
         left join  t_repair_register rr on r.repair_id = rr.repair_id
         left join  t_repair_register rr on r.repair_id = rr.repair_id
@@ -96,4 +96,54 @@
         order by r.create_time desc
         order by r.create_time desc
     </select>
     </select>
 
 
+
+    <select id="pageInfoList" resultType="com.fdkankan.sale.vo.response.RepairerVo">
+        select  r.*,rr.check_result,o.create_time as orderReceivingTime,c.customer_name,
+        o.warranty_type ,o.sys_user_id as saleId,rr.sys_user_id as repairManId, rr.over_time as repairOverTime
+        from t_repair r
+        left join  t_order_receiving o on r.repair_id = o.repair_id
+        left join  t_repair_register rr on r.repair_id = rr.repair_id
+        left join  t_customer c on r.repair_id = c.repair_id
+        left join t_repair_pay rp on r.repair_id = rp.repair_id
+        where r.rec_status = 'A'
+        <if test="param.cameraType != null">
+            and r.camera_type = #{param.cameraType}
+        </if>
+        <if test="param.cameraSnCode != null and param.cameraSnCode != ''">
+            and r.camera_sn_code like  concat ('%',#{param.cameraSnCode},'%')
+        </if>
+        <if test="param.startTime != null and param.startTime != ''">
+            and r.create_time BETWEEN #{param.startTime} and #{param.endTime}
+        </if>
+        <if test="param.receiverType != null ">
+            and r.receiver_type = #{param.receiverType}
+        </if>
+        <if test="param.warrantyType != null ">
+            and o.warranty_type = #{param.warrantyType}
+        </if>
+        <if test="param.customerName != null and param.customerName != ''">
+            and c.customer_name like  concat ('%',#{param.customerName},'%')
+        </if>
+        <if test="param.saleId != null ">
+            and o.sys_user_id = #{param.saleId}
+        </if>
+        <if test="param.repairManId != null ">
+            and rr.sys_user_id = #{param.repairManId}
+        </if>
+        <if test="param.payStatus != null ">
+            and rp.pay_status = #{param.payStatus}
+        </if>
+        <if test="param.commentStatus != null ">
+            and r.comment_status = #{param.commentStatus}
+        </if>
+        <if test="param.repairIds != null and param.repairIds.size >0 ">
+            and r.repair_id in
+            <foreach item="repairId" collection="param.repairIds" open="(" separator="," close=")">
+                #{repairId}
+            </foreach>
+        </if>
+        order by r.create_time desc
+    </select>
+
+
 </mapper>
 </mapper>