Merge branch 'master' of http://192.168.1.110:5678/r/pms-upgrade into weicd
10 files added
32 files modified
| | |
| | | @ApiModelProperty(value = "合同状态") |
| | | private String contractStatus; |
| | | |
| | | @Column(name = "`project_id`") |
| | | @ApiModelProperty(value = "项目ID") |
| | | private Long projectId; |
| | | |
| | | @Column(name = "`remarks`") |
| | | @ApiModelProperty(value = "备注信息") |
| | | private String remarks; |
| 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.contract.domain; |
| | | |
| | | import lombok.Data; |
| | | import cn.hutool.core.bean.BeanUtil; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import cn.hutool.core.bean.copier.CopyOptions; |
| | | import me.zhengjie.base.BaseEntity; |
| | | |
| | | import javax.persistence.*; |
| | | import javax.validation.constraints.*; |
| | | import java.sql.Timestamp; |
| | | import java.math.BigDecimal; |
| | | import java.io.Serializable; |
| | | |
| | | /** |
| | | * @website https://eladmin.vip |
| | | * @description / |
| | | * @author 赵士淞 |
| | | * @date 2023-02-10 |
| | | **/ |
| | | @Entity |
| | | @Data |
| | | @Table(name="contract_project") |
| | | public class ContractProject extends BaseEntity implements Serializable { |
| | | |
| | | @Id |
| | | @GeneratedValue(strategy = GenerationType.IDENTITY) |
| | | @Column(name = "`id`") |
| | | @ApiModelProperty(value = "ID") |
| | | private Long id; |
| | | |
| | | @Column(name = "`contract_id`",nullable = false) |
| | | @NotNull |
| | | @ApiModelProperty(value = "所属合同") |
| | | private Long contractId; |
| | | |
| | | @Column(name = "`project_id`",nullable = false) |
| | | @NotNull |
| | | @ApiModelProperty(value = "所属项目") |
| | | private Long projectId; |
| | | |
| | | @Column(name = "`fund_type`",nullable = false) |
| | | @NotNull |
| | | @ApiModelProperty(value = "款项类型") |
| | | private String fundType; |
| | | |
| | | @Column(name = "`allocated_amount`",nullable = false) |
| | | @NotNull |
| | | @ApiModelProperty(value = "分配金额") |
| | | private BigDecimal allocatedAmount; |
| | | |
| | | @Column(name = "`remarks`") |
| | | @ApiModelProperty(value = "备注信息") |
| | | private String remarks; |
| | | |
| | | public void copy(ContractProject source){ |
| | | BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true)); |
| | | } |
| | | } |
| | |
| | | */ |
| | | @Query(value = "SELECT SUM(after_tax_amount) AS totalAmount FROM contract_invoice WHERE contract_id = ?1",nativeQuery = true) |
| | | BigDecimal countTotalAmountByContractId(Long contractId); |
| | | |
| | | /** |
| | | * 根据合同ID删除 |
| | | * @param contractId |
| | | */ |
| | | void deleteByContractId(Long contractId); |
| | | } |
| | |
| | | */ |
| | | @Query(value = "SELECT SUM(payment_amount) AS totalAmount FROM contract_payment WHERE contract_id = ?1",nativeQuery = true) |
| | | BigDecimal countTotalAmountByContractId(Long contractId); |
| | | |
| | | /** |
| | | * 根据合同ID删除 |
| | | * @param contractId |
| | | */ |
| | | void deleteByContractId(Long contractId); |
| | | } |
| 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.contract.repository; |
| | | |
| | | import me.zhengjie.modules.contract.domain.ContractProject; |
| | | import org.springframework.data.jpa.repository.JpaRepository; |
| | | import org.springframework.data.jpa.repository.JpaSpecificationExecutor; |
| | | import org.springframework.data.jpa.repository.Query; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @website https://eladmin.vip |
| | | * @author 赵士淞 |
| | | * @date 2023-02-10 |
| | | **/ |
| | | public interface ContractProjectRepository extends JpaRepository<ContractProject, Long>, JpaSpecificationExecutor<ContractProject> { |
| | | |
| | | /** |
| | | * 根据项目ID删除 |
| | | * @param projectId |
| | | */ |
| | | void deleteByProjectId(Long projectId); |
| | | |
| | | /** |
| | | * 根据合同ID删除 |
| | | * @param contractId |
| | | */ |
| | | void deleteByContractId(Long contractId); |
| | | |
| | | /** |
| | | * 根据合同ID、款项类型查询合同项目数量 |
| | | * @param contractId |
| | | * @param fundType |
| | | * @return |
| | | */ |
| | | @Query(value = "SELECT COUNT(*) FROM contract_project WHERE contract_id = ?1 AND fund_type = ?2",nativeQuery = true) |
| | | Integer countByContractIdAndFundType(Long contractId, String fundType); |
| | | |
| | | /** |
| | | * 根据合同ID、款项类型查询合同项目金额 |
| | | * @param contractId |
| | | * @param fundType |
| | | * @return |
| | | */ |
| | | @Query(value = "SELECT COALESCE(SUM(allocated_amount), 0) FROM contract_project WHERE contract_id = ?1 AND fund_type = ?2",nativeQuery = true) |
| | | BigDecimal sumAllocatedAmountByContractIdAndFundType(Long contractId, String fundType); |
| | | |
| | | /** |
| | | * 根据合同ID、项目ID、款项类型查询 |
| | | * @param contractId |
| | | * @param projectId |
| | | * @param fundType |
| | | * @return |
| | | */ |
| | | List<ContractProject> findByContractIdAndProjectIdAndFundType(Long contractId, Long projectId, String fundType); |
| | | } |
| 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.contract.rest; |
| | | |
| | | import me.zhengjie.annotation.Log; |
| | | import me.zhengjie.modules.contract.domain.ContractProject; |
| | | import me.zhengjie.modules.contract.service.ContractProjectService; |
| | | import me.zhengjie.modules.contract.service.dto.ContractProjectQueryCriteria; |
| | | import org.springframework.data.domain.Pageable; |
| | | import lombok.RequiredArgsConstructor; |
| | | import org.springframework.http.HttpStatus; |
| | | import org.springframework.http.ResponseEntity; |
| | | import org.springframework.security.access.prepost.PreAuthorize; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import io.swagger.annotations.*; |
| | | import java.io.IOException; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | |
| | | /** |
| | | * @website https://eladmin.vip |
| | | * @author 赵士淞 |
| | | * @date 2023-02-10 |
| | | **/ |
| | | @RestController |
| | | @RequiredArgsConstructor |
| | | @Api(tags = "合同项目关联管理") |
| | | @RequestMapping("/api/contractProject") |
| | | public class ContractProjectController { |
| | | |
| | | private final ContractProjectService contractProjectService; |
| | | |
| | | @Log("导出数据") |
| | | @ApiOperation("导出数据") |
| | | @GetMapping(value = "/download") |
| | | @PreAuthorize("@el.check('contractProject:download')") |
| | | public void exportContractProject(HttpServletResponse response, ContractProjectQueryCriteria criteria) throws IOException { |
| | | contractProjectService.download(contractProjectService.queryAll(criteria), response); |
| | | } |
| | | |
| | | @GetMapping |
| | | @Log("查询合同项目关联") |
| | | @ApiOperation("查询合同项目关联") |
| | | @PreAuthorize("@el.check('contractProject:list')") |
| | | public ResponseEntity<Object> queryContractProject(ContractProjectQueryCriteria criteria, Pageable pageable){ |
| | | return new ResponseEntity<>(contractProjectService.queryAll(criteria,pageable),HttpStatus.OK); |
| | | } |
| | | |
| | | @GetMapping(value = "/all") |
| | | @Log("查询合同项目关联") |
| | | @ApiOperation("查询合同项目关联") |
| | | @PreAuthorize("@el.check('contractProject:list')") |
| | | public ResponseEntity<Object> queryContractProject(ContractProjectQueryCriteria criteria){ |
| | | return new ResponseEntity<>(contractProjectService.queryAll(criteria),HttpStatus.OK); |
| | | } |
| | | |
| | | @PostMapping |
| | | @Log("新增合同项目关联") |
| | | @ApiOperation("新增合同项目关联") |
| | | @PreAuthorize("@el.check('contractProject:add')") |
| | | public ResponseEntity<Object> createContractProject(@Validated @RequestBody ContractProject resources){ |
| | | return new ResponseEntity<>(contractProjectService.create(resources),HttpStatus.CREATED); |
| | | } |
| | | |
| | | @PutMapping |
| | | @Log("修改合同项目关联") |
| | | @ApiOperation("修改合同项目关联") |
| | | @PreAuthorize("@el.check('contractProject:edit')") |
| | | public ResponseEntity<Object> updateContractProject(@Validated @RequestBody ContractProject resources){ |
| | | contractProjectService.update(resources); |
| | | return new ResponseEntity<>(HttpStatus.NO_CONTENT); |
| | | } |
| | | |
| | | @DeleteMapping |
| | | @Log("删除合同项目关联") |
| | | @ApiOperation("删除合同项目关联") |
| | | @PreAuthorize("@el.check('contractProject:del')") |
| | | public ResponseEntity<Object> deleteContractProject(@RequestBody Long[] ids) { |
| | | contractProjectService.deleteAll(ids); |
| | | return new ResponseEntity<>(HttpStatus.OK); |
| | | } |
| | | } |
| 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.contract.service; |
| | | |
| | | import me.zhengjie.modules.contract.domain.ContractProject; |
| | | import me.zhengjie.modules.contract.service.dto.ContractProjectDto; |
| | | import me.zhengjie.modules.contract.service.dto.ContractProjectQueryCriteria; |
| | | import org.springframework.data.domain.Pageable; |
| | | import java.util.Map; |
| | | import java.util.List; |
| | | import java.io.IOException; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | |
| | | /** |
| | | * @website https://eladmin.vip |
| | | * @description 服务接口 |
| | | * @author 赵士淞 |
| | | * @date 2023-02-10 |
| | | **/ |
| | | public interface ContractProjectService { |
| | | |
| | | /** |
| | | * 查询数据分页 |
| | | * @param criteria 条件 |
| | | * @param pageable 分页参数 |
| | | * @return Map<String,Object> |
| | | */ |
| | | Map<String,Object> queryAll(ContractProjectQueryCriteria criteria, Pageable pageable); |
| | | |
| | | /** |
| | | * 查询所有数据不分页 |
| | | * @param criteria 条件参数 |
| | | * @return List<ContractProjectDto> |
| | | */ |
| | | List<ContractProjectDto> queryAll(ContractProjectQueryCriteria criteria); |
| | | |
| | | /** |
| | | * 根据ID查询 |
| | | * @param id ID |
| | | * @return ContractProjectDto |
| | | */ |
| | | ContractProjectDto findById(Long id); |
| | | |
| | | /** |
| | | * 创建 |
| | | * @param resources / |
| | | * @return ContractProjectDto |
| | | */ |
| | | ContractProjectDto create(ContractProject resources); |
| | | |
| | | /** |
| | | * 编辑 |
| | | * @param resources / |
| | | */ |
| | | void update(ContractProject resources); |
| | | |
| | | /** |
| | | * 多选删除 |
| | | * @param ids / |
| | | */ |
| | | void deleteAll(Long[] ids); |
| | | |
| | | /** |
| | | * 导出数据 |
| | | * @param all 待导出的数据 |
| | | * @param response / |
| | | * @throws IOException / |
| | | */ |
| | | void download(List<ContractProjectDto> all, HttpServletResponse response) throws IOException; |
| | | } |
| | |
| | | import java.sql.Timestamp; |
| | | import java.math.BigDecimal; |
| | | import java.io.Serializable; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @website https://eladmin.vip |
| | |
| | | /** 合同状态 */ |
| | | private String contractStatus; |
| | | |
| | | /** 项目ID */ |
| | | private Long projectId; |
| | | |
| | | /** 备注信息 */ |
| | | private String remarks; |
| | | |
| | |
| | | /** 乙方姓名 */ |
| | | private String secondName; |
| | | |
| | | /** 项目名称 */ |
| | | private String projectName; |
| | | /** 合同费数量 */ |
| | | private Integer fundContractNum; |
| | | |
| | | /** 合同费金额 */ |
| | | private BigDecimal fundContractAmount; |
| | | |
| | | /** 服务费数量 */ |
| | | private Integer fundServiceNum; |
| | | |
| | | /** 服务费金额 */ |
| | | private BigDecimal fundServiceAmount; |
| | | } |
| 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.contract.service.dto; |
| | | |
| | | import lombok.Data; |
| | | import me.zhengjie.base.BaseDTO; |
| | | |
| | | import java.sql.Timestamp; |
| | | import java.math.BigDecimal; |
| | | import java.io.Serializable; |
| | | |
| | | /** |
| | | * @website https://eladmin.vip |
| | | * @description / |
| | | * @author 赵士淞 |
| | | * @date 2023-02-10 |
| | | **/ |
| | | @Data |
| | | public class ContractProjectDto extends BaseDTO implements Serializable { |
| | | |
| | | /** ID */ |
| | | private Long id; |
| | | |
| | | /** 所属合同 */ |
| | | private Long contractId; |
| | | |
| | | /** 所属项目 */ |
| | | private Long projectId; |
| | | |
| | | /** 款项类型 */ |
| | | private String fundType; |
| | | |
| | | /** 分配金额 */ |
| | | private BigDecimal allocatedAmount; |
| | | |
| | | /** 备注信息 */ |
| | | private String remarks; |
| | | |
| | | /** 合同名称 */ |
| | | private String contractName; |
| | | |
| | | /** 项目名称 */ |
| | | private String projectName; |
| | | } |
| 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.contract.service.dto; |
| | | |
| | | import lombok.Data; |
| | | import java.util.List; |
| | | import me.zhengjie.annotation.Query; |
| | | |
| | | /** |
| | | * @website https://eladmin.vip |
| | | * @author 赵士淞 |
| | | * @date 2023-02-10 |
| | | **/ |
| | | @Data |
| | | public class ContractProjectQueryCriteria{ |
| | | |
| | | /** 精确 */ |
| | | @Query |
| | | private Long contractId; |
| | | |
| | | /** 精确 */ |
| | | @Query |
| | | private Long projectId; |
| | | |
| | | /** 精确 */ |
| | | @Query |
| | | private String fundType; |
| | | } |
| | |
| | | /** 模糊 */ |
| | | @Query(type = Query.Type.INNER_LIKE) |
| | | private String contractAreaCode; |
| | | |
| | | /** 精确 */ |
| | | @Query |
| | | private Long projectId; |
| | | } |
| | |
| | | package me.zhengjie.modules.contract.service.impl; |
| | | |
| | | import me.zhengjie.modules.constant.Constant; |
| | | import me.zhengjie.modules.contract.domain.Contract; |
| | | import me.zhengjie.modules.contract.domain.ContractInvoice; |
| | | import me.zhengjie.modules.contract.domain.ContractInvoicePayment; |
| | | import me.zhengjie.modules.contract.repository.ContractInvoicePaymentRepository; |
| | |
| | | private final DictDetailRepository dictDetailRepository; |
| | | private final ContractInvoicePaymentRepository contractInvoicePaymentRepository; |
| | | private final ContractInvoicePaymentServiceImpl contractInvoicePaymentServiceImpl; |
| | | private final ContractServiceImpl contractServiceImpl; |
| | | private final ContractRepository contractRepository; |
| | | |
| | | @Override |
| | | public Map<String,Object> queryAll(ContractInvoiceQueryCriteria criteria, Pageable pageable){ |
| | |
| | | // DTO赋值 |
| | | contractInvoiceDto.setContractPaymentIds(contractPaymentIds); |
| | | // 查询合同数据 |
| | | ContractDto contractDto = contractServiceImpl.findById(t.getContractId()); |
| | | Contract contract = contractRepository.findById(t.getContractId()).orElseGet(Contract::new); |
| | | // DTO赋值 |
| | | contractInvoiceDto.setContractName(contractDto.getContractName()); |
| | | contractInvoiceDto.setContractName(contract.getContractName()); |
| | | // 返回处理好的DTO |
| | | return contractInvoiceDto; |
| | | } |
| | |
| | | public void download(List<ContractInvoiceDto> all, HttpServletResponse response) throws IOException { |
| | | List<Map<String, Object>> list = new ArrayList<>(); |
| | | for (ContractInvoiceDto contractInvoice : all) { |
| | | ContractDto contractDto = contractServiceImpl.findById(contractInvoice.getContractId()); |
| | | Contract contract = contractRepository.findById(contractInvoice.getContractId()).orElseGet(Contract::new); |
| | | String invoiceType = contractInvoice.getInvoiceType() != null ? dictDetailRepository.findByDictNameAndValue(Constant.INVOICE_TYPE, contractInvoice.getInvoiceType()).getLabel() : ""; |
| | | Map<String,Object> map = new LinkedHashMap<>(); |
| | | map.put("所属合同", contractDto.getContractName()); |
| | | map.put("所属合同", contract.getContractName()); |
| | | map.put("开票时间", contractInvoice.getBillingTime()); |
| | | map.put("发票类型", invoiceType); |
| | | map.put("税前金额", contractInvoice.getBeforeTaxAmount()); |
| | |
| | | // DTO赋值 |
| | | contractPaymentDto.setContractInvoiceIds(contractInvoiceIds); |
| | | // 查询合同数据 |
| | | ContractDto contractDto = contractServiceImpl.findById(t.getContractId()); |
| | | Contract contract = contractRepository.findById(t.getContractId()).orElseGet(Contract::new); |
| | | // DTO赋值 |
| | | contractPaymentDto.setContractName(contractDto.getContractName()); |
| | | contractPaymentDto.setContractName(contract.getContractName()); |
| | | // 返回处理好的DTO |
| | | return contractPaymentDto; |
| | | } |
| | |
| | | String fundBelongEnd = sdf.format(contractPayment.getFundBelongEnd()); |
| | | fundBelong = fundBelongStart.substring(0, 10) + " 至 " + fundBelongEnd.substring(0, 10) + " 服务费"; |
| | | } |
| | | ContractDto contractDto = contractServiceImpl.findById(contractPayment.getContractId()); |
| | | Contract contract = contractRepository.findById(contractPayment.getContractId()).orElseGet(Contract::new); |
| | | Map<String,Object> map = new LinkedHashMap<>(); |
| | | map.put("所属合同", contractDto.getContractName()); |
| | | map.put("所属合同", contract.getContractName()); |
| | | map.put("付款时间", contractPayment.getPaymentTime()); |
| | | map.put("款项类型", fundType); |
| | | map.put("付款金额", contractPayment.getPaymentAmount()); |
| 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.contract.service.impl; |
| | | |
| | | import me.zhengjie.exception.BadRequestException; |
| | | import me.zhengjie.modules.constant.Constant; |
| | | import me.zhengjie.modules.contract.domain.ContractProject; |
| | | import me.zhengjie.modules.contract.service.dto.ContractDto; |
| | | import me.zhengjie.modules.project.service.dto.ProjectDto; |
| | | import me.zhengjie.modules.project.service.impl.ProjectServiceImpl; |
| | | import me.zhengjie.modules.system.repository.DictDetailRepository; |
| | | import me.zhengjie.utils.ValidationUtil; |
| | | import me.zhengjie.utils.FileUtil; |
| | | import lombok.RequiredArgsConstructor; |
| | | import me.zhengjie.modules.contract.repository.ContractProjectRepository; |
| | | import me.zhengjie.modules.contract.service.ContractProjectService; |
| | | import me.zhengjie.modules.contract.service.dto.ContractProjectDto; |
| | | import me.zhengjie.modules.contract.service.dto.ContractProjectQueryCriteria; |
| | | import me.zhengjie.modules.contract.service.mapstruct.ContractProjectMapper; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.data.domain.Page; |
| | | import org.springframework.data.domain.Pageable; |
| | | import me.zhengjie.utils.PageUtil; |
| | | import me.zhengjie.utils.QueryHelp; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.io.IOException; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.util.ArrayList; |
| | | import java.util.LinkedHashMap; |
| | | import java.util.function.Function; |
| | | |
| | | /** |
| | | * @website https://eladmin.vip |
| | | * @description 服务实现 |
| | | * @author 赵士淞 |
| | | * @date 2023-02-10 |
| | | **/ |
| | | @Service |
| | | @RequiredArgsConstructor |
| | | public class ContractProjectServiceImpl implements ContractProjectService { |
| | | |
| | | private final ContractProjectRepository contractProjectRepository; |
| | | private final ContractProjectMapper contractProjectMapper; |
| | | private final ProjectServiceImpl projectServiceImpl; |
| | | private final ContractServiceImpl contractServiceImpl; |
| | | private final DictDetailRepository dictDetailRepository; |
| | | |
| | | @Override |
| | | public Map<String,Object> queryAll(ContractProjectQueryCriteria criteria, Pageable pageable){ |
| | | Page<ContractProject> page = contractProjectRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable); |
| | | // 将实体类转换为DTO(重写) |
| | | Function<ContractProject, ContractProjectDto> func = new Function<ContractProject, ContractProjectDto>(){ |
| | | @Override |
| | | public ContractProjectDto apply(ContractProject t) { |
| | | // 将实体类转换成DTO |
| | | ContractProjectDto contractProjectDto = contractProjectMapper.toDto(t); |
| | | // 根据项目ID查询项目 |
| | | ProjectDto projectDto = projectServiceImpl.findById(t.getProjectId()); |
| | | // 项目名称 |
| | | contractProjectDto.setProjectName(projectDto.getName()); |
| | | // 根据合同ID查询合同 |
| | | ContractDto contractDto = contractServiceImpl.findById(t.getContractId()); |
| | | // 合同名称 |
| | | contractProjectDto.setContractName(contractDto.getContractName()); |
| | | // 返回处理好的DTO |
| | | return contractProjectDto; |
| | | } |
| | | }; |
| | | return PageUtil.toPage(page.map(func)); |
| | | } |
| | | |
| | | @Override |
| | | public List<ContractProjectDto> queryAll(ContractProjectQueryCriteria criteria){ |
| | | return contractProjectMapper.toDto(contractProjectRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder))); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional |
| | | public ContractProjectDto findById(Long id) { |
| | | ContractProject contractProject = contractProjectRepository.findById(id).orElseGet(ContractProject::new); |
| | | ValidationUtil.isNull(contractProject.getId(),"ContractProject","id",id); |
| | | return contractProjectMapper.toDto(contractProject); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public ContractProjectDto create(ContractProject resources) { |
| | | // 新增修改校验 |
| | | createOrUpdateCheck(null, resources); |
| | | return contractProjectMapper.toDto(contractProjectRepository.save(resources)); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void update(ContractProject resources) { |
| | | ContractProject contractProject = contractProjectRepository.findById(resources.getId()).orElseGet(ContractProject::new); |
| | | ValidationUtil.isNull( contractProject.getId(),"ContractProject","id",resources.getId()); |
| | | // 新增修改校验 |
| | | createOrUpdateCheck(contractProject, resources); |
| | | contractProject.copy(resources); |
| | | contractProjectRepository.save(contractProject); |
| | | } |
| | | |
| | | @Override |
| | | public void deleteAll(Long[] ids) { |
| | | for (Long id : ids) { |
| | | contractProjectRepository.deleteById(id); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public void download(List<ContractProjectDto> all, HttpServletResponse response) throws IOException { |
| | | List<Map<String, Object>> list = new ArrayList<>(); |
| | | for (ContractProjectDto contractProject : all) { |
| | | ContractDto contractDto = contractServiceImpl.findById(contractProject.getContractId()); |
| | | ProjectDto projectDto = projectServiceImpl.findById(contractProject.getProjectId()); |
| | | String fundType = contractProject.getFundType() != null ? dictDetailRepository.findByDictNameAndValue(Constant.FUND_TYPE, contractProject.getFundType()).getLabel() : ""; |
| | | Map<String,Object> map = new LinkedHashMap<>(); |
| | | map.put("所属合同", contractDto.getContractName()); |
| | | map.put("所属项目", projectDto.getName()); |
| | | map.put("款项类型", fundType); |
| | | map.put("分配金额", contractProject.getAllocatedAmount()); |
| | | map.put("备注信息", contractProject.getRemarks()); |
| | | map.put("创建者", contractProject.getCreateBy()); |
| | | map.put("创建时间", contractProject.getCreateTime()); |
| | | list.add(map); |
| | | } |
| | | FileUtil.downloadExcel(list, response); |
| | | } |
| | | |
| | | /** |
| | | * 新增修改校验 |
| | | * @param oldContractProject |
| | | * @param newContractProject |
| | | */ |
| | | private void createOrUpdateCheck(ContractProject oldContractProject, ContractProject newContractProject) { |
| | | // 根据合同ID、项目ID、款项类型查询合同项目数据 |
| | | List<ContractProject> contractProjectList = contractProjectRepository.findByContractIdAndProjectIdAndFundType(newContractProject.getContractId(), newContractProject.getProjectId(), newContractProject.getFundType()); |
| | | // 判断合同项目数据是否为空 |
| | | if (contractProjectList.size() != 0 && contractProjectList.get(0).getId() != newContractProject.getId()) { |
| | | throw new BadRequestException("合同任务已存在,无法重复分配!"); |
| | | } |
| | | // 分配金额总和 |
| | | BigDecimal sumAllocatedAmount = contractProjectRepository.sumAllocatedAmountByContractIdAndFundType(newContractProject.getContractId(), newContractProject.getFundType()); |
| | | // 判断是新增还是修改 |
| | | if (oldContractProject == null) { |
| | | // 分配金额总和 |
| | | sumAllocatedAmount = sumAllocatedAmount.add(newContractProject.getAllocatedAmount()); |
| | | } else { |
| | | // 判断新旧合同项目付款类型是否一致 |
| | | if (oldContractProject.getFundType().equals(newContractProject.getFundType())) { |
| | | // 分配金额总和 |
| | | sumAllocatedAmount = sumAllocatedAmount.subtract(oldContractProject.getAllocatedAmount()).add(newContractProject.getAllocatedAmount()); |
| | | } else { |
| | | // 分配金额总和 |
| | | sumAllocatedAmount = sumAllocatedAmount.add(newContractProject.getAllocatedAmount()); |
| | | } |
| | | } |
| | | // 根据合同ID查询合同数据 |
| | | ContractDto contractDto = contractServiceImpl.findById(newContractProject.getContractId()); |
| | | // 判断合同项目款项类型 |
| | | if (Constant.FUND_CONTRACT.equals(newContractProject.getFundType())) { |
| | | // 判断分配金额是否超出合同金额 |
| | | if (contractDto.getContractAmount() == null || sumAllocatedAmount.compareTo(contractDto.getContractAmount()) == 1) { |
| | | throw new BadRequestException("合同分配总金额超出合同费金额!"); |
| | | } |
| | | } else if (Constant.FUND_SERVICE.equals(newContractProject.getFundType())) { |
| | | // 判断分配金额是否超出合同金额 |
| | | if (contractDto.getServiceAmount() == null || sumAllocatedAmount.compareTo(contractDto.getServiceAmount()) == 1) { |
| | | throw new BadRequestException("合同分配总金额超出服务费金额!"); |
| | | } |
| | | } |
| | | } |
| | | } |
| | |
| | | package me.zhengjie.modules.contract.service.impl; |
| | | |
| | | import me.zhengjie.modules.constant.Constant; |
| | | import me.zhengjie.modules.contract.domain.Contract; |
| | | import me.zhengjie.modules.contract.domain.ContractInvoice; |
| | | import me.zhengjie.modules.contract.domain.ContractInvoicePayment; |
| | | import me.zhengjie.modules.contract.domain.ContractPayment; |
| | | import me.zhengjie.modules.contract.repository.ContractInvoicePaymentRepository; |
| | | import me.zhengjie.modules.contract.repository.ContractInvoiceRepository; |
| | | import me.zhengjie.modules.contract.repository.ContractPaymentRepository; |
| | | import me.zhengjie.modules.contract.service.dto.ContractFirstDto; |
| | | import me.zhengjie.modules.contract.service.dto.ContractSecondDto; |
| | | import me.zhengjie.modules.contract.domain.*; |
| | | import me.zhengjie.modules.contract.repository.*; |
| | | import me.zhengjie.modules.contract.service.dto.*; |
| | | import me.zhengjie.modules.contract.service.mapstruct.ContractProjectMapper; |
| | | import me.zhengjie.modules.project.service.dto.ProjectDto; |
| | | import me.zhengjie.modules.project.service.impl.ProjectServiceImpl; |
| | | import me.zhengjie.modules.system.repository.DictDetailRepository; |
| | | import me.zhengjie.utils.ValidationUtil; |
| | | import me.zhengjie.utils.FileUtil; |
| | | import lombok.RequiredArgsConstructor; |
| | | import me.zhengjie.modules.contract.repository.ContractRepository; |
| | | import me.zhengjie.modules.contract.service.ContractService; |
| | | import me.zhengjie.modules.contract.service.dto.ContractDto; |
| | | import me.zhengjie.modules.contract.service.dto.ContractQueryCriteria; |
| | | import me.zhengjie.modules.contract.service.mapstruct.ContractMapper; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | |
| | | private final DictDetailRepository dictDetailRepository; |
| | | private final ContractFirstServiceImpl contractFirstServiceImpl; |
| | | private final ContractSecondServiceImpl contractSecondServiceImpl; |
| | | private final ProjectServiceImpl projectServiceImpl; |
| | | private final ContractProjectRepository contractProjectRepository; |
| | | |
| | | @Override |
| | | public Map<String,Object> queryAll(ContractQueryCriteria criteria, Pageable pageable){ |
| | |
| | | public ContractDto apply(Contract t) { |
| | | // 将实体类转换成DTO |
| | | ContractDto contractDto = contractMapper.toDto(t); |
| | | |
| | | // 合同款延期情况 |
| | | contractDto.setContractPostponement(contractPostponement(t)); |
| | | // 服务款延期情况 |
| | |
| | | contractDto.setFirstName(contractFirstName(t)); |
| | | // 乙方姓名 |
| | | contractDto.setSecondName(contractSecondName(t)); |
| | | // 项目名称 |
| | | contractDto.setProjectName(projectName(t)); |
| | | // 合同费数量 |
| | | contractDto.setFundContractNum(contractProjectNum(t, Constant.FUND_CONTRACT)); |
| | | // 合同费金额 |
| | | contractDto.setFundContractAmount(contractProjectAmount(t, Constant.FUND_CONTRACT)); |
| | | // 服务费数量 |
| | | contractDto.setFundServiceNum(contractProjectNum(t, Constant.FUND_SERVICE)); |
| | | // 服务费金额 |
| | | contractDto.setFundServiceAmount(contractProjectAmount(t, Constant.FUND_SERVICE)); |
| | | // 返回处理好的DTO |
| | | return contractDto; |
| | | } |
| | |
| | | contractDto.setFirstName(contractFirstName(contractList.get(i))); |
| | | // 乙方姓名 |
| | | contractDto.setSecondName(contractSecondName(contractList.get(i))); |
| | | // 项目名称 |
| | | contractDto.setProjectName(projectName(contractList.get(i))); |
| | | // 合同费数量 |
| | | contractDto.setFundContractNum(contractProjectNum(contractList.get(i), Constant.FUND_CONTRACT)); |
| | | // 合同费金额 |
| | | contractDto.setFundContractAmount(contractProjectAmount(contractList.get(i), Constant.FUND_CONTRACT)); |
| | | // 服务费数量 |
| | | contractDto.setFundServiceNum(contractProjectNum(contractList.get(i), Constant.FUND_SERVICE)); |
| | | // 服务费金额 |
| | | contractDto.setFundServiceAmount(contractProjectAmount(contractList.get(i), Constant.FUND_SERVICE)); |
| | | // DTO新增 |
| | | contractDtoList.add(contractDto); |
| | | } |
| | |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void deleteAll(Long[] ids) { |
| | | for (Long contractId : ids) { |
| | | contractRepository.deleteById(contractId); |
| | | contractInvoiceRepository.deleteByContractId(contractId); |
| | | contractPaymentRepository.deleteByContractId(contractId); |
| | | contractProjectRepository.deleteByContractId(contractId); |
| | | } |
| | | } |
| | | |
| | |
| | | for (ContractDto contract : all) { |
| | | String firstName = contractFirstName(contractMapper.toEntity(contract)); |
| | | String secondName = contractSecondName(contractMapper.toEntity(contract)); |
| | | String projectName = projectName(contractMapper.toEntity(contract)); |
| | | String contractType = contract.getContractType() != null ? dictDetailRepository.findByDictNameAndValue(Constant.CONTRACT_TYPE, contract.getContractType()).getLabel() : ""; |
| | | String contractPaymentState = contract.getContractPaymentState() != null ? dictDetailRepository.findByDictNameAndValue(Constant.PAYMENT_STATE, contract.getContractPaymentState()).getLabel() : ""; |
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
| | |
| | | map.put("合同初版文件", contract.getRelatedDocumentsFirst()); |
| | | map.put("合同终版文件", contract.getRelatedDocumentsFinal()); |
| | | map.put("合同状态", contractStatus); |
| | | map.put("项目名称", projectName); |
| | | map.put("备注信息", contract.getRemarks()); |
| | | map.put("创建者", contract.getCreateBy()); |
| | | map.put("创建日期", contract.getCreateTime()); |
| | |
| | | } |
| | | |
| | | /** |
| | | * 项目名称 |
| | | * 合同项目数量 |
| | | * @param resources |
| | | * @return |
| | | */ |
| | | public String projectName(Contract resources) { |
| | | // 判断项目ID是否为空 |
| | | if (resources.getProjectId() != null) { |
| | | // 查询项目数据 |
| | | ProjectDto projectDto = projectServiceImpl.findById(resources.getProjectId()); |
| | | return projectDto.getName(); |
| | | } else { |
| | | return null; |
| | | public Integer contractProjectNum(Contract resources, String fundType) { |
| | | // 查询合同项目数据 |
| | | return contractProjectRepository.countByContractIdAndFundType(resources.getContractId(), fundType); |
| | | } |
| | | |
| | | /** |
| | | * 合同项目金额 |
| | | * @param resources |
| | | * @return |
| | | */ |
| | | public BigDecimal contractProjectAmount(Contract resources, String fundType) { |
| | | // 查询合同项目数据 |
| | | return contractProjectRepository.sumAllocatedAmountByContractIdAndFundType(resources.getContractId(), fundType); |
| | | } |
| | | |
| | | /** |
| 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.contract.service.mapstruct; |
| | | |
| | | import me.zhengjie.base.BaseMapper; |
| | | import me.zhengjie.modules.contract.domain.ContractProject; |
| | | import me.zhengjie.modules.contract.service.dto.ContractProjectDto; |
| | | import org.mapstruct.Mapper; |
| | | import org.mapstruct.ReportingPolicy; |
| | | |
| | | /** |
| | | * @website https://eladmin.vip |
| | | * @author 赵士淞 |
| | | * @date 2023-02-10 |
| | | **/ |
| | | @Mapper(componentModel = "spring", unmappedTargetPolicy = ReportingPolicy.IGNORE) |
| | | public interface ContractProjectMapper extends BaseMapper<ContractProjectDto, ContractProject> { |
| | | |
| | | } |
| | |
| | | * @date 2023-01-13 |
| | | **/ |
| | | public interface CostRepository extends JpaRepository<Cost, Long>, JpaSpecificationExecutor<Cost> { |
| | | |
| | | /** |
| | | * 根据项目ID删除 |
| | | * @param projectId |
| | | */ |
| | | void deleteByProjectId(Long projectId); |
| | | } |
| | |
| | | */ |
| | | @Query(value = "SELECT DISTINCT(project_id) FROM project_cost WHERE user_id = ?1", nativeQuery = true) |
| | | List<Long> findProjectIdByUserId(Long userId); |
| | | |
| | | /** |
| | | * 根据项目ID删除 |
| | | * @param projectId |
| | | */ |
| | | void deleteByProjectId(Long projectId); |
| | | } |
| | |
| | | public interface ProjectPerformanceDetailRepository extends JpaRepository<ProjectPerformanceDetail, Long>, JpaSpecificationExecutor<ProjectPerformanceDetail> { |
| | | |
| | | Optional<ProjectPerformanceDetail> findByProjectIdAndUserIdAndYearMonthLessThan(Long projectId, Long key, Timestamp yearMonth); |
| | | |
| | | /** |
| | | * 根据项目ID删除 |
| | | * @param projectId |
| | | */ |
| | | void deleteByProjectId(Long projectId); |
| | | } |
| | |
| | | // 根据项目查询绩效表 |
| | | @Query(value = "SELECT * FROM `project_performance` WHERE project_id = ?", nativeQuery = true) |
| | | ProjectPerformance findByProjectId(Long id); |
| | | |
| | | /** |
| | | * 根据项目ID删除 |
| | | * @param projectId |
| | | */ |
| | | void deleteByProjectId(Long projectId); |
| | | } |
| | |
| | | |
| | | 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.sql.Timestamp; |
| | |
| | | |
| | | @Query(value = "SELECT distinct belong_week FROM project_progress WHERE belong_year = ?1", nativeQuery = true) |
| | | List<Integer> findAllBelongWeekByBelongYear(Integer year); |
| | | |
| | | /** |
| | | * 根据项目ID删除 |
| | | * @param projectId |
| | | */ |
| | | @Modifying |
| | | @Query(value = "DELETE FROM project_progress WHERE project_id = ?1", nativeQuery = true) |
| | | void deleteByProjectId(Long projectId); |
| | | } |
| | |
| | | |
| | | @Query(value = "SELECT MIN(plan_start_time) AS taskStartDate, MAX(plan_end_time) AS taskEndDate, COALESCE(SUM(plan_hours), 0) AS totalTaskTime FROM project_task WHERE project_id = ?1", nativeQuery = true) |
| | | ProjectTaskSummary findSummaryByProjectId(Long id); |
| | | |
| | | /** |
| | | * 根据项目ID删除 |
| | | * @param projectId |
| | | */ |
| | | void deleteByProjectId(Long projectId); |
| | | } |
| | |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | |
| | | import me.zhengjie.exception.BadRequestException; |
| | | import me.zhengjie.modules.contract.repository.ContractProjectRepository; |
| | | import me.zhengjie.modules.cost.repository.CostRepository; |
| | | import me.zhengjie.modules.project.repository.*; |
| | | import me.zhengjie.modules.project.service.ProjectCostService; |
| | | import me.zhengjie.modules.task.domain.TaskDailyInterface; |
| | | import me.zhengjie.modules.task.domain.TaskDaliy; |
| | | import me.zhengjie.modules.task.domain.TaskInterface; |
| | | import org.springframework.data.domain.Page; |
| | | import org.springframework.data.domain.Pageable; |
| | |
| | | import me.zhengjie.modules.project.domain.ProjectTask; |
| | | import me.zhengjie.modules.project.domain.ProjectTaskSummary; |
| | | import me.zhengjie.modules.project.domain.ProjectType; |
| | | import me.zhengjie.modules.project.repository.ProjectCostRepository; |
| | | import me.zhengjie.modules.project.repository.ProjectRepository; |
| | | import me.zhengjie.modules.project.repository.ProjectTaskRepository; |
| | | import me.zhengjie.modules.project.repository.ProjectTypeRepository; |
| | | import me.zhengjie.modules.project.service.ProjectService; |
| | | import me.zhengjie.modules.project.service.dto.ProjectDto; |
| | | import me.zhengjie.modules.project.service.dto.ProjectQueryCriteria; |
| | |
| | | private final TaskRepository taskRepository; |
| | | private final TaskDaliyRepository taskDaliyRepository; |
| | | private final ProjectCostService projectCostService; |
| | | private final ProjectProgressRepository projectProgressRepository; |
| | | private final ProjectPerformanceRepository projectPerformanceRepository; |
| | | private final ProjectPerformanceDetailRepository projectPerformanceDetailRepository; |
| | | private final CostRepository costRepository; |
| | | private final ContractProjectRepository contractProjectRepository; |
| | | |
| | | @Override |
| | | public Map<String,Object> queryAll(ProjectQueryCriteria criteria, Pageable pageable) { |
| | |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void deleteAll(Long[] ids) { |
| | | for (Long id : ids) { |
| | | // 根据项目ID查询任务日报 |
| | | List<TaskDaliy> taskDaliyList = taskDaliyRepository.findByProjectId(id); |
| | | // 判断任务日报数量 |
| | | if (taskDaliyList.size() == 0) { |
| | | projectRepository.deleteById(id); |
| | | projectTaskRepository.deleteByProjectId(id); |
| | | projectCostRepository.deleteByProjectId(id); |
| | | projectProgressRepository.deleteByProjectId(id); |
| | | projectPerformanceRepository.deleteByProjectId(id); |
| | | projectPerformanceDetailRepository.deleteByProjectId(id); |
| | | costRepository.deleteByProjectId(id); |
| | | taskRepository.deleteByProjectId(id); |
| | | taskUserRepository.deleteByProjectId(id); |
| | | taskDaliyRepository.deleteByProjectId(id); |
| | | contractProjectRepository.deleteByProjectId(id); |
| | | } else { |
| | | throw new BadRequestException("存在任务日报的项目无法删除!"); |
| | | } |
| | | } |
| | | } |
| | | |
| | |
| | | |
| | | private Long levelId; |
| | | |
| | | private String levelName; |
| | | |
| | | private String gender; |
| | | |
| | | private String avatarName; |
| | |
| | | |
| | | @Override |
| | | public List<UserDto> queryAll(UserQueryCriteria criteria) { |
| | | // 日历类 |
| | | Calendar calendar = Calendar.getInstance(); |
| | | // 日期格式化 |
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); |
| | | // 日历字符串 |
| | | String calendarStr = sdf.format(calendar.getTime()); |
| | | // 查询用户数据 |
| | | List<User> users = userRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root, criteria, criteriaBuilder)); |
| | | return userMapper.toDto(users); |
| | | List<UserDto> usersDto = userMapper.toDto(users); |
| | | // 循环用户 |
| | | for (int i= 0; i < usersDto.size(); i ++) { |
| | | // 根据用户ID、指定年月查询用户级别工资 |
| | | SysUserLevelWage sysUserLevelWage = sysUserLevelWageRepository.findTargetYearMonth(usersDto.get(i).getId(), calendarStr); |
| | | // 判断用户级别工资是否为空 |
| | | if (sysUserLevelWage != null) { |
| | | // 根据ID查询用户级别 |
| | | SysLevel sysLevel = sysLevelRepository.findById(sysUserLevelWage.getLevelId()).orElseGet(SysLevel::new); |
| | | // 用户 |
| | | usersDto.get(i).setLevelName(sysLevel.getName()); |
| | | } else { |
| | | // 用户 |
| | | usersDto.get(i).setLevelName(null); |
| | | } |
| | | } |
| | | return usersDto; |
| | | } |
| | | |
| | | @Override |
| | |
| | | /** |
| | | * 根据项目ID、任务ID查询 |
| | | * @param projectId |
| | | * @param taskId |
| | | * @return |
| | | */ |
| | | @Query(value = "SELECT user_id AS userId, COALESCE(SUM(consumed_hours), 0) AS consumedHours FROM task_daliy WHERE project_id = ?1 GROUP BY user_id", nativeQuery = true) |
| | |
| | | */ |
| | | @Query(value = "SELECT DISTINCT(project_id) FROM task_user WHERE user_id = ?1", nativeQuery = true) |
| | | List<Long> findProjectIdByUserId(Long userId); |
| | | |
| | | /** |
| | | * 根据项目ID删除 |
| | | * @param projectId |
| | | */ |
| | | void deleteByProjectId(Long projectId); |
| | | |
| | | /** |
| | | * 根据项目ID查询 |
| | | * @param projectId |
| | | * @return |
| | | */ |
| | | List<TaskDaliy> findByProjectId(Long projectId); |
| | | } |
| | |
| | | |
| | | @Query(value = "SELECT COALESCE(SUM(plan_hours), 0.0) AS planHours, COALESCE(sum(plan_workload), 0.0) as planWorkload FROM task WHERE project_id = ?1", nativeQuery = true) |
| | | TaskInterface collectByProjectId(Long projectId); |
| | | |
| | | /** |
| | | * 根据项目ID删除 |
| | | * @param projectId |
| | | */ |
| | | void deleteByProjectId(Long projectId); |
| | | } |
| | |
| | | * @return |
| | | */ |
| | | TaskUser findByTaskIdAndUserId(Long taskId, Long userId); |
| | | |
| | | /** |
| | | * 根据项目ID删除 |
| | | * @param projectId |
| | | */ |
| | | void deleteByProjectId(Long projectId); |
| | | } |
| | |
| | | taskUserService.deleteAll(ids); |
| | | return new ResponseEntity<>(HttpStatus.OK); |
| | | } |
| | | |
| | | @GetMapping(value = "/taskUserIds") |
| | | @Log("查询任务分配用户") |
| | | @ApiOperation("查询任务分配用户") |
| | | @PreAuthorize("@el.check('taskUser:list')") |
| | | public ResponseEntity<Object> queryTaskUserIds(TaskUserQueryCriteria criteria){ |
| | | return new ResponseEntity<>(taskUserService.queryTaskUserIds(criteria),HttpStatus.OK); |
| | | } |
| | | } |
| | |
| | | * @return TaskUserDto |
| | | */ |
| | | void divide(TaskUserDto resources); |
| | | |
| | | /** |
| | | * 查询任务分配用户 |
| | | * @param criteria |
| | | * @return |
| | | */ |
| | | List<Long> queryTaskUserIds(TaskUserQueryCriteria criteria); |
| | | } |
| | |
| | | taskUserRepository.save(taskUser); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public List<Long> queryTaskUserIds(TaskUserQueryCriteria criteria){ |
| | | return taskUserRepository.findUserIdByTaskId(criteria.getTaskId()); |
| | | } |
| | | } |
| | |
| | | "babel-plugin-transform-remove-console": "^6.9.4", |
| | | "chalk": "2.4.2", |
| | | "chokidar": "2.1.5", |
| | | "connect": "3.6.6", |
| | | "compression-webpack-plugin": "5.0.2", |
| | | "connect": "3.6.6", |
| | | "eslint": "5.15.3", |
| | | "eslint-plugin-vue": "5.2.2", |
| | | "html-webpack-plugin": "3.2.0", |
| | |
| | | "svg-sprite-loader": "4.1.3", |
| | | "svgo": "1.2.0", |
| | | "tasksfile": "^5.1.1", |
| | | "vue-template-compiler": "2.6.14" |
| | | "vue-template-compiler": "2.6.14", |
| | | "webpack": "^4.6.0" |
| | | }, |
| | | "engines": { |
| | | "node": ">=8.9", |
| New file |
| | |
| | | import request from '@/utils/request' |
| | | |
| | | export function getAll(params) { |
| | | return request({ |
| | | url: 'api/contractProject', |
| | | method: 'get', |
| | | params |
| | | }) |
| | | } |
| | | |
| | | export function add(data) { |
| | | return request({ |
| | | url: 'api/contractProject', |
| | | method: 'post', |
| | | data |
| | | }) |
| | | } |
| | | |
| | | export function del(ids) { |
| | | return request({ |
| | | url: 'api/contractProject/', |
| | | method: 'delete', |
| | | data: ids |
| | | }) |
| | | } |
| | | |
| | | export function edit(data) { |
| | | return request({ |
| | | url: 'api/contractProject', |
| | | method: 'put', |
| | | data |
| | | }) |
| | | } |
| | | |
| | | export default { getAll, add, edit, del } |
| | |
| | | }) |
| | | } |
| | | |
| | | export default { getAll, add, edit, del } |
| | | export function getTaskUserIds(params) { |
| | | return request({ |
| | | url: 'api/taskUser/taskUserIds', |
| | | method: 'get', |
| | | params |
| | | }) |
| | | } |
| | | |
| | | export default { getAll, add, edit, del, getTaskUserIds } |
| | |
| | | if (cents < 10) { cents = '0' + cents } |
| | | for (var i = 0; i < Math.floor((num.length - (1 + i)) / 3); i++) { num = num.substring(0, num.length - (4 * i + 3)) + ',' + num.substring(num.length - (4 * i + 3)) } |
| | | return (((sign) ? '' : '-') + num + '.' + cents) |
| | | }, |
| | | /** |
| | | * 最大两位小数格式 |
| | | * @param {Object} num |
| | | */ |
| | | toMaxTwoDecimalPlaces(num) { |
| | | const numList = num.toString().split('.') |
| | | num = numList.length > 1 ? numList[1].length > 1 ? num.toFixed(2) : num : num |
| | | return num |
| | | } |
| | | } |
| | | const crud = Object.assign({}, data) |
| | |
| | | :value="item.value" |
| | | /> |
| | | </el-select> |
| | | <el-select v-model="query.projectId" filterable clearable placeholder="所属项目" style="width: 185px;" class="filter-item" @keyup.enter.native="crud.toQuery"> |
| | | <el-option |
| | | v-for="item in projects" |
| | | :key="item.id" |
| | | :label="item.name" |
| | | :value="item.id" |
| | | /> |
| | | </el-select> |
| | | <date-range-picker v-model="query.signDate" clearable placeholder="签订日期" style="width: 185px;" class="date-item" @keyup.enter.native="crud.toQuery" /> |
| | | <rrOperation :crud="crud" /> |
| | | </div> |
| | | <!--如果想在工具栏加入更多按钮,可以使用插槽方式, slot = 'left' or 'right'--> |
| | | <crudOperation :permission="permission" /> |
| | | <crudOperation :permission="permission"> |
| | | <el-button |
| | | slot="right" |
| | | v-permission="permission.divide" |
| | | class="filter-item" |
| | | size="mini" |
| | | type="primary" |
| | | icon="el-icon-share" |
| | | :disabled="crud.selections.length !== 1" |
| | | @click="toDivide(crud.selections[0])" |
| | | > |
| | | 分配 |
| | | </el-button> |
| | | <el-button |
| | | slot="right" |
| | | v-permission="permission.seeDivide" |
| | | class="filter-item" |
| | | size="mini" |
| | | type="primary" |
| | | icon="el-icon-share" |
| | | :disabled="crud.selections.length !== 1" |
| | | style="margin-left: 4px !important;" |
| | | @click="toSeeDivide(crud.selections[0])" |
| | | > |
| | | 查看分配 |
| | | </el-button> |
| | | </crudOperation> |
| | | <el-row :gutter="40" style="color: red; font-weight: bolder;"> |
| | | <el-col :xs="12" :sm="12" :lg="6"> |
| | | 合同费总金额:{{ crud.toMoney(contractTotalMoney) }} |
| | |
| | | :key="item.id" |
| | | :label="item.label" |
| | | :value="item.value" |
| | | /> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="所属项目" prop="projectId"> |
| | | <el-select v-model="form.projectId" filterable clearable placeholder="请选择" style="width: 535px;"> |
| | | <el-option |
| | | v-for="item in projects" |
| | | :key="item.id" |
| | | :label="item.name" |
| | | :value="item.id" |
| | | /> |
| | | </el-select> |
| | | </el-form-item> |
| | |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column :show-overflow-tooltip="true" prop="contractContent" label="合同内容" width="100" /> |
| | | <el-table-column :show-overflow-tooltip="true" prop="projectName" label="所属项目" width="100" /> |
| | | <el-table-column label="合同费项目数据"> |
| | | <el-table-column :show-overflow-tooltip="true" prop="fundContractNum" label="分配项目数" width="100" /> |
| | | <el-table-column :show-overflow-tooltip="true" prop="fundContractAmount" label="分配总金额" width="100"> |
| | | <template slot-scope="scope"> |
| | | <span v-if="scope.row.fundContractAmount != null && scope.row.fundContractAmount != 0"> |
| | | {{ crud.toMoney(scope.row.fundContractAmount) }} |
| | | </span> |
| | | </template> |
| | | </el-table-column> |
| | | </el-table-column> |
| | | <el-table-column label="服务费项目数据"> |
| | | <el-table-column :show-overflow-tooltip="true" prop="fundServiceNum" label="分配项目数" width="100" /> |
| | | <el-table-column :show-overflow-tooltip="true" prop="fundServiceAmount" label="分配总金额" width="100"> |
| | | <template slot-scope="scope"> |
| | | <span v-if="scope.row.fundServiceAmount != null && scope.row.fundServiceAmount != 0"> |
| | | {{ crud.toMoney(scope.row.fundServiceAmount) }} |
| | | </span> |
| | | </template> |
| | | </el-table-column> |
| | | </el-table-column> |
| | | <el-table-column :show-overflow-tooltip="true" prop="remarks" label="备注信息" width="100" /> |
| | | <el-table-column fixed="right" :show-overflow-tooltip="true" prop="contractStatus" label="合同状态" width="100"> |
| | | <template slot-scope="scope"> |
| | | {{ dict.label[contractStatus][scope.row.contractStatus] }} |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column v-if="checkPer(['admin','contract:edit','contract:del'])" fixed="right" label="操作" width="150px" align="center"> |
| | | <el-table-column v-if="checkPer(['admin','contract:edit','contract:del','contract:divide'])" fixed="right" label="操作" width="180px" align="center"> |
| | | <template slot-scope="scope"> |
| | | <udOperation |
| | | :data="scope.row" |
| | | :permission="permission" |
| | | > |
| | | <el-button |
| | | slot="left" |
| | | v-permission="permission.divide" |
| | | size="mini" |
| | | type="primary" |
| | | icon="el-icon-share" |
| | | @click="toDivide(scope.row)" |
| | | /> |
| | | </udOperation> |
| | | </template> |
| | | </el-table-column> |
| | | </el-table> |
| | | <!--分页组件--> |
| | | <pagination /> |
| | | <!--表单组件(分配)--> |
| | | <el-dialog :close-on-click-modal="false" :before-close="divideClose" :visible.sync="divideStatus" title="项目分配" width="500px"> |
| | | <el-form ref="divideForm" :model="divideForm" :rules="divideRules" size="small" label-width="80px"> |
| | | <el-form-item label="所属合同" prop="contractName"> |
| | | {{ divideForm.contractName }} |
| | | </el-form-item> |
| | | <el-form-item label="所属项目" prop="projectId"> |
| | | <el-select v-model="divideForm.projectId" filterable clearable placeholder="请选择" style="width: 370px;"> |
| | | <el-option |
| | | v-for="item in projects" |
| | | :key="item.id" |
| | | :label="item.name" |
| | | :value="item.id" |
| | | /> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="款项类型" prop="fundType"> |
| | | <el-select v-model="divideForm.fundType" filterable placeholder="请选择" style="width: 370px;"> |
| | | <el-option |
| | | v-for="item in dict[fundType]" |
| | | :key="item.id" |
| | | :label="item.label" |
| | | :value="item.value" |
| | | /> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="分配金额" prop="allocatedAmount"> |
| | | <money-input :key="random" v-model="divideForm.allocatedAmount" :width="370" /> |
| | | </el-form-item> |
| | | </el-form> |
| | | <div slot="footer" class="dialog-footer"> |
| | | <el-button type="text" @click="divideClose">取消</el-button> |
| | | <el-button :loading="divideLoading" type="primary" @click="divideSubmit">确认</el-button> |
| | | </div> |
| | | </el-dialog> |
| | | </div> |
| | | </div> |
| | | </template> |
| | |
| | | import crudContractFirst from '@/api/contract/contractFirst' |
| | | import crudContractSecond from '@/api/contract/contractSecond' |
| | | import crudProject from '@/api/project/project' |
| | | import crudContractProject from '@/api/contract/contractProject' |
| | | import { regionData, CodeToText } from 'element-china-area-data' |
| | | import moneyInput from '../../assembly/moneyInput/index.vue' |
| | | import fileUpload from '../../assembly/fileUpload/index.vue' |
| | |
| | | import { contractTotalMoney, contractDelayTotalAmount, contractDelayTotalMoney, advancePaymentTotalMoney } from '@/api/contract/contract' |
| | | import { serviceTotalMoney, serviceDelayTotalAmount, serviceDelayTotalMoney, receivePaymentTotalMoney } from '@/api/contract/contract' |
| | | |
| | | const defaultForm = { contractId: null, contractNumber: null, contractName: null, firstId: null, secondId: null, signDate: null, startDate: null, endDate: null, contractAreaCode: null, contractArea: null, contractType: null, contractContent: null, contractAmount: null, contractPaymentDate: null, contractPaymentState: null, serviceStartsDate: null, serviceAmount: null, servicePaymentDate: null, servicePaymentState: null, relatedDocumentsFirst: null, relatedDocumentsFinal: null, contractStatus: null, projectId: null, remarks: null, createBy: null, updateBy: null, createTime: null, updateTime: null } |
| | | const defaultForm = { contractId: null, contractNumber: null, contractName: null, firstId: null, secondId: null, signDate: null, startDate: null, endDate: null, contractAreaCode: null, contractArea: null, contractType: null, contractContent: null, contractAmount: null, contractPaymentDate: null, contractPaymentState: null, serviceStartsDate: null, serviceAmount: null, servicePaymentDate: null, servicePaymentState: null, relatedDocumentsFirst: null, relatedDocumentsFinal: null, contractStatus: null, remarks: null, createBy: null, updateBy: null, createTime: null, updateTime: null } |
| | | export default { |
| | | name: 'InServiceContract', |
| | | components: { pagination, crudOperation, rrOperation, udOperation, moneyInput, fileUpload, DateRangePicker }, |
| | | mixins: [presenter(), header(), form(defaultForm), crud()], |
| | | dicts: [constant.CONTRACT_TYPE, constant.PAYMENT_STATE, constant.CONTRACT_STATUS], |
| | | dicts: [constant.CONTRACT_TYPE, constant.PAYMENT_STATE, constant.CONTRACT_STATUS, constant.FUND_TYPE], |
| | | cruds() { |
| | | return CRUD({ title: '合同详情', url: 'api/contract', idField: 'contractId', sort: 'contractId,desc', crudMethod: { ...crudContract }}) |
| | | }, |
| | |
| | | callback(new Error('服务费金额不能为空')) |
| | | } |
| | | } |
| | | // 分配金额校验规则 |
| | | var validateAllocatedAmount = (rule, value, callback) => { |
| | | if (value !== null) { |
| | | if (isNaN(Number(value))) { |
| | | callback(new Error('请输入数字值')) |
| | | } else { |
| | | if (value < 0 || value > 1000000000) { |
| | | callback(new Error('分配金额不能超过10亿')) |
| | | } else { |
| | | callback() |
| | | } |
| | | } |
| | | } else { |
| | | callback(new Error('分配金额不能为空')) |
| | | } |
| | | } |
| | | return { |
| | | permission: { |
| | | add: ['admin', 'contract:add'], |
| | | edit: ['admin', 'contract:edit'], |
| | | del: ['admin', 'contract:del'], |
| | | download: ['admin', 'contract:download'] |
| | | download: ['admin', 'contract:download'], |
| | | divide: ['admin', 'contract:divide'], |
| | | seeDivide: ['admin', 'contract:seeDivide'] |
| | | }, |
| | | rules: { |
| | | contractName: [ |
| | |
| | | paymentState: constant.PAYMENT_STATE, |
| | | // 字典:合同状态 |
| | | contractStatus: constant.CONTRACT_STATUS, |
| | | // 字典:款项类型 |
| | | fundType: constant.FUND_TYPE, |
| | | // 甲方数据 |
| | | customerFirst: [], |
| | | // 乙方数据 |
| | | customerSecond: [], |
| | | // 项目数据 |
| | | // 项目列表 |
| | | projects: [], |
| | | // 所属地区数据 |
| | | areaOptions: regionData, |
| | |
| | | // 运维服务延期金额 |
| | | serviceDelayTotalMoney: 0, |
| | | // 应收款总金额 |
| | | receivePaymentTotalMoney: 0 |
| | | receivePaymentTotalMoney: 0, |
| | | // 分配表单状态 |
| | | divideStatus: false, |
| | | // 分配表单加载 |
| | | divideLoading: false, |
| | | // 分配表单数据 |
| | | divideForm: { contractId: null, contractName: null, projectId: null, fundType: null, allocatedAmount: null }, |
| | | // 分配表单验证 |
| | | divideRules: { |
| | | projectId: [ |
| | | { required: true, message: '所属项目不能为空', trigger: 'change' } |
| | | ], |
| | | fundType: [ |
| | | { required: true, message: '款项类型不能为空', trigger: 'change' } |
| | | ], |
| | | allocatedAmount: [ |
| | | { required: true, validator: validateAllocatedAmount, trigger: 'blur' } |
| | | ] |
| | | } |
| | | } |
| | | }, |
| | | watch: { |
| | |
| | | this.getCustomerFirst() |
| | | // 获取乙方数据 |
| | | this.getCustomerSecond() |
| | | // 获取项目数据 |
| | | this.getProject() |
| | | // 获取项目列表 |
| | | this.getProjects() |
| | | // 获取合同款总金额 |
| | | this.getContractTotalMoney() |
| | | // 获取合同款延期数 |
| | |
| | | that.customerSecond = res |
| | | }) |
| | | }, |
| | | // 获取项目数据 |
| | | getProject() { |
| | | const that = this |
| | | // 获取项目数据 |
| | | // 获取项目列表 |
| | | getProjects() { |
| | | // 获取项目列表 |
| | | crudProject.getAll().then(res => { |
| | | // 获取项目数据 |
| | | that.projects = res |
| | | // 项目列表 |
| | | this.projects = res |
| | | }) |
| | | }, |
| | | // 地区选择触发 |
| | |
| | | // 应收款总金额 |
| | | this.receivePaymentTotalMoney = res |
| | | }) |
| | | }, |
| | | // 任务分配 |
| | | toDivide(data) { |
| | | // 分配表单数据 |
| | | this.divideForm.contractId = data.contractId |
| | | this.divideForm.contractName = data.contractName |
| | | // 分配表单状态 |
| | | this.divideStatus = true |
| | | }, |
| | | // 查看分配 |
| | | toSeeDivide(data) { |
| | | // 跳转页面 |
| | | this.$router.push({ |
| | | name: 'ContractProject', |
| | | params: { |
| | | contractId: data.contractId |
| | | } |
| | | }) |
| | | }, |
| | | // 分配表单关闭 |
| | | divideClose() { |
| | | // 分配表单状态 |
| | | this.divideStatus = false |
| | | // 分配表单加载 |
| | | this.divideLoading = false |
| | | // 随机数 |
| | | this.random = Math.random() |
| | | // 分配表单数据 |
| | | this.divideForm = { contractId: null, contractName: null, projectId: null, fundType: null, allocatedAmount: null } |
| | | // 清除表单验证 |
| | | this.$nextTick(() => { |
| | | this.$refs['divideForm'].clearValidate() |
| | | }) |
| | | }, |
| | | // 分配表单提交 |
| | | divideSubmit() { |
| | | // 分配表单加载 |
| | | this.divideLoading = true |
| | | // 表单验证 |
| | | this.$refs['divideForm'].validate((valid) => { |
| | | if (valid) { |
| | | // 分配项目 |
| | | crudContractProject.add(this.divideForm).then(res => { |
| | | // 分配表单关闭 |
| | | this.divideClose() |
| | | // 消息提示 |
| | | this.crud.notify('项目分配成功', CRUD.NOTIFICATION_TYPE.SUCCESS) |
| | | // 刷新页面 |
| | | this.crud.refresh() |
| | | }).catch(() => { |
| | | // 分配表单加载 |
| | | this.divideLoading = false |
| | | return false |
| | | }) |
| | | } else { |
| | | // 分配表单加载 |
| | | this.divideLoading = false |
| | | return false |
| | | } |
| | | }) |
| | | } |
| | | } |
| | | } |
| New file |
| | |
| | | <template> |
| | | <div class="app-container"> |
| | | <!--工具栏--> |
| | | <div class="head-container"> |
| | | <div v-if="crud.props.searchToggle"> |
| | | <!-- 搜索 --> |
| | | <el-select v-model="query.contractId" filterable clearable placeholder="所属合同" style="width: 185px;" class="filter-item" @keyup.enter.native="crud.toQuery"> |
| | | <el-option |
| | | v-for="item in contracts" |
| | | :key="item.contractId" |
| | | :label="item.contractName" |
| | | :value="item.contractId" |
| | | /> |
| | | </el-select> |
| | | <el-select v-model="query.projectId" filterable clearable placeholder="所属项目" style="width: 185px;" class="filter-item" @keyup.enter.native="crud.toQuery"> |
| | | <el-option |
| | | v-for="item in projects" |
| | | :key="item.id" |
| | | :label="item.name" |
| | | :value="item.id" |
| | | /> |
| | | </el-select> |
| | | <el-select v-model="query.fundType" filterable clearable placeholder="款项类型" style="width: 185px;" class="filter-item" @keyup.enter.native="crud.toQuery"> |
| | | <el-option |
| | | v-for="item in dict[fundType]" |
| | | :key="item.id" |
| | | :label="item.label" |
| | | :value="item.value" |
| | | /> |
| | | </el-select> |
| | | <rrOperation :crud="crud" /> |
| | | </div> |
| | | <!--如果想在工具栏加入更多按钮,可以使用插槽方式, slot = 'left' or 'right'--> |
| | | <crudOperation :permission="permission" /> |
| | | <!--表单组件--> |
| | | <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 label="所属合同" prop="contractId"> |
| | | <el-select v-model="form.contractId" filterable clearable placeholder="请选择" style="width: 370px;"> |
| | | <el-option |
| | | v-for="item in contracts" |
| | | :key="item.contractId" |
| | | :label="item.contractName" |
| | | :value="item.contractId" |
| | | /> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="所属项目" prop="projectId"> |
| | | <el-select v-model="form.projectId" filterable clearable placeholder="请选择" style="width: 370px;"> |
| | | <el-option |
| | | v-for="item in projects" |
| | | :key="item.id" |
| | | :label="item.name" |
| | | :value="item.id" |
| | | /> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="款项类型" prop="fundType"> |
| | | <el-select v-model="form.fundType" filterable placeholder="请选择" style="width: 370px;"> |
| | | <el-option |
| | | v-for="item in dict[fundType]" |
| | | :key="item.id" |
| | | :label="item.label" |
| | | :value="item.value" |
| | | /> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="分配金额" prop="allocatedAmount"> |
| | | <money-input :key="random" v-model="form.allocatedAmount" :width="370" /> |
| | | </el-form-item> |
| | | <el-form-item label="备注信息"> |
| | | <el-input v-model="form.remarks" :rows="3" type="textarea" style="width: 370px;" /> |
| | | </el-form-item> |
| | | </el-form> |
| | | <div slot="footer" class="dialog-footer"> |
| | | <el-button type="text" @click="crud.cancelCU">取消</el-button> |
| | | <el-button :loading="crud.status.cu === 2" type="primary" @click="crud.submitCU">确认</el-button> |
| | | </div> |
| | | </el-dialog> |
| | | <!--表格渲染--> |
| | | <el-table ref="table" v-loading="crud.loading" :data="crud.data" size="small" style="width: 100%;" @selection-change="crud.selectionChangeHandler"> |
| | | <el-table-column type="selection" width="55" /> |
| | | <el-table-column :show-overflow-tooltip="true" prop="contractName" label="所属合同" /> |
| | | <el-table-column :show-overflow-tooltip="true" prop="projectName" label="所属项目" /> |
| | | <el-table-column :show-overflow-tooltip="true" prop="fundType" label="款项类型"> |
| | | <template slot-scope="scope"> |
| | | {{ dict.label[fundType][scope.row.fundType] }} |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column :show-overflow-tooltip="true" prop="allocatedAmount" label="分配金额"> |
| | | <template slot-scope="scope"> |
| | | {{ crud.toMoney(scope.row.allocatedAmount) }} |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column :show-overflow-tooltip="true" prop="remarks" label="备注信息" /> |
| | | <el-table-column :show-overflow-tooltip="true" prop="createTime" label="创建时间" /> |
| | | <el-table-column v-if="checkPer(['admin','contractProject:edit','contractProject:del'])" label="操作" width="150px" align="center"> |
| | | <template slot-scope="scope"> |
| | | <udOperation |
| | | :data="scope.row" |
| | | :permission="permission" |
| | | /> |
| | | </template> |
| | | </el-table-column> |
| | | </el-table> |
| | | <!--分页组件--> |
| | | <pagination /> |
| | | </div> |
| | | </div> |
| | | </template> |
| | | |
| | | <script> |
| | | import crudContractProject from '@/api/contract/contractProject' |
| | | import CRUD, { presenter, header, form, crud } from '@crud/crud' |
| | | import rrOperation from '@crud/RR.operation' |
| | | import crudOperation from '@crud/CRUD.operation' |
| | | import udOperation from '@crud/UD.operation' |
| | | import pagination from '@crud/Pagination' |
| | | import crudContract from '@/api/contract/contract' |
| | | import crudProject from '@/api/project/project' |
| | | import moneyInput from '../../assembly/moneyInput/index.vue' |
| | | import constant from '../../../utils/constant' |
| | | |
| | | const defaultForm = { id: null, contractId: null, projectId: null, fundType: null, allocatedAmount: null, remarks: null, createBy: null, updateBy: null, createTime: null, updateTime: null } |
| | | export default { |
| | | name: 'ContractProject', |
| | | components: { pagination, crudOperation, rrOperation, udOperation, moneyInput }, |
| | | mixins: [presenter(), header(), form(defaultForm), crud()], |
| | | dicts: [constant.FUND_TYPE], |
| | | cruds() { |
| | | return CRUD({ title: '合同项目关联', url: 'api/contractProject', idField: 'id', sort: 'id,desc', crudMethod: { ...crudContractProject }}) |
| | | }, |
| | | data() { |
| | | // 分配金额校验规则 |
| | | var validateAllocatedAmount = (rule, value, callback) => { |
| | | if (value !== null) { |
| | | if (isNaN(Number(value))) { |
| | | callback(new Error('请输入数字值')) |
| | | } else { |
| | | if (value < 0 || value > 1000000000) { |
| | | callback(new Error('分配金额不能超过10亿')) |
| | | } else { |
| | | callback() |
| | | } |
| | | } |
| | | } else { |
| | | callback(new Error('分配金额不能为空')) |
| | | } |
| | | } |
| | | return { |
| | | permission: { |
| | | add: ['admin', 'contractProject:add'], |
| | | edit: ['admin', 'contractProject:edit'], |
| | | del: ['admin', 'contractProject:del'], |
| | | download: ['admin', 'contractProject:download'] |
| | | }, |
| | | rules: { |
| | | contractId: [ |
| | | { required: true, message: '所属合同不能为空', trigger: 'change' } |
| | | ], |
| | | projectId: [ |
| | | { required: true, message: '所属项目不能为空', trigger: 'change' } |
| | | ], |
| | | fundType: [ |
| | | { required: true, message: '请选择款项类型', trigger: 'change' } |
| | | ], |
| | | allocatedAmount: [ |
| | | { required: true, validator: validateAllocatedAmount, trigger: 'blur' } |
| | | ] |
| | | }, |
| | | queryTypeOptions: [ |
| | | { key: 'contractId', display_name: '所属合同' }, |
| | | { key: 'projectId', display_name: '所属项目' }, |
| | | { key: 'fundType', display_name: '款项类型' } |
| | | ], |
| | | // 字典:款项类型 |
| | | fundType: constant.FUND_TYPE, |
| | | // 合同列表 |
| | | contracts: [], |
| | | // 项目列表 |
| | | projects: [], |
| | | // 随机数 |
| | | random: 0 |
| | | } |
| | | }, |
| | | methods: { |
| | | // 钩子:在获取表格数据之前执行,false 则代表不获取数据 |
| | | [CRUD.HOOK.beforeRefresh]() { |
| | | // 判断传参是否为空 |
| | | if (this.$route.params.contractId != null && this.$route.params.contractId !== '' && this.crud.query.contractId === undefined) { |
| | | // 检索条件赋值 |
| | | this.$set(this.crud.query, 'contractId', Number(this.$route.params.contractId)) |
| | | } |
| | | // 获取合同列表 |
| | | this.getContracts() |
| | | // 获取项目列表 |
| | | this.getProjects() |
| | | return true |
| | | }, |
| | | // 获取合同列表 |
| | | getContracts() { |
| | | // 获取合同列表 |
| | | crudContract.getAll().then(res => { |
| | | // 合同列表 |
| | | this.contracts = res |
| | | }) |
| | | }, |
| | | // 获取项目列表 |
| | | getProjects() { |
| | | // 获取项目列表 |
| | | crudProject.getAll().then(res => { |
| | | // 项目列表 |
| | | this.projects = res |
| | | }) |
| | | }, |
| | | // 钩子:开始 "新建/编辑" - 之前 |
| | | [CRUD.HOOK.beforeToCU]() { |
| | | // 随机数 |
| | | this.random = Math.random() |
| | | } |
| | | } |
| | | } |
| | | </script> |
| | | |
| | | <style scoped> |
| | | |
| | | </style> |
| | |
| | | data() { |
| | | // 指针重指向 |
| | | const _this = this |
| | | // 时长(千内)验证 |
| | | // 时长(万内)验证 |
| | | var durationValidate = (rule, value, callback) => { |
| | | const reg = /^([0-9]|[1-9]\d{1,2})(\.\d{1,2})?$|1000$/ |
| | | const reg = /^([0-9]|[1-9]\d{1,3})(\.\d{1,2})?$/ |
| | | if (value != null && value !== '' && !reg.test(value)) { |
| | | callback(new Error('请输入 一千 以内的正整数或两位小数')) |
| | | callback(new Error('请输入 一万 以内的正整数或两位小数')) |
| | | } else { |
| | | callback() |
| | | } |
| | |
| | | v-model="roleDatas" |
| | | style="width: 437px" |
| | | multiple |
| | | :multiple-limit="1" |
| | | placeholder="请选择" |
| | | @remove-tag="deleteTag" |
| | | @change="changeRole" |
| | |
| | | :key="item.id" |
| | | :label="item.name" |
| | | :value="item.id" |
| | | :disabled="item.approveStatus == approveStatusUnrecognized" |
| | | /> |
| | | </el-select> |
| | | </el-form-item> |
| | |
| | | <el-table-column :show-overflow-tooltip="true" prop="planEndTime" label="计划结束时间" width="140" /> |
| | | <el-table-column :show-overflow-tooltip="true" label="已完成 / 已分配 / 计划工时" width="160"> |
| | | <template slot-scope="scope"> |
| | | {{ scope.row.completedHours }} / {{ scope.row.divideHours }} / {{ scope.row.planHours }} |
| | | {{ crud.toMaxTwoDecimalPlaces(scope.row.completedHours) }} / {{ scope.row.divideHours }} / {{ scope.row.planHours }} |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column :show-overflow-tooltip="true" label="已完成 / 已分配 / 计划工作量" width="180"> |
| | | <template slot-scope="scope"> |
| | | <span> |
| | | {{ scope.row.completedWorkload }} / {{ scope.row.divideWorkload }} / {{ scope.row.planWorkload == null || scope.row.planWorkload == '' ? 0 : scope.row.planWorkload }} |
| | | {{ crud.toMaxTwoDecimalPlaces(scope.row.completedWorkload) }} / {{ scope.row.divideWorkload }} / {{ scope.row.planWorkload == null || scope.row.planWorkload == '' ? 0 : scope.row.planWorkload }} |
| | | </span> |
| | | </template> |
| | | </el-table-column> |
| | |
| | | <el-form-item label="任务名称" prop="taskName"> |
| | | {{ divideForm.taskName }} |
| | | </el-form-item> |
| | | <el-form-item label="分配用户" prop="userIds"> |
| | | <el-form-item label="分配员工" prop="userIds"> |
| | | <el-select v-model="divideForm.userIds" filterable clearable multiple placeholder="请选择" style="width: 340px;"> |
| | | <el-option |
| | | v-for="item in users" |
| | |
| | | :label="item.nickName" |
| | | :value="item.id" |
| | | :disabled="!item.enabled || divideForm.divideUserIds.includes(item.id)" |
| | | /> |
| | | > |
| | | <span style="float: left">{{ item.nickName }}</span> |
| | | <span style="float: right; color: #8492a6; font-size: 13px">{{ item.levelName }}</span> |
| | | </el-option> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="任务开始时间" prop="taskStartDate"> |
| | |
| | | data() { |
| | | // 指针重指向 |
| | | const _this = this |
| | | // 时长(千内)验证 |
| | | // 时长(万内)验证 |
| | | var durationValidate = (rule, value, callback) => { |
| | | const reg = /^([0-9]|[1-9]\d{1,2})(\.\d{1,2})?$|1000$/ |
| | | const reg = /^([0-9]|[1-9]\d{1,3})(\.\d{1,2})?$/ |
| | | if (value != null && value !== '' && !reg.test(value)) { |
| | | callback(new Error('请输入 一千 以内的正整数或两位小数')) |
| | | callback(new Error('请输入 一万 以内的正整数或两位小数')) |
| | | } else { |
| | | callback() |
| | | } |
| | |
| | | standardWorkloadUnit: constant.STANDARD_WORKLOAD_UNIT, |
| | | // 字典:任务状态 |
| | | taskStatus: constant.TASK_STATUS, |
| | | // 字典:批准状态-未承认 |
| | | approveStatusUnrecognized: constant.APPROVE_STATUS_UNRECOGNIZED, |
| | | // CRUD状态 |
| | | crudStatusPrepared: CRUD.STATUS.PREPARED, |
| | | // 项目列表 |
| | |
| | | // 分配表单加载 |
| | | divideLoading: false, |
| | | // 分配表单数据 |
| | | divideForm: { projectId: null, projectName: null, taskId: null, taskname: null, userIds: [], divideUserIds: [], taskStartDate: null, taskEndDate: null, taskHours: null, taskWorkload: null, taskStatus: null }, |
| | | divideForm: { projectId: null, projectName: null, taskId: null, taskName: null, userIds: [], divideUserIds: [], taskStartDate: null, taskEndDate: null, taskHours: null, taskWorkload: null, taskStatus: null }, |
| | | // 分配表单验证 |
| | | divideRules: { |
| | | userIds: [ |
| | | { required: true, message: '分配用户不能为空', trigger: 'change' } |
| | | { required: true, message: '分配员工不能为空', trigger: 'change' } |
| | | ], |
| | | taskStartDate: [ |
| | | { required: true, message: '任务开始时间不能为空', trigger: 'change' } |
| | |
| | | // 分配表单加载 |
| | | this.divideLoading = false |
| | | // 分配表单数据 |
| | | this.divideForm = { projectId: null, projectName: null, taskId: null, taskname: null, userIds: [], divideUserIds: [], taskStartDate: null, taskEndDate: null, taskHours: null, taskWorkload: null, taskStatus: null } |
| | | this.divideForm = { projectId: null, projectName: null, taskId: null, taskName: null, userIds: [], divideUserIds: [], taskStartDate: null, taskEndDate: null, taskHours: null, taskWorkload: null, taskStatus: null } |
| | | // 清除表单验证 |
| | | this.$nextTick(() => { |
| | | this.$refs['divideForm'].clearValidate() |
| | |
| | | return CRUD({ title: '任务日报', url: 'api/taskDaliy', idField: 'id', sort: 'fillDate,desc', crudMethod: { ...crudTaskDaliy }}) |
| | | }, |
| | | data() { |
| | | // 时长(千内)验证 |
| | | // 时长(万内)验证 |
| | | var durationValidate = (rule, value, callback) => { |
| | | const reg = /^([0-9]|[1-9]\d{1,2})(\.\d{1,2})?$|1000$/ |
| | | const reg = /^([0-9]|[1-9]\d{1,3})(\.\d{1,2})?$/ |
| | | if (value != null && value !== '' && !reg.test(value)) { |
| | | callback(new Error('请输入 一千 以内的正整数或两位小数')) |
| | | callback(new Error('请输入 一万 以内的正整数或两位小数')) |
| | | } else { |
| | | callback() |
| | | } |
| | |
| | | <div class="head-container"> |
| | | <div v-if="crud.props.searchToggle"> |
| | | <!-- 搜索 --> |
| | | <el-select v-model="query.userId" filterable clearable placeholder="所属员工" style="width: 185px;" class="filter-item" @keyup.enter.native="crud.toQuery"> |
| | | <el-option |
| | | v-for="item in users" |
| | | :key="item.id" |
| | | :label="item.nickName" |
| | | :value="item.id" |
| | | /> |
| | | </el-select> |
| | | <el-select v-model="query.projectId" filterable clearable placeholder="所属项目" style="width: 185px;" class="filter-item" @change="queryProjectChange" @keyup.enter.native="crud.toQuery"> |
| | | <el-option |
| | | v-for="item in projects" |
| | |
| | | v-for="item in queryTasks" |
| | | :key="item.id" |
| | | :label="item.name" |
| | | :value="item.id" |
| | | /> |
| | | </el-select> |
| | | <el-select v-model="query.userId" filterable clearable placeholder="所属员工" style="width: 185px;" class="filter-item" @keyup.enter.native="crud.toQuery"> |
| | | <el-option |
| | | v-for="item in users" |
| | | :key="item.id" |
| | | :label="item.nickName" |
| | | :value="item.id" |
| | | /> |
| | | </el-select> |
| | |
| | | <!--表单组件--> |
| | | <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="110px"> |
| | | <el-form-item label="所属员工" prop="userId"> |
| | | <el-select v-model="form.userId" filterable clearable placeholder="请选择" style="width: 340px;" :disabled="crud.status.edit == crudStatusPrepared || userRolesLevelMin == roleLevelOrdinary"> |
| | | <el-option |
| | | v-for="item in users" |
| | | :key="item.id" |
| | | :label="item.nickName" |
| | | :value="item.id" |
| | | :disabled="!item.enabled" |
| | | /> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="所属项目" prop="projectId"> |
| | | <el-select v-model="form.projectId" filterable clearable placeholder="请选择" style="width: 340px;" :disabled="crud.status.edit == crudStatusPrepared || userRolesLevelMin == roleLevelOrdinary" @change="formProjectChange"> |
| | | <el-option |
| | |
| | | :key="item.id" |
| | | :label="item.name" |
| | | :value="item.id" |
| | | :disabled="item.approveStatus == approveStatusUnrecognized" |
| | | /> |
| | | </el-select> |
| | | </el-form-item> |
| | |
| | | :label="item.name" |
| | | :value="item.id" |
| | | /> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="所属员工" prop="userId"> |
| | | <el-select v-model="form.userId" filterable clearable placeholder="请选择" style="width: 340px;" :disabled="crud.status.edit == crudStatusPrepared || userRolesLevelMin == roleLevelOrdinary"> |
| | | <el-option |
| | | v-for="item in users" |
| | | :key="item.id" |
| | | :label="item.nickName" |
| | | :value="item.id" |
| | | :disabled="!item.enabled || form.divideUserIds.includes(item.id)" |
| | | > |
| | | <span style="float: left">{{ item.nickName }}</span> |
| | | <span style="float: right; color: #8492a6; font-size: 13px">{{ item.levelName }}</span> |
| | | </el-option> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="任务开始时间" prop="taskStartDate"> |
| | |
| | | <!--表格渲染--> |
| | | <el-table ref="table" v-loading="crud.loading" :data="crud.data" size="small" style="width: 100%;" @selection-change="crud.selectionChangeHandler"> |
| | | <el-table-column type="selection" width="55" /> |
| | | <el-table-column :show-overflow-tooltip="true" prop="userNickName" label="所属员工" fixed="left" width="100"> |
| | | <el-table-column :show-overflow-tooltip="true" prop="projectName" label="所属项目" fixed="left" width="140"> |
| | | <template slot-scope="scope"> |
| | | <el-tag>{{ scope.row.userNickName }}</el-tag> |
| | | <el-tag>{{ scope.row.projectName }}</el-tag> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column :show-overflow-tooltip="true" prop="taskName" label="所属任务" fixed="left" width="180"> |
| | |
| | | <el-tag>{{ scope.row.taskName }}</el-tag> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column :show-overflow-tooltip="true" prop="projectName" label="所属项目" width="140"> |
| | | <el-table-column :show-overflow-tooltip="true" prop="userNickName" label="所属员工" width="100"> |
| | | <template slot-scope="scope"> |
| | | <el-tag>{{ scope.row.projectName }}</el-tag> |
| | | <el-tag>{{ scope.row.userNickName }}</el-tag> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column :show-overflow-tooltip="true" prop="taskStartDate" label="任务开始时间" width="140" /> |
| | |
| | | import crudTask from '@/api/task/task' |
| | | import crudUser from '@/api/system/user' |
| | | |
| | | const defaultForm = { id: null, userId: null, projectId: null, taskId: null, taskStartDate: null, taskEndDate: null, taskHours: null, taskWorkload: null, taskStatus: null, remarks: null, createBy: null, createTime: null, updateBy: null, updateTime: null } |
| | | const defaultForm = { id: null, userId: null, projectId: null, taskId: null, taskStartDate: null, taskEndDate: null, taskHours: null, taskWorkload: null, taskStatus: null, remarks: null, createBy: null, createTime: null, updateBy: null, updateTime: null, divideUserIds: [] } |
| | | export default { |
| | | name: 'TaskUser', |
| | | components: { pagination, crudOperation, rrOperation, udOperation }, |
| | |
| | | data() { |
| | | // 指针重指向 |
| | | const _this = this |
| | | // 时长(千内)验证 |
| | | // 时长(万内)验证 |
| | | var durationValidate = (rule, value, callback) => { |
| | | const reg = /^([0-9]|[1-9]\d{1,2})(\.\d{1,2})?$|1000$/ |
| | | const reg = /^([0-9]|[1-9]\d{1,3})(\.\d{1,2})?$/ |
| | | if (value != null && value !== '' && !reg.test(value)) { |
| | | callback(new Error('请输入 一千 以内的正整数或两位小数')) |
| | | callback(new Error('请输入 一万 以内的正整数或两位小数')) |
| | | } else { |
| | | callback() |
| | | } |
| | |
| | | download: ['admin', 'taskUser:download'] |
| | | }, |
| | | rules: { |
| | | userId: [ |
| | | { required: true, message: '所属员工不能为空', trigger: 'change' } |
| | | ], |
| | | projectId: [ |
| | | { required: true, message: '所属项目不能为空', trigger: 'change' } |
| | | ], |
| | | taskId: [ |
| | | { required: true, message: '所属任务不能为空', trigger: 'change' } |
| | | ], |
| | | userId: [ |
| | | { required: true, message: '所属员工不能为空', trigger: 'change' } |
| | | ], |
| | | taskStartDate: [ |
| | | { required: true, message: '任务开始时间不能为空', trigger: 'change' } |
| | |
| | | ] |
| | | }, |
| | | queryTypeOptions: [ |
| | | { key: 'userId', display_name: '所属员工' }, |
| | | { key: 'projectId', display_name: '所属项目' }, |
| | | { key: 'taskId', display_name: '所属任务' }, |
| | | { key: 'userId', display_name: '所属员工' }, |
| | | { key: 'taskStatus', display_name: '任务状态' } |
| | | ], |
| | | // 任务开始时间选项 |
| | |
| | | taskStatus: constant.TASK_STATUS, |
| | | // 字典:标准工作量单位 |
| | | standardWorkloadUnit: constant.STANDARD_WORKLOAD_UNIT, |
| | | // 字典:批准状态-未承认 |
| | | approveStatusUnrecognized: constant.APPROVE_STATUS_UNRECOGNIZED, |
| | | // 角色级别:普通用户 |
| | | roleLevelOrdinary: constant.ROLE_LEVEL_ORDINARY, |
| | | // CRUD状态 |
| | |
| | | if (this.formTasks[i].id === this.form.taskId) { |
| | | // 表单赋值 |
| | | this.form.taskWorkloadUnit = this.formTasks[i].planWorkloadUnit |
| | | return |
| | | break |
| | | } |
| | | // 判断循环是否结束 |
| | | if (i === this.formTasks.length - 1) { |
| | |
| | | this.form.taskWorkloadUnit = null |
| | | } |
| | | } |
| | | // 判断是否是否是新增 |
| | | if (this.crud.status.add === CRUD.STATUS.PREPARED) { |
| | | // 表单赋值 |
| | | this.form.userId = null |
| | | } |
| | | // 查询任务分配用户 |
| | | crudTaskUser.getTaskUserIds({ taskId: this.form.taskId }).then(res => { |
| | | // 表单赋值 |
| | | this.form.divideUserIds = res |
| | | }) |
| | | } |
| | | } |
| | | } |