Ver Fonte

Merge branch 'master' of http://47.100.37.243:10191/wutt/manHourHousekeeper

zhouyy há 7 meses atrás
pai
commit
9f4279a828
44 ficheiros alterados com 2165 adições e 178 exclusões
  1. 28 13
      fhKeeper/formulahousekeeper/management-crm/src/main/java/com/management/platform/controller/ContractController.java
  2. 21 0
      fhKeeper/formulahousekeeper/management-crm/src/main/java/com/management/platform/controller/ContractCustomController.java
  3. 21 0
      fhKeeper/formulahousekeeper/management-crm/src/main/java/com/management/platform/controller/ContractPayCustomizedController.java
  4. 19 2
      fhKeeper/formulahousekeeper/management-crm/src/main/java/com/management/platform/controller/ContractPaymentController.java
  5. 55 0
      fhKeeper/formulahousekeeper/management-crm/src/main/java/com/management/platform/controller/ContractTypeSecController.java
  6. 8 2
      fhKeeper/formulahousekeeper/management-crm/src/main/java/com/management/platform/entity/CompanyDingding.java
  7. 50 1
      fhKeeper/formulahousekeeper/management-crm/src/main/java/com/management/platform/entity/Contract.java
  8. 129 0
      fhKeeper/formulahousekeeper/management-crm/src/main/java/com/management/platform/entity/ContractCustom.java
  9. 98 0
      fhKeeper/formulahousekeeper/management-crm/src/main/java/com/management/platform/entity/ContractPayCustomized.java
  10. 60 0
      fhKeeper/formulahousekeeper/management-crm/src/main/java/com/management/platform/entity/ContractTypeSec.java
  11. 16 0
      fhKeeper/formulahousekeeper/management-crm/src/main/java/com/management/platform/mapper/ContractCustomMapper.java
  12. 2 2
      fhKeeper/formulahousekeeper/management-crm/src/main/java/com/management/platform/mapper/ContractMapper.java
  13. 16 0
      fhKeeper/formulahousekeeper/management-crm/src/main/java/com/management/platform/mapper/ContractPayCustomizedMapper.java
  14. 16 0
      fhKeeper/formulahousekeeper/management-crm/src/main/java/com/management/platform/mapper/ContractTypeSecMapper.java
  15. 16 0
      fhKeeper/formulahousekeeper/management-crm/src/main/java/com/management/platform/service/ContractCustomService.java
  16. 16 0
      fhKeeper/formulahousekeeper/management-crm/src/main/java/com/management/platform/service/ContractPayCustomizedService.java
  17. 11 4
      fhKeeper/formulahousekeeper/management-crm/src/main/java/com/management/platform/service/ContractService.java
  18. 25 0
      fhKeeper/formulahousekeeper/management-crm/src/main/java/com/management/platform/service/ContractTypeSecService.java
  19. 1 0
      fhKeeper/formulahousekeeper/management-crm/src/main/java/com/management/platform/service/DingDingService.java
  20. 4 3
      fhKeeper/formulahousekeeper/management-crm/src/main/java/com/management/platform/service/ExcelExportService.java
  21. 20 0
      fhKeeper/formulahousekeeper/management-crm/src/main/java/com/management/platform/service/impl/ContractCustomServiceImpl.java
  22. 20 0
      fhKeeper/formulahousekeeper/management-crm/src/main/java/com/management/platform/service/impl/ContractPayCustomizedServiceImpl.java
  23. 729 35
      fhKeeper/formulahousekeeper/management-crm/src/main/java/com/management/platform/service/impl/ContractServiceImpl.java
  24. 135 0
      fhKeeper/formulahousekeeper/management-crm/src/main/java/com/management/platform/service/impl/ContractTypeSecServiceImpl.java
  25. 178 25
      fhKeeper/formulahousekeeper/management-crm/src/main/java/com/management/platform/service/impl/ExcelExportServiceImpl.java
  26. 1 1
      fhKeeper/formulahousekeeper/management-crm/src/main/java/com/management/platform/service/impl/SysRoleServiceImpl.java
  27. 2 0
      fhKeeper/formulahousekeeper/management-crm/src/main/java/com/management/platform/service/impl/WxCorpInfoServiceImpl.java
  28. 138 0
      fhKeeper/formulahousekeeper/management-crm/src/main/java/com/management/platform/util/ExcelUtil.java
  29. 30 0
      fhKeeper/formulahousekeeper/management-crm/src/main/resources/mapper/ContractCustomMapper.xml
  30. 1 1
      fhKeeper/formulahousekeeper/management-crm/src/main/resources/mapper/ContractLogMapper.xml
  31. 7 62
      fhKeeper/formulahousekeeper/management-crm/src/main/resources/mapper/ContractMapper.xml
  32. 25 0
      fhKeeper/formulahousekeeper/management-crm/src/main/resources/mapper/ContractPayCustomizedMapper.xml
  33. 18 0
      fhKeeper/formulahousekeeper/management-crm/src/main/resources/mapper/ContractTypeSecMapper.xml
  34. 225 0
      fhKeeper/formulahousekeeper/management-workshop/src/main/java/com/management/platform/task/TimingTask.java
  35. 0 2
      fhKeeper/formulahousekeeper/timesheet/src/views/project/finance.vue
  36. 2 5
      fhKeeper/formulahousekeeper/timesheet_h5/public/index.html
  37. 1 0
      fhKeeper/formulahousekeeper/webttkuaiban/build_package.bat
  38. 3 2
      fhKeeper/formulahousekeeper/webttkuaiban/src/main/java/com/firerock/webttkuaiban/demos/controller/ArticleTemplateController.java
  39. 2 2
      fhKeeper/formulahousekeeper/webttkuaiban/src/main/resources/static/knowledge.ftl
  40. 2 2
      fhKeeper/formulahousekeeper/webttkuaiban/src/main/resources/static/knowledgeDetails.ftl
  41. 1 1
      fhKeeper/formulahousekeeper/webttkuaiban/src/main/resources/static/moduleView/header.html
  42. 7 7
      fhKeeper/formulahousekeeper/webttkuaiban/src/main/resources/templates/knowledge.ftl
  43. 5 5
      fhKeeper/formulahousekeeper/webttkuaiban/src/main/resources/templates/knowledgeDetails.ftl
  44. 1 1
      fhKeeper/formulahousekeeper/webttkuaiban/src/main/resources/templates/moduleView/header.html

+ 28 - 13
fhKeeper/formulahousekeeper/management-crm/src/main/java/com/management/platform/controller/ContractController.java

@@ -2,9 +2,7 @@ package com.management.platform.controller;
 
 
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
-import com.management.platform.entity.Contract;
-import com.management.platform.entity.Project;
-import com.management.platform.entity.User;
+import com.management.platform.entity.*;
 import com.management.platform.mapper.ProjectMapper;
 import com.management.platform.mapper.UserMapper;
 import com.management.platform.service.ContractService;
@@ -44,16 +42,27 @@ public class ContractController {
      * 分页查询合同
      */
     @RequestMapping("/getContractPage")
-    public HttpRespMsg getContractPage (HttpServletRequest request, @RequestParam Integer pageIndex, @RequestParam Integer pageSize, String number,String name,String typeName,Integer status,String startDate,String endDate, String paymentStartDate, String paymentEndDate){
-        return contractService.getContractPage(request,pageIndex,pageSize,number,name,typeName,status,startDate,endDate, paymentStartDate, paymentEndDate);
+    public HttpRespMsg getContractPage (HttpServletRequest request, @RequestParam Integer pageIndex, @RequestParam Integer pageSize, String number,String name,String typeName,Integer status,
+                                        String startDate,String endDate, String paymentStartDate, String paymentEndDate, Integer secTypeId,@RequestParam(required = false) String customerOrg,@RequestParam(required = false) Integer finishStatus){
+        return contractService.getContractPage(request,pageIndex,pageSize,number,name,typeName,status,startDate,endDate, paymentStartDate, paymentEndDate, secTypeId,customerOrg,finishStatus);
     }
 
     /**
      * 导出合同
      */
-    @RequestMapping("/ExportContract")
-    public HttpRespMsg ExportContract (HttpServletRequest request, String number,String name,String typeName,Integer status,String startDate,String endDate, String paymentStartDate, String paymentEndDate){
-        return contractService.ExportContract(request,number,name,typeName,status,startDate,endDate, paymentStartDate, paymentEndDate);
+    @RequestMapping("/exportContract")
+    public HttpRespMsg exportContract (HttpServletRequest request, String number,String name,String typeName,Integer status,String startDate,
+                                       String endDate, String paymentStartDate, String paymentEndDate, Integer secTypeId,@RequestParam(required = false) String customerOrg,@RequestParam(required = false) Integer finishStatus){
+        return contractService.ExportContract(request,number,name,typeName,status,startDate,endDate, paymentStartDate, paymentEndDate, secTypeId,customerOrg,finishStatus);
+    }
+
+    /**
+     * 导出合同
+     */
+    @RequestMapping("/exportContractOneToMany")
+    public HttpRespMsg exportContractOneToMany (HttpServletRequest request, String number,String name,String typeName,Integer status,String startDate,
+                                                String endDate, String paymentStartDate, String paymentEndDate, Integer secTypeId,@RequestParam(required = false) String customerOrg,@RequestParam(required = false) Integer finishStatus){
+        return contractService.exportContractOneToMany(request,number,name,typeName,status,startDate,endDate, paymentStartDate, paymentEndDate, secTypeId,customerOrg,finishStatus);
     }
 
     /**
@@ -61,23 +70,29 @@ public class ContractController {
      */
     @RequestMapping("/importContract")
     public HttpRespMsg importContract (HttpServletRequest request, MultipartFile file){
-        return contractService.importContract(request,file);
+        String token = request.getHeader("TOKEN");
+        User user = userMapper.selectById(token);
+        if (user.getCompanyId() == 10 || user.getCompanyId() == 4215) {
+            return contractService.importContractCustom(request,file);
+        } else {
+            return contractService.importContract(request,file);
+        }
     }
 
     /**
      * 新增合同
      */
     @RequestMapping("/addContract")
-    public HttpRespMsg addContract (HttpServletRequest request,Contract contract, String paymentListStr){
-        return contractService.addContract(request,contract, paymentListStr);
+    public HttpRespMsg addContract (HttpServletRequest request, Contract contract, ContractCustom custom, String paymentListStr){
+        return contractService.addContract(request,contract, custom, paymentListStr);
     }
 
     /**
      * 编辑合同
      */
     @RequestMapping("/editContract")
-    public HttpRespMsg editContract (HttpServletRequest request,Contract contract, String paymentListStr){
-        return contractService.editContract(request,contract, paymentListStr);
+    public HttpRespMsg editContract (HttpServletRequest request,Contract contract,ContractCustom custom, String paymentListStr){
+        return contractService.editContract(request,contract, custom, paymentListStr);
     }
 
     /**

+ 21 - 0
fhKeeper/formulahousekeeper/management-crm/src/main/java/com/management/platform/controller/ContractCustomController.java

@@ -0,0 +1,21 @@
+package com.management.platform.controller;
+
+
+import org.springframework.web.bind.annotation.RequestMapping;
+
+import org.springframework.web.bind.annotation.RestController;
+
+/**
+ * <p>
+ *  前端控制器
+ * </p>
+ *
+ * @author Seyason
+ * @since 2024-11-25
+ */
+@RestController
+@RequestMapping("/contract-custom")
+public class ContractCustomController {
+
+}
+

+ 21 - 0
fhKeeper/formulahousekeeper/management-crm/src/main/java/com/management/platform/controller/ContractPayCustomizedController.java

@@ -0,0 +1,21 @@
+package com.management.platform.controller;
+
+
+import org.springframework.web.bind.annotation.RequestMapping;
+
+import org.springframework.web.bind.annotation.RestController;
+
+/**
+ * <p>
+ *  前端控制器
+ * </p>
+ *
+ * @author Seyason
+ * @since 2024-11-25
+ */
+@RestController
+@RequestMapping("/contract-pay-customized")
+public class ContractPayCustomizedController {
+
+}
+

+ 19 - 2
fhKeeper/formulahousekeeper/management-crm/src/main/java/com/management/platform/controller/ContractPaymentController.java

@@ -2,14 +2,19 @@ package com.management.platform.controller;
 
 
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.management.platform.entity.ContractPayCustomized;
 import com.management.platform.entity.ContractPayment;
+import com.management.platform.entity.User;
+import com.management.platform.service.ContractPayCustomizedService;
 import com.management.platform.service.ContractPaymentService;
+import com.management.platform.service.UserService;
 import com.management.platform.util.HttpRespMsg;
 import org.springframework.web.bind.annotation.RequestMapping;
 
 import org.springframework.web.bind.annotation.RestController;
 
 import javax.annotation.Resource;
+import javax.servlet.http.HttpServletRequest;
 
 /**
  * <p>
@@ -26,10 +31,22 @@ public class ContractPaymentController {
     @Resource
     private ContractPaymentService contractPaymentService;
 
+    @Resource
+    private UserService userService;
+
+    @Resource
+    private ContractPayCustomizedService payCustomizedService;
+
     @RequestMapping("/getList")
-    public HttpRespMsg getList(Integer contractId) {
+    public HttpRespMsg getList(HttpServletRequest request,Integer contractId) {
         HttpRespMsg msg = new HttpRespMsg();
-        msg.data = contractPaymentService.list(new QueryWrapper<ContractPayment>().eq("contract_id", contractId));
+        String token = request.getHeader("token");
+        User user = userService.getById(token);
+        if (user.getCompanyId()!=4215){
+            msg.data = contractPaymentService.list(new QueryWrapper<ContractPayment>().eq("contract_id", contractId));
+        }else {
+            msg.data = payCustomizedService.list(new QueryWrapper<ContractPayCustomized>().eq("contract_id", contractId));
+        }
         return msg;
     }
 

+ 55 - 0
fhKeeper/formulahousekeeper/management-crm/src/main/java/com/management/platform/controller/ContractTypeSecController.java

@@ -0,0 +1,55 @@
+package com.management.platform.controller;
+
+
+import com.management.platform.entity.ContractType;
+import com.management.platform.entity.ContractTypeSec;
+import com.management.platform.service.ContractTypeSecService;
+import com.management.platform.service.ContractTypeService;
+import com.management.platform.util.HttpRespMsg;
+import org.springframework.web.bind.annotation.RequestMapping;
+
+import org.springframework.web.bind.annotation.RestController;
+
+import javax.annotation.Resource;
+import javax.servlet.http.HttpServletRequest;
+
+/**
+ * <p>
+ *  前端控制器
+ * </p>
+ *
+ * @author Seyason
+ * @since 2024-09-14
+ */
+@RestController
+@RequestMapping("/contract-type-sec")
+public class ContractTypeSecController {
+    @Resource
+    private ContractTypeSecService contractTypeSecService;
+
+    /**
+     * 返回公司自定义合同类型
+     */
+    @RequestMapping("/getContractType")
+    public HttpRespMsg getContractType (HttpServletRequest request){
+
+        return contractTypeSecService.getContractType(request);
+    }
+
+    /**
+     * 新增、修改合同类型
+     */
+    @RequestMapping("/changeContractType")
+    public HttpRespMsg changeContractType (HttpServletRequest request, ContractTypeSec contractType){
+        return contractTypeSecService.changeContractType(request,contractType);
+    }
+
+    /**
+     * 删除合同类型
+     */
+    @RequestMapping("/deleteContractType")
+    public HttpRespMsg deleteContractType (HttpServletRequest request, Integer deleteId){
+        return contractTypeSecService.deleteContractType(request,deleteId);
+    }
+}
+

+ 8 - 2
fhKeeper/formulahousekeeper/management-crm/src/main/java/com/management/platform/entity/CompanyDingding.java

@@ -11,11 +11,11 @@ import lombok.experimental.Accessors;
 
 /**
  * <p>
- * 
+ *
  * </p>
  *
  * @author Seyason
- * @since 2023-05-26
+ * @since 2024-04-20
  */
 @Data
 @EqualsAndHashCode(callSuper = false)
@@ -108,6 +108,12 @@ public class CompanyDingding extends Model<CompanyDingding> {
     @TableField("sync_contact")
     private Integer syncContact;
 
+    /**
+     * 通讯录是否需要转译
+     */
+    @TableField("contact_need_translate")
+    private Integer contactNeedTranslate;
+
 
     @Override
     protected Serializable pkVal() {

+ 50 - 1
fhKeeper/formulahousekeeper/management-crm/src/main/java/com/management/platform/entity/Contract.java

@@ -20,7 +20,7 @@ import org.springframework.format.annotation.DateTimeFormat;
  * </p>
  *
  * @author Seyason
- * @since 2023-05-24
+ * @since 2024-11-27
  */
 @Data
 @EqualsAndHashCode(callSuper = false)
@@ -160,6 +160,55 @@ public class Contract extends Model<Contract> {
     @TableField(exist = false)
     private BigDecimal nextPaymentAmount;
 
+    @TableField(exist = false)
+    public ContractCustom customData;
+
+    @TableField(exist = false)
+    public ContractPayCustomized payCustomizedData;
+
+    /**
+     * 二级分类id
+     */
+    @TableField("sec_type_id")
+    private Integer secTypeId;
+
+    /**
+     * 自定义字段存值
+     */
+    @TableField("plate1")
+    private String plate1;
+
+    /**
+     * 自定义字段存值
+     */
+    @TableField("plate2")
+    private String plate2;
+
+    /**
+     * 自定义字段存值
+     */
+    @TableField("plate3")
+    private String plate3;
+
+    /**
+     * 自定义字段存值
+     */
+    @TableField("plate4")
+    private String plate4;
+
+    /**
+     * 自定义字段存值
+     */
+    @TableField("plate5")
+    private String plate5;
+
+    /**
+     * 二级分类名称
+     */
+    @TableField(exist = false)
+    private String secTypeName;
+
+
     @Override
     protected Serializable pkVal() {
         return this.id;

+ 129 - 0
fhKeeper/formulahousekeeper/management-crm/src/main/java/com/management/platform/entity/ContractCustom.java

@@ -0,0 +1,129 @@
+package com.management.platform.entity;
+
+import java.math.BigDecimal;
+import com.baomidou.mybatisplus.extension.activerecord.Model;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableField;
+import java.io.Serializable;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.experimental.Accessors;
+
+/**
+ * <p>
+ * 
+ * </p>
+ *
+ * @author Seyason
+ * @since 2024-11-25
+ */
+@Data
+@EqualsAndHashCode(callSuper = false)
+@Accessors(chain = true)
+public class ContractCustom extends Model<ContractCustom> {
+
+    private static final long serialVersionUID=1L;
+
+    /**
+     * 合同Id
+     */
+    @TableId("contract_id")
+    private Integer contractId;
+
+    /**
+     * 对方单位
+     */
+    @TableField("customer_org")
+    private String customerOrg;
+
+    /**
+     * 对方联系人
+     */
+    @TableField("customer_contact")
+    private String customerContact;
+
+    /**
+     * 对方电话
+     */
+    @TableField("customer_phone")
+    private String customerPhone;
+
+    /**
+     * 使用部门
+     */
+    @TableField("use_department")
+    private String useDepartment;
+
+    /**
+     * 经费来源
+     */
+    @TableField("funds_source")
+    private String fundsSource;
+
+    /**
+     * 合同承办人
+     */
+    @TableField("undertaker")
+    private String undertaker;
+
+    /**
+     * 代理人
+     */
+    @TableField("agent")
+    private String agent;
+
+    /**
+     * 签订日期
+     */
+    @TableField("sign_date")
+    private String signDate;
+
+    /**
+     * 备案日期
+     */
+    @TableField("filings_date")
+    private String filingsDate;
+
+    /**
+     * 增值税税率(%)
+     */
+    @TableField("tax_rate")
+    private Integer taxRate;
+
+    /**
+     * 合同金额(元)/不含税价
+     */
+    @TableField("amounts_no_tax")
+    private BigDecimal amountsNoTax;
+
+    /**
+     * 币种
+     */
+    @TableField("currency")
+    private String currency;
+
+    /**
+     * 是否固定金额 0否,1是
+     */
+    @TableField("is_amount_fixed")
+    private Boolean isAmountFixed;
+
+    /**
+     * 合同状态(是否结清):1-履约中,2-履约结束
+     */
+    @TableField("finish_status")
+    private Integer finishStatus;
+
+    /**
+     * 印花税税目
+     */
+    @TableField("stamp_duty_items")
+    private String stampDutyItems;
+
+
+    @Override
+    protected Serializable pkVal() {
+        return this.contractId;
+    }
+
+}

+ 98 - 0
fhKeeper/formulahousekeeper/management-crm/src/main/java/com/management/platform/entity/ContractPayCustomized.java

@@ -0,0 +1,98 @@
+package com.management.platform.entity;
+
+import java.math.BigDecimal;
+import com.baomidou.mybatisplus.extension.activerecord.Model;
+import com.baomidou.mybatisplus.annotation.TableField;
+import java.io.Serializable;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.experimental.Accessors;
+
+/**
+ * <p>
+ * 
+ * </p>
+ *
+ * @author Seyason
+ * @since 2024-11-25
+ */
+@Data
+@EqualsAndHashCode(callSuper = false)
+@Accessors(chain = true)
+public class ContractPayCustomized extends Model<ContractPayCustomized> {
+
+    private static final long serialVersionUID=1L;
+
+    /**
+     * 合同id
+     */
+    @TableField("contract_id")
+    private Integer contractId;
+
+    /**
+     * 付款日期
+     */
+    @TableField("pay_date")
+    private String payDate;
+
+    /**
+     * 已付款金额(元)
+     */
+    @TableField("payed_amount")
+    private BigDecimal payedAmount;
+
+    /**
+     * 付款类型:1-预付,2-报账
+     */
+    @TableField("pay_way")
+    private Integer payWay;
+
+    /**
+     * 凭证号
+     */
+    @TableField("bill_number")
+    private String billNumber;
+
+    /**
+     * 已冲销金额
+     */
+    @TableField("reserved_amounts")
+    private BigDecimal reservedAmounts;
+
+    /**
+     * 冲销凭证号
+     */
+    @TableField("reserved_bill_number")
+    private String reservedBillNumber;
+
+    /**
+     * 付款总金额
+     */
+    @TableField("total_payed_amounts")
+    private BigDecimal totalPayedAmounts;
+
+    /**
+     * 待付款金额
+     */
+    @TableField("pending_amounts")
+    private BigDecimal pendingAmounts;
+
+    /**
+     * 是否已付款
+     */
+    @TableField("is_payed")
+    private Boolean isPayed;
+
+    /**
+     * 付款类型:0报账,1预付
+     */
+    @TableField("pay_type")
+    private Boolean payType;
+
+
+    @Override
+    protected Serializable pkVal() {
+        return null;
+    }
+
+}

+ 60 - 0
fhKeeper/formulahousekeeper/management-crm/src/main/java/com/management/platform/entity/ContractTypeSec.java

@@ -0,0 +1,60 @@
+package com.management.platform.entity;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.extension.activerecord.Model;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableField;
+import java.io.Serializable;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.experimental.Accessors;
+
+/**
+ * <p>
+ * 
+ * </p>
+ *
+ * @author Seyason
+ * @since 2024-11-25
+ */
+@Data
+@EqualsAndHashCode(callSuper = false)
+@Accessors(chain = true)
+public class ContractTypeSec extends Model<ContractTypeSec> {
+
+    private static final long serialVersionUID=1L;
+
+    /**
+     * 合同类型id
+     */
+    @TableId(value = "id", type = IdType.AUTO)
+    private Integer id;
+
+    /**
+     * 公司id
+     */
+    @TableField("company_id")
+    private Integer companyId;
+
+    /**
+     * 合同类型
+     */
+    @TableField("sec_type_name")
+    private String secTypeName;
+
+    /**
+     * 主类型id
+     */
+    @TableField("main_type_id")
+    private Integer mainTypeId;
+
+    @TableField(exist = false)
+    private String mainTypeName;
+
+
+    @Override
+    protected Serializable pkVal() {
+        return this.id;
+    }
+
+}

+ 16 - 0
fhKeeper/formulahousekeeper/management-crm/src/main/java/com/management/platform/mapper/ContractCustomMapper.java

@@ -0,0 +1,16 @@
+package com.management.platform.mapper;
+
+import com.management.platform.entity.ContractCustom;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+
+/**
+ * <p>
+ *  Mapper 接口
+ * </p>
+ *
+ * @author Seyason
+ * @since 2024-11-25
+ */
+public interface ContractCustomMapper extends BaseMapper<ContractCustom> {
+
+}

+ 2 - 2
fhKeeper/formulahousekeeper/management-crm/src/main/java/com/management/platform/mapper/ContractMapper.java

@@ -14,6 +14,6 @@ import java.util.List;
  * @since 2022-11-29
  */
 public interface ContractMapper extends BaseMapper<Contract> {
-    List<Contract> selectContract(Integer companyId, Integer pageStart, Integer pageSize, String number, String name, String typeName, Integer status, String startDate,String endDate, String paymentStartDate, String paymentEndDate);
-    Long selectContractCnt(Integer companyId, String number, String name, String typeName, Integer status, String startDate,String endDate, String paymentStartDate, String paymentEndDate);
+    List<Contract> selectContract(Integer companyId, Integer pageStart, Integer pageSize, String number, String name, String typeName, Integer status, String startDate,String endDate, String paymentStartDate, String paymentEndDate, Integer secTypeId,String customerOrg,Integer finishStatus);
+    Long selectContractCnt(Integer companyId, String number, String name, String typeName, Integer status, String startDate,String endDate, String paymentStartDate, String paymentEndDate, Integer secTypeId,String customerOrg,Integer finishStatus);
 }

+ 16 - 0
fhKeeper/formulahousekeeper/management-crm/src/main/java/com/management/platform/mapper/ContractPayCustomizedMapper.java

@@ -0,0 +1,16 @@
+package com.management.platform.mapper;
+
+import com.management.platform.entity.ContractPayCustomized;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+
+/**
+ * <p>
+ *  Mapper 接口
+ * </p>
+ *
+ * @author Seyason
+ * @since 2024-11-25
+ */
+public interface ContractPayCustomizedMapper extends BaseMapper<ContractPayCustomized> {
+
+}

+ 16 - 0
fhKeeper/formulahousekeeper/management-crm/src/main/java/com/management/platform/mapper/ContractTypeSecMapper.java

@@ -0,0 +1,16 @@
+package com.management.platform.mapper;
+
+import com.management.platform.entity.ContractTypeSec;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+
+/**
+ * <p>
+ *  Mapper 接口
+ * </p>
+ *
+ * @author Seyason
+ * @since 2024-11-25
+ */
+public interface ContractTypeSecMapper extends BaseMapper<ContractTypeSec> {
+
+}

+ 16 - 0
fhKeeper/formulahousekeeper/management-crm/src/main/java/com/management/platform/service/ContractCustomService.java

@@ -0,0 +1,16 @@
+package com.management.platform.service;
+
+import com.management.platform.entity.ContractCustom;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+/**
+ * <p>
+ *  服务类
+ * </p>
+ *
+ * @author Seyason
+ * @since 2024-11-25
+ */
+public interface ContractCustomService extends IService<ContractCustom> {
+
+}

+ 16 - 0
fhKeeper/formulahousekeeper/management-crm/src/main/java/com/management/platform/service/ContractPayCustomizedService.java

@@ -0,0 +1,16 @@
+package com.management.platform.service;
+
+import com.management.platform.entity.ContractPayCustomized;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+/**
+ * <p>
+ *  服务类
+ * </p>
+ *
+ * @author Seyason
+ * @since 2024-11-25
+ */
+public interface ContractPayCustomizedService extends IService<ContractPayCustomized> {
+
+}

+ 11 - 4
fhKeeper/formulahousekeeper/management-crm/src/main/java/com/management/platform/service/ContractService.java

@@ -2,6 +2,8 @@ package com.management.platform.service;
 
 import com.management.platform.entity.Contract;
 import com.baomidou.mybatisplus.extension.service.IService;
+import com.management.platform.entity.ContractCustom;
+import com.management.platform.entity.ContractPayCustomized;
 import com.management.platform.util.HttpRespMsg;
 import org.springframework.web.bind.annotation.RequestParam;
 import org.springframework.web.multipart.MultipartFile;
@@ -19,19 +21,24 @@ import java.util.List;
  */
 public interface ContractService extends IService<Contract> {
 
-    HttpRespMsg getContractPage(HttpServletRequest request, Integer pageIndex, Integer pageSize, String number, String name, String typeName, Integer status, String startDate, String endDate, String paymentStartDate, String paymentEndDate);
+    HttpRespMsg getContractPage(HttpServletRequest request, Integer pageIndex, Integer pageSize, String number, String name, String typeName, Integer status, String startDate, String endDate, String paymentStartDate, String paymentEndDate, Integer secTypeId,String customerOrg,Integer finishStatus);
 
-    HttpRespMsg ExportContract(HttpServletRequest request, String number, String name, String typeName, Integer status, String startDate, String endDate, String paymentStartDate, String paymentEndDate);
+    HttpRespMsg ExportContract(HttpServletRequest request, String number, String name, String typeName, Integer status, String startDate, String endDate, String paymentStartDate, String paymentEndDate, Integer secTypeId,String customerOrg,Integer finishStatus);
 
-    HttpRespMsg addContract(HttpServletRequest request, Contract contract, String paymentListStr);
+    HttpRespMsg addContract(HttpServletRequest request, Contract contract, ContractCustom custom, String paymentListStr);
 
-    HttpRespMsg editContract(HttpServletRequest request, Contract contract, String paymentListStr);
+    HttpRespMsg editContract(HttpServletRequest request, Contract contract, ContractCustom custom, String paymentListStr);
 
     HttpRespMsg importContract(HttpServletRequest request, MultipartFile file);
 
+    HttpRespMsg importContractCustom(HttpServletRequest request, MultipartFile file);
+
     HttpRespMsg processContract(HttpServletRequest request, Integer id, Integer status ,String msg);
 
     HttpRespMsg contractFile(HttpServletRequest request, Integer id);
 
     HttpRespMsg deleteContract(HttpServletRequest request, Integer id);
+
+    HttpRespMsg exportContractOneToMany(HttpServletRequest request, String number, String name, String typeName, Integer status, String startDate,
+                                        String endDate, String paymentStartDate, String paymentEndDate, Integer secTypeId,String customerOrg,Integer finishStatus);
 }

+ 25 - 0
fhKeeper/formulahousekeeper/management-crm/src/main/java/com/management/platform/service/ContractTypeSecService.java

@@ -0,0 +1,25 @@
+package com.management.platform.service;
+
+import com.management.platform.entity.ContractType;
+import com.management.platform.entity.ContractTypeSec;
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.management.platform.util.HttpRespMsg;
+
+import javax.servlet.http.HttpServletRequest;
+
+/**
+ * <p>
+ *  服务类
+ * </p>
+ *
+ * @author Seyason
+ * @since 2024-09-14
+ */
+public interface ContractTypeSecService extends IService<ContractTypeSec> {
+
+    HttpRespMsg getContractType(HttpServletRequest request);
+
+    HttpRespMsg changeContractType(HttpServletRequest request, ContractTypeSec contractTypeSec);
+
+    HttpRespMsg deleteContractType(HttpServletRequest request, Integer deleteId);
+}

+ 1 - 0
fhKeeper/formulahousekeeper/management-crm/src/main/java/com/management/platform/service/DingDingService.java

@@ -2,6 +2,7 @@ package com.management.platform.service;
 
 import com.alibaba.fastjson.JSONArray;
 import com.management.platform.entity.CompanyDingding;
+import com.management.platform.entity.UserDingdingTime;
 import com.management.platform.util.HttpRespMsg;
 import com.taobao.api.ApiException;
 

+ 4 - 3
fhKeeper/formulahousekeeper/management-crm/src/main/java/com/management/platform/service/ExcelExportService.java

@@ -1,5 +1,6 @@
 package com.management.platform.service;
 
+import com.management.platform.entity.CompanyDingding;
 import com.management.platform.entity.WxCorpInfo;
 import com.management.platform.util.HttpRespMsg;
 
@@ -10,9 +11,9 @@ public interface ExcelExportService {
     public void testRead(String jobId);
     public HttpRespMsg exportGeneralExcelByTitleAndList(WxCorpInfo wxCorpInfo, String title, List<List<String>> list, String downloadPath) throws Exception;
     public HttpRespMsg exportGeneralExcelByTitleAndList2(WxCorpInfo wxCorpInfo, String title, List<List<String>> list, String downloadPath) throws Exception;
-    public HttpRespMsg exportMultiSheetGeneralExcelByTitleAndList(WxCorpInfo wxCorpInfo,String title, List<List<String>>[] multiSheetList, String downloadPath,String[] sheetsName) throws Exception;
-    public HttpRespMsg exportTranForwx(WxCorpInfo wxCorpInfo,String title) throws Exception;
+    public HttpRespMsg exportMultiSheetGeneralExcelByTitleAndList(WxCorpInfo wxCorpInfo, String title, List<List<String>>[] multiSheetList, String downloadPath,String[] sheetsName) throws Exception;
+    public HttpRespMsg exportMultiSheetGeneralExcelByTitleAndListNew(WxCorpInfo wxCorpInfo, String title, List<List<String>>[] multiSheetList, String downloadPath,String[] sheetsName) throws Exception;
+    public HttpRespMsg exportTranForwx(WxCorpInfo wxCorpInfo, String title) throws Exception;
     void testAdd(String jobId);
-
     HttpRespMsg exportGeneralExcelForExpense(WxCorpInfo wxCorpInfo, String fileName, List<List<String>> allList, List<Map> mapList, String path) throws Exception;
 }

+ 20 - 0
fhKeeper/formulahousekeeper/management-crm/src/main/java/com/management/platform/service/impl/ContractCustomServiceImpl.java

@@ -0,0 +1,20 @@
+package com.management.platform.service.impl;
+
+import com.management.platform.entity.ContractCustom;
+import com.management.platform.mapper.ContractCustomMapper;
+import com.management.platform.service.ContractCustomService;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.stereotype.Service;
+
+/**
+ * <p>
+ *  服务实现类
+ * </p>
+ *
+ * @author Seyason
+ * @since 2024-11-25
+ */
+@Service
+public class ContractCustomServiceImpl extends ServiceImpl<ContractCustomMapper, ContractCustom> implements ContractCustomService {
+
+}

+ 20 - 0
fhKeeper/formulahousekeeper/management-crm/src/main/java/com/management/platform/service/impl/ContractPayCustomizedServiceImpl.java

@@ -0,0 +1,20 @@
+package com.management.platform.service.impl;
+
+import com.management.platform.entity.ContractPayCustomized;
+import com.management.platform.mapper.ContractPayCustomizedMapper;
+import com.management.platform.service.ContractPayCustomizedService;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.stereotype.Service;
+
+/**
+ * <p>
+ *  服务实现类
+ * </p>
+ *
+ * @author Seyason
+ * @since 2024-11-25
+ */
+@Service
+public class ContractPayCustomizedServiceImpl extends ServiceImpl<ContractPayCustomizedMapper, ContractPayCustomized> implements ContractPayCustomizedService {
+
+}

Diff do ficheiro suprimidas por serem muito extensas
+ 729 - 35
fhKeeper/formulahousekeeper/management-crm/src/main/java/com/management/platform/service/impl/ContractServiceImpl.java


+ 135 - 0
fhKeeper/formulahousekeeper/management-crm/src/main/java/com/management/platform/service/impl/ContractTypeSecServiceImpl.java

@@ -0,0 +1,135 @@
+package com.management.platform.service.impl;
+
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.management.platform.entity.Contract;
+import com.management.platform.entity.ContractType;
+import com.management.platform.entity.ContractTypeSec;
+import com.management.platform.entity.User;
+import com.management.platform.entity.vo.SysRichFunction;
+import com.management.platform.mapper.*;
+import com.management.platform.service.ContractTypeSecService;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.management.platform.service.ExcelExportService;
+import com.management.platform.util.HttpRespMsg;
+import com.management.platform.util.MessageUtils;
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.stereotype.Service;
+
+import javax.annotation.Resource;
+import javax.servlet.http.HttpServletRequest;
+import java.util.List;
+
+/**
+ * <p>
+ *  服务实现类
+ * </p>
+ *
+ * @author Seyason
+ * @since 2024-09-14
+ */
+@Service
+public class ContractTypeSecServiceImpl extends ServiceImpl<ContractTypeSecMapper, ContractTypeSec> implements ContractTypeSecService {
+    @Resource
+    private ContractTypeSecMapper contractTypeSecMapper;
+    @Resource
+    private ContractTypeMapper contractTypeMapper;
+    @Resource
+    private ContractMapper contractMapper;
+    @Resource
+    private UserMapper userMapper;
+    @Resource
+    private SysFunctionMapper sysFunctionMapper;
+
+    /**
+     * 返回公司自定义合同类型
+     * @param request
+     * @return
+     */
+    @Override
+    public HttpRespMsg getContractType(HttpServletRequest request) {
+        HttpRespMsg httpRespMsg = new HttpRespMsg();
+        String token = request.getHeader("token");
+        User user = userMapper.selectById(token);
+        List<SysRichFunction> functionContractList = sysFunctionMapper.getRoleFunctions(user.getRoleId(), "查看全部合同");
+        if(functionContractList.size() <= 0){
+            return httpRespMsg;
+        }
+        List<ContractTypeSec> types = contractTypeSecMapper.selectList(new QueryWrapper<ContractTypeSec>().eq("company_id", user.getCompanyId()));
+        List<ContractType> mainList = contractTypeMapper.selectList(new QueryWrapper<ContractType>().eq("company_id", user.getCompanyId()));
+        for (ContractTypeSec secType : types) {
+            secType.setMainTypeName(mainList.stream().filter(mainType -> mainType.getId().equals(secType.getMainTypeId())).findFirst().get().getTypeName());
+        }
+        httpRespMsg.data = types;
+        return httpRespMsg;
+    }
+
+    /**
+     * 新增、修改合同类型
+     * @param request
+     * @param contractType
+     * @return
+     */
+    @Override
+    public HttpRespMsg changeContractType(HttpServletRequest request, ContractTypeSec contractType) {
+        HttpRespMsg httpRespMsg = new HttpRespMsg();
+        String token = request.getHeader("token");
+        User user = userMapper.selectById(token);
+        List<SysRichFunction> functionContractList = sysFunctionMapper.getRoleFunctions(user.getRoleId(), "合同类型管理");
+        if(functionContractList.size() <= 0){
+            httpRespMsg.setError(MessageUtils.message("access.operationError"));
+            return httpRespMsg;
+        }
+        if (StringUtils.isBlank(contractType.getSecTypeName())){
+            //合同类型名不可为空
+            httpRespMsg.setError(MessageUtils.message("contract.typeNameEmpty"));
+            return httpRespMsg;
+        }
+        List<ContractTypeSec> types = contractTypeSecMapper.selectList(new QueryWrapper<ContractTypeSec>().eq("company_id", user.getCompanyId()));
+        //新增或修改自定义类型
+        for (ContractTypeSec type : types) {
+            if (type.getSecTypeName().equals(contractType.getSecTypeName()) && type.getMainTypeId().equals(contractType.getMainTypeId()) && !type.getId().equals(contractType.getId())){
+                //类型名不可重复
+                httpRespMsg.setError("[" + type.getSecTypeName() + "]" + MessageUtils.message("contract.typeNameRepeat"));
+                return httpRespMsg;
+            }
+        }
+        if (contractType.getId() == null){
+            contractType.setCompanyId(user.getCompanyId());
+            contractTypeSecMapper.insert(contractType);
+        }else {
+            contractType.setCompanyId(null);
+            contractTypeSecMapper.updateById(contractType);
+        }
+        //操作成功
+        httpRespMsg.msg = MessageUtils.message("contract.operationSuc");
+        return httpRespMsg;
+    }
+
+    /**
+     * 删除合同类型
+     * @param request
+     * @param deleteId
+     * @return
+     */
+    @Override
+    public HttpRespMsg deleteContractType(HttpServletRequest request, Integer deleteId) {
+        HttpRespMsg httpRespMsg = new HttpRespMsg();
+        String token = request.getHeader("token");
+        User user = userMapper.selectById(token);
+        List<SysRichFunction> functionContractList = sysFunctionMapper.getRoleFunctions(user.getRoleId(), "合同类型管理");
+        if(functionContractList.size() <= 0){
+            httpRespMsg.setError(MessageUtils.message("access.deleteError"));
+            return httpRespMsg;
+        }
+        List<Contract> types = contractMapper.selectList(new QueryWrapper<Contract>().eq("sec_type_id", deleteId));
+        if (types.size() > 0){
+            //该类型尚有合同在使用,无法删除!
+            httpRespMsg.setError(MessageUtils.message("Contract.typeDelError"));
+        }else {
+            contractTypeSecMapper.deleteById(deleteId);
+            httpRespMsg.setMsg(MessageUtils.message("file.deleteSuc"));
+        }
+        return httpRespMsg;
+    }
+
+}

+ 178 - 25
fhKeeper/formulahousekeeper/management-crm/src/main/java/com/management/platform/service/impl/ExcelExportServiceImpl.java

@@ -1,25 +1,24 @@
 package com.management.platform.service.impl;
 
 import com.management.platform.entity.CorpwxJobResult;
+import com.management.platform.entity.User;
 import com.management.platform.entity.WxCorpInfo;
 import com.management.platform.mapper.CorpwxJobResultMapper;
+import com.management.platform.mapper.UserMapper;
+import com.management.platform.service.DingDingService;
 import com.management.platform.service.ExcelExportService;
 import com.management.platform.service.WxCorpInfoService;
 import com.management.platform.util.ExcelUtil;
 import com.management.platform.util.HttpRespMsg;
 import com.management.platform.util.MessageUtils;
-import org.apache.poi.hssf.usermodel.*;
-import org.apache.poi.ss.usermodel.BorderStyle;
-import org.apache.poi.ss.usermodel.CellStyle;
-import org.apache.poi.ss.usermodel.FillPatternType;
-import org.apache.poi.ss.usermodel.HorizontalAlignment;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.core.io.FileSystemResource;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Isolation;
 import org.springframework.transaction.annotation.Transactional;
 
 import javax.annotation.Resource;
-import java.io.File;
-import java.io.FileOutputStream;
+import javax.servlet.http.HttpServletRequest;
 import java.time.LocalDateTime;
 import java.util.HashMap;
 import java.util.List;
@@ -29,11 +28,20 @@ import java.util.Map;
 public class ExcelExportServiceImpl implements ExcelExportService {
     //用于控制线程锁
     public static HashMap<String, CorpwxJobResult> corpwxJobCenter = new HashMap();
+    public static HashMap<String, Integer> corpddJobCenter = new HashMap();
     @Resource
     private WxCorpInfoService wxCorpInfoService;
+    @Resource
+    private DingDingService dingDingService;
+    @Resource
+    private HttpServletRequest request;
+    @Resource
+    private UserMapper userMapper;
 
     @Resource
     private CorpwxJobResultMapper corpwxJobResultMapper;
+    @Value("${upload.path}")
+    private String path;
 
     @Transactional(isolation = Isolation.READ_COMMITTED)
     public void testRead(String jobId) {
@@ -74,9 +82,33 @@ public class ExcelExportServiceImpl implements ExcelExportService {
         String resp = ExcelUtil.exportGeneralExcelByTitleAndList(title, list, downloadPath);
         String fileUrlSuffix = title + ".xlsx";
         if(wxCorpInfo != null && wxCorpInfo.getSaasSyncContact() == 1){
+            FileSystemResource fileSystemResource = new FileSystemResource(path+fileUrlSuffix);
+//            String md5 = DigestUtils.md5Hex(FileUtil.readBytes(fileSystemResource.getFile()));
+
+            Long checkSize = 20L*1024*1024;
+            if(fileSystemResource.getFile().length() >= checkSize){
+                httpRespMsg.setError("文件过大,请缩短查询日期范围");
+                return httpRespMsg;
+            }
+            String jobId = "";
             String mediaId = wxCorpInfoService.getTranslationMediaId(fileUrlSuffix);
-            String jobId = wxCorpInfoService.syncTranslation(wxCorpInfo.getCorpid(),mediaId,fileUrlSuffix, null);
+            jobId = wxCorpInfoService.syncTranslation(wxCorpInfo.getCorpid(),mediaId,fileUrlSuffix, null);
+//            if(fileSystemResource.getFile().length() >= checkSize){
+//                String tmpFileJobId = wxCorpInfoService.getTranslationJobId(fileUrlSuffix,md5,wxCorpInfo);
+//                if(!StringUtils.isEmpty(tmpFileJobId)){
+//                    String mediaId = wxCorpInfoService.getAsyncJobResult(tmpFileJobId,wxCorpInfo);
+//                    jobId = wxCorpInfoService.syncTranslation(wxCorpInfo.getCorpid(),mediaId,fileUrlSuffix, null);
+//                }
+//            }else{
+//                String mediaId = wxCorpInfoService.getTranslationMediaId(fileUrlSuffix);
+//                jobId = wxCorpInfoService.syncTranslation(wxCorpInfo.getCorpid(),mediaId,fileUrlSuffix, null);
+//            }
+
             System.out.println("上传待转译文件到企业微信, jobId==" + jobId);
+//            if(StringUtils.isEmpty(jobId)){
+//                httpRespMsg.setError("转义jobId为空,请联系管理员");
+//                return httpRespMsg;
+//            }
             int i = 0;
             String syncTranslationResult = null;
             /**
@@ -84,7 +116,7 @@ public class ExcelExportServiceImpl implements ExcelExportService {
              * 此处轮询查询本地数据库,检测到有任务的回调数据时继续执行查询操作
              */
             long t = System.currentTimeMillis();
-            while (i < 30) {
+            while (i < 40) {
                 if (i < 10) {
                     Thread.sleep(300);
                 } else if (i < 20){
@@ -94,26 +126,98 @@ public class ExcelExportServiceImpl implements ExcelExportService {
                 }
                 System.out.println("i=="+i+", "+LocalDateTime.now());
                 CorpwxJobResult corpwxJobResult = corpwxJobCenter.get(jobId);
-
-
-                syncTranslationResult = wxCorpInfoService.getSyncTranslationResult(jobId);
-                if (syncTranslationResult != null && !syncTranslationResult.equals("")) {
-                    long t2 = System.currentTimeMillis();
-                    System.out.println("企业微信转译文件后地址是:"+syncTranslationResult+",耗时:" + (t2 - t) + "ms");
-                    httpRespMsg.data = syncTranslationResult;
-                    return httpRespMsg;
+                if (corpwxJobResult != null) {
+                    if (corpwxJobResult.getErrCode() == 0) {
+                        syncTranslationResult = wxCorpInfoService.getSyncTranslationResult(jobId);
+                        corpwxJobCenter.remove(jobId);
+                    } else {
+                        long t2 = System.currentTimeMillis();
+                        System.out.println("222企业微信转译报错:"+corpwxJobResult.getErrMsg()+",耗时:" + (t2 - t) + "ms");
+                        httpRespMsg.setError(corpwxJobResult.getErrMsg());
+                        return httpRespMsg;
+                    }
+                    break;
                 }
                 i++;
             }
+            if (syncTranslationResult != null) {
+                long t2 = System.currentTimeMillis();
+                System.out.println("企业微信转译文件后地址是:"+syncTranslationResult+",耗时:" + (t2 - t) + "ms");
+                httpRespMsg.data = syncTranslationResult;
+            } else {
                 //httpRespMsg.setError("处理超时...");
-            httpRespMsg.setError(MessageUtils.message("request.outTime"));
+                httpRespMsg.setError(MessageUtils.message("request.outTime"));
+            }
         }else {
             httpRespMsg.data = resp;
         }
         return httpRespMsg;
     }
 
-    public HttpRespMsg exportGeneralExcelForExpense(WxCorpInfo wxCorpInfo, String title, List<List<String>> list, List<Map> mapList, String downloadPath) throws Exception {
+    public HttpRespMsg exportGeneralExcelByTitleAndListNew(String userId,WxCorpInfo wxCorpInfo, String title, List<List<String>> list, String downloadPath) throws Exception {
+        HttpRespMsg httpRespMsg = new HttpRespMsg();
+        if (title.contains("/")) {
+            //文件名不能含有路径,得替换掉
+            title = title.replace("/", "@");
+        }
+        if (title.contains("\\")) {
+            //文件名不能含有路径,得替换掉
+            title = title.replace("\\", "@");
+        }
+        String resp = ExcelUtil.exportGeneralExcelByTitleAndList(title, list, downloadPath);
+        String fileUrlSuffix = title + ".xlsx";
+        if(wxCorpInfo != null && wxCorpInfo.getSaasSyncContact() == 1){
+            String mediaId = wxCorpInfoService.getTranslationMediaId(fileUrlSuffix);
+            String jobId = wxCorpInfoService.syncTranslation(wxCorpInfo.getCorpid(),mediaId,fileUrlSuffix, null);
+            System.out.println("上传待转译文件到企业微信, jobId==" + jobId);
+            int i = 0;
+            String syncTranslationResult = null;
+            /**
+             * 异步上传转译文件的任务完成时会触发回调,在WeiXinCorpController中的commonDevCallbackPost实现了对回调的处理,存储到corpwxJobResult表中
+             * 此处轮询查询本地数据库,检测到有任务的回调数据时继续执行查询操作
+             */
+            long t = System.currentTimeMillis();
+            while (i < 40) {
+                if (i < 10) {
+                    Thread.sleep(300);
+                } else if (i < 20){
+                    Thread.sleep(1000);
+                } else {
+                    Thread.sleep(3000);
+                }
+                System.out.println("i=="+i+", "+LocalDateTime.now());
+                CorpwxJobResult corpwxJobResult = corpwxJobCenter.get(jobId);
+                if (corpwxJobResult != null) {
+                    if (corpwxJobResult.getErrCode() == 0) {
+                        syncTranslationResult = wxCorpInfoService.getSyncTranslationResult(jobId);
+                        corpwxJobCenter.remove(jobId);
+                    } else {
+                        long t2 = System.currentTimeMillis();
+                        System.out.println("222企业微信转译报错:"+corpwxJobResult.getErrMsg()+",耗时:" + (t2 - t) + "ms");
+                        httpRespMsg.setError(corpwxJobResult.getErrMsg());
+                        return httpRespMsg;
+                    }
+                    break;
+                }
+                i++;
+            }
+            if (syncTranslationResult != null) {
+                long t2 = System.currentTimeMillis();
+                System.out.println("企业微信转译文件后地址是:"+syncTranslationResult+",耗时:" + (t2 - t) + "ms");
+                httpRespMsg.data = syncTranslationResult;
+                wxCorpInfoService.sendWXCorpMsg(wxCorpInfo,userId,syncTranslationResult, null, WxCorpInfoServiceImpl.TEXT_CARD_MSG__ASYNC_DWONLOAD);
+            } else {
+                //httpRespMsg.setError("处理超时...");
+                httpRespMsg.setError(MessageUtils.message("request.outTime"));
+            }
+        } else {
+            httpRespMsg.data = resp;
+        }
+        return httpRespMsg;
+    }
+
+
+    public HttpRespMsg exportGeneralExcelForExpense(WxCorpInfo wxCorpInfo,  String title, List<List<String>> list, List<Map> mapList, String downloadPath) throws Exception {
         HttpRespMsg httpRespMsg = new HttpRespMsg();
         if (title.contains("/")) {
             //文件名不能含有路径,得替换掉
@@ -149,7 +253,7 @@ public class ExcelExportServiceImpl implements ExcelExportService {
                 }
                 i++;
             }
-            if (syncTranslationResult != null && !syncTranslationResult.equals("")) {
+            if (syncTranslationResult != null) {
                 httpRespMsg.data = syncTranslationResult;
             } else {
                 //httpRespMsg.setError("处理超时...");
@@ -197,7 +301,7 @@ public class ExcelExportServiceImpl implements ExcelExportService {
                 }
                 i++;
             }
-            if (syncTranslationResult != null && !syncTranslationResult.equals("")) {
+            if (syncTranslationResult != null) {
                 httpRespMsg.data = syncTranslationResult;
             } else {
                 //httpRespMsg.setError("处理超时...");
@@ -210,7 +314,7 @@ public class ExcelExportServiceImpl implements ExcelExportService {
     }
 
 
-    public  HttpRespMsg exportMultiSheetGeneralExcelByTitleAndList(WxCorpInfo wxCorpInfo,String title, List<List<String>>[] multiSheetList, String downloadPath,String[] sheetsName) throws Exception {
+    public  HttpRespMsg exportMultiSheetGeneralExcelByTitleAndList(WxCorpInfo wxCorpInfo, String title, List<List<String>>[] multiSheetList, String downloadPath,String[] sheetsName) throws Exception {
         HttpRespMsg httpRespMsg = new HttpRespMsg();
         String resp = ExcelUtil.exportMultiSheetGeneralExcelByTitleAndList(title,multiSheetList, downloadPath,sheetsName);
         if (title.contains("/")) {
@@ -246,7 +350,56 @@ public class ExcelExportServiceImpl implements ExcelExportService {
                 }
                 i++;
             }
-            if (syncTranslationResult != null && !syncTranslationResult.equals("")) {
+            if (syncTranslationResult != null) {
+                httpRespMsg.data = syncTranslationResult;
+            } else {
+                //httpRespMsg.setError("处理超时...");
+                httpRespMsg.setError(MessageUtils.message("request.outTime"));
+            }
+        }else {
+            httpRespMsg.data = resp;
+        }
+        return httpRespMsg;
+    }
+
+    @Override
+    public HttpRespMsg exportMultiSheetGeneralExcelByTitleAndListNew(WxCorpInfo wxCorpInfo,  String title, List<List<String>>[] multiSheetList, String downloadPath, String[] sheetsName) throws Exception {
+        HttpRespMsg httpRespMsg = new HttpRespMsg();
+        String resp = ExcelUtil.exportMultiSheetGeneralExcelByTitleAndListNew(title,multiSheetList, downloadPath,sheetsName);
+        if (title.contains("/")) {
+            //文件名不能含有路径,得替换掉
+            title = title.replace("/", "@");
+        }
+        if (title.contains("\\")) {
+            //文件名不能含有路径,得替换掉
+            title = title.replace("\\", "@");
+        }
+        String fileUrlSuffix = title + ".xlsx";
+        if(wxCorpInfo != null && wxCorpInfo.getSaasSyncContact() == 1){
+            String mediaId = wxCorpInfoService.getTranslationMediaId(fileUrlSuffix);
+            String jobId = wxCorpInfoService.syncTranslation(wxCorpInfo.getCorpid(),mediaId,fileUrlSuffix, null);
+            int i = 0;
+            String syncTranslationResult = null;
+            /**
+             * 异步上传转译文件的任务完成时会触发回调,在WeiXinCorpController中的commonDevCallbackPost实现了对回调的处理,存储到corpwxJobResult表中
+             * 此处轮询查询本地数据库,检测到有任务的回调数据时继续执行查询操作
+             */
+            while (i < 10) {
+                Thread.sleep(300);
+                CorpwxJobResult corpwxJobResult = corpwxJobCenter.get(jobId);
+                if (corpwxJobResult != null) {
+                    if (corpwxJobResult.getErrCode() == 0) {
+                        syncTranslationResult = wxCorpInfoService.getSyncTranslationResult(jobId);
+                        corpwxJobCenter.remove(jobId);
+                    } else {
+                        httpRespMsg.setError(corpwxJobResult.getErrMsg());
+                        return httpRespMsg;
+                    }
+                    break;
+                }
+                i++;
+            }
+            if (syncTranslationResult != null) {
                 httpRespMsg.data = syncTranslationResult;
             } else {
                 //httpRespMsg.setError("处理超时...");
@@ -258,7 +411,7 @@ public class ExcelExportServiceImpl implements ExcelExportService {
         return httpRespMsg;
     }
 
-    public  HttpRespMsg exportTranForwx(WxCorpInfo wxCorpInfo,String title) throws Exception {
+    public  HttpRespMsg exportTranForwx(WxCorpInfo wxCorpInfo, String title) throws Exception {
         HttpRespMsg httpRespMsg = new HttpRespMsg();
         if (title.contains("/")) {
             //文件名不能含有路径,得替换掉
@@ -293,7 +446,7 @@ public class ExcelExportServiceImpl implements ExcelExportService {
                 }
                 i++;
             }
-            if (syncTranslationResult != null && !syncTranslationResult.equals("")) {
+            if (syncTranslationResult != null) {
                 httpRespMsg.data = syncTranslationResult;
             } else {
                 //httpRespMsg.setError("处理超时...");

+ 1 - 1
fhKeeper/formulahousekeeper/management-crm/src/main/java/com/management/platform/service/impl/SysRoleServiceImpl.java

@@ -33,7 +33,7 @@ public class SysRoleServiceImpl extends ServiceImpl<SysRoleMapper, SysRole> impl
     public static String[] pmModules =  {"商机","线索", "客户","联系人","任务","报表服务", "销售订单","产品管理"};
     public static String[] financeModules =  {"商机","线索", "客户","联系人","任务","报表服务", "销售订单","产品管理"};
     public static String[] pmoModules =  {"商机","线索", "客户","联系人","任务","报表服务", "销售订单","产品管理"};
-    public static String[] corpLeaderModules =  {"商机","线索", "客户","联系人","任务","报表服务","数据分析", "销售订单","产品管理","组织架构","系统设置"};
+    public static String[] corpLeaderModules =  {"商机","线索", "客户","联系人","任务","报表服务","数据分析", "销售订单","产品管理","合同管理","组织架构","系统设置"};
 
     public static final HashMap<String, String[]> moduleMaps = new HashMap();
     static {

+ 2 - 0
fhKeeper/formulahousekeeper/management-crm/src/main/java/com/management/platform/service/impl/WxCorpInfoServiceImpl.java

@@ -89,6 +89,8 @@ public class WxCorpInfoServiceImpl extends ServiceImpl<WxCorpInfoMapper, WxCorpI
     public static final int TEXT_CARD_MSG_EXPENSE_DENY = 22;//费用报销审核驳回
     public static final int TEXT_CARD_MSG_TASK = 23;//费用报销审核驳回
 
+    public static final int TEXT_CARD_MSG__ASYNC_DWONLOAD = 23;//文件异步下载
+
     private static Object userLock = new Object();
 
     @Value("${suitId}")

+ 138 - 0
fhKeeper/formulahousekeeper/management-crm/src/main/java/com/management/platform/util/ExcelUtil.java

@@ -763,4 +763,142 @@ public class ExcelUtil {
         }
         return true;
     }
+
+    public static String exportMultiSheetGeneralExcelByTitleAndListNew(String title, List<List<String>>[] multiSheetList, String downloadPath, String[] sheetsName) {
+        String result="系统提示:Excel文件导出成功!";
+        String fileName= title+".xlsx";
+        try {
+            // 创建工作簿
+            SXSSFWorkbook workBook = new SXSSFWorkbook();
+            // 创建工作类
+            for (int sheetIndex=0;sheetIndex<multiSheetList.length; sheetIndex++) {
+                Sheet sheetOne = workBook.createSheet();
+                workBook.setSheetName(sheetIndex,sheetsName[sheetIndex]);
+                sheetOne.setDefaultColumnWidth(16);
+
+                //设置字体样式
+                Font headFont = workBook.createFont();
+                headFont.setBold(true);
+                headFont.setFontHeightInPoints((short) 10);
+                headFont.setFontName("黑体");
+
+                Font titleFont = workBook.createFont();
+                titleFont.setBold(true);
+                titleFont.setFontHeightInPoints((short) 10);
+                titleFont.setFontName("黑体");
+
+                Font font = workBook.createFont();
+                font.setFontHeightInPoints((short) 10);
+                font.setFontName("宋体");
+
+                //设置单元格样式
+                XSSFCellStyle  headStyle = (XSSFCellStyle) workBook.createCellStyle();
+                headStyle.setFont(headFont);
+                headStyle.setAlignment(HorizontalAlignment.CENTER);
+                headStyle.setVerticalAlignment(org.apache.poi.ss.usermodel.VerticalAlignment.CENTER);
+                headStyle.setWrapText(true);
+                headStyle.setBorderBottom(BorderStyle.THIN); //下边框
+                headStyle.setBorderLeft(BorderStyle.THIN);//左边框
+                headStyle.setBorderTop(BorderStyle.THIN);//上边框
+                headStyle.setBorderRight(BorderStyle.THIN);//右边框
+
+                String color = "c0c0c0";    //此处得到的color为16进制的字符串
+                //转为RGB码
+                int r = Integer.parseInt((color.substring(0,2)),16);   //转为16进制
+                int g = Integer.parseInt((color.substring(2,4)),16);
+                int b = Integer.parseInt((color.substring(4,6)),16);
+
+                //自定义cell颜色
+//            HSSFPalette palette = workBook.getCustomPalette();
+                //这里的9是索引
+//            palette.setColorAtIndex((short)9, (byte) r, (byte) g, (byte) b);
+
+                //设置自定义颜色
+                XSSFColor xssfColor = new XSSFColor();
+                byte[] colorRgb = { (byte)118, (byte)147, (byte)60 };
+                xssfColor.setRGB(colorRgb);
+//                headStyle.setFillForegroundColor(IndexedColors.GREY_25_PERCENT.index);
+//                headStyle.setFillPattern(FillPatternType.SOLID_FOREGROUND);// 填充模式(和背景颜色成对使用)
+                //cs.setFillForegroundColor(IndexedColors.AQUA.getIndex()); //设置自带的颜色
+
+                CellStyle titleStyle = workBook.createCellStyle();
+                titleStyle.setFont(titleFont);
+                titleStyle.setAlignment(HorizontalAlignment.CENTER);
+                titleStyle.setVerticalAlignment(org.apache.poi.ss.usermodel.VerticalAlignment.CENTER);
+                titleStyle.setFillPattern(FillPatternType.SOLID_FOREGROUND);  //填充单元格
+//                titleStyle.setFillForegroundColor((short)9);    //填色
+                titleStyle.setWrapText(true);
+                titleStyle.setBorderBottom(BorderStyle.THIN); //下边框
+                titleStyle.setBorderLeft(BorderStyle.THIN);//左边框
+                titleStyle.setBorderTop(BorderStyle.THIN);//上边框
+                titleStyle.setBorderRight(BorderStyle.THIN);//右边框
+
+                CellStyle cellStyle = workBook.createCellStyle();
+                cellStyle.setFont(font);
+                cellStyle.setAlignment(HorizontalAlignment.CENTER);
+                cellStyle.setVerticalAlignment(org.apache.poi.ss.usermodel.VerticalAlignment.CENTER);
+                cellStyle.setWrapText(true);
+                cellStyle.setBorderBottom(BorderStyle.THIN); //下边框
+                cellStyle.setBorderLeft(BorderStyle.THIN);//左边框
+                cellStyle.setBorderTop(BorderStyle.THIN);//上边框
+                cellStyle.setBorderRight(BorderStyle.THIN);//右边框
+
+                if(multiSheetList[sheetIndex].size() > 0) {
+                    int start = 0;
+                    for(List<String> rowList : multiSheetList[sheetIndex]) {
+                        Row row = sheetOne.createRow(start);
+                        row.setHeightInPoints(24);
+                        for(int i = 0; i < rowList.size(); i++) {
+                            Cell cell = row.createCell(i);
+                            if(start == 0) {
+                                cell.setCellStyle(headStyle);
+                            }else {
+                                cell.setCellStyle(cellStyle);
+                            }
+                            cell.setCellValue(rowList.get(i));
+                        }
+                        start++;
+                    }
+                    if (sheetIndex==1){
+                        Row row0 = sheetOne.getRow(0);
+                        for (int i = 0; i < 4; i++) {
+                            sheetOne.addMergedRegion(new CellRangeAddress(0, 1, i,i));
+                        }
+                        int numberOfCells = row0.getPhysicalNumberOfCells();
+                        int index=-1;
+                        for (int i = 0; i < numberOfCells; i++) {
+                            if (row0.getCell(i).getStringCellValue().equals("项目工时分配")){
+                                index=i;
+                                break;
+                            }
+                        }
+                        if (index!=-1){
+                            sheetOne.addMergedRegion(new CellRangeAddress(0, 0, 4,index-1));
+                        }
+                        short lastCellNum = row0.getLastCellNum();
+                        if (index!=-1&&index<lastCellNum-1){
+                            sheetOne.addMergedRegion(new CellRangeAddress(0, 0, index,lastCellNum-1));
+                        }
+
+
+
+                    }
+                }
+            }
+
+
+            File dir = new File(downloadPath);
+            if (!dir.exists()) {
+                dir.mkdirs();
+            }
+            FileOutputStream os = new FileOutputStream(downloadPath+fileName);//保存到本地
+            workBook.write(os);
+            os.flush();
+            os.close();
+        }catch(Exception e) {
+            System.out.println(result);
+            e.printStackTrace();
+        }
+        return "/upload/"+fileName;
+    }
 }

+ 30 - 0
fhKeeper/formulahousekeeper/management-crm/src/main/resources/mapper/ContractCustomMapper.xml

@@ -0,0 +1,30 @@
+<?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.management.platform.mapper.ContractCustomMapper">
+
+    <!-- 通用查询映射结果 -->
+    <resultMap id="BaseResultMap" type="com.management.platform.entity.ContractCustom">
+        <id column="contract_id" property="contractId" />
+        <result column="customer_org" property="customerOrg" />
+        <result column="customer_contact" property="customerContact" />
+        <result column="customer_phone" property="customerPhone" />
+        <result column="use_department" property="useDepartment" />
+        <result column="funds_source" property="fundsSource" />
+        <result column="undertaker" property="undertaker" />
+        <result column="agent" property="agent" />
+        <result column="sign_date" property="signDate" />
+        <result column="filings_date" property="filingsDate" />
+        <result column="tax_rate" property="taxRate" />
+        <result column="amounts_no_tax" property="amountsNoTax" />
+        <result column="currency" property="currency" />
+        <result column="is_amount_fixed" property="isAmountFixed" />
+        <result column="finish_status" property="finishStatus" />
+        <result column="stamp_duty_items" property="stampDutyItems" />
+    </resultMap>
+
+    <!-- 通用查询结果列 -->
+    <sql id="Base_Column_List">
+        contract_id, customer_org, customer_contact, customer_phone, use_department, funds_source, undertaker, agent, sign_date, filings_date, tax_rate, amounts_no_tax, currency, is_amount_fixed, finish_status, stamp_duty_items
+    </sql>
+
+</mapper>

+ 1 - 1
fhKeeper/formulahousekeeper/management-crm/src/main/resources/mapper/ContractLogMapper.xml

@@ -26,6 +26,6 @@
         left join user
         on contract_log.operator_id = user.id
         where contract_log.company_id = #{companyId}
-		AND contract_log.id in(SELECT MAX(id) FROM contract_log WHERE type = 3 GROUP BY contract_id)
+        AND contract_log.id in(SELECT MAX(id) FROM contract_log WHERE type = 3 GROUP BY contract_id)
     </select>
 </mapper>

+ 7 - 62
fhKeeper/formulahousekeeper/management-crm/src/main/resources/mapper/ContractMapper.xml

@@ -19,72 +19,17 @@
         <result column="indate" property="indate" />
         <result column="remarks" property="remarks" />
         <result column="payment" property="payment" />
+        <result column="sec_type_id" property="secTypeId" />
+        <result column="plate1" property="plate1" />
+        <result column="plate2" property="plate2" />
+        <result column="plate3" property="plate3" />
+        <result column="plate4" property="plate4" />
+        <result column="plate5" property="plate5" />
     </resultMap>
 
     <!-- 通用查询结果列 -->
     <sql id="Base_Column_List">
-        id, company_id, creator_id, start_date, end_date, number, project_id, name, amounts, type_id, checkerId, status, indate, remarks, payment
+        id, company_id, creator_id, start_date, end_date, number, project_id, name, amounts, type_id, checkerId, status, indate, remarks, payment, sec_type_id, plate1, plate2, plate3, plate4, plate5
     </sql>
-    <select id="selectContract" resultType="com.management.platform.entity.Contract">
-        select contract.id,contract.company_id,contract.creator_id,contract.number,contract.name,contract.amounts,contract.type_id,contract_type.type_name,contract.status,contract.indate,contract.remarks,
-        contract.start_date as startDate,contract.end_date as endDate,
-        user.name as creatorName,user.corpwx_userid as creatorWxCorpId, contract.project_id, contract.payment, cp.pay_date AS next_payment_date, cp.amount AS next_payment_amount
-        from contract
-        left join contract_type
-        on contract.type_id = contract_type.id
-        LEFT JOIN (SELECT contract_id, pay_date, amount FROM contract_payment WHERE is_payed = 0 GROUP BY contract_id) cp ON cp.contract_id=contract.id
-        left join user
-        on contract.creator_id = user.id
-        where contract.company_id = #{companyId}
-        <if test="number!=null">
-            and number like #{number}
-        </if>
-        <if test="name!=null">
-            and contract.name like #{name}
-        </if>
-        <if test="typeName!=null">
-            and contract_type.id = #{typeName}
-        </if>
-        <if test="status!=null">
-            and status = #{status}
-        </if>
-        <if test="startDate!=null and endDate !=null">
-            and indate between #{startDate} and #{endDate}
-        </if>
-        <if test="paymentStartDate != null and paymentEndDate != null">
-            and cp.pay_date between #{paymentStartDate} and #{paymentEndDate}
-        </if>
-        order by contract.id desc
-        <if test="pageStart!=null and pageSize!=null">
-            limit #{pageStart},#{pageSize}
-        </if>
-    </select>
 
-    <select id="selectContractCnt" resultType="java.lang.Long">
-        select count(1) from contract
-        left join contract_type
-        on contract.type_id = contract_type.id
-        LEFT JOIN (SELECT contract_id, pay_date, amount FROM contract_payment WHERE is_payed = 0 GROUP BY contract_id) cp ON cp.contract_id=contract.id
-        left join user
-        on contract.creator_id = user.id
-        where contract.company_id = #{companyId}
-        <if test="number!=null">
-            and number like #{number}
-        </if>
-        <if test="name!=null">
-            and contract.name like #{name}
-        </if>
-        <if test="typeName!=null">
-            and contract_type.id = #{typeName}
-        </if>
-        <if test="status!=null">
-            and status = #{status}
-        </if>
-        <if test="startDate!=null and endDate !=null">
-            and indate between #{startDate} and #{endDate}
-        </if>
-        <if test="paymentStartDate != null and paymentEndDate != null">
-            and cp.pay_date between #{paymentStartDate} and #{paymentEndDate}
-        </if>
-    </select>
 </mapper>

+ 25 - 0
fhKeeper/formulahousekeeper/management-crm/src/main/resources/mapper/ContractPayCustomizedMapper.xml

@@ -0,0 +1,25 @@
+<?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.management.platform.mapper.ContractPayCustomizedMapper">
+
+    <!-- 通用查询映射结果 -->
+    <resultMap id="BaseResultMap" type="com.management.platform.entity.ContractPayCustomized">
+        <result column="contract_id" property="contractId" />
+        <result column="pay_date" property="payDate" />
+        <result column="payed_amount" property="payedAmount" />
+        <result column="pay_way" property="payWay" />
+        <result column="bill_number" property="billNumber" />
+        <result column="reserved_amounts" property="reservedAmounts" />
+        <result column="reserved_bill_number" property="reservedBillNumber" />
+        <result column="total_payed_amounts" property="totalPayedAmounts" />
+        <result column="pending_amounts" property="pendingAmounts" />
+        <result column="is_payed" property="isPayed" />
+        <result column="pay_type" property="payType" />
+    </resultMap>
+
+    <!-- 通用查询结果列 -->
+    <sql id="Base_Column_List">
+        contract_id, pay_date, payed_amount, pay_way, bill_number, reserved_amounts, reserved_bill_number, total_payed_amounts, pending_amounts, is_payed, pay_type
+    </sql>
+
+</mapper>

+ 18 - 0
fhKeeper/formulahousekeeper/management-crm/src/main/resources/mapper/ContractTypeSecMapper.xml

@@ -0,0 +1,18 @@
+<?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.management.platform.mapper.ContractTypeSecMapper">
+
+    <!-- 通用查询映射结果 -->
+    <resultMap id="BaseResultMap" type="com.management.platform.entity.ContractTypeSec">
+        <id column="id" property="id" />
+        <result column="company_id" property="companyId" />
+        <result column="sec_type_name" property="secTypeName" />
+        <result column="main_type_id" property="mainTypeId" />
+    </resultMap>
+
+    <!-- 通用查询结果列 -->
+    <sql id="Base_Column_List">
+        id, company_id, sec_type_name, main_type_id
+    </sql>
+
+</mapper>

+ 225 - 0
fhKeeper/formulahousekeeper/management-workshop/src/main/java/com/management/platform/task/TimingTask.java

@@ -575,4 +575,229 @@ public class TimingTask {
         }
     }
 
+
+    @Scheduled(cron = "0 40 2 ? * *")
+    public void getTemporaryJobApplicationNew() throws Exception {
+        if(isDev){
+            return;
+        }
+        DateTimeFormatter df=DateTimeFormatter.ofPattern("yyyy-MM-dd");
+        LocalDate start=LocalDate.now().minusDays(7);
+        LocalDate end=LocalDate.now();
+        JSONArray jsonArrayFilter = new JSONArray();
+        JSONObject filter1 = new JSONObject();
+        WxCorpTemplate template = wxCorpTemplateService.getOne(new QueryWrapper<WxCorpTemplate>().eq("company_id",7).eq("type",2));//类型设置为2
+        filter1.put("key","template_id");
+        filter1.put("value",template.getTemplateId());
+        jsonArrayFilter.add(filter1);
+        JSONObject filter2 = new JSONObject();
+        filter2.put("key","sp_status");
+        filter2.put("value","2");
+        jsonArrayFilter.add(filter2);
+        List<String> approvalInfo = wxCorpInfoService.getApprovalInfo(7, df.format(start), df.format(end), "", jsonArrayFilter);
+        List<Department> departmentList = departmentService.list(new LambdaQueryWrapper<Department>().eq(Department::getCompanyId, 7));
+        List<TaskType> taskTypeList = taskTypeService.list(new LambdaQueryWrapper<TaskType>().eq(TaskType::getCompanyId, 7));
+        List<User> userList = userMapper.selectList(new LambdaQueryWrapper<User>().eq(User::getCompanyId,7));
+        if(approvalInfo!=null){
+            for (int i = 0; i < approvalInfo.size(); i++) {
+                String codeNum = approvalInfo.get(i);
+                String approvalInfoDetailResp = wxCorpInfoService.getApprovalInfoDetail(7, codeNum);
+                JSONObject approvalInfoDetail = JSONObject.parseObject(approvalInfoDetailResp);
+                JSONObject info = approvalInfoDetail.getJSONObject("info");
+                JSONObject applyer = info.getJSONObject("applyer");
+                String userid = applyer.getString("userid");
+                //过滤审核状态只需要审核通过的数据
+                int sp_status = info.getIntValue("sp_status");
+                if(sp_status!=2){
+                    continue;
+                }
+                Optional<User> first = userList.stream().filter(u ->u.getCorpwxRealUserid()!=null&&u.getCorpwxRealUserid().equals(userid)).findFirst();
+                if(!first.isPresent()){
+                    continue;
+                }
+                JSONObject apply_data = info.getJSONObject("apply_data");
+                System.out.println("获取到的单据信息===========>"+apply_data);
+                JSONArray contents = apply_data.getJSONArray("contents");
+                //生成 车间插单计划
+                int count = planService.count(new LambdaQueryWrapper<Plan>().eq(Plan::getTaskChangeNoticeNum, info.getString("sp_no")));
+                if(count>0){
+                    continue;
+                }
+                Plan plan=new Plan();
+                plan.setCompanyId(7);
+                plan.setCreateTime(LocalDateTime.now());
+                plan.setPlanType(1);
+                plan.setCreateId(first.get().getId());
+                plan.setTaskChangeNoticeNum(info.getString("sp_no"));
+                //参与人员列表
+                List<String> userTeams=new ArrayList<>();
+                //初始化 单价(元/小时)
+                BigDecimal price=new BigDecimal(0);
+                //初始化 工作时长
+                double workTime=0;
+
+                long apply_time = info.getLongValue("apply_time");
+                LocalDate createDate;
+                if(apply_time>0){
+                    createDate=  DateTimeUtil.getLocalDateFromUnix(apply_time);
+                }else {
+                    createDate  =LocalDate.now();
+                }
+                //初始化工位
+                Integer deptId=0;
+                for (int i1 = 0; i1 < contents.size(); i1++) {
+                    JSONObject map = contents.getJSONObject(i1);
+                    JSONArray title = map.getJSONArray("title");
+                    JSONObject value = map.getJSONObject("value");
+                    String control = map.getString("control");
+                    /*if(title.getJSONObject(0).getString("text").equals("临时报工分类")){
+                        if(control.equals("Selector")){
+                            JSONObject selector = value.getJSONObject("selector");
+                            JSONArray options = selector.getJSONArray("options");
+                            JSONObject object = options.getJSONObject(0);
+                            JSONArray value1 = object.getJSONArray("value");
+                            JSONObject jsonObject = value1.getJSONObject(0);
+                            String text = jsonObject.getString("text");
+                            Optional<TaskType> first1 = taskTypeList.stream().filter(t -> t.getTaskTypeName().equals(text)).findFirst();
+                            if(first1.isPresent()){
+                                plan.setTaskTypeId(first1.get().getId());
+                                plan.setTaskTypeName(first1.get().getTaskTypeName());
+                            }
+                        }
+                    }*/
+                    if(title.getJSONObject(0).getString("text").equals("项目名称")){
+                        if(control.equals("Text")||control.equals("Textarea")){
+                            String text = value.getString("text");
+                            plan.setProjectName(text);
+                        }
+                    }
+                    if(title.getJSONObject(0).getString("text").equals("生产订单号")){
+                        if(control.equals("Text")||control.equals("Textarea")){
+                            String text = value.getString("text");
+                            plan.setProductOrderNum(text);
+                        }
+                    }
+                    if(title.getJSONObject(0).getString("text").equals("生产数量")){
+                        if(control.equals("Number")){
+                            int new_number= value.get("new_number")!=null?value.getIntValue("new_number"):0;
+                            plan.setNum(new_number);
+                        }
+                    }
+                    if(title.getJSONObject(0).getString("text").equals("作业单位")){
+                        if(control.equals("Contact")){
+                            JSONArray departments = value.getJSONArray("departments");
+                            String openapi_id = departments.getJSONObject(0).getString("openapi_id");
+                            Optional<Department> first1 = departmentList.stream().filter(d -> d.getCorpwxDeptid().equals(Integer.valueOf(openapi_id))).findFirst();
+                            if(first1.isPresent()){
+                                plan.setStationId(first1.get().getDepartmentId());
+                                plan.setStationName(first1.get().getDepartmentName());
+                                plan.setForemanId(first1.get().getManagerId());
+                                Optional<User> first2 = userList.stream().filter(u -> u.getId().equals(first1.get().getManagerId())).findFirst();
+                                if(first2.isPresent()){
+                                    plan.setForemanName(first2.get().getName());
+                                }
+                                deptId=first1.get().getDepartmentId();
+                            }
+                        }
+                    }
+                    if(title.getJSONObject(0).getString("text").contains("单价")){
+                        if(control.equals("Number")){
+                            if(!value.getString("new_number").equals("")){
+                                Double new_money = value.getDouble("new_number");
+                                plan.setMoneyOfJob(new BigDecimal(new_money==null?0:new_money));
+                                price=new BigDecimal(new_money);
+                            }
+                        }
+                    }
+                    if(title.getJSONObject(0).getString("text").contains("结算总额")){
+                        if(control.equals("Formula")){
+                            JSONObject formula = value.getJSONObject("formula");
+                            if(!formula.getString("value").equals("")){
+                                double formulaDoubleValue = formula.getDoubleValue("value");
+                                BigDecimal bigDecimal = new BigDecimal(formulaDoubleValue);
+                                if(workTime>0){
+                                    BigDecimal divide = bigDecimal.divide(new BigDecimal(workTime), 3, RoundingMode.HALF_UP);
+                                    plan.setMoneyOfJob(divide);
+                                }
+                                plan.setSettlementAmount(bigDecimal);
+                            }
+                        }
+                    }
+                    //先处理多个人员 公用此单据非工时部分内容
+                    if(title.getJSONObject(0).getString("text").equals("作业人员")){
+                        if(control.equals("Contact")){
+                            JSONArray members = value.getJSONArray("members");
+                            plan.setPlanManNum(members.size());
+                            for (int i2 = 0; i2 < members.size(); i2++) {
+                                JSONObject jsonObject = members.getJSONObject(i2);
+                                String userid1 = jsonObject.getString("userid");
+                                userTeams.add(userid1);
+                            }
+
+                        }
+                    }
+
+                    long startTime=0;
+                    long endTime=0;
+                    if(title.getJSONObject(0).getString("text").equals("作业开始日期")){
+                        if(control.equals("Date")){
+                            JSONObject date = value.getJSONObject("date");
+                            long s_timestamp = date.getLongValue("s_timestamp");
+                            startTime=s_timestamp;
+                            LocalDate localDateFromUnix = DateTimeUtil.getLocalDateFromUnix(s_timestamp);
+                            plan.setStartDate(localDateFromUnix);
+                        }
+                    }
+                    if(title.getJSONObject(0).getString("text").equals("作业结束日期")){
+                        if(control.equals("Date")){
+                            JSONObject date = value.getJSONObject("date");
+                            long s_timestamp = date.getLongValue("s_timestamp");
+                            if (s_timestamp!=0){
+                                endTime=s_timestamp;
+                            }
+                            LocalDate localDateFromUnix = DateTimeUtil.getLocalDateFromUnix(s_timestamp);
+                            plan.setEndDate(localDateFromUnix);
+                        }
+                    }
+                    if (endTime>0){
+                        long l = endTime - startTime;//工作时长
+                        workTime=l/60000.0;
+                        plan.setPlanWorkHour(workTime);//分钟
+                    }
+                    if(title.getJSONObject(0).getString("text").equals("备注")){
+                        if(control.equals("Text")||control.equals("Textarea")){
+                            String text = value.getString("text");
+                            plan.setDescribtion(text);
+                        }
+                    }
+                }
+                planService.save(plan);
+                List<Report> reportList=new ArrayList<>();
+                //处理人员日报数据
+                for (String userTeam : userTeams) {
+                    Optional<User> user = userList.stream().filter(u -> u.getCorpwxRealUserid() != null && u.getCorpwxRealUserid().equals(userTeam)).findFirst();
+                    if(user.isPresent()){
+                        Report report=new Report();
+                        report.setCreateDate(createDate);
+                        report.setCreatorId(user.get().getId());
+                        report.setCreateTime(LocalDateTime.now());
+                        BigDecimal bigDecimal = new BigDecimal(workTime);
+                        bigDecimal=bigDecimal.divide(new BigDecimal(plan.getPlanManNum()==null?0:plan.getPlanManNum()),1,RoundingMode.HALF_UP);
+                        report.setWorkingTime(bigDecimal.doubleValue());
+                        bigDecimal=bigDecimal.multiply(price);
+                        report.setCost(bigDecimal);
+                        report.setStatus(2);
+                        report.setPlanId(plan.getId());
+                        report.setCompanyId(7);
+                        report.setDeptId(deptId);
+                        reportList.add(report);
+                    }
+                }
+                if(reportList.size()>0){
+                    reportService.saveBatch(reportList);
+                }
+            }
+        }
+    }
+
 }

+ 0 - 2
fhKeeper/formulahousekeeper/timesheet/src/views/project/finance.vue

@@ -192,8 +192,6 @@
                       </el-select>
                 </el-form-item>
                 <el-form-item :label="''" >
-                    <el-checkbox v-model="notParticipatingInSharedAllProject" @change="selectAllItems">选中全部项目</el-checkbox>
-                    <br />
                     <el-link type="warning" :underline="false">*设置后请重新导入该月人员薪资</el-link>
                 </el-form-item>
             </el-form>

+ 2 - 5
fhKeeper/formulahousekeeper/timesheet_h5/public/index.html

@@ -61,13 +61,10 @@
 
         var flag = IsPC(); //true为PC端,false为手机端
         if(flag) {
-            console.log('触发')
             // 当前地址为工时管家移动端就跳转到工时管家官网
-            if(urls.indexOf('mobworktime.ttkuaiban') != '-1') {
+            if(urls.indexOf('mobworktime.ttkuaiban') != '-1') {//
                 location.href = 'https://worktime.ttkuaiban.com';
-            } else {
-                location.href = 'http://mldworktime.ttkuaiban.com:9097/';
-            }
+            } 
         }
     </script>
     <style>

+ 1 - 0
fhKeeper/formulahousekeeper/webttkuaiban/build_package.bat

@@ -0,0 +1 @@
+mvn package

+ 3 - 2
fhKeeper/formulahousekeeper/webttkuaiban/src/main/java/com/firerock/webttkuaiban/demos/controller/ArticleTemplateController.java

@@ -23,7 +23,7 @@ public class ArticleTemplateController {
     @Autowired
     ArticleService articleService;
 
-    @GetMapping("/pageList/{pageIndex}")  // 这里的 PageBean 是事先定义好的实体类
+    @GetMapping("/pageList/{pageIndex}.html")  // 这里的 PageBean 是事先定义好的实体类
     public Object PageList(Model model, @PathVariable("pageIndex") Integer pageIndex, @RequestParam(required = false) String info) {
         Integer pageSize = 10;
         // 定义格式化器
@@ -61,7 +61,7 @@ public class ArticleTemplateController {
         return "articleList";
     }
 
-    @GetMapping("/articleDetail/{id}")  // 这里的 PageBean 是事先定义好的实体类
+    @GetMapping("/articleDetail/{id}.html")  // 这里的 PageBean 是事先定义好的实体类
     public Object articleDetail(Model model, @PathVariable("id") Integer id) {
         // 定义格式化器
         DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
@@ -105,6 +105,7 @@ public class ArticleTemplateController {
         return "knowledgeDetails";
     }
 
+
     @GetMapping("/articleDetail")  // 这里的 PageBean 是事先定义好的实体类
     public Object articleDetailById(Model model, @RequestParam Integer id) {
         // 定义格式化器

+ 2 - 2
fhKeeper/formulahousekeeper/webttkuaiban/src/main/resources/static/knowledge.ftl

@@ -46,7 +46,7 @@
             <div>
               <!-- <div class="knowledgeField-content-item" onclick="triggerButtonClick(${item.id})"> -->
               <div class="knowledgeField-content-item">
-              <a href="/articleTemplate/articleDetail/${item.id}">
+              <a href="/articleTemplate/articleDetail/${item.id}.html">
                 <div class="image"><img src="${item.coverImgUrl}" class="wh100" class="wh100"></img>
                   </div>
                   <div class="textContent">
@@ -58,7 +58,7 @@
                         ${item.viewCount}
                       </div>
                       <!-- <button class="linkButtonss" onclick="learnMore(${item.id})">了解详情></button> -->
-                      <a class="linkButtonss" href="/articleTemplate/articleDetail/${item.id}">查看详情></a>
+                      <a class="linkButtonss" href="/articleTemplate/articleDetail/${item.id}.html">查看详情></a>
                     </div>
                   </div>
               </a>

+ 2 - 2
fhKeeper/formulahousekeeper/webttkuaiban/src/main/resources/static/knowledgeDetails.ftl

@@ -91,7 +91,7 @@
           <div class="line"></div>
           <div class="latestList">
             <#list latestList as item>
-              <a href="/articleTemplate/articleDetail/${item.id}">
+              <a href="/articleTemplate/articleDetail/${item.id}.html">
                 <div class="latestList-item" data-item='${item.id}'>
                   <div class="latestList-item-image">
                     <img src="${item.coverImgUrl}" class="wh100"></img>
@@ -113,7 +113,7 @@
           <div class="line"></div>
           <div class="latestList">
             <#list relatedList as item>
-              <a href="/articleTemplate/articleDetail/${item.id}">
+              <a href="/articleTemplate/articleDetail/${item.id}.html">
                 <div class="latestList-item" data-item='${item.id}'>
                   <div class="latestList-item-image">
                     <img src="${item.coverImgUrl}" class="wh100"></img>

+ 1 - 1
fhKeeper/formulahousekeeper/webttkuaiban/src/main/resources/static/moduleView/header.html

@@ -68,7 +68,7 @@
             { label: '产品定价', value: '../index.html#pricing', class: 'header-item' },
             { label: '关于我们', value: '../about.html', class: 'header-item' },
             { label: '企业动态', value: '../dynamic.html', class: 'header-item' },
-            { label: '知识园地', value: '/articleTemplate/pageList/1', class: 'header-item' },
+            { label: '知识园地', value: '/articleTemplate/pageList/1.html', class: 'header-item' },
           ],
           otherList: [
             { label: '工时管家', path: '../index.html', icon: './image/icon/workHour.png', hoverIcon: './image/icon/workHourHover.png' },

+ 7 - 7
fhKeeper/formulahousekeeper/webttkuaiban/src/main/resources/templates/knowledge.ftl

@@ -46,7 +46,7 @@
             <div>
               <!-- <div class="knowledgeField-content-item" onclick="triggerButtonClick(${item.id})"> -->
               <div class="knowledgeField-content-item">
-              <a href="/articleTemplate/articleDetail/${item.id}">
+              <a href="/articleTemplate/articleDetail/${item.id}.html">
                 <div class="image"><img src="${item.coverImgUrl}" class="wh100" class="wh100"></img>
                   </div>
                   <div class="textContent">
@@ -58,7 +58,7 @@
                         ${item.viewCount}
                       </div>
                       <!-- <button class="linkButtonss" onclick="learnMore(${item.id})">了解详情></button> -->
-                      <a class="linkButtonss" href="/articleTemplate/articleDetail/${item.id}">查看详情></a>
+                      <a class="linkButtonss" href="/articleTemplate/articleDetail/${item.id}.html">查看详情></a>
                     </div>
                   </div>
               </a>
@@ -101,7 +101,7 @@
   // const params = new URLSearchParams(window.location.search);
   const url = window.location.href
   const match = url.match(/pageList\/(\d+)/);
-  const number = match ? match[1] : null;
+  const number = match ? match[1].substring(0,match[1].indexOf('\\.')) : null;
   const pageIndex = +number || 1
   const pageSize = 10
   console.log(number, '<==== number')
@@ -118,10 +118,10 @@
 
   function search() {
     const inputVal = document.getElementById("knowledgeInput").value;
-    window.location.href = knowledgeUrl + fixedParameters + '?&info=' + inputVal
+    window.location.href = knowledgeUrl + fixedParameters + '.html?&info=' + inputVal
   }
   function learnMore(id) {
-    window.location.href = knowledgeDetails + `/` + id
+    window.location.href = knowledgeDetails + `/` + id + '.html';
   }
   function triggerButtonClick(itemId) {
     // 找到该 item 对应的按钮并触发点击事件
@@ -141,7 +141,7 @@
     if(!inputVal) {
       return
     }
-    window.location.href = knowledgeUrl + '/' + inputVal
+    window.location.href = knowledgeUrl + '/' + inputVal + '.html';
   }
 
   // 初始化分页组件
@@ -164,7 +164,7 @@
 
   // 跳转到指定页面
   function goToPage(page) {
-    window.location.href = knowledgeUrl + '/' + page
+    window.location.href = knowledgeUrl + '/' + page + '.html';
   }
 
   // 初始化分页

+ 5 - 5
fhKeeper/formulahousekeeper/webttkuaiban/src/main/resources/templates/knowledgeDetails.ftl

@@ -86,12 +86,12 @@
         <div class="latestArticles">
           <div class="knowledgeDetails-right-title">
             <div>最新文章</div>
-            <a href="/articleTemplate/pageList/1" class="linkButton">查看更多></a>
+            <a href="/articleTemplate/pageList/1.html" class="linkButton">查看更多></a>
           </div>
           <div class="line"></div>
           <div class="latestList">
             <#list latestList as item>
-              <a href="/articleTemplate/articleDetail/${item.id}">
+              <a href="/articleTemplate/articleDetail/${item.id}.html">
                 <div class="latestList-item" data-item='${item.id}'>
                   <div class="latestList-item-image">
                     <img src="${item.coverImgUrl}" class="wh100"></img>
@@ -108,12 +108,12 @@
         <div class="relatedRecommendations">
           <div class="knowledgeDetails-right-title">
             <div>相关推荐</div>
-            <a href="/articleTemplate/pageList/1" class="linkButton">查看更多></a>
+            <a href="/articleTemplate/pageList/1.html" class="linkButton">查看更多></a>
           </div>
           <div class="line"></div>
           <div class="latestList">
             <#list relatedList as item>
-              <a href="/articleTemplate/articleDetail/${item.id}">
+              <a href="/articleTemplate/articleDetail/${item.id}.html">
                 <div class="latestList-item" data-item='${item.id}'>
                   <div class="latestList-item-image">
                     <img src="${item.coverImgUrl}" class="wh100"></img>
@@ -197,7 +197,7 @@
   
   const knowledgeDetails = '/articleTemplate/articleDetail'
   function toKnowledge() {
-    window.location.href = `/articleTemplate/pageList/1`
+    window.location.href = `/articleTemplate/pageList/1.html`
   }
   
   $('#returnIcon').click(function () {

+ 1 - 1
fhKeeper/formulahousekeeper/webttkuaiban/src/main/resources/templates/moduleView/header.html

@@ -68,7 +68,7 @@
             { label: '产品定价', value: '../index.html#pricing', class: 'header-item' },
             { label: '关于我们', value: '../about.html', class: 'header-item' },
             { label: '企业动态', value: '../dynamic.html', class: 'header-item' },
-            { label: '知识园地', value: '/articleTemplate/pageList/1', class: 'header-item' },
+            { label: '知识园地', value: '/articleTemplate/pageList/1.html', class: 'header-item' },
           ],
           otherList: [
             { label: '工时管家', path: '../index.html', icon: './image/icon/workHour.png', hoverIcon: './image/icon/workHourHover.png' },