Merge branch 'weicd' of http://192.168.1.110:5678/r/pms-upgrade into yaozc
2 files added
16 files modified
| | |
| | | import me.zhengjie.modules.assetManagement.domain.AssetManagement; |
| | | import org.springframework.data.jpa.repository.JpaRepository; |
| | | import org.springframework.data.jpa.repository.JpaSpecificationExecutor; |
| | | import org.springframework.data.jpa.repository.Query; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @website https://eladmin.vip |
| | |
| | | * @date 2023-02-06 |
| | | **/ |
| | | public interface AssetManagementRepository extends JpaRepository<AssetManagement, Long>, JpaSpecificationExecutor<AssetManagement> { |
| | | |
| | | /** |
| | | * 根据公司和日期查询 |
| | | * @return |
| | | */ |
| | | @Query(value = "SELECT * FROM `asset_management` WHERE buy_date like %?% and affiliated_company_id = ? and assets_type = ?",nativeQuery = true) |
| | | List<AssetManagement> findByDateAndCompany(String buyDate, Long companyId, String assetsType); |
| | | } |
| | |
| | | import org.apache.poi.hpsf.Decimal; |
| | | import org.springframework.data.jpa.repository.JpaRepository; |
| | | import org.springframework.data.jpa.repository.JpaSpecificationExecutor; |
| | | import org.springframework.data.jpa.repository.Modifying; |
| | | import org.springframework.data.jpa.repository.Query; |
| | | |
| | | import java.math.BigDecimal; |
| | |
| | | */ |
| | | @Query(value = "SELECT SUM(amount) FROM capital_flow_expend WHERE flow_id = ?1", nativeQuery = true) |
| | | BigDecimal sumAmountByFlowId(Long flowId); |
| | | |
| | | // 根据流水id删除数据 |
| | | @Modifying |
| | | @Query(value = "delete from capital_flow_expend where flow_id = ?1",nativeQuery = true) |
| | | void deleteByFlowId(Long flowId); |
| | | } |
| | |
| | | import org.apache.poi.hpsf.Decimal; |
| | | import org.springframework.data.jpa.repository.JpaRepository; |
| | | import org.springframework.data.jpa.repository.JpaSpecificationExecutor; |
| | | import org.springframework.data.jpa.repository.Modifying; |
| | | import org.springframework.data.jpa.repository.Query; |
| | | |
| | | import java.math.BigDecimal; |
| | |
| | | */ |
| | | @Query(value = "SELECT SUM(amount) FROM capital_flow_income WHERE flow_id = ?1", nativeQuery = true) |
| | | BigDecimal sumAmountByFlowId(Long flowId); |
| | | |
| | | // 根据流水id删除数据 |
| | | @Modifying |
| | | @Query(value = "delete from capital_flow_income where flow_id = ?1",nativeQuery = true) |
| | | void deleteByFlowId(Long flowId); |
| | | } |
| | |
| | | import me.zhengjie.modules.capitalFlow.domain.CapitalFlow; |
| | | import org.springframework.data.jpa.repository.JpaRepository; |
| | | import org.springframework.data.jpa.repository.JpaSpecificationExecutor; |
| | | import org.springframework.data.jpa.repository.Query; |
| | | |
| | | import java.sql.Timestamp; |
| | | |
| | | /** |
| | | * @website https://eladmin.vip |
| | |
| | | * @date 2023-02-13 |
| | | **/ |
| | | public interface CapitalFlowRepository extends JpaRepository<CapitalFlow, Long>, JpaSpecificationExecutor<CapitalFlow> { |
| | | |
| | | /** |
| | | * 根据日期,公司id查询 |
| | | * @param yearMonth |
| | | * @param companyId |
| | | * @return |
| | | */ |
| | | @Query |
| | | CapitalFlow findByFlowYearMonthAndCompanyId(Timestamp yearMonth, Long companyId); |
| | | } |
| | |
| | | import me.zhengjie.modules.capitalFlow.domain.CapitalFlow; |
| | | import me.zhengjie.modules.capitalFlow.service.CapitalFlowService; |
| | | import me.zhengjie.modules.capitalFlow.service.dto.CapitalFlowQueryCriteria; |
| | | import me.zhengjie.modules.salary.service.dto.SalaryQueryCriteria; |
| | | import org.springframework.data.domain.Pageable; |
| | | import lombok.RequiredArgsConstructor; |
| | | import org.springframework.http.HttpStatus; |
| | |
| | | capitalFlowService.deleteAll(ids); |
| | | return new ResponseEntity<>(HttpStatus.OK); |
| | | } |
| | | |
| | | @PutMapping(value = "/generate") |
| | | @Log("生成工资记录") |
| | | @ApiOperation("生成工资记录") |
| | | @PreAuthorize("@el.check('capitalFlow:generate')") |
| | | public ResponseEntity<Object> generateSalary(@Validated @RequestBody CapitalFlow resources){ |
| | | capitalFlowService.generate(resources); |
| | | return new ResponseEntity<>(HttpStatus.NO_CONTENT); |
| | | } |
| | | } |
| | |
| | | import me.zhengjie.modules.capitalFlow.domain.CapitalFlow; |
| | | import me.zhengjie.modules.capitalFlow.service.dto.CapitalFlowDto; |
| | | import me.zhengjie.modules.capitalFlow.service.dto.CapitalFlowQueryCriteria; |
| | | import me.zhengjie.modules.salary.service.dto.SalaryQueryCriteria; |
| | | import org.springframework.data.domain.Pageable; |
| | | import java.util.Map; |
| | | import java.util.List; |
| | |
| | | * @throws IOException / |
| | | */ |
| | | void download(List<CapitalFlowDto> all, HttpServletResponse response) throws IOException; |
| | | |
| | | /** |
| | | * 生成流水记录 |
| | | * @param resources / |
| | | */ |
| | | void generate(CapitalFlow resources); |
| | | } |
| | |
| | | */ |
| | | package me.zhengjie.modules.capitalFlow.service.impl; |
| | | |
| | | import me.zhengjie.exception.BadRequestException; |
| | | import me.zhengjie.modules.capitalFlow.domain.CapitalFlow; |
| | | import me.zhengjie.modules.capitalFlow.domain.CapitalFlowExpend; |
| | | import me.zhengjie.modules.capitalFlow.domain.CapitalFlowIncome; |
| | | import me.zhengjie.modules.capitalFlow.repository.CapitalFlowExpendRepository; |
| | | import me.zhengjie.modules.capitalFlow.repository.CapitalFlowIncomeRepository; |
| | | import me.zhengjie.modules.quartz.service.impl.CapitalServiceImpl; |
| | | import me.zhengjie.modules.system.service.dto.SysCompanyDto; |
| | | import me.zhengjie.modules.system.service.impl.SysCompanyServiceImpl; |
| | | import me.zhengjie.utils.*; |
| | |
| | | import org.springframework.data.domain.Page; |
| | | import org.springframework.data.domain.Pageable; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.*; |
| | | import java.io.IOException; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.util.ArrayList; |
| | | import java.util.LinkedHashMap; |
| | | import java.util.function.Function; |
| | | |
| | | /** |
| | |
| | | * @date 2023-02-13 |
| | | **/ |
| | | @Service |
| | | @Transactional |
| | | @RequiredArgsConstructor |
| | | public class CapitalFlowServiceImpl implements CapitalFlowService { |
| | | |
| | |
| | | private final SysCompanyServiceImpl sysCompanyServiceImpl; |
| | | private final CapitalFlowExpendRepository capitalFlowExpendRepository; |
| | | private final CapitalFlowIncomeRepository capitalFlowIncomeRepository; |
| | | private final CapitalServiceImpl capitalService; |
| | | |
| | | @Override |
| | | public Map<String,Object> queryAll(CapitalFlowQueryCriteria criteria, Pageable pageable){ |
| | |
| | | @Override |
| | | public void deleteAll(Long[] ids) { |
| | | for (Long id : ids) { |
| | | // 查询流水支出表 |
| | | List<CapitalFlowExpend> capitalFlowExpends = capitalFlowExpendRepository.findByFlowId(id); |
| | | for(int i = 0; i < capitalFlowExpends.size(); i++){ |
| | | capitalFlowExpendRepository.deleteByFlowId(capitalFlowExpends.get(i).getFlowId()); |
| | | } |
| | | // 查询流水收入表 |
| | | List<CapitalFlowIncome> capitalFlowIncomes = capitalFlowIncomeRepository.findByFlowId(id); |
| | | for(int i = 0; i < capitalFlowIncomes.size(); i++){ |
| | | capitalFlowIncomeRepository.deleteByFlowId(capitalFlowIncomes.get(i).getFlowId()); |
| | | } |
| | | capitalFlowRepository.deleteById(id); |
| | | } |
| | | } |
| | |
| | | } |
| | | |
| | | /** |
| | | * 流水生成 |
| | | * @param resources / |
| | | */ |
| | | @Override |
| | | public void generate(CapitalFlow resources) { |
| | | // 日历类 |
| | | Calendar cal = Calendar.getInstance(); |
| | | cal.add(Calendar.MONTH, -1); |
| | | if(resources.getFlowYearMonth().compareTo(cal.getTime()) > 0){ |
| | | throw new BadRequestException("只能更新上个月的流水记录"); |
| | | } |
| | | // 格式化日期 |
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); |
| | | // 目标年月 |
| | | String targetYearMonth = sdf.format(resources.getFlowYearMonth().getTime()); |
| | | capitalService.getCapitalInfo(resources.getCompanyId(), targetYearMonth); |
| | | } |
| | | |
| | | /** |
| | | * 公司名称 |
| | | * @param resources |
| | | * @return |
| | |
| | | public static final String TASK_STATUS_NOT_STARTED = "task_status_not_started"; |
| | | // 任务状态:进行中 |
| | | public static final String TASK_STATUS_IN_HAND = "task_status_in_hand"; |
| | | // 任务状态:待测试 |
| | | public static final String TASK_STATUS_TEST = "task_status_test"; |
| | | // 任务状态:已暂停 |
| | | public static final String TASK_STATUS_STOP = "task_status_stop"; |
| | | // 任务状态:已完成 |
| | | public static final String TASK_STATUS_COMPLETED = "task_status_completed"; |
| | | |
| | |
| | | |
| | | // 合同状态 |
| | | public static final String CONTRACT_STATUS = "contract_status"; |
| | | // 合同状态: 未开始 |
| | | public static final String CONTRACT_STATUS_NOT_STARTED = "contract_not_started"; |
| | | // 合同状态:进行中 |
| | | public static final String CONTRACT_STATUS_HAVE_HAND = "contract_have_hand"; |
| | | // 合同状态:服务中 |
| | | public static final String CONTRACT_STATUS_IN_SERVICE = "contract_in_service"; |
| | | // 合同状态:已终止 |
| | | public static final String CONTRACT_STATUS_TERMINATED = "contract_terminated"; |
| | | // 合同状态:已结束 |
| | | public static final String CONTRACT_STATUS_IS_OVER = "contract_is_over"; |
| | | |
| | | // key iv |
| | | public static final String key = "1234567890123456"; |
| | |
| | | public static final String RESOURCES_TYPE_REMIND = "resources_type_remind"; |
| | | // 提醒状态:不提醒 |
| | | public static final String RESOURCES_TYPE_NOREMIND = "resources_type_noRemind"; |
| | | |
| | | // 资产类型 |
| | | public static final String ACCET_TYPE = "asset_type"; |
| | | // 资产类型:固定 |
| | | public static final String ACCET_TYPE_FIXED = "asset_type_fixed"; |
| | | // 资产类型:流动 |
| | | public static final String ACCET_TYPE_FLOW = "asset_type_flow"; |
| | | |
| | | // 合同费用类型 |
| | | public static final String CONTRACR_TYPE_COST = "contract_type_cost"; |
| | | // 合同费用类型:合同支出 |
| | | public static final String CONTRACR_EXPENDITURE = "contract_expenditure"; |
| | | // 合同费用类型:合同收入 |
| | | public static final String CONTRACR_REVENUE = "contract_revenue"; |
| | | |
| | | public static final String DAILY_PAYROLL_EXPEND = "工资流水支出"; |
| | | public static final String ASSET_FLOW_EXPEND_G = "固定资产支出"; |
| | | public static final String ASSET_FLOW_EXPEND_L = "流动资产支出"; |
| | | public static final String CONTRACT_EXPENSES = "合同费用支出"; |
| | | public static final String CONTRACT_EXPENSES_S = "合同费用收入"; |
| | | } |
| | |
| | | @ApiModelProperty(value = "合同ID") |
| | | private Long contractId; |
| | | |
| | | /** 魏传栋 - 始 */ |
| | | @Column(name = "`company_id`") |
| | | @ApiModelProperty(value = "公司ID") |
| | | private Long companyId; |
| | | /** 魏传栋 - 终 */ |
| | | |
| | | @Column(name = "`payment_time`") |
| | | @ApiModelProperty(value = "付款时间") |
| | | private Timestamp paymentTime; |
| | |
| | | @ApiModelProperty(value = "款项结束日期") |
| | | private Timestamp fundBelongEnd; |
| | | |
| | | /** 魏传栋 - 始 */ |
| | | @Column(name = "`payment_type`") |
| | | @ApiModelProperty(value = "收支类型") |
| | | private String paymentType; |
| | | /** 魏传栋 - 终 */ |
| | | |
| | | @Column(name = "`remarks`") |
| | | @ApiModelProperty(value = "备注信息") |
| | | private String remarks; |
| | |
| | | */ |
| | | package me.zhengjie.modules.contract.repository; |
| | | |
| | | import me.zhengjie.modules.assetManagement.domain.AssetManagement; |
| | | import me.zhengjie.modules.contract.domain.ContractPayment; |
| | | import org.springframework.data.jpa.repository.JpaRepository; |
| | | import org.springframework.data.jpa.repository.JpaSpecificationExecutor; |
| | |
| | | * @param contractId |
| | | */ |
| | | void deleteByContractId(Long contractId); |
| | | |
| | | /** |
| | | * 根据公司和日期查询 |
| | | * @return |
| | | */ |
| | | @Query(value = "SELECT * FROM `contract_payment` WHERE payment_time like %?% and company_id = ? and payment_type = ?",nativeQuery = true) |
| | | List<ContractPayment> findByDateAndCompany(String buyDate, Long companyId, String assetsType); |
| | | } |
| | |
| | | |
| | | /** 发票信息 */ |
| | | private List<Long> contractInvoiceIds; |
| | | |
| | | /** 魏传栋 - 始 */ |
| | | /** 公司id */ |
| | | private Long companyId; |
| | | |
| | | /** 费用类型 */ |
| | | private String paymentType; |
| | | |
| | | /** 公司名 */ |
| | | private String companyName; |
| | | /** 魏传栋 - 终 */ |
| | | } |
| | |
| | | import me.zhengjie.modules.contract.repository.ContractRepository; |
| | | import me.zhengjie.modules.contract.service.dto.ContractDto; |
| | | import me.zhengjie.modules.contract.service.mapstruct.ContractMapper; |
| | | import me.zhengjie.modules.system.domain.SysCompany; |
| | | import me.zhengjie.modules.system.repository.DictDetailRepository; |
| | | import me.zhengjie.modules.system.repository.SysCompanyRepository; |
| | | import me.zhengjie.utils.ValidationUtil; |
| | | import me.zhengjie.utils.FileUtil; |
| | | import lombok.RequiredArgsConstructor; |
| | |
| | | private final ContractServiceImpl contractServiceImpl; |
| | | private final ContractMapper contractMapper; |
| | | private final ContractRepository contractRepository; |
| | | private final SysCompanyRepository sysCompanyRepository; |
| | | |
| | | @Override |
| | | public Map<String,Object> queryAll(ContractPaymentQueryCriteria criteria, Pageable pageable){ |
| | |
| | | Contract contract = contractRepository.findById(t.getContractId()).orElseGet(Contract::new); |
| | | // DTO赋值 |
| | | contractPaymentDto.setContractName(contract.getContractName()); |
| | | |
| | | // 魏传栋 - 始 |
| | | SysCompany sysCompany = sysCompanyRepository.findById(contractPaymentDto.getCompanyId()).orElseGet(SysCompany::new); |
| | | contractPaymentDto.setCompanyName(sysCompany.getLabel()); |
| | | // 返回处理好的DTO |
| | | return contractPaymentDto; |
| | | } |
| New file |
| | |
| | | /* |
| | | * Copyright 2019-2020 Zheng Jie |
| | | * |
| | | * Licensed under the Apache License, Version 2.0 (the "License"); |
| | | * you may not use this file except in compliance with the License. |
| | | * You may obtain a copy of the License at |
| | | * |
| | | * http://www.apache.org/licenses/LICENSE-2.0 |
| | | * |
| | | * Unless required by applicable law or agreed to in writing, software |
| | | * distributed under the License is distributed on an "AS IS" BASIS, |
| | | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| | | * See the License for the specific language governing permissions and |
| | | * limitations under the License. |
| | | */ |
| | | package me.zhengjie.modules.quartz.service.impl; |
| | | |
| | | |
| | | import lombok.RequiredArgsConstructor; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import me.zhengjie.modules.assetManagement.domain.AssetManagement; |
| | | import me.zhengjie.modules.assetManagement.repository.AssetManagementRepository; |
| | | import me.zhengjie.modules.capitalFlow.domain.CapitalFlow; |
| | | import me.zhengjie.modules.capitalFlow.domain.CapitalFlowExpend; |
| | | import me.zhengjie.modules.capitalFlow.domain.CapitalFlowIncome; |
| | | import me.zhengjie.modules.capitalFlow.repository.CapitalFlowExpendRepository; |
| | | import me.zhengjie.modules.capitalFlow.repository.CapitalFlowIncomeRepository; |
| | | import me.zhengjie.modules.capitalFlow.repository.CapitalFlowRepository; |
| | | import me.zhengjie.modules.constant.Constant; |
| | | import me.zhengjie.modules.contract.domain.ContractPayment; |
| | | import me.zhengjie.modules.contract.repository.ContractPaymentRepository; |
| | | import me.zhengjie.modules.salary.domain.Salary; |
| | | import me.zhengjie.modules.salary.repository.SalaryRepository; |
| | | import me.zhengjie.modules.system.domain.SysCompany; |
| | | import me.zhengjie.modules.system.repository.SysCompanyRepository; |
| | | import me.zhengjie.modules.system.service.UserService; |
| | | import me.zhengjie.modules.system.service.dto.UserDto; |
| | | import me.zhengjie.modules.system.service.dto.UserQueryCriteria; |
| | | import org.apache.commons.lang3.ObjectUtils; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.sql.Timestamp; |
| | | import java.util.Calendar; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @author Zheng Jie |
| | | * @date 2019-01-07 |
| | | */ |
| | | @Slf4j |
| | | @Service |
| | | @RequiredArgsConstructor |
| | | public class CapitalServiceImpl{ |
| | | |
| | | private final SysCompanyRepository sysCompanyRepository; |
| | | private final UserService userService; |
| | | private final SalaryRepository salaryRepository; |
| | | private final AssetManagementRepository assetManagementRepository; |
| | | private final CapitalFlowRepository capitalFlowRepository; |
| | | private final CapitalFlowExpendRepository capitalFlowExpendRepository; |
| | | private final ContractPaymentRepository contractPaymentRepository; |
| | | private final CapitalFlowIncomeRepository capitalFlowIncomeRepository; |
| | | |
| | | /** |
| | | * 向资金流水和流水指出添加数据 |
| | | * @param companyId |
| | | * @param targetYearMonth |
| | | */ |
| | | public void getCapitalInfo(Long companyId, String targetYearMonth){ |
| | | // 判断公司Id是否为空 |
| | | if(companyId != null){ |
| | | // 单个公司流水 |
| | | singleCompanyFlow(companyId, targetYearMonth); |
| | | }else{ |
| | | // 查询所有公司 |
| | | List<SysCompany> companyList = sysCompanyRepository.findAll(); |
| | | for(int i = 0; i < companyList.size(); i++){ |
| | | try { |
| | | // 单个公司流水 |
| | | singleCompanyFlow(companyList.get(i).getId(), targetYearMonth); |
| | | }catch (Exception e){ |
| | | // 跳过本次循环 |
| | | continue; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 单个公司流水 |
| | | * @param companyId |
| | | * @param targetYearMonth |
| | | */ |
| | | public void singleCompanyFlow(Long companyId, String targetYearMonth){ |
| | | // 日历类 |
| | | Calendar cal = Calendar.getInstance(); |
| | | // 设置年份 |
| | | cal.set(Calendar.YEAR, Integer.valueOf(targetYearMonth.substring(0,4))); |
| | | // 设置月份 |
| | | cal.set(Calendar.MONTH, Integer.valueOf(targetYearMonth.substring(5,7)) - 1); |
| | | // 设置日份 |
| | | cal.set(Calendar.DAY_OF_MONTH, 1); |
| | | // 设置时数 |
| | | cal.set(Calendar.HOUR_OF_DAY, 0); |
| | | // 设置分数 |
| | | cal.set(Calendar.MINUTE, 0); |
| | | // 设置秒数 |
| | | cal.set(Calendar.SECOND, 0); |
| | | // 设置毫秒数 |
| | | cal.set(Calendar.MILLISECOND, 0); |
| | | |
| | | // 查询资金流水 |
| | | CapitalFlow capitalFlow = capitalFlowRepository.findByFlowYearMonthAndCompanyId(new Timestamp(cal.getTime().getTime()), companyId); |
| | | // 判断是否为空 |
| | | if(ObjectUtils.isEmpty(capitalFlow)){ |
| | | capitalFlow = new CapitalFlow(); |
| | | } |
| | | capitalFlow.setFlowYearMonth(new Timestamp(cal.getTime().getTime())); |
| | | capitalFlow.setCompanyId(companyId); |
| | | // 资金流水管理添加 |
| | | capitalFlowRepository.save(capitalFlow); |
| | | |
| | | // 查询流水支出管理 |
| | | List<CapitalFlowExpend> capitalFlowExpends = capitalFlowExpendRepository.findByFlowId(capitalFlow.getId()); |
| | | // 流水支出管理不为空,数据全部删除(手动添加的也删除) |
| | | for(int i = 0; i < capitalFlowExpends.size(); i++){ |
| | | capitalFlowExpendRepository.delete(capitalFlowExpends.get(i)); |
| | | } |
| | | |
| | | // 查询流水收入管理 |
| | | List<CapitalFlowIncome> capitalFlowIncomes = capitalFlowIncomeRepository.findByFlowId(capitalFlow.getId()); |
| | | // 流水收入管理不为空,数据全部删除 |
| | | for(int i = 0; i< capitalFlowIncomes.size(); i++){ |
| | | capitalFlowIncomeRepository.delete(capitalFlowIncomes.get(i)); |
| | | } |
| | | |
| | | // 工资支出总金额 |
| | | Double totalWageExpenditure = 0.0; |
| | | // 用户检索类 |
| | | UserQueryCriteria userQueryCriteria = new UserQueryCriteria(); |
| | | userQueryCriteria.setEnabled(true); |
| | | // 获取用户列表 |
| | | List<UserDto> userDtoList = userService.queryAll(userQueryCriteria); |
| | | for(int i = 0; i < userDtoList.size(); i++){ |
| | | // 判断员工是否属于当前公司 |
| | | if(userDtoList.get(i).getCompanyId().equals(companyId)){ |
| | | // 根据日期和员工查询工资条 |
| | | List<Salary> salaryList = salaryRepository.findByUserIdAndSalaryYearMonth(userDtoList.get(i).getId(), new Timestamp(cal.getTime().getTime())); |
| | | for(int i1 = 0; i1 < salaryList.size(); i1++){ |
| | | totalWageExpenditure = totalWageExpenditure + Double.valueOf(salaryList.get(i1).getPreTaxAmount().toString()); |
| | | } |
| | | } |
| | | } |
| | | // 工资支出总金额不为0的话就往流水支出管理添加数据 |
| | | if(!totalWageExpenditure.equals(0.0)){ |
| | | // 调用方法添加 |
| | | saveCapitalFlowExpend(capitalFlow.getId(),totalWageExpenditure, Constant.DAILY_PAYROLL_EXPEND); |
| | | } |
| | | |
| | | |
| | | // 资产支出总金额(固定) |
| | | Double totalAssetsExpenditureFixed = 0.0; |
| | | // 根据日期和公司查询固定资产 |
| | | List<AssetManagement> assetManagementList = assetManagementRepository.findByDateAndCompany(targetYearMonth.substring(0,7), companyId, Constant.ACCET_TYPE_FIXED); |
| | | for(int i = 0; i < assetManagementList.size(); i++){ |
| | | totalAssetsExpenditureFixed = totalAssetsExpenditureFixed + Double.valueOf(assetManagementList.get(i).getBuyMoney().toString()); |
| | | } |
| | | // 固定资产支出总金额不为0的话就往流水支出管理添加数据 |
| | | if(!totalAssetsExpenditureFixed.equals(0.0)){ |
| | | // 调用方法添加 |
| | | saveCapitalFlowExpend(capitalFlow.getId(),totalAssetsExpenditureFixed, Constant.ASSET_FLOW_EXPEND_G); |
| | | } |
| | | |
| | | // 资产支出总金额(流动) |
| | | Double totalAssetsExpenditureFlow = 0.0; |
| | | // 根据日期和公司查询流动资产 |
| | | List<AssetManagement> assetManagementLists = assetManagementRepository.findByDateAndCompany(targetYearMonth.substring(0,7), companyId, Constant.ACCET_TYPE_FLOW); |
| | | for(int i = 0; i < assetManagementLists.size(); i++){ |
| | | totalAssetsExpenditureFlow = totalAssetsExpenditureFlow + Double.valueOf(assetManagementLists.get(i).getBuyMoney().toString()); |
| | | } |
| | | // 流动资产支出总金额不为0的话就往流水支出管理添加数据 |
| | | if(!totalAssetsExpenditureFlow.equals(0.0)){ |
| | | // 调用方法添加 |
| | | saveCapitalFlowExpend(capitalFlow.getId(),totalAssetsExpenditureFlow, Constant.ASSET_FLOW_EXPEND_L); |
| | | } |
| | | |
| | | // 合同支出总金额 |
| | | Double contractExpenditure = 0.0; |
| | | // 根据日期和公司查询合同付款 |
| | | List<ContractPayment> contractPayments = contractPaymentRepository.findByDateAndCompany(targetYearMonth.substring(0,7), companyId, Constant.CONTRACR_EXPENDITURE); |
| | | for(int i = 0; i < contractPayments.size(); i++){ |
| | | contractExpenditure = contractExpenditure + Double.valueOf(contractPayments.get(i).getPaymentAmount().toString()); |
| | | } |
| | | // 合同支出总金额不为0的话就往流水支出管理添加数据 |
| | | if(!contractExpenditure.equals(0.0)){ |
| | | // 调用方法添加 |
| | | saveCapitalFlowExpend(capitalFlow.getId(),contractExpenditure, Constant.CONTRACT_EXPENSES); |
| | | } |
| | | |
| | | // 合同收入总金额 |
| | | Double contractRevenue = 0.0; |
| | | // 根据日期和公司查询合同收入 |
| | | List<ContractPayment> contractPaymentList = contractPaymentRepository.findByDateAndCompany(targetYearMonth.substring(0,7), companyId, Constant.CONTRACR_REVENUE); |
| | | for(int i = 0; i < contractPaymentList.size(); i++){ |
| | | contractRevenue = contractRevenue + Double.valueOf(contractPaymentList.get(i).getPaymentAmount().toString()); |
| | | } |
| | | // 合同收入总金额不为0就往流水收入管理添加数据 |
| | | if(!contractRevenue.equals(0.0)){ |
| | | CapitalFlowIncome capitalFlowIncome = new CapitalFlowIncome(); |
| | | capitalFlowIncome.setFlowId(capitalFlow.getId()); |
| | | capitalFlowIncome.setAmount(new BigDecimal(contractRevenue)); |
| | | capitalFlowIncome.setTitle(Constant.CONTRACT_EXPENSES_S); |
| | | capitalFlowIncomeRepository.save(capitalFlowIncome); |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 流水支出管理添加 |
| | | * @param id |
| | | * @param totalExpenditure |
| | | * @param title |
| | | */ |
| | | public void saveCapitalFlowExpend(Long id, Double totalExpenditure, String title){ |
| | | CapitalFlowExpend capitalFlowExpend = new CapitalFlowExpend(); |
| | | capitalFlowExpend.setFlowId(id); |
| | | capitalFlowExpend.setTitle(title); |
| | | capitalFlowExpend.setAmount(new BigDecimal(totalExpenditure)); |
| | | capitalFlowExpendRepository.save(capitalFlowExpend); |
| | | } |
| | | |
| | | |
| | | } |
| New file |
| | |
| | | package me.zhengjie.modules.quartz.task; |
| | | |
| | | import lombok.RequiredArgsConstructor; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import me.zhengjie.modules.quartz.service.impl.CapitalServiceImpl; |
| | | import org.springframework.scheduling.annotation.Async; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.text.ParseException; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.Calendar; |
| | | |
| | | /** |
| | | * 月报定时任务,每月初执行 |
| | | */ |
| | | @Slf4j |
| | | @Service |
| | | @RequiredArgsConstructor |
| | | @Async |
| | | public class CapitalMethod { |
| | | |
| | | private final CapitalServiceImpl capitalService; |
| | | |
| | | public void getCapital() throws ParseException { |
| | | // 日历类 |
| | | Calendar cal = Calendar.getInstance(); |
| | | cal.add(Calendar.MONTH, -1); |
| | | // 格式化日期 |
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); |
| | | // 目标年月 |
| | | String targetYearMonth = sdf.format(cal.getTime()); |
| | | // 调用方法 |
| | | capitalService.getCapitalInfo(null, targetYearMonth); |
| | | } |
| | | } |
| | |
| | | }) |
| | | } |
| | | |
| | | export default { getAll, add, edit, del } |
| | | export function generate(data) { |
| | | return request({ |
| | | url: 'api/capitalFlow/generate', |
| | | method: 'put', |
| | | data |
| | | }) |
| | | } |
| | | |
| | | export default { getAll, add, edit, del, generate } |
| | |
| | | export const TASK_STATUS_NOT_STARTED = 'task_status_not_started' |
| | | // 任务状态:进行中 |
| | | export const TASK_STATUS_IN_HAND = 'task_status_in_hand' |
| | | // 任务状态:待测试 |
| | | export const TASK_STATUS_TEST = 'task_status_test' |
| | | // 任务状态:已暂停 |
| | | export const TASK_STATUS_STOP = 'task_status_stop' |
| | | // 任务状态:已完成 |
| | | export const TASK_STATUS_COMPLETED = 'task_status_completed' |
| | | |
| | |
| | | |
| | | // 合同状态 |
| | | export const CONTRACT_STATUS = 'contract_status' |
| | | // 合同状态: 未开始 |
| | | export const CONTRACT_STATUS_NOT_STARTED = 'contract_not_started' |
| | | // 合同状态:进行中 |
| | | export const CONTRACT_STATUS_HAVE_HAND = 'contract_have_hand' |
| | | // 合同状态:服务中 |
| | | export const CONTRACT_STATUS_IN_SERVICE = 'contract_in_service' |
| | | // 合同状态:已终止 |
| | | export const CONTRACT_STATUS_TERMINATED = 'contract_terminated' |
| | | // 合同状态:已结束 |
| | | export const CONTRACT_STATUS_IS_OVER = 'contract_is_over' |
| | | |
| | | // 合同费用类型 |
| | | export const CONTRACR_TYPE_COST = 'contract_type_cost' |
| | | // 合同费用类型:合同支出 |
| | | export const CONTRACR_EXPENDITURE = 'contract_expenditure' |
| | | // 合同费用类型:合同收入 |
| | | export const CONTRACR_REVENUE = 'contract_revenue' |
| | | |
| | | export default { |
| | | ROLE_LEVEL_SUPER, |
| | |
| | | TASK_STATUS, |
| | | TASK_STATUS_NOT_STARTED, |
| | | TASK_STATUS_IN_HAND, |
| | | TASK_STATUS_STOP, |
| | | TASK_STATUS_TEST, |
| | | TASK_STATUS_COMPLETED, |
| | | CONFIGURATION_TYPE, |
| | | CONFIGURATION_TYPE_PERCENTAGE, |
| | |
| | | CONTRACT_SERVICE, |
| | | CONTRACT_DEVELOP_SERVICE, |
| | | PAYMENT_STATE, |
| | | CONTRACT_STATUS |
| | | CONTRACT_STATUS, |
| | | CONTRACT_STATUS_NOT_STARTED, |
| | | CONTRACT_STATUS_HAVE_HAND, |
| | | CONTRACT_STATUS_IN_SERVICE, |
| | | CONTRACT_STATUS_TERMINATED, |
| | | CONTRACT_STATUS_IS_OVER, |
| | | CONTRACR_TYPE_COST, |
| | | CONTRACR_EXPENDITURE, |
| | | CONTRACR_REVENUE |
| | | } |
| | |
| | | <rrOperation :crud="crud" /> |
| | | </div> |
| | | <!--如果想在工具栏加入更多按钮,可以使用插槽方式, slot = 'left' or 'right'--> |
| | | <crudOperation :permission="permission" /> |
| | | <crudOperation :permission="permission"> |
| | | <el-button |
| | | slot="right" |
| | | v-permission="permission.generate" |
| | | class="filter-item" |
| | | size="mini" |
| | | type="primary" |
| | | icon="el-icon-plus" |
| | | style="margin-right: 6px;" |
| | | @click="openGenerate" |
| | | >生成</el-button> |
| | | </crudOperation> |
| | | <!--表单组件--> |
| | | <el-dialog :close-on-click-modal="false" :before-close="crud.cancelCU" :visible.sync="crud.status.cu > 0" :title="crud.status.title" width="500px"> |
| | | <el-form ref="form" :model="form" :rules="rules" size="small" label-width="80px"> |
| | |
| | | <el-form-item> |
| | | <span slot="label" class="flow-label">流水支出</span> |
| | | </el-form-item> |
| | | <template v-for="item in props.row.capitalFlowExpends"> |
| | | <el-form-item :key="item.id" :label="item.title"> |
| | | <span>{{ crud.toMoney(item.amount) }}</span> |
| | | </el-form-item> |
| | | </template> |
| | | <span v-if="props.row.capitalFlowExpends != ''"> |
| | | <template v-for="item in props.row.capitalFlowExpends"> |
| | | <el-form-item :key="item.id" :label="item.title"> |
| | | <span>{{ crud.toMoney(item.amount) }}</span> |
| | | </el-form-item> |
| | | </template> |
| | | </span> |
| | | <span v-else> |
| | | <template> |
| | | <el-form-item> |
| | | <span>{{ '无' }}</span> |
| | | </el-form-item> |
| | | </template> |
| | | </span> |
| | | </el-form> |
| | | <el-form label-position="left" class="my-demo-table-expand"> |
| | | <el-form-item> |
| | | <span slot="label" class="flow-label">流水收入</span> |
| | | </el-form-item> |
| | | <template v-for="item in props.row.capitalFlowIncomes"> |
| | | <el-form-item :key="item.id" :label="item.title"> |
| | | <span>{{ crud.toMoney(item.amount) }}</span> |
| | | </el-form-item> |
| | | </template> |
| | | <span v-if="props.row.capitalFlowIncomes != ''"> |
| | | <template v-for="item in props.row.capitalFlowIncomes"> |
| | | <el-form-item :key="item.id" :label="item.title"> |
| | | <span>{{ crud.toMoney(item.amount) }}</span> |
| | | </el-form-item> |
| | | </template> |
| | | </span> |
| | | <span v-else> |
| | | <template> |
| | | <el-form-item> |
| | | <span>{{ '无' }}</span> |
| | | </el-form-item> |
| | | </template> |
| | | </span> |
| | | </el-form> |
| | | </div> |
| | | </template> |
| | |
| | | </el-table-column> |
| | | <el-table-column label="结余总金额"> |
| | | <template slot-scope="scope"> |
| | | {{ crud.toMoney(scope.row.capitalFlowIncomesAmount - scope.row.capitalFlowExpendsAmount) }} |
| | | {{ crud.toMoney((scope.row.capitalFlowIncomesAmount == null ? 0 : scope.row.capitalFlowIncomesAmount) - scope.row.capitalFlowExpendsAmount) }} |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="remarks" label="备注" /> |
| | |
| | | </el-table> |
| | | <!--分页组件--> |
| | | <pagination /> |
| | | <!--表单组件--> |
| | | <el-dialog :close-on-click-modal="false" :before-close="closeGenerate" :visible.sync="generateStatus" title="生成资金流水记录" width="500px"> |
| | | <el-form ref="generateForm" :model="generateForm" :rules="generateRules" size="small" label-width="80px"> |
| | | <el-form-item label="流水年月" prop="flowYearMonth"> |
| | | <el-date-picker |
| | | v-model="generateForm.flowYearMonth" |
| | | type="month" |
| | | style="width: 370px;" |
| | | placeholder="请选择" |
| | | /> |
| | | </el-form-item> |
| | | <el-form-item label="所属公司" prop="companyId"> |
| | | <el-select v-model="generateForm.companyId" filterable clearable placeholder="请选择" style="width: 370px;"> |
| | | <el-option |
| | | v-for="item in companyList" |
| | | :key="item.id" |
| | | :label="item.label" |
| | | :value="item.id" |
| | | /> |
| | | </el-select> |
| | | </el-form-item> |
| | | </el-form> |
| | | <div slot="footer" class="dialog-footer"> |
| | | <el-button type="text" @click="closeGenerate">取消</el-button> |
| | | <el-button :loading="generateLoading" type="primary" @click="submitGenerate">确认</el-button> |
| | | </div> |
| | | </el-dialog> |
| | | </div> |
| | | </div> |
| | | </template> |
| | |
| | | add: ['admin', 'capitalFlow:add'], |
| | | edit: ['admin', 'capitalFlow:edit'], |
| | | del: ['admin', 'capitalFlow:del'], |
| | | download: ['admin', 'capitalFlow:download'] |
| | | download: ['admin', 'capitalFlow:download'], |
| | | generate: ['admin', 'capitalFlow:generate'] |
| | | }, |
| | | rules: { |
| | | flowYearMonth: [ |
| | |
| | | { key: 'companyId', display_name: '所属公司' } |
| | | ], |
| | | // 公司列表 |
| | | companyList: [] |
| | | companyList: [], |
| | | // 生成表单状态 |
| | | generateStatus: false, |
| | | // 生成表单加载 |
| | | generateLoading: false, |
| | | // 生成表单数据 |
| | | generateForm: { flowYearMonth: null, companyId: null }, |
| | | // 生成表单验证 |
| | | generateRules: { |
| | | flowYearMonth: [ |
| | | { required: true, message: '流水年月不能为空', trigger: 'change' } |
| | | ] |
| | | } |
| | | } |
| | | }, |
| | | methods: { |
| | |
| | | // 公司列表 |
| | | this.companyList = res |
| | | }) |
| | | }, |
| | | // 生成表单打开 |
| | | openGenerate() { |
| | | // 生成表单状态 |
| | | this.generateStatus = true |
| | | }, |
| | | // 生成表单提交 |
| | | submitGenerate() { |
| | | // 生成表单加载 |
| | | this.generateLoading = true |
| | | // 表单验证 |
| | | this.$refs['generateForm'].validate((valid) => { |
| | | if (valid) { |
| | | // 生成工资 |
| | | crudCapitalFlow.generate(this.generateForm).then(res => { |
| | | // 生成表单加载 |
| | | this.generateLoading = false |
| | | // 生成表单关闭 |
| | | this.closeGenerate() |
| | | // 搜索:刷新表格 |
| | | this.crud.toQuery() |
| | | // 消息提示 |
| | | this.crud.notify('生成成功', CRUD.NOTIFICATION_TYPE.SUCCESS) |
| | | }).catch(() => { |
| | | // 生成表单加载 |
| | | this.generateLoading = false |
| | | }) |
| | | } else { |
| | | // 生成表单加载 |
| | | this.generateLoading = false |
| | | } |
| | | }) |
| | | }, |
| | | // 生成表单关闭 |
| | | closeGenerate() { |
| | | // 生成表单状态 |
| | | this.generateStatus = false |
| | | // 生成表单数据 |
| | | this.generateForm = { flowYearMonth: null, userId: null } |
| | | // 清空表单 |
| | | this.$refs['generateForm'].clearValidate() |
| | | } |
| | | } |
| | | } |
| | |
| | | <el-form-item label="付款金额" prop="paymentAmount"> |
| | | <money-input :key="random" v-model="form.paymentAmount" :width="200" /> |
| | | </el-form-item> |
| | | <!--魏传栋 - 始--> |
| | | <el-form-item label="所属公司" prop="companyId"> |
| | | <el-select v-model="form.companyId" filterable clearable placeholder="请选择" style="width: 200px;"> |
| | | <el-option |
| | | v-for="item in companyList" |
| | | :key="item.id" |
| | | :label="item.label" |
| | | :value="item.id" |
| | | /> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="收支类型" prop="paymentType"> |
| | | <el-select v-model="form.paymentType" filterable clearable placeholder="请选择" style="width: 200px;"> |
| | | <el-option |
| | | v-for="item in dict[paymentType]" |
| | | :key="item.id" |
| | | :label="item.label" |
| | | :value="item.value" |
| | | /> |
| | | </el-select> |
| | | </el-form-item> |
| | | <!--魏传栋 - 终--> |
| | | <span v-if="form.fundType == fundContract"> |
| | | <el-divider>合同费款项所属</el-divider> |
| | | <el-form-item label="所属内容" prop="fundBelong"> |
| | |
| | | {{ crud.toMoney(scope.row.paymentAmount) }} |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column :show-overflow-tooltip="true" prop="companyName" label="所属公司" /> |
| | | <el-table-column :show-overflow-tooltip="true" prop="paymentType" label="收支类型"> |
| | | <template slot-scope="scope"> |
| | | {{ dict.label[paymentType][scope.row.paymentType] }} |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column :show-overflow-tooltip="true" prop="fundBelong" label="款项所属"> |
| | | <template slot-scope="scope"> |
| | | <span v-if="scope.row.fundBelong != null"> |
| | |
| | | |
| | | <script> |
| | | import crudContractPayment from '@/api/contract/contractPayment' |
| | | import crudSysCompany from '@/api/system/sysCompany' |
| | | import CRUD, { presenter, header, form, crud } from '@crud/crud' |
| | | import rrOperation from '@crud/RR.operation' |
| | | import crudOperation from '@crud/CRUD.operation' |
| | |
| | | import crudContract from '@/api/contract/contract' |
| | | import crudContractInvoice from '@/api/contract/contractInvoice' |
| | | |
| | | const defaultForm = { paymentId: null, contractId: null, paymentTime: null, fundType: null, paymentAmount: null, fundBelong: null, fundBelongYear: null, fundBelongStart: null, fundBelongEnd: null, remarks: null, contractInvoiceIds: [], createBy: null, updateBy: null, createTime: null, updateTime: null } |
| | | const defaultForm = { paymentId: null, contractId: null, paymentTime: null, fundType: null, paymentAmount: null, fundBelong: null, fundBelongYear: null, fundBelongStart: null, fundBelongEnd: null, remarks: null, contractInvoiceIds: [], createBy: null, updateBy: null, createTime: null, updateTime: null, companyId: null, paymentType: null } |
| | | export default { |
| | | name: 'ContractPayment', |
| | | components: { pagination, crudOperation, rrOperation, udOperation, moneyInput }, |
| | | mixins: [presenter(), header(), form(defaultForm), crud()], |
| | | dicts: [constant.FUND_TYPE], |
| | | dicts: [constant.FUND_TYPE, constant.CONTRACR_TYPE_COST], |
| | | cruds() { |
| | | return CRUD({ title: '合同付款', url: 'api/contractPayment', idField: 'paymentId', sort: 'paymentId,desc', crudMethod: { ...crudContractPayment }}) |
| | | }, |
| | |
| | | ], |
| | | fundBelongEnd: [ |
| | | { required: true, message: '请选择款项结束日期', trigger: 'change' } |
| | | ], |
| | | companyId: [ |
| | | { required: true, message: '请选择所属公司', trigger: 'change' } |
| | | ], |
| | | paymentType: [ |
| | | { required: true, message: '请选择收支类型', trigger: 'change' } |
| | | ] |
| | | }, |
| | | queryTypeOptions: [ |
| | |
| | | // 发票数据 |
| | | contractInvoiceList: [], |
| | | // 当前合同信息 |
| | | currentContract: {} |
| | | currentContract: {}, |
| | | // 公司 |
| | | companyList: [], |
| | | // 字典:收支类型 |
| | | paymentType: constant.CONTRACR_TYPE_COST |
| | | } |
| | | }, |
| | | methods: { |
| | |
| | | if (this.$route.query.contractId != null && this.crud.query.contractId === undefined) { |
| | | this.$set(this.crud.query, 'contractId', Number(this.$route.query.contractId)) |
| | | } |
| | | // 获取公司数据 |
| | | crudSysCompany.getAll().then(res => { |
| | | this.companyList = res |
| | | }) |
| | | return true |
| | | }, |
| | | // 获取合同数据 |