Browse Source

出口合同代码

chen 3 weeks ago
parent
commit
c8e02eb78b
12 changed files with 319 additions and 98 deletions
  1. 0 1
      yudao-module-contract/yudao-module-contract-biz/src/main/java/cn/iocoder/yudao/module/contract/controller/admin/basicData/vo/BasicSupplierRespVO.java
  2. 12 9
      yudao-module-contract/yudao-module-contract-biz/src/main/java/cn/iocoder/yudao/module/contract/controller/admin/exportContract/ExportContractController.java
  3. 2 2
      yudao-module-contract/yudao-module-contract-biz/src/main/java/cn/iocoder/yudao/module/contract/controller/admin/exportContract/ExportOrderController.java
  4. 141 0
      yudao-module-contract/yudao-module-contract-biz/src/main/java/cn/iocoder/yudao/module/contract/controller/admin/exportContract/vo/ExportContractExportVO.java
  5. 4 0
      yudao-module-contract/yudao-module-contract-biz/src/main/java/cn/iocoder/yudao/module/contract/controller/admin/exportContract/vo/ExportContractPageReqVO.java
  6. 40 49
      yudao-module-contract/yudao-module-contract-biz/src/main/java/cn/iocoder/yudao/module/contract/controller/admin/exportContract/vo/ExportOrderPageReqVO.java
  7. 1 1
      yudao-module-contract/yudao-module-contract-biz/src/main/java/cn/iocoder/yudao/module/contract/controller/admin/invoice/InvoiceController.java
  8. 3 0
      yudao-module-contract/yudao-module-contract-biz/src/main/java/cn/iocoder/yudao/module/contract/dal/mysql/exportContract/ExportContractMapper.java
  9. 35 11
      yudao-module-contract/yudao-module-contract-biz/src/main/java/cn/iocoder/yudao/module/contract/dal/mysql/order/OrderMapper.java
  10. 48 24
      yudao-module-contract/yudao-module-contract-biz/src/main/java/cn/iocoder/yudao/module/contract/service/exportContract/ExportContractServiceImpl.java
  11. 1 0
      yudao-module-contract/yudao-module-contract-biz/src/main/java/cn/iocoder/yudao/module/contract/service/invoiceContract/InvoiceContractServiceImpl.java
  12. 32 1
      yudao-module-contract/yudao-module-contract-biz/src/main/java/cn/iocoder/yudao/module/contract/utils/DateEnFormatUtil.java

+ 0 - 1
yudao-module-contract/yudao-module-contract-biz/src/main/java/cn/iocoder/yudao/module/contract/controller/admin/basicData/vo/BasicSupplierRespVO.java

@@ -14,7 +14,6 @@ import com.alibaba.excel.annotation.*;
 public class BasicSupplierRespVO {
 
     @Schema(description = "编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "31260")
-    @ExcelProperty("编号")
     private Long id;
 
     @Schema(description = "供应商名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "李四")

+ 12 - 9
yudao-module-contract/yudao-module-contract-biz/src/main/java/cn/iocoder/yudao/module/contract/controller/admin/exportContract/ExportContractController.java

@@ -114,8 +114,8 @@ public class ExportContractController {
         pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
         List<ExportContractDO> list = exportContractService.getExportContractPage(pageReqVO).getList();
         // 导出 Excel
-        ExcelUtils.write(response, "出口合同.xls", "数据", ExportContractRespVO.class,
-                        BeanUtils.toBean(list, ExportContractRespVO.class));
+        ExcelUtils.write(response, "出口合同.xls", "数据", ExportContractExportVO.class,
+                        BeanUtils.toBean(list, ExportContractExportVO.class));
     }
 
     /**
@@ -184,7 +184,7 @@ public class ExportContractController {
                     break;
                 }
             }
-            exportContractService.updateById(exportContract);
+            exportContractService.updateById(updateObj);
         }
         return success(true);
     }
@@ -213,11 +213,14 @@ public class ExportContractController {
     @Parameter(name = "id", description = "编号", required = true, example = "1024")
     public CommonResult<?> cancellation(@RequestParam("id") Long id) {
         ExportContractDO exportContract = exportContractService.getById(id);
-        exportContract.setStatus("3");
-        exportContract.setContractHtml("");
-        exportContract.setContractFileUrl("");
-        exportContractService.updateById(exportContract);
-
+        List<ExportContractDO> list = exportContractService.list(Wrappers.<ExportContractDO>lambdaQuery().eq(ExportContractDO::getBstnk,exportContract.getBstnk()).ne(ExportContractDO::getStatus,"3"));
+        for(ExportContractDO exportContractDo : list){
+            exportContractDo.setStatus("3");
+            exportContractDo.setContractHtml("");
+            exportContractDo.setContractFileUrl("");
+            exportContractService.updateById(exportContractDo);
+        }
+        exportContract = exportContractService.getById(id);
         List<OrderDO> orderList = orderService.list(Wrappers.<OrderDO>lambdaQuery().eq(OrderDO::getContractNo,exportContract.getBstnk()) );
         for(OrderDO orderDO : orderList){
             //合同作废 3
@@ -241,7 +244,7 @@ public class ExportContractController {
         if (exportContract == null) {
             return error("合同不存在");
         }
-        List<OrderDetailsDO> detailsList = orderDetailsMapper.selectList(Wrappers.<OrderDetailsDO>lambdaQuery().in(OrderDetailsDO::getVbeln,Arrays.asList(exportContract.getVbelns())).orderByAsc(OrderDetailsDO::getVbeln,OrderDetailsDO::getPosnr).orderByAsc(OrderDetailsDO::getVbeln,OrderDetailsDO::getPosnr));
+        List<OrderDetailsDO> detailsList = orderDetailsMapper.selectList(Wrappers.<OrderDetailsDO>lambdaQuery().in(OrderDetailsDO::getVbeln,Arrays.asList(exportContract.getVbelns().split(","))).orderByAsc(OrderDetailsDO::getVbeln,OrderDetailsDO::getPosnr));
 
         exportContractService.generateContractFile(exportContract,detailsList);
         if("2".equals(exportContract.getStatus())){

+ 2 - 2
yudao-module-contract/yudao-module-contract-biz/src/main/java/cn/iocoder/yudao/module/contract/controller/admin/exportContract/ExportOrderController.java

@@ -121,7 +121,7 @@ public class ExportOrderController {
             return error("公司不存在或公司英文地址公司英文名称为空");
         }
         ClientDO clientDO = clientService.getOne(Wrappers.<ClientDO>lambdaQuery().eq(ClientDO::getClientCode,order.getKunnr()));
-        if(clientDO==null || StringUtils.isBlank(clientDO.getCollectionAddress())){
+        if(clientDO==null || StringUtils.isBlank(clientDO.getStreet())){
             return error("客户不存在或客户地址为空");
         }
         List<OrderDetailsDO> detailsList = orderDetailsMapper.selectList(Wrappers.<OrderDetailsDO>lambdaQuery().in(OrderDetailsDO::getOrderId,Arrays.asList(ids)).orderByAsc(OrderDetailsDO::getVbeln,OrderDetailsDO::getPosnr).orderByAsc(OrderDetailsDO::getVbeln,OrderDetailsDO::getPosnr));
@@ -131,7 +131,7 @@ public class ExportOrderController {
         Map<String,Object> result = new HashMap<>();
         result.put("orderIds",orderIds);
         result.put("companyEnAddress",companyDO.getEnAddress());
-        result.put("collectionAddress",clientDO.getCollectionAddress());
+        result.put("collectionAddress",clientDO.getStreet());
         result.put("exportContract",exportContract);
         result.put("detailsList",detailsList);
         return success(result);

+ 141 - 0
yudao-module-contract/yudao-module-contract-biz/src/main/java/cn/iocoder/yudao/module/contract/controller/admin/exportContract/vo/ExportContractExportVO.java

@@ -0,0 +1,141 @@
+package cn.iocoder.yudao.module.contract.controller.admin.exportContract.vo;
+
+import cn.iocoder.yudao.framework.common.pojo.PageParam;
+import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat;
+import cn.iocoder.yudao.framework.excel.core.convert.DictConvert;
+import cn.iocoder.yudao.module.contract.utils.StringUtils;
+import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
+import com.alibaba.excel.annotation.ExcelProperty;
+import com.alibaba.excel.annotation.write.style.ColumnWidth;
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.ToString;
+import org.springframework.format.annotation.DateTimeFormat;
+
+import java.time.LocalDateTime;
+
+import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
+
+@Schema(description = "管理后台 - 出口合同分页 Request VO")
+@Data
+@ExcelIgnoreUnannotated
+public class ExportContractExportVO {
+
+    @Schema(description = "合同状态", example = "1")
+    @ExcelProperty(value="合同状态", converter = DictConvert.class)
+    @DictFormat("order_contract_status") // TODO 代码优化:建议设置到对应的 DictTypeConstants 枚举类中
+    private String status;
+
+    @Schema(description = "合同类型", example = "1")
+    @ExcelProperty("合同类型")
+    private String type;
+
+    @Schema(description = "合同日期")
+    @ExcelProperty("合同日期")
+    private String audat;
+
+    @Schema(description = "合同号码")
+    @ExcelProperty("合同号码")
+    private String bstnk;
+
+    @Schema(description = "组织编码")
+    @ExcelProperty("组织编码")
+    private String vkorg;
+
+    @Schema(description = "销售方编码")
+    @ExcelProperty("销售方编码")
+    private String bukrs;
+
+    @Schema(description = "销售方名称")
+    @ExcelProperty("销售方名称")
+    private String butxt;
+
+    @Schema(description = "售达方编码")
+    @ExcelProperty("售达方编码")
+    private String kunnr;
+
+    @Schema(description = "售达方名称", example = "张三")
+    @ExcelProperty("售达方名称")
+    private String kname;
+
+    @Schema(description = "付款条件", example = "张三")
+    @ExcelProperty("付款条件")
+    private String paymentName;
+
+    @Schema(description = "装运期限")
+    @ExcelProperty("装运期限")
+    private String vdatu;
+
+    @Schema(description = "国际贸易条件")
+    @ExcelProperty("国际贸易条件")
+    private String inco1;
+
+    @Schema(description = "国际贸易条件2")
+    @ExcelProperty("国际贸易条件2")
+    private String inco2;
+
+    @Schema(description = "包装方式", example = "赵六")
+    @ExcelProperty("包装方式")
+    private String packingName;
+
+    @Schema(description = "收款银行", example = "李四")
+    @ExcelProperty("收款银行")
+    private String bankName;
+
+    @Schema(description = "经销商名称")
+    @ExcelProperty("经销商名称")
+    private String zzlifnrt;
+
+    @Schema(description = "总金额")
+    @ExcelProperty("总金额")
+    private String totalMoney;
+
+    @Schema(description = "下载次数", example = "12708")
+    @ExcelProperty("下载次数")
+    private Integer downloadCount;
+
+    @Schema(description = "打印次数", example = "13810")
+    @ExcelProperty("打印次数")
+    private Integer printCount;
+
+
+    @Schema(description = "原件是否上传")
+    @ExcelProperty("原件是否上传")
+    private String fileIds;
+
+
+    @Schema(description = "释放推送状态")
+    @ExcelProperty(value = "释放推送状态", converter = DictConvert.class)
+    @DictFormat("order_contract_push_release") // TODO 代码优化:建议设置到对应的 DictTypeConstants 枚举类中
+    private String isPushRelease;
+
+    @Schema(description = "异常原因")
+    @ExcelProperty("异常原因")
+    private String abnormalCause;
+
+    @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
+    @ExcelProperty("创建时间")
+    @ColumnWidth(20)
+    private LocalDateTime createTime;
+
+
+    public String getFileIds() {
+        if(StringUtils.isBlank(fileIds)){
+            return "否";
+        }else{
+            return "是";
+        }
+    }
+
+
+    public String getType(){
+        if("1".equals(type)){
+            return "出口订单合同";
+        }else if("2".equals(type)){
+            return "佣金合同";
+        }else{
+            return "";
+        }
+    }
+}

+ 4 - 0
yudao-module-contract/yudao-module-contract-biz/src/main/java/cn/iocoder/yudao/module/contract/controller/admin/exportContract/vo/ExportContractPageReqVO.java

@@ -44,6 +44,10 @@ public class ExportContractPageReqVO extends PageParam {
     private LocalDateTime[] createTime;
 
 
+    @Schema(description = "状态", example = "1")
+    private String[] statusList;
+
+
 
     @Schema(description = "排序字段")
     private String prop;

+ 40 - 49
yudao-module-contract/yudao-module-contract-biz/src/main/java/cn/iocoder/yudao/module/contract/controller/admin/exportContract/vo/ExportOrderPageReqVO.java

@@ -17,35 +17,55 @@ import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_
 @ToString(callSuper = true)
 public class ExportOrderPageReqVO extends PageParam {
 
-//    @Schema(description = "类型编码")
-//    private String contractTypeCode;
-//
-//    @Schema(description = "类型名称", example = "李四")
-//    private String contractTypeName;
-//
-//    @Schema(description = "模板id", example = "4922")
-//    private Long contractTemplateId;
-//
-//    @Schema(description = "模板名称", example = "张三")
-//    private String contractTemplateName;
+
     @Schema(description = "凭证日期")
-    private String audat;
+    private String[] audat;
 
     @Schema(description = "销售凭证")
     private String vbeln;
 
+    @Schema(description = "销售凭证搜索类型")
+    private String vbelnType;
+
+    @Schema(description = "销售凭证区间开始")
+    private String vbelnStart;
+
+    @Schema(description = "销售凭证区间结束")
+    private String vbelnEnd;
+
     @Schema(description = "销售凭证类型/销售凭证类型")
     private String pzinfo;
 
     @Schema(description = "销售组织")
     private String vkorg;
 
+    @Schema(description = "合同管控类型解释")
+    private String zzhtgklxms;
+
+    @Schema(description = "合同管控类型")
+    private String zzhtgklx;
+
+    @Schema(description = "付款条件解释")
+    private String ztermt;
+
+    @Schema(description = "付款条件")
+    private String zterm;
+
+    @Schema(description = "付款条件搜索类型")
+    private String ztermtType;
+
     @Schema(description = "公司代码/公司名称")
     private String buinfo;
 
     @Schema(description = "售达方/售达方描述")
     private String kuinfo;
 
+    @Schema(description = "售达方")
+    private String kunnr;
+
+    @Schema(description = "售达方搜索类型")
+    private String kunnrType;
+
     @Schema(description = "销售部门/部门描述")
     private String vkinfo;
 
@@ -54,42 +74,13 @@ public class ExportOrderPageReqVO extends PageParam {
 
     @Schema(description = "业务员/业务员名称")
     private String ywyinfo;
-//
-//    @Schema(description = "装运条件")
-//    private String vsbed;
-//
-//    @Schema(description = "合同管控类型")
-//    private String zzhtgklx;
-//
-//    @Schema(description = "合同管控类型描述")
-//    private String zzhtgklxms;
-//
-//    @Schema(description = "抬头合同打印备注")
-//    private String zzhthbz;
-//
-//    @Schema(description = "送货地址")
-//    private String zzshdz;
-//
-//    @Schema(description = "付款条件")
-//    private String zterm;
-//
-//    @Schema(description = "付款条件解释")
-//    private String ztermt;
-//
-//    @Schema(description = "交货冻结")
-//    private String lifsk;
-//
-//    @Schema(description = "信用期")
-//    private String zmonth;
-//
-//    @Schema(description = "订单原因")
-//    private String augru;
-//
-//    @Schema(description = "订单原因解释")
-//    private String augrut;
-
-    @Schema(description = "创建时间")
-    @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
-    private LocalDateTime[] createTime;
 
+    @Schema(description = "合同状态", example = "1")
+    private String status;
+
+
+    @Schema(description = "排序字段")
+    private String prop;
+    @Schema(description = "排序类型")
+    private String order;
 }

+ 1 - 1
yudao-module-contract/yudao-module-contract-biz/src/main/java/cn/iocoder/yudao/module/contract/controller/admin/invoice/InvoiceController.java

@@ -162,7 +162,7 @@ public class InvoiceController {
         if(!"-2".equals(status) && !"0".equals(status)){
             return error("传入的状态异常");
         }
-        if("-2".equals(invoiceDO.getStatus()) || "0".equals(invoiceDO.getStatus())){
+        if("-2".equals(invoiceDO.getStatus()) || "0".equals(invoiceDO.getStatus()) || "2".equals(invoiceDO.getStatus())){
             InvoiceDO invoice = new InvoiceDO();
             invoice.setId(id);
             invoice.setStatus(status);

+ 3 - 0
yudao-module-contract/yudao-module-contract-biz/src/main/java/cn/iocoder/yudao/module/contract/dal/mysql/exportContract/ExportContractMapper.java

@@ -7,6 +7,7 @@ import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
 import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
 import cn.iocoder.yudao.framework.mybatis.core.query.MPJLambdaWrapperX;
 import cn.iocoder.yudao.module.contract.dal.dataobject.exportContract.ExportContractDO;
+import cn.iocoder.yudao.module.contract.dal.dataobject.invoiceContract.InvoiceContractDO;
 import cn.iocoder.yudao.module.contract.dal.dataobject.order.OrderDO;
 import cn.iocoder.yudao.module.contract.utils.StringUtils;
 import org.apache.commons.lang3.ObjectUtils;
@@ -27,6 +28,8 @@ public interface ExportContractMapper extends BaseMapperX<ExportContractDO> {
                 .betweenIfPresent(ExportContractDO::getCreateTime, reqVO.getCreateTime())
                 .betweenIfPresent(ExportContractDO::getAudat, reqVO.getAudat())
 
+                .in(!ObjectUtils.isEmpty(reqVO.getStatusList()), ExportContractDO::getStatus, Arrays.asList(!ObjectUtils.isEmpty(reqVO.getStatusList())?reqVO.getStatusList():new Object[]{""}))
+
 
                 .like(!ObjectUtils.isEmpty(reqVO.getVkorg()) && "1".equals(reqVO.getVkorgType()),ExportContractDO::getVkorg, reqVO.getVkorg())
                 .in(!ObjectUtils.isEmpty(reqVO.getVkorg()) && "2".equals(reqVO.getVkorgType()),ExportContractDO::getVkorg, !ObjectUtils.isEmpty(reqVO.getVkorg()) ?reqVO.getVkorg().split(","): new Object[]{""})

+ 35 - 11
yudao-module-contract/yudao-module-contract-biz/src/main/java/cn/iocoder/yudao/module/contract/dal/mysql/order/OrderMapper.java

@@ -3,10 +3,14 @@ package cn.iocoder.yudao.module.contract.dal.mysql.order;
 import java.util.*;
 
 import cn.iocoder.yudao.framework.common.pojo.PageResult;
+import cn.iocoder.yudao.framework.common.util.collection.ArrayUtils;
 import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
 import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
+import cn.iocoder.yudao.framework.mybatis.core.query.MPJLambdaWrapperX;
 import cn.iocoder.yudao.module.contract.controller.admin.exportContract.vo.ExportOrderPageReqVO;
 import cn.iocoder.yudao.module.contract.dal.dataobject.order.OrderDO;
+import cn.iocoder.yudao.module.contract.dal.dataobject.orderContract.OrderContractDO;
+import cn.iocoder.yudao.module.contract.utils.StringUtils;
 import org.apache.commons.lang3.ObjectUtils;
 import org.apache.ibatis.annotations.Mapper;
 import cn.iocoder.yudao.module.contract.controller.admin.order.vo.*;
@@ -63,18 +67,38 @@ public interface OrderMapper extends BaseMapperX<OrderDO> {
     }
 
     default PageResult<OrderDO> getExportOrderPage(ExportOrderPageReqVO reqVO) {
-        return selectPage(reqVO, new LambdaQueryWrapperX<OrderDO>()
-                .eqIfPresent(OrderDO::getAudat, reqVO.getAudat())
-                .likeIfPresent(OrderDO::getVbeln, reqVO.getVbeln())
-                .likeIfPresent(OrderDO::getVkorg, reqVO.getVkorg())
-                .betweenIfPresent(OrderDO::getCreateTime, reqVO.getCreateTime())
-                .and(!ObjectUtils.isEmpty(reqVO.getPzinfo()),i -> i.like(OrderDO::getAuart, reqVO.getPzinfo()).or().like(OrderDO::getAuartt, reqVO.getPzinfo()))
-                .and(!ObjectUtils.isEmpty(reqVO.getBuinfo()),i -> i.like(OrderDO::getBukrs, reqVO.getBuinfo()).or().like(OrderDO::getButxt, reqVO.getBuinfo()))
-                .and(!ObjectUtils.isEmpty(reqVO.getKuinfo()),i -> i.like(OrderDO::getKunnr, reqVO.getKuinfo()).or().like(OrderDO::getKname, reqVO.getKuinfo()))
-                .and(!ObjectUtils.isEmpty(reqVO.getVkinfo()),i -> i.like(OrderDO::getVkbur, reqVO.getVkinfo()).or().like(OrderDO::getVkburt, reqVO.getVkinfo()))
+        return selectPage(reqVO, new MPJLambdaWrapperX<OrderDO>()
+                .between(!ObjectUtils.isEmpty(reqVO.getAudat()),OrderDO::getAudat, ArrayUtils.get(reqVO.getAudat(), 0),ArrayUtils.get(reqVO.getAudat(), 1))
+                .like(!ObjectUtils.isEmpty(reqVO.getVbeln()) && "1".equals(reqVO.getVbelnType()),OrderDO::getVbeln, reqVO.getVbeln())
+                .in(!ObjectUtils.isEmpty(reqVO.getVbeln()) && "2".equals(reqVO.getVbelnType()),OrderDO::getVbeln, !ObjectUtils.isEmpty(reqVO.getVbeln()) ?reqVO.getVbeln().split(","): new Object[]{""})
+
+                .like(!ObjectUtils.isEmpty(reqVO.getZtermt()) && "1".equals(reqVO.getZtermtType()),OrderDO::getZtermt, reqVO.getZtermt())
+                .in(!ObjectUtils.isEmpty(reqVO.getZtermt()) && "2".equals(reqVO.getZtermtType()),OrderDO::getZtermt, !ObjectUtils.isEmpty(reqVO.getZtermt()) ?reqVO.getZtermt().split(","): new Object[]{""})
+                .notIn(!ObjectUtils.isEmpty(reqVO.getZtermt()) && "3".equals(reqVO.getZtermtType()),OrderDO::getZtermt, !ObjectUtils.isEmpty(reqVO.getZtermt()) ?reqVO.getZtermt().split(","): new Object[]{""})
+
+                .ge(!ObjectUtils.isEmpty(reqVO.getVbelnStart()),OrderDO::getVbeln, reqVO.getVbelnStart())
+                .le(!ObjectUtils.isEmpty(reqVO.getVbelnEnd()),OrderDO::getVbeln, reqVO.getVbelnEnd())
+                .like(!ObjectUtils.isEmpty(reqVO.getVkorg()),OrderDO::getVkorg, reqVO.getVkorg())
+                .in(!ObjectUtils.isEmpty(reqVO.getZzhtgklxms()),OrderDO::getZzhtgklxms,  !ObjectUtils.isEmpty(reqVO.getZzhtgklxms()) ?reqVO.getZzhtgklxms().split(","): new Object[]{""})
+                .in(!ObjectUtils.isEmpty(reqVO.getPzinfo()),OrderDO::getAuartt,  !ObjectUtils.isEmpty(reqVO.getPzinfo()) ?reqVO.getPzinfo().split(","): new Object[]{""})
+                .in(!ObjectUtils.isEmpty(reqVO.getBuinfo()),OrderDO::getButxt,  !ObjectUtils.isEmpty(reqVO.getBuinfo()) ?reqVO.getBuinfo().split(","): new Object[]{""})
+                .in(!ObjectUtils.isEmpty(reqVO.getKuinfo()),OrderDO::getKname,  !ObjectUtils.isEmpty(reqVO.getKuinfo()) ?reqVO.getKuinfo().split(","): new Object[]{""})
+
+                .like(!ObjectUtils.isEmpty(reqVO.getKunnr()) && "1".equals(reqVO.getKunnrType()),OrderDO::getKname, reqVO.getKunnr())
+                .in(!ObjectUtils.isEmpty(reqVO.getKunnr()) && "2".equals(reqVO.getKunnrType()),OrderDO::getKname, !ObjectUtils.isEmpty(reqVO.getKunnr()) ?reqVO.getKunnr().split(","): new Object[]{""})
+
+                .in(!ObjectUtils.isEmpty(reqVO.getVkinfo()),OrderDO::getVkburt,  !ObjectUtils.isEmpty(reqVO.getVkinfo()) ?reqVO.getVkinfo().split(","): new Object[]{""})
                 .and(!ObjectUtils.isEmpty(reqVO.getVkginfo()),i -> i.like(OrderDO::getVkgrp, reqVO.getVkginfo()).or().like(OrderDO::getVkgrpt, reqVO.getVkginfo()))
-                .and(!ObjectUtils.isEmpty(reqVO.getYwyinfo()),i -> i.like(OrderDO::getYwy, reqVO.getYwyinfo()).or().like(OrderDO::getYwyt, reqVO.getYwyinfo()))
+                .in(!ObjectUtils.isEmpty(reqVO.getYwyinfo()),OrderDO::getYwyt,  !ObjectUtils.isEmpty(reqVO.getYwyinfo()) ?reqVO.getYwyinfo().split(","): new Object[]{""})
+
+                .in(!ObjectUtils.isEmpty(reqVO.getZzhtgklx()),OrderDO::getZzhtgklx,  !ObjectUtils.isEmpty(reqVO.getZzhtgklx()) ?reqVO.getZzhtgklx().split(","): new Object[]{""})
+                .in(!ObjectUtils.isEmpty(reqVO.getZterm()),OrderDO::getZterm,  !ObjectUtils.isEmpty(reqVO.getZterm()) ?reqVO.getZterm().split(","): new Object[]{""})
+                .eq(!ObjectUtils.isEmpty(reqVO.getStatus()), OrderDO::getStatus, reqVO.getStatus())
+
                 .eq(OrderDO::getHtdymb,"Y4")
-                .orderByDesc(OrderDO::getAudat).orderByDesc(OrderDO::getVbeln));
+
+                .orderByDesc(ObjectUtils.isEmpty(reqVO.getOrder()),OrderDO::getAudat).orderByDesc(ObjectUtils.isEmpty(reqVO.getOrder()),OrderDO::getVbeln)
+                .orderBy(ObjectUtils.isNotEmpty(reqVO.getOrder()),"ascending".equals(reqVO.getOrder()), StringUtils.toUnderScoreCase(reqVO.getProp()))
+        );
     }
 }

+ 48 - 24
yudao-module-contract/yudao-module-contract-biz/src/main/java/cn/iocoder/yudao/module/contract/service/exportContract/ExportContractServiceImpl.java

@@ -1,25 +1,16 @@
 package cn.iocoder.yudao.module.contract.service.exportContract;
 
-import cn.hutool.core.date.DateUtil;
 import cn.hutool.core.util.ObjectUtil;
 import cn.iocoder.yudao.framework.common.exception.ServiceException;
 import cn.iocoder.yudao.framework.common.exception.enums.GlobalErrorCodeConstants;
 import cn.iocoder.yudao.framework.common.util.number.MoneyUtil;
 import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils;
-import cn.iocoder.yudao.framework.web.core.util.WebFrameworkUtils;
-import cn.iocoder.yudao.module.contract.dal.dataobject.basicData.BasicBankDO;
-import cn.iocoder.yudao.module.contract.dal.dataobject.basicData.BasicPackingDO;
-import cn.iocoder.yudao.module.contract.dal.dataobject.basicData.BasicPaymentDO;
-import cn.iocoder.yudao.module.contract.dal.dataobject.basicData.BasicSupplierDO;
+import cn.iocoder.yudao.module.contract.dal.dataobject.basicData.*;
 import cn.iocoder.yudao.module.contract.dal.dataobject.client.ClientDO;
 import cn.iocoder.yudao.module.contract.dal.dataobject.company.CompanyDO;
 import cn.iocoder.yudao.module.contract.dal.dataobject.contractTemplate.ContractTemplateDO;
-import cn.iocoder.yudao.module.contract.dal.dataobject.frameworkAgreement.FrameworkAgreementDO;
-import cn.iocoder.yudao.module.contract.dal.dataobject.invoice.InvoiceDO;
-import cn.iocoder.yudao.module.contract.dal.dataobject.invoice.InvoiceDetailsDO;
 import cn.iocoder.yudao.module.contract.dal.dataobject.order.OrderDO;
 import cn.iocoder.yudao.module.contract.dal.dataobject.order.OrderDetailsDO;
-import cn.iocoder.yudao.module.contract.dal.dataobject.orderContract.OrderContractDO;
 import cn.iocoder.yudao.module.contract.dal.mysql.order.OrderDetailsMapper;
 import cn.iocoder.yudao.module.contract.service.basicData.*;
 import cn.iocoder.yudao.module.contract.service.client.ClientService;
@@ -28,38 +19,32 @@ import cn.iocoder.yudao.module.contract.service.contractTemplate.ContractTemplat
 import cn.iocoder.yudao.module.contract.service.order.OrderService;
 import cn.iocoder.yudao.module.contract.utils.DateEnFormatUtil;
 import cn.iocoder.yudao.module.contract.utils.HtmlToFileConverter;
-import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import cn.iocoder.yudao.module.contract.utils.StringUtils;
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import lombok.extern.slf4j.Slf4j;
-import org.checkerframework.checker.units.qual.C;
 import org.jsoup.Jsoup;
 import org.jsoup.nodes.Document;
 import org.jsoup.nodes.Element;
 import org.jsoup.select.Elements;
 import org.springframework.stereotype.Service;
 import javax.annotation.Resource;
-import javax.jnlp.BasicService;
 
 import org.springframework.validation.annotation.Validated;
 import org.springframework.transaction.annotation.Transactional;
 
 import java.math.BigDecimal;
-import java.time.LocalDateTime;
 import java.util.*;
 import java.util.stream.Collectors;
 
 import cn.iocoder.yudao.module.contract.controller.admin.exportContract.vo.*;
 import cn.iocoder.yudao.module.contract.dal.dataobject.exportContract.ExportContractDO;
 import cn.iocoder.yudao.framework.common.pojo.PageResult;
-import cn.iocoder.yudao.framework.common.pojo.PageParam;
 import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
 
 import cn.iocoder.yudao.module.contract.dal.mysql.exportContract.ExportContractMapper;
 
 import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
-import static cn.iocoder.yudao.framework.common.pojo.CommonResult.error;
 import static cn.iocoder.yudao.module.contract.enums.ErrorCodeConstants.*;
 
 /**
@@ -206,6 +191,7 @@ public class ExportContractServiceImpl extends ServiceImpl<ExportContractMapper,
         if(StringUtils.isNotBlank(exportContract.getZzlifnr())){
             //供应商不为空时生成佣金合同
             ExportContractDO exportContractDO = BeanUtils.toBean(exportContract,ExportContractDO.class);
+            exportContractDO.setId(null);
             exportContractDO.setType("2");
             generateContractFile(exportContractDO,exportContractGenerate.getDetailsList());
             saveOrUpdate(exportContractDO);
@@ -246,10 +232,23 @@ public class ExportContractServiceImpl extends ServiceImpl<ExportContractMapper,
             }
             Map<String,Object> param = buildContractParam(exportContract,detailsList,basicBankDO,company,clientDO);
             htmlContent = HtmlToFileConverter.authHtmlToPdf(htmlContent, param);
-            String fileUrl = htmlToFileConverter.htmlToWord(htmlContent,"exportContract/"+exportContract.getBstnk(),"fpht-");
-            if("2".equals(exportContract.getType())){
+            String fileUrl = null;
+            if("1".equals(exportContract.getType())){
+                fileUrl = htmlToFileConverter.htmlToWord(htmlContent,"exportContract/"+exportContract.getBstnk(),"fpht-");
+            }else{
                 //佣金合同,需要与出口订单合同合并
-
+                List<String> htmlContents = new ArrayList<>();
+                ExportContractDO exportContractDO = getOne(Wrappers.<ExportContractDO>lambdaQuery().eq(ExportContractDO::getBstnk,exportContract.getBstnk()).eq(ExportContractDO::getType,"1").ne(ExportContractDO::getStatus,"3"));
+                if(exportContractDO==null){
+                    throw new ServiceException(GlobalErrorCodeConstants.INTERNAL_SERVER_ERROR.getCode(),"佣金合同生成失败,未找到"+exportContract.getBstnk()+"的出口合同");
+                }
+                htmlContents.add(exportContractDO.getContractHtml());
+                htmlContents.add(htmlContent);
+                fileUrl = htmlToFileConverter.htmlToWord(htmlContents,"exportContract/"+exportContract.getBstnk(),"fpht-");
+                htmlContent = StringUtils.join(htmlContents,"<div style='break-after: page;'></div><div class='page-break'>")+"</div>";
+            }
+            if(fileUrl==null){
+                throw new ServiceException(GlobalErrorCodeConstants.INTERNAL_SERVER_ERROR.getCode(),"文件生成失败");
             }
 //            exportContract.setGeneratedTime(LocalDateTime.now());
             exportContract.setContractHtml(htmlContent);
@@ -343,8 +342,12 @@ public class ExportContractServiceImpl extends ServiceImpl<ExportContractMapper,
         param.put("付款条件", StringUtils.nvl(exportContract.getPaymentName(), ""));
         if(StringUtils.isNotBlank(exportContract.getVdatu())){
             param.put("装运期限", DateEnFormatUtil.convertToCustomFormat(exportContract.getVdatu()));
+            param.put("凭证日期后一月", DateEnFormatUtil.convertToCustomFormat(exportContract.getVdatu(),1));
+            param.put("凭证日期后三月", DateEnFormatUtil.convertToCustomFormat(exportContract.getVdatu(),2));
         }else{
             param.put("装运期限", "");
+            param.put("凭证日期后一月", "");
+            param.put("凭证日期后三月", "");
         }
         param.put("经销商名称", StringUtils.nvl(exportContract.getZzlifnrt(), ""));
         param.put("公司代码", StringUtils.nvl(exportContract.getBukrs(), ""));
@@ -359,10 +362,6 @@ public class ExportContractServiceImpl extends ServiceImpl<ExportContractMapper,
         param.put("联行号", StringUtils.nvl(basicBankDO.getBankCode(), ""));
         param.put("银行账号", StringUtils.nvl(basicBankDO.getBankAccount(), ""));
 
-        param.put("品种海关编码", StringUtils.nvl("", ""));
-        param.put("价格组合并", StringUtils.nvl("", ""));
-        param.put("凭证日期后一月", StringUtils.nvl("", ""));
-        param.put("凭证日期后三月", StringUtils.nvl("", ""));
         //产品信息
         List<Map<String,Object>> details = new ArrayList<>();
         BigDecimal quantityTotal= BigDecimal.ZERO;
@@ -370,8 +369,30 @@ public class ExportContractServiceImpl extends ServiceImpl<ExportContractMapper,
         BigDecimal noTaxAmountSum = BigDecimal.ZERO;
         String rebirthRemark = "";
 
+        List<String> brokerageList = new ArrayList<>();
+        List<String> varietyList = new ArrayList<>();
         for(int i=0;i<orderDeatils.size();i++){
             OrderDetailsDO orderDetailsDO = orderDeatils.get(i);
+            BasicBrokerageDO brokerage = null;
+            BasicVarietyDO variety = null;
+            if(StringUtils.isNotBlank(orderDetailsDO.getKonda())){
+                brokerage = basicBrokerageService.getOne(Wrappers.<BasicBrokerageDO>lambdaQuery().eq(BasicBrokerageDO::getCode,orderDetailsDO.getKonda()),false);
+                if(brokerage==null){
+                    throw new ServiceException(GlobalErrorCodeConstants.INTERNAL_SERVER_ERROR.getCode(),"佣金组-"+orderDetailsDO.getKonda()+"不存在");
+                }
+                if(!brokerageList.contains(brokerage.getValue())){
+                    brokerageList.add(brokerage.getValue());
+                }
+            }
+            if(StringUtils.isNotBlank(orderDetailsDO.getZzpz())){
+                variety = basicVarietyService.getOne(Wrappers.<BasicVarietyDO>lambdaQuery().eq(BasicVarietyDO::getName,orderDetailsDO.getZzpz()),false);
+                if(variety==null){
+                    throw new ServiceException(GlobalErrorCodeConstants.INTERNAL_SERVER_ERROR.getCode(),"品种编码-"+orderDetailsDO.getZzpz()+"不存在");
+                }
+                if(!varietyList.contains(variety.getValue())){
+                    varietyList.add(variety.getValue());
+                }
+            }
             Map<String,Object> data = new HashMap<>();
             data.put("序号",i+1);
             data.put("行项目", StringUtils.nvl(orderDetailsDO.getPosnr(),""));
@@ -395,7 +416,7 @@ public class ExportContractServiceImpl extends ServiceImpl<ExportContractMapper,
             data.put("物料功能性", StringUtils.nvl(orderDetailsDO.getZzwlgnx(),""));
 
             data.put("凭证货币", StringUtils.nvl(orderDetailsDO.getWaerk(),""));
-            data.put("佣金组", StringUtils.nvl("",""));
+            data.put("佣金组", brokerage!=null?brokerage.getValue():"");
             data.put("佣金金额", StringUtils.nvl(MoneyUtil.toSeparator(orderDetailsDO.getKwert()),""));
             data.put("销售单位", StringUtils.nvl(orderDetailsDO.getVrkme(),""));
             data.put("物料类型", StringUtils.nvl(orderDetailsDO.getMtart(),""));
@@ -419,6 +440,9 @@ public class ExportContractServiceImpl extends ServiceImpl<ExportContractMapper,
         }
         param.put("orderDetails",details);
 
+        param.put("价格组合并", brokerageList.size()>0?String.join(";", brokerageList):"");
+        param.put("品种海关编码", varietyList.size()>0?String.join(";", varietyList):"");
+
         //产品合计
         param.put("再生产品备注",rebirthRemark);
         param.put("数量合计",MoneyUtil.toSeparator(quantityTotal.toString()));

+ 1 - 0
yudao-module-contract/yudao-module-contract-biz/src/main/java/cn/iocoder/yudao/module/contract/service/invoiceContract/InvoiceContractServiceImpl.java

@@ -277,6 +277,7 @@ public class InvoiceContractServiceImpl extends ServiceImpl<InvoiceContractMappe
         param.put("组织编码", StringUtils.nvl(invoiceContract.getSellertaxid(), ""));
         param.put("框架协议号", StringUtils.nvl(frameworkAgreementNo, ""));
         param.put("付款方式", "000".equals(clientDO.getZmonth())?"款到发货":"货到付款");
+        param.put("框架协议名", StringUtils.isNotEmpty(frameworkAgreementNo)?"框架协议:":"");
         //产品信息
         List<Map<String,Object>> details = new ArrayList<>();
         BigDecimal quantityTotal= BigDecimal.ZERO;

+ 32 - 1
yudao-module-contract/yudao-module-contract-biz/src/main/java/cn/iocoder/yudao/module/contract/utils/DateEnFormatUtil.java

@@ -56,10 +56,41 @@ public class DateEnFormatUtil {
         return ordinalDay + "-" + month + "-" + year;
     }
 
+    /**
+     * 将日期从yyyy-MM-dd格式转换为6th-SEP-2022格式
+     *
+     * @param inputDate 输入的日期字符串,格式为yyyy-MM-dd
+     * @return 转换后的日期字符串,格式为6th-SEP-2022
+     * @throws IllegalArgumentException 如果输入的日期字符串格式不正确
+     */
+    public static String convertToCustomFormat(String inputDate,long monthsToAdd) {
+        // 定义输入日期的格式
+        DateTimeFormatter inputFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
+
+        // 解析输入的日期字符串
+        LocalDate date;
+        try {
+            date = LocalDate.parse(inputDate, inputFormatter);
+            date = date.plusMonths(monthsToAdd);
+        } catch (Exception e) {
+            throw new IllegalArgumentException("输入的日期字符串格式不正确: " + inputDate, e);
+        }
+
+        // 获取日期的各个部分
+        int day = date.getDayOfMonth();
+        String month = date.getMonth().getDisplayName(TextStyle.SHORT, Locale.ENGLISH).toUpperCase();
+        int year = date.getYear();
+
+        // 拼接序数后缀
+        String ordinalDay = day + getOrdinalSuffix(day);
+
+        // 返回格式化后的字符串
+        return ordinalDay + "-" + month + "-" + year;
+    }
     public static void main(String[] args) {
         // 测试转换方法
         String inputDate = "2022-09-01";
-        String outputDate = convertToCustomFormat(inputDate);
+        String outputDate = convertToCustomFormat(inputDate,5);
         System.out.println(outputDate); // 输出: 6th-SEP-2022
     }
 }