Ver Fonte

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

seyason há 9 meses atrás
pai
commit
73a1910d88

+ 8 - 0
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/controller/ContractController.java

@@ -54,6 +54,14 @@ public class ContractController {
         return contractService.ExportContract(request,number,name,typeName,status,startDate,endDate, paymentStartDate, paymentEndDate, secTypeId);
     }
 
+    /**
+     * 导出合同
+     */
+    @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){
+        return contractService.ExportContractOneToMany(request,number,name,typeName,status,startDate,endDate, paymentStartDate, paymentEndDate, secTypeId);
+    }
+
     /**
      * 导入合同
      */

+ 2 - 0
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/service/ContractService.java

@@ -38,4 +38,6 @@ public interface ContractService extends IService<Contract> {
     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);
 }

+ 313 - 0
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/service/impl/ContractServiceImpl.java

@@ -86,6 +86,8 @@ public class ContractServiceImpl extends ServiceImpl<ContractMapper, Contract> i
     private String path;
     @Autowired
     private ContractTypeSecMapper contractTypeSecMapper;
+    @Autowired
+    private ContractPayCustomizedMapper contractPayCustomizedMapper;
 
     /**
      * 分页查询合同
@@ -1170,4 +1172,315 @@ public class ContractServiceImpl extends ServiceImpl<ContractMapper, Contract> i
         msg.msg = MessageUtils.message("other.deleteScu");
         return msg;
     }
+
+    @Override
+    public HttpRespMsg ExportContractOneToMany(HttpServletRequest request, String number, String name, String typeName, Integer status, String startDate, String endDate, String paymentStartDate, String paymentEndDate, Integer secTypeId) {
+        HttpRespMsg httpRespMsg = new HttpRespMsg();
+        User user = userMapper.selectById(request.getHeader("token"));
+        List<SysRichFunction> functionContractList = sysFunctionMapper.getRoleFunctions(user.getRoleId(), "导出合同");
+        if(functionContractList.size() <= 0){
+            httpRespMsg.setError(MessageUtils.message("access.operationError"));
+            return httpRespMsg;
+        }
+        WxCorpInfo wxCorpInfo = wxCorpInfoMapper.selectOne(new QueryWrapper<WxCorpInfo>().eq("company_id", user.getCompanyId()));
+        CompanyDingding dingding = companyDingdingMapper.selectOne(new QueryWrapper<CompanyDingding>().eq("company_id", user.getCompanyId()));
+        HttpRespMsg contractPage = getContractPage(request, null, null, number, name, typeName, status, startDate, endDate, paymentStartDate, paymentEndDate, secTypeId);
+        HashMap<String, Object> resultDate = (HashMap<String, Object>) contractPage.data;
+        List<ContractPageVO> data = (List<ContractPageVO>)resultDate.get("data");
+        List<String> headList = new ArrayList<String>();
+//        headList.add("合同编号");
+//        headList.add("合同名称");
+//        headList.add("合同开始时间");
+//        headList.add("合同结束时间");
+//        headList.add("合同创建者");
+//        headList.add("合同金额(¥)");
+//        headList.add("合同类型");
+//        headList.add("状态");
+//        headList.add("创建时间");
+//        headList.add("备注");
+
+        ArrayList<List<String>> allList = new ArrayList<>();
+
+        if ( user.getCompanyId() == 4215){
+            headList.add("序号");
+            headList.add("合同名称");
+            headList.add("合同号");
+            headList.add("合同类别");
+            headList.add("二级分类");
+            headList.add("对方单位");
+            headList.add("对方联系人");
+            headList.add("对方联系电话");
+            headList.add("使用部门");
+            headList.add("经费来源");
+            headList.add("合同承办人");
+            headList.add("委托代理人");
+            headList.add("签订日期");
+            headList.add("合同生效日期");
+            headList.add("合同终止日期");
+            headList.add("备案日期");
+            headList.add("合同金额(元)/含税价");
+            headList.add("增值税税率");
+            headList.add("合同金额(元)/不含税价");
+            headList.add("是否固定金额");
+            headList.add("币种");
+            headList.add("合同状态(是否结清)");
+            headList.add("备注");
+            headList.add("印花税税目");
+
+            headList.add("付款日期");
+            headList.add("已付款金额(元)");
+            headList.add("付款类型");
+            headList.add("凭证号");
+            headList.add("待付款金额(元)");
+            allList.add(headList);
+
+            List<Integer> contractIds = data.stream().map(Contract::getId).filter(Objects::nonNull).collect(Collectors.toList());
+            QueryWrapper<ContractPayCustomized> customizedQueryWrapper = new QueryWrapper<>();
+            customizedQueryWrapper.in("contract_id", contractIds).eq("is_payed",1);
+            List<ContractPayCustomized> customizedList = contractPayCustomizedMapper.selectList(customizedQueryWrapper);
+
+            int i=0;
+            for (ContractPageVO contract : data) {
+                i++;
+                List<ContractPayCustomized> payCustomizedList = customizedList.stream().filter(c -> c.getContractId().equals(contract.getId())).collect(Collectors.toList());
+                if (!payCustomizedList.isEmpty()){
+                    for (int j = 0; j < payCustomizedList.size(); j++) {
+                        if (j==0){
+                            ArrayList<String> item = new ArrayList<>();
+                            item.add(i+"");
+                            item.add(contract.getName()== null ? "" : contract.getName());
+                            item.add(contract.getNumber() == null ? "" : contract.getNumber());
+                            item.add(contract.getTypeName() == null ? "" : contract.getTypeName() );
+                            item.add(contract.getSecTypeName() == null ? "" : contract.getSecTypeName() );
+                            ContractCustom customData = contract.getCustomData();
+                            if (customData!=null){
+                                item.add(customData.getCustomerOrg()==null?"":customData.getCustomerOrg());
+                                item.add(customData.getCustomerContact()==null?"":customData.getCustomerContact());
+                                item.add(customData.getCustomerPhone()==null?"":customData.getCustomerPhone());
+                                item.add(customData.getUseDepartment()==null?"":customData.getUseDepartment());
+                                item.add(customData.getFundsSource()==null?"":customData.getFundsSource());
+                                item.add(customData.getUndertaker()==null?"":customData.getUndertaker());
+                                item.add(customData.getAgent()==null?"":customData.getAgent());
+                                item.add(customData.getSignDate()==null?"":customData.getSignDate());
+                            }else {
+                                item.add("");
+                                item.add("");
+                                item.add("");
+                                item.add("");
+                                item.add("");
+                                item.add("");
+                                item.add("");
+                                item.add("");
+                            }
+                            item.add(contract.getStartDate() == null ? "" : contract.getStartDate() + "");
+                            item.add(contract.getEndDate() == null ? "" : contract.getEndDate() + "");
+                            if (customData!=null) {
+                                item.add(customData.getFilingsDate() == null ? "" : customData.getFilingsDate());
+                            }else {
+                                item.add("");
+                            }
+                            item.add(contract.getAmounts() == null ? "" : contract.getAmounts()+"" );
+                            if (customData!=null) {
+                                item.add(customData.getTaxRate() == null ? "" : customData.getTaxRate()+"");
+                                item.add(customData.getAmountsNoTax() == null ? "" : customData.getAmountsNoTax()+"");
+                                if (customData.getIsAmountFixed() == null){
+                                    item.add("");
+                                }else if (customData.getIsAmountFixed().equals(false)){
+                                    item.add("否");
+                                }else if (customData.getIsAmountFixed().equals(true)){
+                                    item.add("是");
+                                }
+                                item.add(customData.getCurrency() == null ? "" : customData.getCurrency());
+
+                                if (customData.getFinishStatus() == null){
+                                    item.add("");
+                                }else if ((customData.getFinishStatus()+"").equals("1")){
+                                    item.add("履约中");
+                                }else if ((customData.getFinishStatus()+"").equals("2")){
+                                    item.add("履约结束");
+                                }
+                            }else {
+                                item.add("");
+                                item.add("");
+                                item.add("");
+                                item.add("");
+                                item.add("");
+                            }
+                            item.add(contract.getRemarks() == null ? "" : contract.getRemarks()+"" );
+                            if (customData!=null) {
+                                item.add(customData.getStampDutyItems() == null ? "" : customData.getStampDutyItems());
+                            }else {
+                                item.add("");
+                            }
+
+                            item.add(payCustomizedList.get(j).getPayDate()==null?"":payCustomizedList.get(j).getPayDate());
+                            item.add(payCustomizedList.get(j).getPayedAmount()==null?"":payCustomizedList.get(j).getPayedAmount()+"");
+                            if (payCustomizedList.get(j).getPayWay()!=null&&payCustomizedList.get(j).getPayWay()==1){
+                                item.add("预付");
+                            } else if (payCustomizedList.get(j).getPayWay()!=null&&payCustomizedList.get(j).getPayWay()==2) {
+                                item.add("报账");
+                            }else {
+                                item.add("");
+                            }
+                            item.add(payCustomizedList.get(j).getBillNumber()==null?"":payCustomizedList.get(j).getBillNumber());
+                            item.add(payCustomizedList.get(j).getPendingAmounts()==null?"":payCustomizedList.get(j).getPendingAmounts()+"");
+                            allList.add(item);
+                        }
+                        else {
+                            ArrayList<String> item = new ArrayList<>();
+                            for (int i1 = 0; i1 < 24; i1++) {
+                                item.add("" );
+                            }
+
+                            item.add(payCustomizedList.get(j).getPayDate()==null?"":payCustomizedList.get(j).getPayDate());
+                            item.add(payCustomizedList.get(j).getPayedAmount()==null?"":payCustomizedList.get(j).getPayedAmount()+"");
+                            if (payCustomizedList.get(j).getPayWay()!=null&&payCustomizedList.get(j).getPayWay()==1){
+                                item.add("预付");
+                            } else if (payCustomizedList.get(j).getPayWay()!=null&&payCustomizedList.get(j).getPayWay()==2) {
+                                item.add("报账");
+                            }else {
+                                item.add("");
+                            }
+                            item.add(payCustomizedList.get(j).getBillNumber()==null?"":payCustomizedList.get(j).getBillNumber());
+                            item.add(payCustomizedList.get(j).getPendingAmounts()==null?"":payCustomizedList.get(j).getPendingAmounts()+"");
+                            allList.add(item);
+                        }
+                    }
+                }
+                else {
+                    ArrayList<String> item = new ArrayList<>();
+                    item.add(i+"");
+                    item.add(contract.getName()== null ? "" : contract.getName());
+                    item.add(contract.getNumber() == null ? "" : contract.getNumber());
+                    item.add(contract.getTypeName() == null ? "" : contract.getTypeName() );
+                    item.add(contract.getSecTypeName() == null ? "" : contract.getSecTypeName() );
+                    ContractCustom customData = contract.getCustomData();
+                    if (customData!=null){
+                        item.add(customData.getCustomerOrg()==null?"":customData.getCustomerOrg());
+                        item.add(customData.getCustomerContact()==null?"":customData.getCustomerContact());
+                        item.add(customData.getCustomerPhone()==null?"":customData.getCustomerPhone());
+                        item.add(customData.getUseDepartment()==null?"":customData.getUseDepartment());
+                        item.add(customData.getFundsSource()==null?"":customData.getFundsSource());
+                        item.add(customData.getUndertaker()==null?"":customData.getUndertaker());
+                        item.add(customData.getAgent()==null?"":customData.getAgent());
+                        item.add(customData.getSignDate()==null?"":customData.getSignDate());
+                    }else {
+                        item.add("");
+                        item.add("");
+                        item.add("");
+                        item.add("");
+                        item.add("");
+                        item.add("");
+                        item.add("");
+                        item.add("");
+                    }
+                    item.add(contract.getStartDate() == null ? "" : contract.getStartDate() + "");
+                    item.add(contract.getEndDate() == null ? "" : contract.getEndDate() + "");
+                    if (customData!=null) {
+                        item.add(customData.getFilingsDate() == null ? "" : customData.getFilingsDate());
+                    }else {
+                        item.add("");
+                    }
+                    item.add(contract.getAmounts() == null ? "" : contract.getAmounts()+"" );
+                    if (customData!=null) {
+                        item.add(customData.getTaxRate() == null ? "" : customData.getTaxRate()+"");
+                        item.add(customData.getAmountsNoTax() == null ? "" : customData.getAmountsNoTax()+"");
+                        if (customData.getIsAmountFixed() == null){
+                            item.add("");
+                        }else if (customData.getIsAmountFixed().equals(false)){
+                            item.add("否");
+                        }else if (customData.getIsAmountFixed().equals(true)){
+                            item.add("是");
+                        }
+                        item.add(customData.getCurrency() == null ? "" : customData.getCurrency());
+
+                        if (customData.getFinishStatus() == null){
+                            item.add("");
+                        }else if ((customData.getFinishStatus()+"").equals("1")){
+                            item.add("履约中");
+                        }else if ((customData.getFinishStatus()+"").equals("2")){
+                            item.add("履约结束");
+                        }
+                    }else {
+                        item.add("");
+                        item.add("");
+                        item.add("");
+                        item.add("");
+                        item.add("");
+                    }
+                    item.add(contract.getRemarks() == null ? "" : contract.getRemarks()+"" );
+                    if (customData!=null) {
+                        item.add(customData.getStampDutyItems() == null ? "" : customData.getStampDutyItems());
+                    }else {
+                        item.add("");
+                    }
+
+                    item.add("");
+                    item.add("");
+                    item.add("");
+                    item.add("");
+                    item.add("");
+                    allList.add(item);
+
+                }
+            }
+        }
+        else {
+            headList.add(MessageUtils.message("entry.contractNo"));
+            headList.add(MessageUtils.message("contract.name"));
+            headList.add(MessageUtils.message("Contract.startDate"));
+            headList.add(MessageUtils.message("Contract.endDate"));
+            headList.add(MessageUtils.message("Contract.creatorName"));
+            headList.add(MessageUtils.message("entry.contract"));
+            headList.add(MessageUtils.message("contract.type"));
+            headList.add(MessageUtils.message("leave.status"));
+            headList.add(MessageUtils.message("excel.creatTime"));
+            headList.add(MessageUtils.message("leave.task"));
+            allList.add(headList);
+            for (ContractPageVO contract : data) {
+                ArrayList<String> item = new ArrayList<>();
+                item.add(contract.getNumber() == null ? "" : contract.getNumber());
+                item.add(contract.getName());
+                item.add(contract.getStartDate() == null ? "" : contract.getStartDate() + "");
+                item.add(contract.getEndDate() == null ? "" : contract.getEndDate() + "");
+                if (wxCorpInfo != null && wxCorpInfo.getSaasSyncContact() == 1) {
+                    contract.setCreatorName("$userName=" + contract.getCreatorWxCorpId() + "$");
+                } else if (dingding != null && dingding.getContactNeedTranslate() == 1) {
+                    contract.setCreatorName("$userName=" + contract.getCreatorName() + "$");
+                } else {
+                    contract.setCreatorName(contract.getCreatorName());
+                }
+                item.add(contract.getCreatorName());
+                BigDecimal bigDecimal = null;
+                if (contract.getAmounts() != null) {
+                    bigDecimal = new BigDecimal(contract.getAmounts().toString()).setScale(2, BigDecimal.ROUND_HALF_UP);
+                }
+                item.add(contract.getAmounts() == null ? "" : bigDecimal + "");
+                item.add(contract.getTypeName());
+                switch (contract.getStatus()) {
+                    case 0:
+                        item.add("审核通过");
+                        break;
+                    case 1:
+                        item.add("待审核");
+                        break;
+                    case 2:
+                        item.add("驳回");
+                        break;
+                    default:
+                        item.add("_");
+                }
+                item.add(contract.getIndate().toString());
+                item.add(contract.getRemarks() == null ? "" : contract.getRemarks());
+                allList.add(item);
+            }
+        }
+        String fileName = MessageUtils.message("contract.export")+System.currentTimeMillis();
+        try {
+            return excelExportService.exportGeneralExcelByTitleAndList(wxCorpInfo,dingding,fileName,allList, path);
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        return httpRespMsg;
+    }
 }