Merge branch 'master' of http://192.168.1.110:5678/r/pms-upgrade into yaozc
122 files added
42 files modified
9 files renamed
1 files deleted
56 files copied
| 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.assetManagement.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.math.BigDecimal; |
| | | import java.sql.Timestamp; |
| | | import java.io.Serializable; |
| | | |
| | | /** |
| | | * @website https://eladmin.vip |
| | | * @description / |
| | | * @author wcd |
| | | * @date 2023-02-06 |
| | | **/ |
| | | @Entity |
| | | @Data |
| | | @Table(name="asset_management") |
| | | public class AssetManagement extends BaseEntity implements Serializable { |
| | | |
| | | @Id |
| | | @GeneratedValue(strategy = GenerationType.IDENTITY) |
| | | @Column(name = "`id`") |
| | | @ApiModelProperty(value = "id") |
| | | private Long id; |
| | | |
| | | @Column(name = "`number`",nullable = false) |
| | | @NotNull |
| | | @ApiModelProperty(value = "编号") |
| | | private String number; |
| | | |
| | | @Column(name = "`name`",nullable = false) |
| | | @NotBlank |
| | | @ApiModelProperty(value = "名称") |
| | | private String name; |
| | | |
| | | @Column(name = "`type_number`") |
| | | @ApiModelProperty(value = "型号") |
| | | private String typeNumber; |
| | | |
| | | @Column(name = "`assets_type`",nullable = false) |
| | | @NotBlank |
| | | @ApiModelProperty(value = "资产类型") |
| | | private String assetsType; |
| | | |
| | | @Column(name = "`buy_date`") |
| | | @ApiModelProperty(value = "购买日期") |
| | | private Timestamp buyDate; |
| | | |
| | | @Column(name = "`buy_money`") |
| | | @ApiModelProperty(value = "购买金额") |
| | | private BigDecimal buyMoney; |
| | | |
| | | @Column(name = "`affiliated_company_id`",nullable = false) |
| | | @NotBlank |
| | | @ApiModelProperty(value = "所属公司id") |
| | | private Long affiliatedCompanyId; |
| | | |
| | | @Column(name = "`state`") |
| | | @ApiModelProperty(value = "使用状态") |
| | | private String state; |
| | | |
| | | @Column(name = "`remarks`") |
| | | @ApiModelProperty(value = "备注") |
| | | private String remarks; |
| | | |
| | | public void copy(AssetManagement source){ |
| | | BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true)); |
| | | } |
| | | } |
| 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.assetManagement.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.io.Serializable; |
| | | |
| | | /** |
| | | * @website https://eladmin.vip |
| | | * @description / |
| | | * @author wcd |
| | | * @date 2023-02-07 |
| | | **/ |
| | | @Entity |
| | | @Data |
| | | @Table(name="asset_use_management") |
| | | public class AssetUseManagement extends BaseEntity implements Serializable { |
| | | |
| | | @Id |
| | | @GeneratedValue(strategy = GenerationType.IDENTITY) |
| | | @Column(name = "`id`") |
| | | @ApiModelProperty(value = "id") |
| | | private Long id; |
| | | |
| | | @Column(name = "`asset_id`") |
| | | @ApiModelProperty(value = "资产id") |
| | | private Long assetId; |
| | | |
| | | @Column(name = "`user_id`") |
| | | @ApiModelProperty(value = "员工id") |
| | | private Long userId; |
| | | |
| | | @Column(name = "`meeting_id`") |
| | | @ApiModelProperty(value = "会议室id") |
| | | private Long meetingId; |
| | | |
| | | @Column(name = "`use_start_time`") |
| | | @ApiModelProperty(value = "使用开始日期") |
| | | private Timestamp useStartTime; |
| | | |
| | | @Column(name = "`use_end_time`") |
| | | @ApiModelProperty(value = "使用结束时间") |
| | | private Timestamp useEndTime; |
| | | |
| | | @Column(name = "`remarks`") |
| | | @ApiModelProperty(value = "备注") |
| | | private String remarks; |
| | | |
| | | public void copy(AssetUseManagement source){ |
| | | BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true)); |
| | | } |
| | | } |
copy from eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/repository/SysUserCompanyRepository.java
copy to eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/assetManagement/repository/AssetManagementRepository.java
| File was copied from eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/repository/SysUserCompanyRepository.java |
| | |
| | | * See the License for the specific language governing permissions and |
| | | * limitations under the License. |
| | | */ |
| | | package me.zhengjie.modules.system.repository; |
| | | package me.zhengjie.modules.assetManagement.repository; |
| | | |
| | | import me.zhengjie.modules.system.domain.SysUserCompany; |
| | | 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; |
| | | |
| | | /** |
| | | * @website https://eladmin.vip |
| | | * @author wcd |
| | | * @date 2023-01-30 |
| | | * @date 2023-02-06 |
| | | **/ |
| | | public interface SysUserCompanyRepository extends JpaRepository<SysUserCompany, Long>, JpaSpecificationExecutor<SysUserCompany> { |
| | | |
| | | /** |
| | | * 根据value查询公司(导出用) |
| | | * @return |
| | | */ |
| | | @Query |
| | | SysUserCompany findByValue(String value); |
| | | public interface AssetManagementRepository extends JpaRepository<AssetManagement, Long>, JpaSpecificationExecutor<AssetManagement> { |
| | | } |
| 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.assetManagement.repository; |
| | | |
| | | import me.zhengjie.modules.assetManagement.domain.AssetUseManagement; |
| | | import me.zhengjie.modules.attendance.domain.AttendanceBusinessTravel; |
| | | 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.time.LocalDateTime; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @website https://eladmin.vip |
| | | * @author wcd |
| | | * @date 2023-02-07 |
| | | **/ |
| | | public interface AssetUseManagementRepository extends JpaRepository<AssetUseManagement, Long>, JpaSpecificationExecutor<AssetUseManagement> { |
| | | |
| | | // 查询同一资产id最大的数据 |
| | | @Query(value = "SELECT max(id) FROM `asset_use_management` WHERE asset_id = ?", nativeQuery = true) |
| | | Integer findByMaxId(Long assId); |
| | | |
| | | // 查询同一资产id最大的数据 |
| | | @Query(value = "SELECT * FROM `asset_use_management` WHERE asset_id = ?", nativeQuery = true) |
| | | List<AssetUseManagement> findAllByAssId(Long assId); |
| | | |
| | | @Query |
| | | List<AssetUseManagement> findByMeetingId(Long meeting); |
| | | |
| | | // 根据资产id删除数据 |
| | | @Modifying |
| | | @Query(value = "delete from asset_use_management where asset_id = ?1",nativeQuery = true) |
| | | void deleteByAssetId(Long assetId); |
| | | } |
| 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.assetManagement.rest; |
| | | |
| | | import me.zhengjie.annotation.Log; |
| | | import me.zhengjie.modules.assetManagement.domain.AssetManagement; |
| | | import me.zhengjie.modules.assetManagement.domain.AssetUseManagement; |
| | | import me.zhengjie.modules.assetManagement.service.AssetManagementService; |
| | | import me.zhengjie.modules.assetManagement.service.AssetUseManagementService; |
| | | import me.zhengjie.modules.assetManagement.service.dto.AssetManagementQueryCriteria; |
| | | import me.zhengjie.modules.task.service.dto.TaskUserDto; |
| | | 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 java.text.ParseException; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | |
| | | /** |
| | | * @website https://eladmin.vip |
| | | * @author wcd |
| | | * @date 2023-02-06 |
| | | **/ |
| | | @RestController |
| | | @RequiredArgsConstructor |
| | | @Api(tags = "资产记录管理") |
| | | @RequestMapping("/api/assetManagement") |
| | | public class AssetManagementController { |
| | | |
| | | private final AssetManagementService assetManagementService; |
| | | private final AssetUseManagementService assetUseManagementService; |
| | | |
| | | @Log("导出数据") |
| | | @ApiOperation("导出数据") |
| | | @GetMapping(value = "/download") |
| | | @PreAuthorize("@el.check('assetManagement:download')") |
| | | public void exportAssetManagement(HttpServletResponse response, AssetManagementQueryCriteria criteria) throws IOException { |
| | | assetManagementService.download(assetManagementService.queryAll(criteria), response); |
| | | } |
| | | |
| | | @GetMapping |
| | | @Log("查询资产记录") |
| | | @ApiOperation("查询资产记录") |
| | | @PreAuthorize("@el.check('assetManagement:list')") |
| | | public ResponseEntity<Object> queryAssetManagement(AssetManagementQueryCriteria criteria, Pageable pageable){ |
| | | return new ResponseEntity<>(assetManagementService.queryAll(criteria,pageable),HttpStatus.OK); |
| | | } |
| | | |
| | | @GetMapping(value = "/all") |
| | | @Log("查询资产记录") |
| | | @ApiOperation("查询资产记录") |
| | | @PreAuthorize("@el.check('assetManagement:list')") |
| | | public ResponseEntity<Object> queryAssetManagement(AssetManagementQueryCriteria criteria){ |
| | | return new ResponseEntity<>(assetManagementService.queryAll(criteria),HttpStatus.OK); |
| | | } |
| | | |
| | | @PostMapping |
| | | @Log("新增资产记录") |
| | | @ApiOperation("新增资产记录") |
| | | @PreAuthorize("@el.check('assetManagement:add')") |
| | | public ResponseEntity<Object> createAssetManagement(@Validated @RequestBody AssetManagement resources){ |
| | | return new ResponseEntity<>(assetManagementService.create(resources),HttpStatus.CREATED); |
| | | } |
| | | |
| | | @PutMapping |
| | | @Log("修改资产记录") |
| | | @ApiOperation("修改资产记录") |
| | | @PreAuthorize("@el.check('assetManagement:edit')") |
| | | public ResponseEntity<Object> updateAssetManagement(@Validated @RequestBody AssetManagement resources){ |
| | | assetManagementService.update(resources); |
| | | return new ResponseEntity<>(HttpStatus.NO_CONTENT); |
| | | } |
| | | |
| | | @DeleteMapping |
| | | @Log("删除资产记录") |
| | | @ApiOperation("删除资产记录") |
| | | @PreAuthorize("@el.check('assetManagement:del')") |
| | | public ResponseEntity<Object> deleteAssetManagement(@RequestBody Long[] ids) { |
| | | assetManagementService.deleteAll(ids); |
| | | return new ResponseEntity<>(HttpStatus.OK); |
| | | } |
| | | |
| | | @PostMapping(value = "/divide") |
| | | @Log("分配任务") |
| | | @ApiOperation("分配任务") |
| | | @PreAuthorize("@el.check('assetManagement:divide')") |
| | | public ResponseEntity<Object> divide(@Validated @RequestBody AssetUseManagement resources) throws ParseException { |
| | | assetUseManagementService.divide(resources); |
| | | return new ResponseEntity<>(HttpStatus.NO_CONTENT); |
| | | } |
| | | } |
| 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.assetManagement.rest; |
| | | |
| | | import me.zhengjie.annotation.Log; |
| | | import me.zhengjie.modules.assetManagement.domain.AssetUseManagement; |
| | | import me.zhengjie.modules.assetManagement.service.AssetUseManagementService; |
| | | import me.zhengjie.modules.assetManagement.service.dto.AssetManagementQueryCriteria; |
| | | import me.zhengjie.modules.assetManagement.service.dto.AssetUseManagementQueryCriteria; |
| | | 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 java.text.ParseException; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | |
| | | /** |
| | | * @website https://eladmin.vip |
| | | * @author wcd |
| | | * @date 2023-02-07 |
| | | **/ |
| | | @RestController |
| | | @RequiredArgsConstructor |
| | | @Api(tags = "资产使用管理") |
| | | @RequestMapping("/api/assetUseManagement") |
| | | public class AssetUseManagementController { |
| | | |
| | | private final AssetUseManagementService assetUseManagementService; |
| | | |
| | | @Log("导出数据") |
| | | @ApiOperation("导出数据") |
| | | @GetMapping(value = "/download") |
| | | @PreAuthorize("@el.check('assetUseManagement:download')") |
| | | public void exportAssetUseManagement(HttpServletResponse response, AssetUseManagementQueryCriteria criteria) throws IOException { |
| | | assetUseManagementService.download(assetUseManagementService.queryAll(criteria), response); |
| | | } |
| | | |
| | | @GetMapping |
| | | @Log("查询资产使用") |
| | | @ApiOperation("查询资产使用") |
| | | @PreAuthorize("@el.check('assetUseManagement:list')") |
| | | public ResponseEntity<Object> queryAssetUseManagement(AssetUseManagementQueryCriteria criteria, Pageable pageable){ |
| | | return new ResponseEntity<>(assetUseManagementService.queryAll(criteria,pageable),HttpStatus.OK); |
| | | } |
| | | |
| | | @GetMapping(value = "/all") |
| | | @Log("查询资产使用") |
| | | @ApiOperation("查询资产使用") |
| | | @PreAuthorize("@el.check('assetUseManagement:list')") |
| | | public ResponseEntity<Object> queryAssetUseManagement(AssetUseManagementQueryCriteria criteria){ |
| | | return new ResponseEntity<>(assetUseManagementService.queryAll(criteria),HttpStatus.OK); |
| | | } |
| | | |
| | | @PostMapping |
| | | @Log("新增资产使用") |
| | | @ApiOperation("新增资产使用") |
| | | @PreAuthorize("@el.check('assetUseManagement:add')") |
| | | public ResponseEntity<Object> createAssetUseManagement(@Validated @RequestBody AssetUseManagement resources) throws ParseException { |
| | | assetUseManagementService.create(resources); |
| | | return new ResponseEntity<>(HttpStatus.CREATED); |
| | | } |
| | | |
| | | @PutMapping |
| | | @Log("修改资产使用") |
| | | @ApiOperation("修改资产使用") |
| | | @PreAuthorize("@el.check('assetUseManagement:edit')") |
| | | public ResponseEntity<Object> updateAssetUseManagement(@Validated @RequestBody AssetUseManagement resources){ |
| | | assetUseManagementService.update(resources); |
| | | return new ResponseEntity<>(HttpStatus.NO_CONTENT); |
| | | } |
| | | |
| | | @DeleteMapping |
| | | @Log("删除资产使用") |
| | | @ApiOperation("删除资产使用") |
| | | @PreAuthorize("@el.check('assetUseManagement:del')") |
| | | public ResponseEntity<Object> deleteAssetUseManagement(@RequestBody Long[] ids) { |
| | | assetUseManagementService.deleteAll(ids); |
| | | return new ResponseEntity<>(HttpStatus.OK); |
| | | } |
| | | } |
copy from eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/service/SysUserCompanyService.java
copy to eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/assetManagement/service/AssetManagementService.java
| File was copied from eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/service/SysUserCompanyService.java |
| | |
| | | * See the License for the specific language governing permissions and |
| | | * limitations under the License. |
| | | */ |
| | | package me.zhengjie.modules.system.service; |
| | | package me.zhengjie.modules.assetManagement.service; |
| | | |
| | | import me.zhengjie.modules.system.domain.SysUserCompany; |
| | | import me.zhengjie.modules.system.service.dto.SysUserCompanyDto; |
| | | import me.zhengjie.modules.system.service.dto.SysUserCompanyQueryCriteria; |
| | | import me.zhengjie.modules.assetManagement.domain.AssetManagement; |
| | | import me.zhengjie.modules.assetManagement.service.dto.AssetManagementDto; |
| | | import me.zhengjie.modules.assetManagement.service.dto.AssetManagementQueryCriteria; |
| | | import org.springframework.data.domain.Pageable; |
| | | import java.util.Map; |
| | | import java.util.List; |
| | |
| | | * @website https://eladmin.vip |
| | | * @description 服务接口 |
| | | * @author wcd |
| | | * @date 2023-01-30 |
| | | * @date 2023-02-06 |
| | | **/ |
| | | public interface SysUserCompanyService { |
| | | public interface AssetManagementService { |
| | | |
| | | /** |
| | | * 查询数据分页 |
| | |
| | | * @param pageable 分页参数 |
| | | * @return Map<String,Object> |
| | | */ |
| | | Map<String,Object> queryAll(SysUserCompanyQueryCriteria criteria, Pageable pageable); |
| | | Map<String,Object> queryAll(AssetManagementQueryCriteria criteria, Pageable pageable); |
| | | |
| | | /** |
| | | * 查询所有数据不分页 |
| | | * @param criteria 条件参数 |
| | | * @return List<SystemSettingDto> |
| | | * @return List<AssetManagementDto> |
| | | */ |
| | | List<SysUserCompanyDto> queryAll(SysUserCompanyQueryCriteria criteria); |
| | | List<AssetManagementDto> queryAll(AssetManagementQueryCriteria criteria); |
| | | |
| | | /** |
| | | * 根据ID查询 |
| | | * @param id ID |
| | | * @return SystemSettingDto |
| | | * @return AssetManagementDto |
| | | */ |
| | | SysUserCompanyDto findById(Long id); |
| | | AssetManagementDto findById(Long id); |
| | | |
| | | /** |
| | | * 创建 |
| | | * @param resources / |
| | | * @return SystemSettingDto |
| | | * @return AssetManagementDto |
| | | */ |
| | | SysUserCompanyDto create(SysUserCompany resources); |
| | | AssetManagementDto create(AssetManagement resources); |
| | | |
| | | /** |
| | | * 编辑 |
| | | * @param resources / |
| | | */ |
| | | void update(SysUserCompany resources); |
| | | void update(AssetManagement resources); |
| | | |
| | | /** |
| | | * 多选删除 |
| | |
| | | * @param response / |
| | | * @throws IOException / |
| | | */ |
| | | void download(List<SysUserCompanyDto> all, HttpServletResponse response) throws IOException; |
| | | |
| | | /** |
| | | * 选择用户改变公司 |
| | | * @param resources |
| | | * @return |
| | | */ |
| | | SysUserCompany getCompName(SysUserCompanyDto resources); |
| | | void download(List<AssetManagementDto> all, HttpServletResponse response) throws IOException; |
| | | } |
| 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.assetManagement.service; |
| | | |
| | | import me.zhengjie.modules.assetManagement.domain.AssetUseManagement; |
| | | import me.zhengjie.modules.assetManagement.service.dto.AssetUseManagementDto; |
| | | import me.zhengjie.modules.assetManagement.service.dto.AssetUseManagementQueryCriteria; |
| | | import me.zhengjie.modules.task.service.dto.TaskUserDto; |
| | | import org.springframework.data.domain.Pageable; |
| | | |
| | | import java.text.ParseException; |
| | | import java.util.Map; |
| | | import java.util.List; |
| | | import java.io.IOException; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | |
| | | /** |
| | | * @website https://eladmin.vip |
| | | * @description 服务接口 |
| | | * @author wcd |
| | | * @date 2023-02-07 |
| | | **/ |
| | | public interface AssetUseManagementService { |
| | | |
| | | /** |
| | | * 查询数据分页 |
| | | * @param criteria 条件 |
| | | * @param pageable 分页参数 |
| | | * @return Map<String,Object> |
| | | */ |
| | | Map<String,Object> queryAll(AssetUseManagementQueryCriteria criteria, Pageable pageable); |
| | | |
| | | /** |
| | | * 查询所有数据不分页 |
| | | * @param criteria 条件参数 |
| | | * @return List<AssetUseManagementDto> |
| | | */ |
| | | List<AssetUseManagementDto> queryAll(AssetUseManagementQueryCriteria criteria); |
| | | |
| | | /** |
| | | * 根据ID查询 |
| | | * @param id ID |
| | | * @return AssetUseManagementDto |
| | | */ |
| | | AssetUseManagementDto findById(Long id); |
| | | |
| | | /** |
| | | * 创建 |
| | | * @param resources / |
| | | * @return AssetUseManagementDto |
| | | */ |
| | | void create(AssetUseManagement resources) throws ParseException; |
| | | |
| | | /** |
| | | * 编辑 |
| | | * @param resources / |
| | | */ |
| | | void update(AssetUseManagement resources); |
| | | |
| | | /** |
| | | * 多选删除 |
| | | * @param ids / |
| | | */ |
| | | void deleteAll(Long[] ids); |
| | | |
| | | /** |
| | | * 导出数据 |
| | | * @param all 待导出的数据 |
| | | * @param response / |
| | | * @throws IOException / |
| | | */ |
| | | void download(List<AssetUseManagementDto> all, HttpServletResponse response) throws IOException; |
| | | |
| | | /** |
| | | * 分配 |
| | | * @param resources / |
| | | * @return AssetUseManagement |
| | | */ |
| | | void divide(AssetUseManagement resources) throws ParseException; |
| | | } |
| 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.assetManagement.service.dto; |
| | | |
| | | import lombok.Data; |
| | | import me.zhengjie.base.BaseDTO; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.sql.Timestamp; |
| | | import java.io.Serializable; |
| | | |
| | | /** |
| | | * @website https://eladmin.vip |
| | | * @description / |
| | | * @author wcd |
| | | * @date 2023-02-06 |
| | | **/ |
| | | @Data |
| | | public class AssetManagementDto extends BaseDTO implements Serializable { |
| | | |
| | | private Long id; |
| | | |
| | | /** 编号 */ |
| | | private String number; |
| | | |
| | | /** 名称 */ |
| | | private String name; |
| | | |
| | | /** 型号 */ |
| | | private String typeNumber; |
| | | |
| | | /** 资产类型 */ |
| | | private String assetsType; |
| | | |
| | | /** 购买日期 */ |
| | | private Timestamp buyDate; |
| | | |
| | | /** 购买金额 */ |
| | | private BigDecimal buyMoney; |
| | | |
| | | /** 所属公司 */ |
| | | private Long affiliatedCompanyId; |
| | | |
| | | /** 使用状态 */ |
| | | private String state; |
| | | |
| | | /** 备注 */ |
| | | private String remarks; |
| | | } |
copy from eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/service/dto/SysUserCompanyQueryCriteria.java
copy to eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/assetManagement/service/dto/AssetManagementQueryCriteria.java
| File was copied from eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/service/dto/SysUserCompanyQueryCriteria.java |
| | |
| | | * See the License for the specific language governing permissions and |
| | | * limitations under the License. |
| | | */ |
| | | package me.zhengjie.modules.system.service.dto; |
| | | package me.zhengjie.modules.assetManagement.service.dto; |
| | | |
| | | import lombok.Data; |
| | | import java.util.List; |
| | |
| | | /** |
| | | * @website https://eladmin.vip |
| | | * @author wcd |
| | | * @date 2023-01-30 |
| | | * @date 2023-02-06 |
| | | **/ |
| | | @Data |
| | | public class SysUserCompanyQueryCriteria { |
| | | public class AssetManagementQueryCriteria{ |
| | | |
| | | @Query(type = Query.Type.INNER_LIKE) |
| | | private String label; |
| | | @Query(propName = "number", type = Query.Type.INNER_LIKE) |
| | | private String number; |
| | | |
| | | @Query(propName = "name", type = Query.Type.INNER_LIKE) |
| | | private String name; |
| | | |
| | | @Query |
| | | private Long affiliatedCompanyId; |
| | | |
| | | @Query |
| | | private String state; |
| | | } |
| 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.assetManagement.service.dto; |
| | | |
| | | import lombok.Data; |
| | | import me.zhengjie.base.BaseDTO; |
| | | |
| | | import java.sql.Timestamp; |
| | | import java.io.Serializable; |
| | | |
| | | /** |
| | | * @website https://eladmin.vip |
| | | * @description / |
| | | * @author wcd |
| | | * @date 2023-02-07 |
| | | **/ |
| | | @Data |
| | | public class AssetUseManagementDto extends BaseDTO implements Serializable { |
| | | |
| | | private Long id; |
| | | |
| | | /** 资产id */ |
| | | private Long assetId; |
| | | |
| | | /** 员工id */ |
| | | private Long userId; |
| | | |
| | | /** 会议室id */ |
| | | private Long meetingId; |
| | | |
| | | /** 使用开始日期 */ |
| | | private Timestamp useStartTime; |
| | | |
| | | /** 使用结束时间 */ |
| | | private Timestamp useEndTime; |
| | | |
| | | /** 备注 */ |
| | | private String remarks; |
| | | |
| | | /** 资产 */ |
| | | private String assName; |
| | | |
| | | /** 用户 */ |
| | | private String nickName; |
| | | |
| | | /** 会议室 */ |
| | | private String meetName; |
| | | } |
copy from eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/service/dto/SysUserCompanyQueryCriteria.java
copy to eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/assetManagement/service/dto/AssetUseManagementQueryCriteria.java
| File was copied from eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/service/dto/SysUserCompanyQueryCriteria.java |
| | |
| | | * See the License for the specific language governing permissions and |
| | | * limitations under the License. |
| | | */ |
| | | package me.zhengjie.modules.system.service.dto; |
| | | package me.zhengjie.modules.assetManagement.service.dto; |
| | | |
| | | import lombok.Data; |
| | | |
| | | import java.sql.Timestamp; |
| | | import java.util.List; |
| | | import me.zhengjie.annotation.Query; |
| | | |
| | | /** |
| | | * @website https://eladmin.vip |
| | | * @author wcd |
| | | * @date 2023-01-30 |
| | | * @date 2023-02-07 |
| | | **/ |
| | | @Data |
| | | public class SysUserCompanyQueryCriteria { |
| | | public class AssetUseManagementQueryCriteria{ |
| | | |
| | | @Query(type = Query.Type.INNER_LIKE) |
| | | private String label; |
| | | @Query |
| | | private Long assetId; |
| | | |
| | | @Query |
| | | private Long userId; |
| | | |
| | | @Query(type = Query.Type.BETWEEN, propName = "useStartTime") |
| | | private List<Timestamp> useStartTime; |
| | | |
| | | @Query(type = Query.Type.BETWEEN, propName = "useEndTime") |
| | | private List<Timestamp> useEndTime; |
| | | } |
| 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.assetManagement.service.impl; |
| | | |
| | | import me.zhengjie.modules.assetManagement.domain.AssetManagement; |
| | | import me.zhengjie.modules.assetManagement.domain.AssetUseManagement; |
| | | import me.zhengjie.modules.assetManagement.repository.AssetUseManagementRepository; |
| | | 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; |
| | | import me.zhengjie.modules.assetManagement.repository.AssetManagementRepository; |
| | | import me.zhengjie.modules.assetManagement.service.AssetManagementService; |
| | | import me.zhengjie.modules.assetManagement.service.dto.AssetManagementDto; |
| | | import me.zhengjie.modules.assetManagement.service.dto.AssetManagementQueryCriteria; |
| | | import me.zhengjie.modules.assetManagement.service.mapstruct.AssetManagementMapper; |
| | | 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.util.List; |
| | | import java.util.Map; |
| | | import java.io.IOException; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.util.ArrayList; |
| | | import java.util.LinkedHashMap; |
| | | |
| | | /** |
| | | * @website https://eladmin.vip |
| | | * @description 服务实现 |
| | | * @author wcd |
| | | * @date 2023-02-06 |
| | | **/ |
| | | @Service |
| | | @Transactional |
| | | @RequiredArgsConstructor |
| | | public class AssetManagementServiceImpl implements AssetManagementService { |
| | | |
| | | private final AssetManagementRepository assetManagementRepository; |
| | | private final AssetManagementMapper assetManagementMapper; |
| | | private final SysCompanyRepository sysCompanyRepository; |
| | | private final DictDetailRepository dictDetailRepository; |
| | | private final AssetUseManagementRepository assetUseManagementRepository; |
| | | |
| | | @Override |
| | | public Map<String,Object> queryAll(AssetManagementQueryCriteria criteria, Pageable pageable){ |
| | | Page<AssetManagement> page = assetManagementRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable); |
| | | return PageUtil.toPage(page.map(assetManagementMapper::toDto)); |
| | | } |
| | | |
| | | @Override |
| | | public List<AssetManagementDto> queryAll(AssetManagementQueryCriteria criteria){ |
| | | return assetManagementMapper.toDto(assetManagementRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder))); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional |
| | | public AssetManagementDto findById(Long id) { |
| | | AssetManagement assetManagement = assetManagementRepository.findById(id).orElseGet(AssetManagement::new); |
| | | ValidationUtil.isNull(assetManagement.getId(),"AssetManagement","id",id); |
| | | return assetManagementMapper.toDto(assetManagement); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public AssetManagementDto create(AssetManagement resources) { |
| | | return assetManagementMapper.toDto(assetManagementRepository.save(resources)); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void update(AssetManagement resources) { |
| | | AssetManagement assetManagement = assetManagementRepository.findById(resources.getId()).orElseGet(AssetManagement::new); |
| | | ValidationUtil.isNull( assetManagement.getId(),"AssetManagement","id",resources.getId()); |
| | | assetManagement.copy(resources); |
| | | assetManagementRepository.save(assetManagement); |
| | | } |
| | | |
| | | @Override |
| | | public void deleteAll(Long[] ids) { |
| | | for (Long id : ids) { |
| | | // 查询资产使用记录 |
| | | List<AssetUseManagement> assetUseManagements = assetUseManagementRepository.findAllByAssId(id); |
| | | for(int i = 0; i < assetUseManagements.size(); i++){ |
| | | assetUseManagementRepository.deleteByAssetId(assetUseManagements.get(i).getAssetId()); |
| | | } |
| | | assetManagementRepository.deleteById(id); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public void download(List<AssetManagementDto> all, HttpServletResponse response) throws IOException { |
| | | List<Map<String, Object>> list = new ArrayList<>(); |
| | | for (AssetManagementDto assetManagement : all) { |
| | | String results = assetManagement.getState() != null ? dictDetailRepository.findByDictNameAndValue("assets_use", assetManagement.getState()).getLabel() : ""; |
| | | Map<String,Object> map = new LinkedHashMap<>(); |
| | | map.put("编号", assetManagement.getNumber()); |
| | | map.put("名称", assetManagement.getName()); |
| | | map.put("型号", assetManagement.getTypeNumber()); |
| | | map.put("资产类型", assetManagement.getAssetsType()); |
| | | map.put("购买日期", assetManagement.getBuyDate()); |
| | | map.put("购买金额", assetManagement.getBuyMoney()); |
| | | map.put("所属公司", sysCompanyRepository.findById(assetManagement.getAffiliatedCompanyId()).orElseGet(SysCompany::new).getLabel()); |
| | | map.put("使用状态", results); |
| | | map.put("备注", assetManagement.getRemarks()); |
| | | map.put("创建者", assetManagement.getCreateBy()); |
| | | map.put("创建时间", assetManagement.getCreateTime()); |
| | | map.put("更新者", assetManagement.getUpdateBy()); |
| | | map.put("更新时间", assetManagement.getUpdateTime()); |
| | | list.add(map); |
| | | } |
| | | FileUtil.downloadExcel(list, response); |
| | | } |
| | | } |
| 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.assetManagement.service.impl; |
| | | |
| | | import me.zhengjie.exception.BadRequestException; |
| | | import me.zhengjie.modules.assetManagement.domain.AssetManagement; |
| | | import me.zhengjie.modules.assetManagement.domain.AssetUseManagement; |
| | | import me.zhengjie.modules.assetManagement.repository.AssetManagementRepository; |
| | | import me.zhengjie.modules.conferenceRoom.domain.MeetingRoom; |
| | | import me.zhengjie.modules.conferenceRoom.repository.MeetingRoomRepository; |
| | | import me.zhengjie.modules.system.domain.User; |
| | | import me.zhengjie.modules.system.repository.UserRepository; |
| | | import me.zhengjie.utils.ValidationUtil; |
| | | import me.zhengjie.utils.FileUtil; |
| | | import lombok.RequiredArgsConstructor; |
| | | import me.zhengjie.modules.assetManagement.repository.AssetUseManagementRepository; |
| | | import me.zhengjie.modules.assetManagement.service.AssetUseManagementService; |
| | | import me.zhengjie.modules.assetManagement.service.dto.AssetUseManagementDto; |
| | | import me.zhengjie.modules.assetManagement.service.dto.AssetUseManagementQueryCriteria; |
| | | import me.zhengjie.modules.assetManagement.service.mapstruct.AssetUseManagementMapper; |
| | | import org.apache.commons.lang3.ObjectUtils; |
| | | 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.sql.Timestamp; |
| | | import java.text.DateFormat; |
| | | import java.text.ParseException; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.*; |
| | | import java.io.IOException; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.util.function.Function; |
| | | |
| | | /** |
| | | * @website https://eladmin.vip |
| | | * @description 服务实现 |
| | | * @author wcd |
| | | * @date 2023-02-07 |
| | | **/ |
| | | @Service |
| | | @RequiredArgsConstructor |
| | | public class AssetUseManagementServiceImpl implements AssetUseManagementService { |
| | | |
| | | private final AssetUseManagementRepository assetUseManagementRepository; |
| | | private final AssetUseManagementMapper assetUseManagementMapper; |
| | | private final AssetManagementRepository assetManagementRepository; |
| | | private final UserRepository userRepository; |
| | | private final MeetingRoomRepository meetingRoomRepository; |
| | | |
| | | @Override |
| | | public Map<String,Object> queryAll(AssetUseManagementQueryCriteria criteria, Pageable pageable){ |
| | | Page<AssetUseManagement> page = assetUseManagementRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable); |
| | | //将实体转换为Dto(重写) |
| | | Function<AssetUseManagement, AssetUseManagementDto> func = new Function<AssetUseManagement, AssetUseManagementDto>(){ |
| | | |
| | | @Override |
| | | public AssetUseManagementDto apply(AssetUseManagement assetUseManagement) { |
| | | // 将实体类转换成DTO |
| | | AssetUseManagementDto assetUseManagementDto = assetUseManagementMapper.toDto(assetUseManagement); |
| | | // 查询资产信息 |
| | | AssetManagement assetManagement = assetManagementRepository.findById(assetUseManagementDto.getAssetId()).orElseGet(AssetManagement::new); |
| | | assetUseManagementDto.setAssName(assetManagement.getNumber()); |
| | | // 用户不等于null |
| | | if(ObjectUtils.isNotEmpty(assetUseManagementDto.getUserId())){ |
| | | //查询用户信息 |
| | | User user = userRepository.findById(assetUseManagementDto.getUserId()).orElseGet(User::new); |
| | | assetUseManagementDto.setNickName(user.getNickName()); |
| | | }else{ |
| | | assetUseManagementDto.setNickName(""); |
| | | } |
| | | // 会议室不等于null |
| | | if(ObjectUtils.isNotEmpty(assetUseManagementDto.getMeetingId())){ |
| | | MeetingRoom meetingRoom = meetingRoomRepository.findById(assetUseManagementDto.getMeetingId()).orElseGet(MeetingRoom::new); |
| | | assetUseManagementDto.setMeetName(meetingRoom.getConferenceRoomName()); |
| | | }else{ |
| | | assetUseManagementDto.setMeetName(""); |
| | | } |
| | | return assetUseManagementDto; |
| | | } |
| | | }; |
| | | return PageUtil.toPage(page.map(func)); |
| | | } |
| | | |
| | | @Override |
| | | public List<AssetUseManagementDto> queryAll(AssetUseManagementQueryCriteria criteria){ |
| | | return assetUseManagementMapper.toDto(assetUseManagementRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder))); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional |
| | | public AssetUseManagementDto findById(Long id) { |
| | | AssetUseManagement assetUseManagement = assetUseManagementRepository.findById(id).orElseGet(AssetUseManagement::new); |
| | | ValidationUtil.isNull(assetUseManagement.getId(),"AssetUseManagement","id",id); |
| | | return assetUseManagementMapper.toDto(assetUseManagement); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void create(AssetUseManagement resources) throws ParseException { |
| | | divide(resources); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void update(AssetUseManagement resources) { |
| | | AssetUseManagement assetUseManagement = assetUseManagementRepository.findById(resources.getId()).orElseGet(AssetUseManagement::new); |
| | | ValidationUtil.isNull( assetUseManagement.getId(),"AssetUseManagement","id",resources.getId()); |
| | | assetUseManagement.copy(resources); |
| | | assetUseManagementRepository.save(assetUseManagement); |
| | | } |
| | | |
| | | @Override |
| | | public void deleteAll(Long[] ids) { |
| | | for (Long id : ids) { |
| | | assetUseManagementRepository.deleteById(id); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public void download(List<AssetUseManagementDto> all, HttpServletResponse response) throws IOException { |
| | | List<Map<String, Object>> list = new ArrayList<>(); |
| | | for (AssetUseManagementDto assetUseManagement : all) { |
| | | Map<String,Object> map = new LinkedHashMap<>(); |
| | | AssetManagement assetManagement = assetManagementRepository.findById(assetUseManagement.getAssetId()).orElseGet(AssetManagement::new); |
| | | map.put("资产", assetManagement.getNumber()); |
| | | map.put("员工", ObjectUtils.isEmpty(assetUseManagement.getUserId()) ? "" : userRepository.getById(assetUseManagement.getUserId()).getNickName()); |
| | | map.put("会议室", ObjectUtils.isEmpty(assetUseManagement.getMeetingId()) ? "" : meetingRoomRepository.getById(assetUseManagement.getMeetingId()).getConferenceRoomName()); |
| | | map.put("使用开始日期", assetUseManagement.getUseStartTime()); |
| | | map.put("使用结束时间", assetUseManagement.getUseEndTime()); |
| | | map.put("备注", assetUseManagement.getRemarks()); |
| | | map.put("创建者", assetUseManagement.getCreateBy()); |
| | | map.put("创建时间", assetUseManagement.getCreateTime()); |
| | | map.put("更新者", assetUseManagement.getUpdateBy()); |
| | | map.put("更新时间", assetUseManagement.getUpdateTime()); |
| | | list.add(map); |
| | | } |
| | | FileUtil.downloadExcel(list, response); |
| | | } |
| | | |
| | | /** |
| | | * 分配 |
| | | * @param resources / |
| | | */ |
| | | @Override |
| | | public void divide(AssetUseManagement resources) throws ParseException { |
| | | // 验证日期 |
| | | List<AssetUseManagement> assetUseManagements = assetUseManagementRepository.findAllByAssId(resources.getAssetId()); |
| | | for(int i = 0; i< assetUseManagements.size(); i++){ |
| | | // 结束时间不为null |
| | | if(ObjectUtils.isNotEmpty(assetUseManagements.get(i).getUseEndTime())){ |
| | | if(resources.getUseStartTime().compareTo(assetUseManagements.get(i).getUseEndTime()) <= 0){ |
| | | throw new BadRequestException("使用开始日期不得小于等于已存在的结束日期"); |
| | | } |
| | | } |
| | | if(ObjectUtils.isEmpty(assetUseManagements.get(i).getUseEndTime())){ |
| | | if(resources.getUseStartTime().compareTo(assetUseManagements.get(i).getUseStartTime()) <= 0){ |
| | | throw new BadRequestException("使用开始日期不得小于等于已存在的开始日期"); |
| | | } |
| | | } |
| | | } |
| | | // 查询同一资产id最大的一条数据就是上一条记录 |
| | | Integer count = assetUseManagementRepository.findByMaxId(resources.getAssetId()); |
| | | AssetUseManagement assetUseManagement = null; |
| | | if(ObjectUtils.isNotEmpty(count)){ |
| | | assetUseManagement = assetUseManagementRepository.findById(Long.valueOf(count)).orElseGet(AssetUseManagement::new); |
| | | } |
| | | if(ObjectUtils.isNotEmpty(assetUseManagement)){ |
| | | // 结束时间为null,赋值 |
| | | if(ObjectUtils.isEmpty(assetUseManagement.getUseEndTime())){ |
| | | DateFormat df = new SimpleDateFormat("yyyy-MM-dd"); |
| | | String str = df.format(resources.getUseStartTime()); |
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); |
| | | Date date = sdf.parse(str); |
| | | // 取当前开始日期的前一天日期 |
| | | Calendar calendar = Calendar.getInstance(); |
| | | calendar.setTime(date); |
| | | calendar.add(Calendar.DAY_OF_MONTH, -1); |
| | | date = (Date) calendar.getTime(); |
| | | String format = df.format(date) + " 00:00:00"; |
| | | assetUseManagement.setUseEndTime(Timestamp.valueOf(format)); |
| | | assetUseManagementRepository.save(assetUseManagement); |
| | | } |
| | | } |
| | | AssetUseManagement assetUseManagement1 = new AssetUseManagement(); |
| | | assetUseManagement1.setAssetId(resources.getAssetId()); |
| | | assetUseManagement1.setUserId(ObjectUtils.isEmpty(resources.getUserId()) ? null : resources.getUserId()); |
| | | assetUseManagement1.setMeetingId(ObjectUtils.isEmpty(resources.getMeetingId()) ? null : resources.getMeetingId()); |
| | | assetUseManagement1.setUseStartTime(resources.getUseStartTime()); |
| | | assetUseManagement1.setUseEndTime(ObjectUtils.isEmpty(resources.getUseEndTime()) ? null : resources.getUseEndTime()); |
| | | assetUseManagementRepository.save(assetUseManagement1); |
| | | } |
| | | } |
copy from eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/service/mapstruct/SysUserCompanyMapper.java
copy to eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/assetManagement/service/mapstruct/AssetManagementMapper.java
| File was copied from eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/service/mapstruct/SysUserCompanyMapper.java |
| | |
| | | * See the License for the specific language governing permissions and |
| | | * limitations under the License. |
| | | */ |
| | | package me.zhengjie.modules.system.service.mapstruct; |
| | | package me.zhengjie.modules.assetManagement.service.mapstruct; |
| | | |
| | | import me.zhengjie.base.BaseMapper; |
| | | import me.zhengjie.modules.system.domain.SysUserCompany; |
| | | import me.zhengjie.modules.system.service.dto.SysUserCompanyDto; |
| | | import me.zhengjie.modules.assetManagement.domain.AssetManagement; |
| | | import me.zhengjie.modules.assetManagement.service.dto.AssetManagementDto; |
| | | import org.mapstruct.Mapper; |
| | | import org.mapstruct.ReportingPolicy; |
| | | |
| | | /** |
| | | * @website https://eladmin.vip |
| | | * @author wcd |
| | | * @date 2023-01-30 |
| | | * @date 2023-02-06 |
| | | **/ |
| | | @Mapper(componentModel = "spring", unmappedTargetPolicy = ReportingPolicy.IGNORE) |
| | | public interface SysUserCompanyMapper extends BaseMapper<SysUserCompanyDto, SysUserCompany> { |
| | | public interface AssetManagementMapper extends BaseMapper<AssetManagementDto, AssetManagement> { |
| | | |
| | | } |
copy from eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/service/mapstruct/SysUserCompanyMapper.java
copy to eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/assetManagement/service/mapstruct/AssetUseManagementMapper.java
| File was copied from eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/service/mapstruct/SysUserCompanyMapper.java |
| | |
| | | * See the License for the specific language governing permissions and |
| | | * limitations under the License. |
| | | */ |
| | | package me.zhengjie.modules.system.service.mapstruct; |
| | | package me.zhengjie.modules.assetManagement.service.mapstruct; |
| | | |
| | | import me.zhengjie.base.BaseMapper; |
| | | import me.zhengjie.modules.system.domain.SysUserCompany; |
| | | import me.zhengjie.modules.system.service.dto.SysUserCompanyDto; |
| | | import me.zhengjie.modules.assetManagement.domain.AssetUseManagement; |
| | | import me.zhengjie.modules.assetManagement.service.dto.AssetUseManagementDto; |
| | | import org.mapstruct.Mapper; |
| | | import org.mapstruct.ReportingPolicy; |
| | | |
| | | /** |
| | | * @website https://eladmin.vip |
| | | * @author wcd |
| | | * @date 2023-01-30 |
| | | * @date 2023-02-07 |
| | | **/ |
| | | @Mapper(componentModel = "spring", unmappedTargetPolicy = ReportingPolicy.IGNORE) |
| | | public interface SysUserCompanyMapper extends BaseMapper<SysUserCompanyDto, SysUserCompany> { |
| | | public interface AssetUseManagementMapper extends BaseMapper<AssetUseManagementDto, AssetUseManagement> { |
| | | |
| | | } |
| 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.attendance.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.io.Serializable; |
| | | |
| | | /** |
| | | * @website https://eladmin.vip |
| | | * @description / |
| | | * @author wcd |
| | | * @date 2023-02-10 |
| | | **/ |
| | | @Entity |
| | | @Data |
| | | @Table(name="attendance_month") |
| | | public class AttendanceMonth extends BaseEntity implements Serializable { |
| | | |
| | | @Id |
| | | @GeneratedValue(strategy = GenerationType.IDENTITY) |
| | | @Column(name = "`id`") |
| | | @ApiModelProperty(value = "id") |
| | | private Long id; |
| | | |
| | | @Column(name = "`attendance_date`") |
| | | @ApiModelProperty(value = "统计年月") |
| | | private Timestamp attendanceDate; |
| | | |
| | | @Column(name = "`user_id`") |
| | | @ApiModelProperty(value = "用户id") |
| | | private Long userId; |
| | | |
| | | @Column(name = "`company_id`") |
| | | @ApiModelProperty(value = "公司id") |
| | | private Long companyId; |
| | | |
| | | @Column(name = "`dept_id`") |
| | | @ApiModelProperty(value = "部门id") |
| | | private Long deptId; |
| | | |
| | | @Column(name = "`job_id`") |
| | | @ApiModelProperty(value = "岗位id") |
| | | private Long jobId; |
| | | |
| | | @Column(name = "`required_attendance_days`") |
| | | @ApiModelProperty(value = "应出勤天数") |
| | | private Long requiredAttendanceDays; |
| | | |
| | | @Column(name = "`required_attendance_time`") |
| | | @ApiModelProperty(value = "应出勤时长") |
| | | private Double requiredAttendanceTime; |
| | | |
| | | @Column(name = "`actual_attendance_days`") |
| | | @ApiModelProperty(value = "实际出勤天数") |
| | | private Long actualAttendanceDays; |
| | | |
| | | @Column(name = "`actual_attendance_time`") |
| | | @ApiModelProperty(value = "实际出勤时长") |
| | | private Double actualAttendanceTime; |
| | | |
| | | @Column(name = "`count_of_being_late`") |
| | | @ApiModelProperty(value = "迟到次数") |
| | | private Long countOfBeingLate; |
| | | |
| | | @Column(name = "`time_of_being_late`") |
| | | @ApiModelProperty(value = "迟到时长") |
| | | private Double timeOfBeingLate; |
| | | |
| | | @Column(name = "`count_of_being_early`") |
| | | @ApiModelProperty(value = "早退次数") |
| | | private Long countOfBeingEarly; |
| | | |
| | | @Column(name = "`time_of_being_early`") |
| | | @ApiModelProperty(value = "早退时长") |
| | | private Double timeOfBeingEarly; |
| | | |
| | | @Column(name = "`go_out_number`") |
| | | @ApiModelProperty(value = "外出次数") |
| | | private Long goOutNumber; |
| | | |
| | | @Column(name = "`go_out_time`") |
| | | @ApiModelProperty(value = "外出时长") |
| | | private Double goOutTime; |
| | | |
| | | @Column(name = "`buss_number`") |
| | | @ApiModelProperty(value = "出差次数") |
| | | private Long bussNumber; |
| | | |
| | | @Column(name = "`buss_time`") |
| | | @ApiModelProperty(value = "出差时长") |
| | | private Double bussTime; |
| | | |
| | | @Column(name = "`on_card_number`") |
| | | @ApiModelProperty(value = "上班缺卡次数") |
| | | private Long onCardNumber; |
| | | |
| | | @Column(name = "`off_card_number`") |
| | | @ApiModelProperty(value = "下班缺卡次数") |
| | | private Long offCardNumber; |
| | | |
| | | @Column(name = "`is_publicity`") |
| | | @ApiModelProperty(value = "公示状态") |
| | | private String isPublicity; |
| | | |
| | | @Column(name = "`is_admit`") |
| | | @ApiModelProperty(value = "承认状态") |
| | | private String isAdmit; |
| | | |
| | | @Column(name = "`remarks`") |
| | | @ApiModelProperty(value = "备注") |
| | | private String remarks; |
| | | |
| | | public void copy(AttendanceMonth source){ |
| | | BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true)); |
| | | } |
| | | } |
| 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.attendance.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.io.Serializable; |
| | | |
| | | /** |
| | | * @website https://eladmin.vip |
| | | * @description / |
| | | * @author wcd |
| | | * @date 2023-02-10 |
| | | **/ |
| | | @Entity |
| | | @Data |
| | | @Table(name="attendance_month_leave") |
| | | public class AttendanceMonthLeave extends BaseEntity implements Serializable { |
| | | |
| | | @Id |
| | | @GeneratedValue(strategy = GenerationType.IDENTITY) |
| | | @Column(name = "`id`") |
| | | @ApiModelProperty(value = "id") |
| | | private Long id; |
| | | |
| | | @Column(name = "`attendance_month_id`",nullable = false) |
| | | @NotNull |
| | | @ApiModelProperty(value = "月报id") |
| | | private Long attendanceMonthId; |
| | | |
| | | @Column(name = "`attendance_date`") |
| | | @ApiModelProperty(value = "统计年月") |
| | | private Timestamp attendanceDate; |
| | | |
| | | @Column(name = "`user_id`",nullable = false) |
| | | @NotNull |
| | | @ApiModelProperty(value = "用户id") |
| | | private Long userId; |
| | | |
| | | @Column(name = "`leave_type`",nullable = false) |
| | | @NotBlank |
| | | @ApiModelProperty(value = "请假类型") |
| | | private String leaveType; |
| | | |
| | | @Column(name = "`leave_count`",nullable = false) |
| | | @NotNull |
| | | @ApiModelProperty(value = "请假次数") |
| | | private Long leaveCount; |
| | | |
| | | @Column(name = "`leave_time`",nullable = false) |
| | | @NotNull |
| | | @ApiModelProperty(value = "请假时长") |
| | | private Double leaveTime; |
| | | |
| | | @Column(name = "`surplus_duration`") |
| | | @ApiModelProperty(value = "剩余时长") |
| | | private Double surplusDuration; |
| | | |
| | | @Column(name = "`remarks`") |
| | | @ApiModelProperty(value = "备注") |
| | | private String remarks; |
| | | |
| | | public void copy(AttendanceMonthLeave source){ |
| | | BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true)); |
| | | } |
| | | } |
| | |
| | | //查询请假记录 |
| | | @Query(value = "SELECT * from attendance_leave where user_id = ?1 and leave_start_time < ?3 and leave_end_time > ?2 and approval_status IN ('approval_status_passed')", nativeQuery = true) |
| | | List<AttendanceLeave> findByUserIdAndDate(Long userId, LocalDateTime startDate, LocalDateTime endDate); |
| | | |
| | | //查询请假记录(根据请假类型) |
| | | @Query(value = "SELECT * from attendance_leave where user_id = ?1 and leave_start_time < ?3 and leave_end_time > ?2 and approval_status IN ('approval_status_passed') and leave_type = ?4", nativeQuery = true) |
| | | List<AttendanceLeave> findByUserIdAndDateAndLeaveType(Long userId, LocalDateTime startDate, LocalDateTime endDate,String LeaveType); |
| | | } |
| 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.attendance.repository; |
| | | |
| | | import me.zhengjie.modules.attendance.domain.AttendanceMonthLeave; |
| | | 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 |
| | | * @author wcd |
| | | * @date 2023-02-13 |
| | | **/ |
| | | public interface AttendanceMonthLeaveRepository extends JpaRepository<AttendanceMonthLeave, Long>, JpaSpecificationExecutor<AttendanceMonthLeave> { |
| | | |
| | | /** |
| | | * 根据月报id查询 |
| | | * @param mouthId |
| | | * @return |
| | | */ |
| | | @Query(value = "SELECT * from attendance_month_leave where attendance_month_id = ?1", nativeQuery = true) |
| | | List<AttendanceMonthLeave> findByAttendanceMonthId(Long mouthId); |
| | | |
| | | /** |
| | | * 根据日期查询 |
| | | * @param date |
| | | * @return |
| | | */ |
| | | @Query(value = "SELECT * from attendance_month_leave where attendance_date = ?1", nativeQuery = true) |
| | | List<AttendanceMonthLeave> findByAttendanceDate(String date); |
| | | } |
| 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.attendance.repository; |
| | | |
| | | import me.zhengjie.modules.attendance.domain.AttendanceMonth; |
| | | 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.util.Date; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @website https://eladmin.vip |
| | | * @author wcd |
| | | * @date 2023-02-10 |
| | | **/ |
| | | public interface AttendanceMonthRepository extends JpaRepository<AttendanceMonth, Long>, JpaSpecificationExecutor<AttendanceMonth> { |
| | | |
| | | // 根据日期删除 |
| | | @Modifying |
| | | @Query(value = "delete from attendance_month where attendance_date = ?1",nativeQuery = true) |
| | | void deleteByActualAttendanceDays(String attendanceDate); |
| | | |
| | | /** |
| | | * 根据日期查询考勤月报 |
| | | * @param attendanceDate |
| | | * @return |
| | | */ |
| | | @Query |
| | | List<AttendanceMonth> findByAttendanceDate(Date attendanceDate); |
| | | |
| | | /** |
| | | * 根据日期时间查询 |
| | | * @param attendanceDate |
| | | * @param userId |
| | | * @return |
| | | */ |
| | | @Query(value = "select * from attendance_month where attendance_date = ?1 and user_id = ?2",nativeQuery = true) |
| | | AttendanceMonth findByAttendanceDateAndUserId(String attendanceDate, Long userId); |
| | | |
| | | } |
| | |
| | | **/ |
| | | public interface AttendanceRepository extends JpaRepository<Attendance, Long>, JpaSpecificationExecutor<Attendance> { |
| | | |
| | | /** 根据用户和日期查询考勤记录对象 */ |
| | | /** 根据用户和日期查询考勤记录对象 **/ |
| | | @Query(value = "SELECT * from attendance WHERE user_id = ? and attendance_date = ? " , nativeQuery = true) |
| | | Attendance findAllByUserIdAndAttendanceDate(Long userId, String baseDate); |
| | | |
| | | /** 根据员工姓名模糊查询 */ |
| | | /** 根据员工姓名模糊查询 **/ |
| | | @Query(value = "SELECT * from attendance WHERE " , nativeQuery = true) |
| | | List<AttendanceDto> findByUserNameLike(String userName); |
| | | |
| | | /** 根据时间范围查询考勤记录 **/ |
| | | @Query(value = "SELECT * from attendance where user_id = ?1 and attendance_date <= ?3 and attendance_date >= ?2", nativeQuery = true) |
| | | List<Attendance> findAllByUserAndDate(Long userId, String startDate, String endDate); |
| | | |
| | | /** 根据日期查询考勤表 **/ |
| | | @Query(value = "SELECT * FROM attendance a left join sys_user u on u.user_id = a.user_id WHERE a.attendance_date LIKE ? and u.enabled != 0", nativeQuery = true) |
| | | List<Attendance> findAllLikeDate(String baseDate); |
| | | } |
| 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.attendance.rest; |
| | | |
| | | import me.zhengjie.annotation.Log; |
| | | import me.zhengjie.modules.attendance.domain.AttendanceMonth; |
| | | import me.zhengjie.modules.attendance.service.AttendanceMonthService; |
| | | import me.zhengjie.modules.attendance.service.dto.AttendanceMonthQueryCriteria; |
| | | 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 wcd |
| | | * @date 2023-02-10 |
| | | **/ |
| | | @RestController |
| | | @RequiredArgsConstructor |
| | | @Api(tags = "考勤月报管理") |
| | | @RequestMapping("/api/attendanceMonth") |
| | | public class AttendanceMonthController { |
| | | |
| | | private final AttendanceMonthService attendanceMonthService; |
| | | |
| | | @Log("导出数据") |
| | | @ApiOperation("导出数据") |
| | | @GetMapping(value = "/download") |
| | | @PreAuthorize("@el.check('attendanceMonth:download')") |
| | | public void exportAttendanceMonth(HttpServletResponse response, AttendanceMonthQueryCriteria criteria) throws IOException { |
| | | attendanceMonthService.download(attendanceMonthService.queryAll(criteria), response); |
| | | } |
| | | |
| | | @GetMapping |
| | | @Log("查询考勤月报") |
| | | @ApiOperation("查询考勤月报") |
| | | @PreAuthorize("@el.check('attendanceMonth:list')") |
| | | public ResponseEntity<Object> queryAttendanceMonth(AttendanceMonthQueryCriteria criteria, Pageable pageable){ |
| | | return new ResponseEntity<>(attendanceMonthService.queryAll(criteria,pageable),HttpStatus.OK); |
| | | } |
| | | |
| | | @GetMapping(value = "/all") |
| | | @Log("查询考勤月报") |
| | | @ApiOperation("查询考勤月报") |
| | | @PreAuthorize("@el.check('attendanceMonth:list')") |
| | | public ResponseEntity<Object> queryAttendanceMonth(AttendanceMonthQueryCriteria criteria){ |
| | | return new ResponseEntity<>(attendanceMonthService.queryAll(criteria),HttpStatus.OK); |
| | | } |
| | | |
| | | @PostMapping |
| | | @Log("新增考勤月报") |
| | | @ApiOperation("新增考勤月报") |
| | | @PreAuthorize("@el.check('attendanceMonth:add')") |
| | | public ResponseEntity<Object> createAttendanceMonth(@Validated @RequestBody AttendanceMonth resources){ |
| | | return new ResponseEntity<>(attendanceMonthService.create(resources),HttpStatus.CREATED); |
| | | } |
| | | |
| | | @PutMapping |
| | | @Log("修改考勤月报") |
| | | @ApiOperation("修改考勤月报") |
| | | @PreAuthorize("@el.check('attendanceMonth:edit')") |
| | | public ResponseEntity<Object> updateAttendanceMonth(@Validated @RequestBody AttendanceMonth resources){ |
| | | attendanceMonthService.update(resources); |
| | | return new ResponseEntity<>(HttpStatus.NO_CONTENT); |
| | | } |
| | | |
| | | @DeleteMapping |
| | | @Log("删除考勤月报") |
| | | @ApiOperation("删除考勤月报") |
| | | @PreAuthorize("@el.check('attendanceMonth:del')") |
| | | public ResponseEntity<Object> deleteAttendanceMonth(@RequestBody Long[] ids) { |
| | | attendanceMonthService.deleteAll(ids); |
| | | return new ResponseEntity<>(HttpStatus.OK); |
| | | } |
| | | |
| | | @PutMapping(value = "/updateIsConfirm") |
| | | @Log("月报个人确认") |
| | | @ApiOperation("月报个人确认") |
| | | public ResponseEntity<Object> editIsConfirm(@Validated @RequestBody AttendanceMonth resources){ |
| | | attendanceMonthService.updateConfirm(resources); |
| | | return new ResponseEntity<>(HttpStatus.NO_CONTENT); |
| | | } |
| | | |
| | | @PutMapping(value = "/publicity") |
| | | @Log("公示月报记录") |
| | | @ApiOperation("公示月报记录") |
| | | @PreAuthorize("@el.check('attendanceMonth:publicity')") |
| | | public ResponseEntity<Object> publicityAttendanceMonth(@RequestBody Long[] ids){ |
| | | attendanceMonthService.publicity(ids); |
| | | return new ResponseEntity<>(HttpStatus.NO_CONTENT); |
| | | } |
| | | } |
| 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.attendance.rest; |
| | | |
| | | import me.zhengjie.annotation.Log; |
| | | import me.zhengjie.modules.attendance.domain.AttendanceMonthLeave; |
| | | import me.zhengjie.modules.attendance.service.AttendanceMonthLeaveService; |
| | | import me.zhengjie.modules.attendance.service.dto.AttendanceMonthLeaveQueryCriteria; |
| | | 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 wcd |
| | | * @date 2023-02-13 |
| | | **/ |
| | | @RestController |
| | | @RequiredArgsConstructor |
| | | @Api(tags = "月报请假类型管理") |
| | | @RequestMapping("/api/attendanceMonthLeave") |
| | | public class AttendanceMonthLeaveController { |
| | | |
| | | private final AttendanceMonthLeaveService attendanceMonthLeaveService; |
| | | |
| | | @Log("导出数据") |
| | | @ApiOperation("导出数据") |
| | | @GetMapping(value = "/download") |
| | | @PreAuthorize("@el.check('attendanceMonthLeave:list')") |
| | | public void exportAttendanceMonthLeave(HttpServletResponse response, AttendanceMonthLeaveQueryCriteria criteria) throws IOException { |
| | | attendanceMonthLeaveService.download(attendanceMonthLeaveService.queryAll(criteria), response); |
| | | } |
| | | |
| | | @GetMapping |
| | | @Log("查询月报请假类型") |
| | | @ApiOperation("查询月报请假类型") |
| | | @PreAuthorize("@el.check('attendanceMonthLeave:list')") |
| | | public ResponseEntity<Object> queryAttendanceMonthLeave(AttendanceMonthLeaveQueryCriteria criteria, Pageable pageable){ |
| | | return new ResponseEntity<>(attendanceMonthLeaveService.queryAll(criteria,pageable),HttpStatus.OK); |
| | | } |
| | | |
| | | @PostMapping |
| | | @Log("新增月报请假类型") |
| | | @ApiOperation("新增月报请假类型") |
| | | @PreAuthorize("@el.check('attendanceMonthLeave:add')") |
| | | public ResponseEntity<Object> createAttendanceMonthLeave(@Validated @RequestBody AttendanceMonthLeave resources){ |
| | | return new ResponseEntity<>(attendanceMonthLeaveService.create(resources),HttpStatus.CREATED); |
| | | } |
| | | |
| | | @PutMapping |
| | | @Log("修改月报请假类型") |
| | | @ApiOperation("修改月报请假类型") |
| | | @PreAuthorize("@el.check('attendanceMonthLeave:edit')") |
| | | public ResponseEntity<Object> updateAttendanceMonthLeave(@Validated @RequestBody AttendanceMonthLeave resources){ |
| | | attendanceMonthLeaveService.update(resources); |
| | | return new ResponseEntity<>(HttpStatus.NO_CONTENT); |
| | | } |
| | | |
| | | @DeleteMapping |
| | | @Log("删除月报请假类型") |
| | | @ApiOperation("删除月报请假类型") |
| | | @PreAuthorize("@el.check('attendanceMonthLeave:del')") |
| | | public ResponseEntity<Object> deleteAttendanceMonthLeave(@RequestBody Long[] ids) { |
| | | attendanceMonthLeaveService.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.attendance.service; |
| | | |
| | | import me.zhengjie.modules.attendance.domain.AttendanceMonthLeave; |
| | | import me.zhengjie.modules.attendance.service.dto.AttendanceMonthLeaveDto; |
| | | import me.zhengjie.modules.attendance.service.dto.AttendanceMonthLeaveQueryCriteria; |
| | | 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 wcd |
| | | * @date 2023-02-13 |
| | | **/ |
| | | public interface AttendanceMonthLeaveService { |
| | | |
| | | /** |
| | | * 查询数据分页 |
| | | * @param criteria 条件 |
| | | * @param pageable 分页参数 |
| | | * @return Map<String,Object> |
| | | */ |
| | | Map<String,Object> queryAll(AttendanceMonthLeaveQueryCriteria criteria, Pageable pageable); |
| | | |
| | | /** |
| | | * 查询所有数据不分页 |
| | | * @param criteria 条件参数 |
| | | * @return List<AttendanceMonthLeaveDto> |
| | | */ |
| | | List<AttendanceMonthLeaveDto> queryAll(AttendanceMonthLeaveQueryCriteria criteria); |
| | | |
| | | /** |
| | | * 根据ID查询 |
| | | * @param id ID |
| | | * @return AttendanceMonthLeaveDto |
| | | */ |
| | | AttendanceMonthLeaveDto findById(Long id); |
| | | |
| | | /** |
| | | * 创建 |
| | | * @param resources / |
| | | * @return AttendanceMonthLeaveDto |
| | | */ |
| | | AttendanceMonthLeaveDto create(AttendanceMonthLeave resources); |
| | | |
| | | /** |
| | | * 编辑 |
| | | * @param resources / |
| | | */ |
| | | void update(AttendanceMonthLeave resources); |
| | | |
| | | /** |
| | | * 多选删除 |
| | | * @param ids / |
| | | */ |
| | | void deleteAll(Long[] ids); |
| | | |
| | | /** |
| | | * 导出数据 |
| | | * @param all 待导出的数据 |
| | | * @param response / |
| | | * @throws IOException / |
| | | */ |
| | | void download(List<AttendanceMonthLeaveDto> all, HttpServletResponse response) throws IOException; |
| | | } |
| 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.attendance.service; |
| | | |
| | | import me.zhengjie.modules.attendance.domain.AttendanceMonth; |
| | | import me.zhengjie.modules.attendance.service.dto.AttendanceMonthDto; |
| | | import me.zhengjie.modules.attendance.service.dto.AttendanceMonthQueryCriteria; |
| | | 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 wcd |
| | | * @date 2023-02-10 |
| | | **/ |
| | | public interface AttendanceMonthService { |
| | | |
| | | /** |
| | | * 查询数据分页 |
| | | * @param criteria 条件 |
| | | * @param pageable 分页参数 |
| | | * @return Map<String,Object> |
| | | */ |
| | | Map<String,Object> queryAll(AttendanceMonthQueryCriteria criteria, Pageable pageable); |
| | | |
| | | /** |
| | | * 查询所有数据不分页 |
| | | * @param criteria 条件参数 |
| | | * @return List<AttendanceMonthDto> |
| | | */ |
| | | List<AttendanceMonthDto> queryAll(AttendanceMonthQueryCriteria criteria); |
| | | |
| | | /** |
| | | * 根据ID查询 |
| | | * @param id ID |
| | | * @return AttendanceMonthDto |
| | | */ |
| | | AttendanceMonthDto findById(Long id); |
| | | |
| | | /** |
| | | * 创建 |
| | | * @param resources / |
| | | * @return AttendanceMonthDto |
| | | */ |
| | | AttendanceMonthDto create(AttendanceMonth resources); |
| | | |
| | | /** |
| | | * 编辑 |
| | | * @param resources / |
| | | */ |
| | | void update(AttendanceMonth resources); |
| | | |
| | | /** |
| | | * 多选删除 |
| | | * @param ids / |
| | | */ |
| | | void deleteAll(Long[] ids); |
| | | |
| | | /** |
| | | * 导出数据 |
| | | * @param all 待导出的数据 |
| | | * @param response / |
| | | * @throws IOException / |
| | | */ |
| | | void download(List<AttendanceMonthDto> all, HttpServletResponse response) throws IOException; |
| | | |
| | | /** |
| | | * 月报个人确认 |
| | | * @param resources |
| | | */ |
| | | void updateConfirm(AttendanceMonth resources); |
| | | |
| | | /** |
| | | * 公示月报记录 |
| | | * @param ids / |
| | | */ |
| | | void publicity(Long[] ids); |
| | | } |
| 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.attendance.service.dto; |
| | | |
| | | import lombok.Data; |
| | | import me.zhengjie.base.BaseDTO; |
| | | |
| | | import java.sql.Timestamp; |
| | | import java.io.Serializable; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * @website https://eladmin.vip |
| | | * @description / |
| | | * @author wcd |
| | | * @date 2023-02-10 |
| | | **/ |
| | | @Data |
| | | public class AttendanceMonthDto extends BaseDTO implements Serializable { |
| | | |
| | | private Long id; |
| | | |
| | | /** 统计年月 */ |
| | | private Timestamp attendanceDate; |
| | | |
| | | /** 用户id */ |
| | | private Long userId; |
| | | |
| | | /** 公司id */ |
| | | private Long companyId; |
| | | |
| | | /** 部门id */ |
| | | private Long deptId; |
| | | |
| | | /** 岗位id */ |
| | | private Long jobId; |
| | | |
| | | /** 应出勤天数 */ |
| | | private Long requiredAttendanceDays; |
| | | |
| | | /** 应出勤时长 */ |
| | | private Double requiredAttendanceTime; |
| | | |
| | | /** 实际出勤天数 */ |
| | | private Long actualAttendanceDays; |
| | | |
| | | /** 实际出勤时长 */ |
| | | private Double actualAttendanceTime; |
| | | |
| | | /** 迟到次数 */ |
| | | private Long countOfBeingLate; |
| | | |
| | | /** 迟到时长 */ |
| | | private Double timeOfBeingLate; |
| | | |
| | | /** 早退次数 */ |
| | | private Long countOfBeingEarly; |
| | | |
| | | /** 早退时长 */ |
| | | private Double timeOfBeingEarly; |
| | | |
| | | /** 外出次数 */ |
| | | private Long goOutNumber; |
| | | |
| | | /** 外出时长 */ |
| | | private Double goOutTime; |
| | | |
| | | /** 出差次数 */ |
| | | private Long bussNumber; |
| | | |
| | | /** 出差时长 */ |
| | | private Double bussTime; |
| | | |
| | | /** 上班缺卡次数 */ |
| | | private Long onCardNumber; |
| | | |
| | | /** 下班缺卡次数 */ |
| | | private Long offCardNumber; |
| | | |
| | | /** 公示状态 */ |
| | | private String isPublicity; |
| | | |
| | | /** 承认状态 */ |
| | | private String isAdmit; |
| | | |
| | | /** 备注 */ |
| | | private String remarks; |
| | | |
| | | /** 用户名 */ |
| | | private String nickName; |
| | | |
| | | /** 部门名 */ |
| | | private String deptName; |
| | | |
| | | /** 公司名 */ |
| | | private String companyName; |
| | | |
| | | /** 岗位名 */ |
| | | private String jobName; |
| | | |
| | | /** 请假相关数据 */ |
| | | private List<Map> leaveTypeList; |
| | | |
| | | /** 年假剩余 */ |
| | | private Double yearTime; |
| | | |
| | | } |
| 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.attendance.service.dto; |
| | | |
| | | import lombok.Data; |
| | | import java.sql.Timestamp; |
| | | import java.io.Serializable; |
| | | |
| | | /** |
| | | * @website https://eladmin.vip |
| | | * @description / |
| | | * @author wcd |
| | | * @date 2023-02-13 |
| | | **/ |
| | | @Data |
| | | public class AttendanceMonthLeaveDto implements Serializable { |
| | | |
| | | private Long id; |
| | | |
| | | /** 月报id */ |
| | | private Long attendanceMonthId; |
| | | |
| | | /** 统计年月 */ |
| | | private Timestamp attendanceDate; |
| | | |
| | | /** 用户id */ |
| | | private Long userId; |
| | | |
| | | /** 请假类型 */ |
| | | private String leaveType; |
| | | |
| | | /** 请假次数 */ |
| | | private Long leaveCount; |
| | | |
| | | /** 请假时长 */ |
| | | private Double leaveTime; |
| | | |
| | | /** 剩余时长 */ |
| | | private Double surplusDuration; |
| | | |
| | | /** 备注 */ |
| | | private String remarks; |
| | | |
| | | } |
copy from eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/service/dto/SysUserCompanyQueryCriteria.java
copy to eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/attendance/service/dto/AttendanceMonthLeaveQueryCriteria.java
| File was copied from eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/service/dto/SysUserCompanyQueryCriteria.java |
| | |
| | | * See the License for the specific language governing permissions and |
| | | * limitations under the License. |
| | | */ |
| | | package me.zhengjie.modules.system.service.dto; |
| | | package me.zhengjie.modules.attendance.service.dto; |
| | | |
| | | import lombok.Data; |
| | | import java.util.List; |
| | |
| | | /** |
| | | * @website https://eladmin.vip |
| | | * @author wcd |
| | | * @date 2023-01-30 |
| | | * @date 2023-02-13 |
| | | **/ |
| | | @Data |
| | | public class SysUserCompanyQueryCriteria { |
| | | |
| | | @Query(type = Query.Type.INNER_LIKE) |
| | | private String label; |
| | | public class AttendanceMonthLeaveQueryCriteria{ |
| | | } |
copy from eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/service/dto/SysUserCompanyQueryCriteria.java
copy to eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/attendance/service/dto/AttendanceMonthQueryCriteria.java
| File was copied from eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/service/dto/SysUserCompanyQueryCriteria.java |
| | |
| | | * See the License for the specific language governing permissions and |
| | | * limitations under the License. |
| | | */ |
| | | package me.zhengjie.modules.system.service.dto; |
| | | package me.zhengjie.modules.attendance.service.dto; |
| | | |
| | | import lombok.Data; |
| | | |
| | | import java.sql.Timestamp; |
| | | import java.util.List; |
| | | import me.zhengjie.annotation.Query; |
| | | |
| | | /** |
| | | * @website https://eladmin.vip |
| | | * @author wcd |
| | | * @date 2023-01-30 |
| | | * @date 2023-02-10 |
| | | **/ |
| | | @Data |
| | | public class SysUserCompanyQueryCriteria { |
| | | public class AttendanceMonthQueryCriteria{ |
| | | |
| | | @Query(type = Query.Type.INNER_LIKE) |
| | | private String label; |
| | | @Query |
| | | private Long userId; |
| | | |
| | | @Query |
| | | private String attendanceDate; |
| | | |
| | | @Query |
| | | private String isPublicity; |
| | | } |
| 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.attendance.service.impl; |
| | | |
| | | import me.zhengjie.modules.attendance.domain.AttendanceMonthLeave; |
| | | import me.zhengjie.modules.attendance.service.AttendanceMonthLeaveService; |
| | | import me.zhengjie.modules.attendance.service.mapstruct.AttendanceMonthLeaveMapper; |
| | | import me.zhengjie.utils.ValidationUtil; |
| | | import me.zhengjie.utils.FileUtil; |
| | | import lombok.RequiredArgsConstructor; |
| | | import me.zhengjie.modules.attendance.repository.AttendanceMonthLeaveRepository; |
| | | import me.zhengjie.modules.attendance.service.dto.AttendanceMonthLeaveDto; |
| | | import me.zhengjie.modules.attendance.service.dto.AttendanceMonthLeaveQueryCriteria; |
| | | 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.util.List; |
| | | import java.util.Map; |
| | | import java.io.IOException; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.util.ArrayList; |
| | | import java.util.LinkedHashMap; |
| | | |
| | | /** |
| | | * @website https://eladmin.vip |
| | | * @description 服务实现 |
| | | * @author wcd |
| | | * @date 2023-02-13 |
| | | **/ |
| | | @Service |
| | | @RequiredArgsConstructor |
| | | public class AttendanceMonthLeaveServiceImpl implements AttendanceMonthLeaveService { |
| | | |
| | | private final AttendanceMonthLeaveRepository attendanceMonthLeaveRepository; |
| | | private final AttendanceMonthLeaveMapper attendanceMonthLeaveMapper; |
| | | |
| | | @Override |
| | | public Map<String,Object> queryAll(AttendanceMonthLeaveQueryCriteria criteria, Pageable pageable){ |
| | | Page<AttendanceMonthLeave> page = attendanceMonthLeaveRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable); |
| | | return PageUtil.toPage(page.map(attendanceMonthLeaveMapper::toDto)); |
| | | } |
| | | |
| | | @Override |
| | | public List<AttendanceMonthLeaveDto> queryAll(AttendanceMonthLeaveQueryCriteria criteria){ |
| | | return attendanceMonthLeaveMapper.toDto(attendanceMonthLeaveRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder))); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional |
| | | public AttendanceMonthLeaveDto findById(Long id) { |
| | | AttendanceMonthLeave attendanceMonthLeave = attendanceMonthLeaveRepository.findById(id).orElseGet(AttendanceMonthLeave::new); |
| | | ValidationUtil.isNull(attendanceMonthLeave.getId(),"AttendanceMonthLeave","id",id); |
| | | return attendanceMonthLeaveMapper.toDto(attendanceMonthLeave); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public AttendanceMonthLeaveDto create(AttendanceMonthLeave resources) { |
| | | return attendanceMonthLeaveMapper.toDto(attendanceMonthLeaveRepository.save(resources)); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void update(AttendanceMonthLeave resources) { |
| | | AttendanceMonthLeave attendanceMonthLeave = attendanceMonthLeaveRepository.findById(resources.getId()).orElseGet(AttendanceMonthLeave::new); |
| | | ValidationUtil.isNull( attendanceMonthLeave.getId(),"AttendanceMonthLeave","id",resources.getId()); |
| | | attendanceMonthLeave.copy(resources); |
| | | attendanceMonthLeaveRepository.save(attendanceMonthLeave); |
| | | } |
| | | |
| | | @Override |
| | | public void deleteAll(Long[] ids) { |
| | | for (Long id : ids) { |
| | | attendanceMonthLeaveRepository.deleteById(id); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public void download(List<AttendanceMonthLeaveDto> all, HttpServletResponse response) throws IOException { |
| | | List<Map<String, Object>> list = new ArrayList<>(); |
| | | for (AttendanceMonthLeaveDto attendanceMonthLeave : all) { |
| | | Map<String,Object> map = new LinkedHashMap<>(); |
| | | map.put("月报id", attendanceMonthLeave.getAttendanceMonthId()); |
| | | map.put("统计年月", attendanceMonthLeave.getAttendanceDate()); |
| | | map.put("用户id", attendanceMonthLeave.getUserId()); |
| | | map.put("请假类型", attendanceMonthLeave.getLeaveType()); |
| | | map.put("请假次数", attendanceMonthLeave.getLeaveCount()); |
| | | map.put("请假时长", attendanceMonthLeave.getLeaveTime()); |
| | | map.put("剩余时长", attendanceMonthLeave.getSurplusDuration()); |
| | | list.add(map); |
| | | } |
| | | FileUtil.downloadExcel(list, response); |
| | | } |
| | | } |
| 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.attendance.service.impl; |
| | | |
| | | import lombok.SneakyThrows; |
| | | import me.zhengjie.exception.BadRequestException; |
| | | import me.zhengjie.modules.attendance.domain.AttendanceMonth; |
| | | import me.zhengjie.modules.attendance.domain.AttendanceMonthLeave; |
| | | import me.zhengjie.modules.attendance.repository.AttendanceMonthLeaveRepository; |
| | | import me.zhengjie.modules.constant.Constant; |
| | | import me.zhengjie.modules.salary.domain.Salary; |
| | | import me.zhengjie.modules.salary.service.dto.SalaryDto; |
| | | import me.zhengjie.modules.system.domain.Dept; |
| | | import me.zhengjie.modules.system.domain.Job; |
| | | import me.zhengjie.modules.system.domain.SysCompany; |
| | | import me.zhengjie.modules.system.domain.User; |
| | | import me.zhengjie.modules.system.repository.*; |
| | | import me.zhengjie.modules.system.service.RoleService; |
| | | import me.zhengjie.modules.system.service.dto.RoleSmallDto; |
| | | import me.zhengjie.utils.*; |
| | | import lombok.RequiredArgsConstructor; |
| | | import me.zhengjie.modules.attendance.repository.AttendanceMonthRepository; |
| | | import me.zhengjie.modules.attendance.service.AttendanceMonthService; |
| | | import me.zhengjie.modules.attendance.service.dto.AttendanceMonthDto; |
| | | import me.zhengjie.modules.attendance.service.dto.AttendanceMonthQueryCriteria; |
| | | import me.zhengjie.modules.attendance.service.mapstruct.AttendanceMonthMapper; |
| | | import org.apache.commons.lang3.ObjectUtils; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.data.domain.Page; |
| | | import org.springframework.data.domain.Pageable; |
| | | |
| | | import java.util.*; |
| | | import java.io.IOException; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.util.function.Function; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * @website https://eladmin.vip |
| | | * @description 服务实现 |
| | | * @author wcd |
| | | * @date 2023-02-10 |
| | | **/ |
| | | @Service |
| | | @RequiredArgsConstructor |
| | | public class AttendanceMonthServiceImpl implements AttendanceMonthService { |
| | | |
| | | private final AttendanceMonthRepository attendanceMonthRepository; |
| | | private final AttendanceMonthMapper attendanceMonthMapper; |
| | | private final UserRepository userRepository; |
| | | private final SysCompanyRepository sysCompanyRepository; |
| | | private final DeptRepository deptRepository; |
| | | private final JobRepository jobRepository; |
| | | private final AttendanceMonthLeaveRepository attendanceMonthLeaveRepository; |
| | | private final AttendanceLeaveServiceImpl attendanceLeaveService; |
| | | private final RoleService roleService; |
| | | private final DictDetailRepository dictDetailRepository; |
| | | |
| | | @Override |
| | | public Map<String,Object> queryAll(AttendanceMonthQueryCriteria criteria, Pageable pageable){ |
| | | // 判断工资查询类年月是否为空 |
| | | if (criteria.getAttendanceDate() != null && !"".equals(criteria.getAttendanceDate())) { |
| | | // 年月:国际时间转中国时间 |
| | | criteria.setAttendanceDate(DateUtil.internationalTimeToChinaTime(criteria.getAttendanceDate())); |
| | | } |
| | | // 获取登录用户角色等级 |
| | | List<Integer> levels = roleService.findByUsersId(SecurityUtils.getCurrentUserId()).stream().map(RoleSmallDto::getLevel).collect(Collectors.toList()); |
| | | // 登录用户最大角色等级 |
| | | int min = Collections.min(levels); |
| | | // 判断角色等级 |
| | | if (min == Constant.ROLE_LEVEL_MANAGER || min == Constant.ROLE_LEVEL_LEADER || min == Constant.ROLE_LEVEL_ORDINARY) { |
| | | criteria.setUserId(SecurityUtils.getCurrentUserId()); |
| | | criteria.setIsPublicity(Constant.PUBLICITY_STATUS_YES); |
| | | } |
| | | Page<AttendanceMonth> page = attendanceMonthRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable); |
| | | // 将实体类转换为DTO(重写) |
| | | Function<AttendanceMonth, AttendanceMonthDto> func = new Function<AttendanceMonth, AttendanceMonthDto>(){ |
| | | @SneakyThrows |
| | | @Override |
| | | public AttendanceMonthDto apply(AttendanceMonth t) { |
| | | // 将实体类转换成DTO |
| | | AttendanceMonthDto attendanceMonthDto = attendanceMonthMapper.toDto(t); |
| | | // 根据用户ID查询用户信息 |
| | | User user = userRepository.findById(attendanceMonthDto.getUserId()).orElseGet(User::new); |
| | | // 用户昵称 |
| | | attendanceMonthDto.setNickName(user.getNickName()); |
| | | // 查询公司 |
| | | SysCompany sysCompany = sysCompanyRepository.findById(attendanceMonthDto.getCompanyId()).orElseGet(SysCompany::new); |
| | | attendanceMonthDto.setCompanyName(sysCompany.getLabel()); |
| | | // 查询部门 |
| | | Dept dept = deptRepository.findById(attendanceMonthDto.getDeptId()).orElseGet(Dept::new); |
| | | attendanceMonthDto.setDeptName(dept.getName()); |
| | | // 查询岗位 |
| | | if(ObjectUtils.isNotEmpty(attendanceMonthDto.getJobId())){ |
| | | Job job = jobRepository.findById(attendanceMonthDto.getJobId()).orElseGet(Job::new); |
| | | attendanceMonthDto.setJobName(job.getName()); |
| | | } |
| | | List<Map> leaveTypeList = new ArrayList<>(); |
| | | // 查询请假类型表 |
| | | List<AttendanceMonthLeave> attendanceMonthLeaves = attendanceMonthLeaveRepository.findByAttendanceMonthId(attendanceMonthDto.getId()); |
| | | if(attendanceMonthLeaves.size() != 0){ |
| | | for(int i = 0; i < attendanceMonthLeaves.size(); i++){ |
| | | Map attTypeInfo = new HashMap(); |
| | | attTypeInfo.put("leaveType", attendanceMonthLeaves.get(i).getLeaveType()); |
| | | attTypeInfo.put("leaveCount", attendanceMonthLeaves.get(i).getLeaveCount()); |
| | | attTypeInfo.put("leaveTime", attendanceMonthLeaves.get(i).getLeaveTime()); |
| | | if(attendanceMonthLeaves.get(i).getLeaveType().equals(Constant.LEAVE_TYPE_ANNUAL_LEAVE)){ |
| | | attTypeInfo.put("leaveYearTime", attendanceMonthLeaves.get(i).getSurplusDuration() == null ? 0 : attendanceMonthLeaves.get(i).getSurplusDuration()); |
| | | } |
| | | leaveTypeList.add(attTypeInfo); |
| | | } |
| | | }else{ |
| | | Double yearTime = attendanceLeaveService.getYearTimeLength(attendanceMonthDto.getUserId()); |
| | | attendanceMonthDto.setYearTime(yearTime); |
| | | } |
| | | attendanceMonthDto.setLeaveTypeList(leaveTypeList); |
| | | // 返回处理好的DTO |
| | | return attendanceMonthDto; |
| | | } |
| | | }; |
| | | return PageUtil.toPage(page.map(func)); |
| | | } |
| | | |
| | | @Override |
| | | public List<AttendanceMonthDto> queryAll(AttendanceMonthQueryCriteria criteria){ |
| | | return attendanceMonthMapper.toDto(attendanceMonthRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder))); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional |
| | | public AttendanceMonthDto findById(Long id) { |
| | | AttendanceMonth attendanceMonth = attendanceMonthRepository.findById(id).orElseGet(AttendanceMonth::new); |
| | | ValidationUtil.isNull(attendanceMonth.getId(),"AttendanceMonth","id",id); |
| | | return attendanceMonthMapper.toDto(attendanceMonth); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public AttendanceMonthDto create(AttendanceMonth resources) { |
| | | // 根据用户ID和年月查询 |
| | | AttendanceMonth attendanceMonth = attendanceMonthRepository.findByAttendanceDateAndUserId(resources.getAttendanceDate().toString().substring(0,19),resources.getUserId()); |
| | | // 判断列表长度 |
| | | if (ObjectUtils.isNotEmpty(attendanceMonth)) { |
| | | throw new BadRequestException("找到相同用户相同年月的月报记录!"); |
| | | } |
| | | return attendanceMonthMapper.toDto(attendanceMonthRepository.save(resources)); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void update(AttendanceMonth resources) { |
| | | // 根据用户ID和年月查询 |
| | | AttendanceMonth attendanceMonth = attendanceMonthRepository.findByAttendanceDateAndUserId(resources.getAttendanceDate().toString().substring(0,19),resources.getUserId()); |
| | | // 判断列表长度 |
| | | if (ObjectUtils.isNotEmpty(attendanceMonth) && attendanceMonth.getId() != resources.getId()) { |
| | | throw new BadRequestException("找到相同用户相同年月的月报记录!"); |
| | | } |
| | | // 判断承认状态 |
| | | if (ObjectUtils.isNotEmpty(attendanceMonth) && Constant.APPROVE_STATUS_ACKNOWLEDGED.equals(attendanceMonth.getIsAdmit())) { |
| | | throw new BadRequestException("已承认的月报记录无法进行修改!"); |
| | | } |
| | | ValidationUtil.isNull( attendanceMonth.getId(),"AttendanceMonth","id",resources.getId()); |
| | | attendanceMonth.copy(resources); |
| | | attendanceMonthRepository.save(attendanceMonth); |
| | | } |
| | | |
| | | @Override |
| | | public void deleteAll(Long[] ids) { |
| | | for (Long id : ids) { |
| | | attendanceMonthRepository.deleteById(id); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 月报个人确认 |
| | | * @param resources |
| | | */ |
| | | @Override |
| | | public void updateConfirm(AttendanceMonth resources) { |
| | | AttendanceMonth attendanceMonth = attendanceMonthRepository.findById(resources.getId()).orElseGet(AttendanceMonth::new); |
| | | attendanceMonth.setIsAdmit(Constant.APPROVE_STATUS_ACKNOWLEDGED); |
| | | attendanceMonthRepository.save(attendanceMonth); |
| | | } |
| | | |
| | | /** |
| | | * 公示月报信息 |
| | | * @param ids / |
| | | */ |
| | | @Override |
| | | public void publicity(Long[] ids) { |
| | | // 循环ID列表 |
| | | for (Long id : ids) { |
| | | // 查询月报 |
| | | AttendanceMonth attendanceMonth = attendanceMonthRepository.findById(id).orElseGet(AttendanceMonth::new); |
| | | ValidationUtil.isNull( attendanceMonth.getId(),"AttendanceMonth","id",id); |
| | | // 公示状态 |
| | | attendanceMonth.setIsPublicity(Constant.PUBLICITY_STATUS_YES); |
| | | // 保存 |
| | | attendanceMonthRepository.save(attendanceMonth); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public void download(List<AttendanceMonthDto> all, HttpServletResponse response) throws IOException { |
| | | List<Map<String, Object>> list = new ArrayList<>(); |
| | | for (AttendanceMonthDto attendanceMonth : all) { |
| | | // 根据用户ID查询用户信息 |
| | | User user = userRepository.findById(attendanceMonth.getUserId()).orElseGet(User::new); |
| | | // 查询公司 |
| | | SysCompany sysCompany = sysCompanyRepository.findById(attendanceMonth.getCompanyId()).orElseGet(SysCompany::new); |
| | | // 查询部门 |
| | | Dept dept = deptRepository.findById(attendanceMonth.getDeptId()).orElseGet(Dept::new); |
| | | Job job = new Job(); |
| | | // 查询岗位 |
| | | if(attendanceMonth.getJobId() != null){ |
| | | job = jobRepository.findById(attendanceMonth.getJobId()).orElseGet(Job::new); |
| | | } |
| | | String isAdmit = attendanceMonth.getIsAdmit() != null ? dictDetailRepository.findByDictNameAndValue(Constant.APPROVE_STATUS_ACKNOWLEDGED, attendanceMonth.getIsAdmit()).getLabel() : ""; |
| | | String isP = attendanceMonth.getIsPublicity() != null ? dictDetailRepository.findByDictNameAndValue(Constant.PUBLICITY_STATUS_YES, attendanceMonth.getIsPublicity()).getLabel() : ""; |
| | | Map<String,Object> map = new LinkedHashMap<>(); |
| | | map.put("统计年月", attendanceMonth.getAttendanceDate()); |
| | | map.put("用户", user.getNickName()); |
| | | map.put("公司", sysCompany.getLabel()); |
| | | map.put("部门", dept.getName()); |
| | | map.put("岗位", job == null ? null : job.getName()); |
| | | map.put("应出勤天数", attendanceMonth.getRequiredAttendanceDays()); |
| | | map.put("应出勤时长", attendanceMonth.getRequiredAttendanceTime()); |
| | | map.put("实际出勤天数", attendanceMonth.getActualAttendanceDays()); |
| | | map.put("实际出勤时长", attendanceMonth.getActualAttendanceTime()); |
| | | map.put("迟到次数", attendanceMonth.getCountOfBeingLate()); |
| | | map.put("迟到时长", attendanceMonth.getTimeOfBeingLate()); |
| | | map.put("早退次数", attendanceMonth.getCountOfBeingEarly()); |
| | | map.put("早退时长", attendanceMonth.getTimeOfBeingEarly()); |
| | | map.put("外出次数", attendanceMonth.getGoOutNumber()); |
| | | map.put("外出时长", attendanceMonth.getGoOutTime()); |
| | | map.put("出差次数", attendanceMonth.getBussNumber()); |
| | | map.put("出差时长", attendanceMonth.getBussTime()); |
| | | map.put("上班缺卡次数", attendanceMonth.getOnCardNumber()); |
| | | map.put("下班缺卡次数", attendanceMonth.getOffCardNumber()); |
| | | map.put("公示状态", attendanceMonth.getIsPublicity()); |
| | | map.put("承认状态", isAdmit); |
| | | map.put("备注", attendanceMonth.getRemarks()); |
| | | map.put("创建者", attendanceMonth.getCreateBy()); |
| | | map.put("创建时间", attendanceMonth.getCreateTime()); |
| | | map.put("更新者", attendanceMonth.getUpdateBy()); |
| | | map.put("更新时间", attendanceMonth.getUpdateTime()); |
| | | list.add(map); |
| | | } |
| | | FileUtil.downloadExcel(list, response); |
| | | } |
| | | } |
copy from eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/service/mapstruct/SysUserCompanyMapper.java
copy to eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/attendance/service/mapstruct/AttendanceMonthLeaveMapper.java
| File was copied from eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/service/mapstruct/SysUserCompanyMapper.java |
| | |
| | | * See the License for the specific language governing permissions and |
| | | * limitations under the License. |
| | | */ |
| | | package me.zhengjie.modules.system.service.mapstruct; |
| | | package me.zhengjie.modules.attendance.service.mapstruct; |
| | | |
| | | import me.zhengjie.base.BaseMapper; |
| | | import me.zhengjie.modules.system.domain.SysUserCompany; |
| | | import me.zhengjie.modules.system.service.dto.SysUserCompanyDto; |
| | | import me.zhengjie.modules.attendance.domain.AttendanceMonthLeave; |
| | | import me.zhengjie.modules.attendance.service.dto.AttendanceMonthLeaveDto; |
| | | import org.mapstruct.Mapper; |
| | | import org.mapstruct.ReportingPolicy; |
| | | |
| | | /** |
| | | * @website https://eladmin.vip |
| | | * @author wcd |
| | | * @date 2023-01-30 |
| | | * @date 2023-02-13 |
| | | **/ |
| | | @Mapper(componentModel = "spring", unmappedTargetPolicy = ReportingPolicy.IGNORE) |
| | | public interface SysUserCompanyMapper extends BaseMapper<SysUserCompanyDto, SysUserCompany> { |
| | | public interface AttendanceMonthLeaveMapper extends BaseMapper<AttendanceMonthLeaveDto, AttendanceMonthLeave> { |
| | | |
| | | } |
copy from eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/service/mapstruct/SysUserCompanyMapper.java
copy to eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/attendance/service/mapstruct/AttendanceMonthMapper.java
| File was copied from eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/service/mapstruct/SysUserCompanyMapper.java |
| | |
| | | * See the License for the specific language governing permissions and |
| | | * limitations under the License. |
| | | */ |
| | | package me.zhengjie.modules.system.service.mapstruct; |
| | | package me.zhengjie.modules.attendance.service.mapstruct; |
| | | |
| | | import me.zhengjie.base.BaseMapper; |
| | | import me.zhengjie.modules.system.domain.SysUserCompany; |
| | | import me.zhengjie.modules.system.service.dto.SysUserCompanyDto; |
| | | import me.zhengjie.modules.attendance.domain.AttendanceMonth; |
| | | import me.zhengjie.modules.attendance.service.dto.AttendanceMonthDto; |
| | | import org.mapstruct.Mapper; |
| | | import org.mapstruct.ReportingPolicy; |
| | | |
| | | /** |
| | | * @website https://eladmin.vip |
| | | * @author wcd |
| | | * @date 2023-01-30 |
| | | * @date 2023-02-10 |
| | | **/ |
| | | @Mapper(componentModel = "spring", unmappedTargetPolicy = ReportingPolicy.IGNORE) |
| | | public interface SysUserCompanyMapper extends BaseMapper<SysUserCompanyDto, SysUserCompany> { |
| | | public interface AttendanceMonthMapper extends BaseMapper<AttendanceMonthDto, AttendanceMonth> { |
| | | |
| | | } |
copy from eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/domain/SysUserCompany.java
copy to eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/capitalFlow/domain/CapitalFlow.java
| File was copied from eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/domain/SysUserCompany.java |
| | |
| | | * See the License for the specific language governing permissions and |
| | | * limitations under the License. |
| | | */ |
| | | package me.zhengjie.modules.system.domain; |
| | | package me.zhengjie.modules.capitalFlow.domain; |
| | | |
| | | import lombok.Data; |
| | | import cn.hutool.core.bean.BeanUtil; |
| | |
| | | import me.zhengjie.base.BaseEntity; |
| | | |
| | | import javax.persistence.*; |
| | | import javax.validation.constraints.*; |
| | | import java.sql.Timestamp; |
| | | import java.io.Serializable; |
| | | |
| | | /** |
| | | * @website https://eladmin.vip |
| | | * @description / |
| | | * @author wcd |
| | | * @date 2023-01-30 |
| | | * @author 赵士淞 |
| | | * @date 2023-02-13 |
| | | **/ |
| | | @Entity |
| | | @Data |
| | | @Table(name="sys_user_company") |
| | | public class SysUserCompany extends BaseEntity implements Serializable { |
| | | @Table(name="capital_flow") |
| | | public class CapitalFlow extends BaseEntity implements Serializable { |
| | | |
| | | @Id |
| | | @GeneratedValue(strategy = GenerationType.IDENTITY) |
| | | @Column(name = "`id`") |
| | | @ApiModelProperty(value = "id") |
| | | @ApiModelProperty(value = "ID") |
| | | private Long id; |
| | | |
| | | @Column(name = "`description`") |
| | | @ApiModelProperty(value = "描述") |
| | | private String description; |
| | | @Column(name = "`flow_year_month`",nullable = false) |
| | | @NotNull |
| | | @ApiModelProperty(value = "流水年月") |
| | | private Timestamp flowYearMonth; |
| | | |
| | | @Column(name = "`label`") |
| | | @ApiModelProperty(value = "标签") |
| | | private String label; |
| | | @Column(name = "`company_id`",nullable = false) |
| | | @NotNull |
| | | @ApiModelProperty(value = "所属公司") |
| | | private Long companyId; |
| | | |
| | | @Column(name = "`value`") |
| | | @ApiModelProperty(value = "值") |
| | | private String value; |
| | | @Column(name = "`remarks`") |
| | | @ApiModelProperty(value = "备注") |
| | | private String remarks; |
| | | |
| | | public void copy(SysUserCompany source){ |
| | | public void copy(CapitalFlow source){ |
| | | BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true)); |
| | | } |
| | | } |
| 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.capitalFlow.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-13 |
| | | **/ |
| | | @Entity |
| | | @Data |
| | | @Table(name="capital_flow_expend") |
| | | public class CapitalFlowExpend extends BaseEntity implements Serializable { |
| | | |
| | | @Id |
| | | @GeneratedValue(strategy = GenerationType.IDENTITY) |
| | | @Column(name = "`id`") |
| | | @ApiModelProperty(value = "ID") |
| | | private Long id; |
| | | |
| | | @Column(name = "`flow_id`",nullable = false) |
| | | @NotNull |
| | | @ApiModelProperty(value = "所属流水") |
| | | private Long flowId; |
| | | |
| | | @Column(name = "`title`",nullable = false) |
| | | @NotBlank |
| | | @ApiModelProperty(value = "标题") |
| | | private String title; |
| | | |
| | | @Column(name = "`amount`",nullable = false) |
| | | @NotNull |
| | | @ApiModelProperty(value = "金额") |
| | | private BigDecimal amount; |
| | | |
| | | @Column(name = "`remarks`") |
| | | @ApiModelProperty(value = "备注") |
| | | private String remarks; |
| | | |
| | | public void copy(CapitalFlowExpend source){ |
| | | BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true)); |
| | | } |
| | | } |
| 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.capitalFlow.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-13 |
| | | **/ |
| | | @Entity |
| | | @Data |
| | | @Table(name="capital_flow_income") |
| | | public class CapitalFlowIncome extends BaseEntity implements Serializable { |
| | | |
| | | @Id |
| | | @GeneratedValue(strategy = GenerationType.IDENTITY) |
| | | @Column(name = "`id`") |
| | | @ApiModelProperty(value = "ID") |
| | | private Long id; |
| | | |
| | | @Column(name = "`flow_id`",nullable = false) |
| | | @NotNull |
| | | @ApiModelProperty(value = "所属流水") |
| | | private Long flowId; |
| | | |
| | | @Column(name = "`title`",nullable = false) |
| | | @NotBlank |
| | | @ApiModelProperty(value = "标题") |
| | | private String title; |
| | | |
| | | @Column(name = "`amount`",nullable = false) |
| | | @NotNull |
| | | @ApiModelProperty(value = "金额") |
| | | private BigDecimal amount; |
| | | |
| | | @Column(name = "`remarks`") |
| | | @ApiModelProperty(value = "备注") |
| | | private String remarks; |
| | | |
| | | public void copy(CapitalFlowIncome source){ |
| | | BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true)); |
| | | } |
| | | } |
| 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.capitalFlow.repository; |
| | | |
| | | import me.zhengjie.modules.capitalFlow.domain.CapitalFlowExpend; |
| | | 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.Query; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @website https://eladmin.vip |
| | | * @author 赵士淞 |
| | | * @date 2023-02-13 |
| | | **/ |
| | | public interface CapitalFlowExpendRepository extends JpaRepository<CapitalFlowExpend, Long>, JpaSpecificationExecutor<CapitalFlowExpend> { |
| | | |
| | | /** |
| | | * 根据流水ID查询 |
| | | * @param flowId |
| | | * @return |
| | | */ |
| | | List<CapitalFlowExpend> findByFlowId(Long flowId); |
| | | |
| | | /** |
| | | * 根据流水ID查询金额总和 |
| | | * @return |
| | | */ |
| | | @Query(value = "SELECT SUM(amount) FROM capital_flow_expend WHERE flow_id = ?1", nativeQuery = true) |
| | | BigDecimal sumAmountByFlowId(Long flowId); |
| | | } |
| 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.capitalFlow.repository; |
| | | |
| | | import me.zhengjie.modules.capitalFlow.domain.CapitalFlowIncome; |
| | | 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.Query; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @website https://eladmin.vip |
| | | * @author 赵士淞 |
| | | * @date 2023-02-13 |
| | | **/ |
| | | public interface CapitalFlowIncomeRepository extends JpaRepository<CapitalFlowIncome, Long>, JpaSpecificationExecutor<CapitalFlowIncome> { |
| | | |
| | | /** |
| | | * 根据流水ID查询 |
| | | * @param flowId |
| | | * @return |
| | | */ |
| | | List<CapitalFlowIncome> findByFlowId(Long flowId); |
| | | |
| | | /** |
| | | * 根据流水ID查询金额总和 |
| | | * @return |
| | | */ |
| | | @Query(value = "SELECT SUM(amount) FROM capital_flow_income WHERE flow_id = ?1", nativeQuery = true) |
| | | BigDecimal sumAmountByFlowId(Long flowId); |
| | | } |
copy from eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/repository/SysUserCompanyRepository.java
copy to eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/capitalFlow/repository/CapitalFlowRepository.java
| File was copied from eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/repository/SysUserCompanyRepository.java |
| | |
| | | * See the License for the specific language governing permissions and |
| | | * limitations under the License. |
| | | */ |
| | | package me.zhengjie.modules.system.repository; |
| | | package me.zhengjie.modules.capitalFlow.repository; |
| | | |
| | | import me.zhengjie.modules.system.domain.SysUserCompany; |
| | | 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; |
| | | |
| | | /** |
| | | * @website https://eladmin.vip |
| | | * @author wcd |
| | | * @date 2023-01-30 |
| | | * @author 赵士淞 |
| | | * @date 2023-02-13 |
| | | **/ |
| | | public interface SysUserCompanyRepository extends JpaRepository<SysUserCompany, Long>, JpaSpecificationExecutor<SysUserCompany> { |
| | | |
| | | /** |
| | | * 根据value查询公司(导出用) |
| | | * @return |
| | | */ |
| | | @Query |
| | | SysUserCompany findByValue(String value); |
| | | public interface CapitalFlowRepository extends JpaRepository<CapitalFlow, Long>, JpaSpecificationExecutor<CapitalFlow> { |
| | | } |
| 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.capitalFlow.rest; |
| | | |
| | | import me.zhengjie.annotation.Log; |
| | | import me.zhengjie.modules.capitalFlow.domain.CapitalFlow; |
| | | import me.zhengjie.modules.capitalFlow.service.CapitalFlowService; |
| | | import me.zhengjie.modules.capitalFlow.service.dto.CapitalFlowQueryCriteria; |
| | | 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-13 |
| | | **/ |
| | | @RestController |
| | | @RequiredArgsConstructor |
| | | @Api(tags = "资金流水管理") |
| | | @RequestMapping("/api/capitalFlow") |
| | | public class CapitalFlowController { |
| | | |
| | | private final CapitalFlowService capitalFlowService; |
| | | |
| | | @Log("导出数据") |
| | | @ApiOperation("导出数据") |
| | | @GetMapping(value = "/download") |
| | | @PreAuthorize("@el.check('capitalFlow:download')") |
| | | public void exportCapitalFlow(HttpServletResponse response, CapitalFlowQueryCriteria criteria) throws IOException { |
| | | capitalFlowService.download(capitalFlowService.queryAll(criteria), response); |
| | | } |
| | | |
| | | @GetMapping |
| | | @Log("查询资金流水") |
| | | @ApiOperation("查询资金流水") |
| | | @PreAuthorize("@el.check('capitalFlow:list')") |
| | | public ResponseEntity<Object> queryCapitalFlow(CapitalFlowQueryCriteria criteria, Pageable pageable){ |
| | | return new ResponseEntity<>(capitalFlowService.queryAll(criteria,pageable),HttpStatus.OK); |
| | | } |
| | | |
| | | @GetMapping(value = "/all") |
| | | @Log("查询资金流水") |
| | | @ApiOperation("查询资金流水") |
| | | @PreAuthorize("@el.check('capitalFlow:list')") |
| | | public ResponseEntity<Object> queryCapitalFlow(CapitalFlowQueryCriteria criteria){ |
| | | return new ResponseEntity<>(capitalFlowService.queryAll(criteria),HttpStatus.OK); |
| | | } |
| | | |
| | | @PostMapping |
| | | @Log("新增资金流水") |
| | | @ApiOperation("新增资金流水") |
| | | @PreAuthorize("@el.check('capitalFlow:add')") |
| | | public ResponseEntity<Object> createCapitalFlow(@Validated @RequestBody CapitalFlow resources){ |
| | | return new ResponseEntity<>(capitalFlowService.create(resources),HttpStatus.CREATED); |
| | | } |
| | | |
| | | @PutMapping |
| | | @Log("修改资金流水") |
| | | @ApiOperation("修改资金流水") |
| | | @PreAuthorize("@el.check('capitalFlow:edit')") |
| | | public ResponseEntity<Object> updateCapitalFlow(@Validated @RequestBody CapitalFlow resources){ |
| | | capitalFlowService.update(resources); |
| | | return new ResponseEntity<>(HttpStatus.NO_CONTENT); |
| | | } |
| | | |
| | | @DeleteMapping |
| | | @Log("删除资金流水") |
| | | @ApiOperation("删除资金流水") |
| | | @PreAuthorize("@el.check('capitalFlow:del')") |
| | | public ResponseEntity<Object> deleteCapitalFlow(@RequestBody Long[] ids) { |
| | | capitalFlowService.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.capitalFlow.rest; |
| | | |
| | | import me.zhengjie.annotation.Log; |
| | | import me.zhengjie.modules.capitalFlow.domain.CapitalFlowExpend; |
| | | import me.zhengjie.modules.capitalFlow.service.CapitalFlowExpendService; |
| | | import me.zhengjie.modules.capitalFlow.service.dto.CapitalFlowExpendQueryCriteria; |
| | | 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-13 |
| | | **/ |
| | | @RestController |
| | | @RequiredArgsConstructor |
| | | @Api(tags = "资金流水支出管理") |
| | | @RequestMapping("/api/capitalFlowExpend") |
| | | public class CapitalFlowExpendController { |
| | | |
| | | private final CapitalFlowExpendService capitalFlowExpendService; |
| | | |
| | | @Log("导出数据") |
| | | @ApiOperation("导出数据") |
| | | @GetMapping(value = "/download") |
| | | @PreAuthorize("@el.check('capitalFlowExpend:download')") |
| | | public void exportCapitalFlowExpend(HttpServletResponse response, CapitalFlowExpendQueryCriteria criteria) throws IOException { |
| | | capitalFlowExpendService.download(capitalFlowExpendService.queryAll(criteria), response); |
| | | } |
| | | |
| | | @GetMapping |
| | | @Log("查询资金流水支出") |
| | | @ApiOperation("查询资金流水支出") |
| | | @PreAuthorize("@el.check('capitalFlowExpend:list')") |
| | | public ResponseEntity<Object> queryCapitalFlowExpend(CapitalFlowExpendQueryCriteria criteria, Pageable pageable){ |
| | | return new ResponseEntity<>(capitalFlowExpendService.queryAll(criteria,pageable),HttpStatus.OK); |
| | | } |
| | | |
| | | @GetMapping(value = "/all") |
| | | @Log("查询资金流水支出") |
| | | @ApiOperation("查询资金流水支出") |
| | | @PreAuthorize("@el.check('capitalFlowExpend:list')") |
| | | public ResponseEntity<Object> queryCapitalFlowExpend(CapitalFlowExpendQueryCriteria criteria){ |
| | | return new ResponseEntity<>(capitalFlowExpendService.queryAll(criteria),HttpStatus.OK); |
| | | } |
| | | |
| | | @PostMapping |
| | | @Log("新增资金流水支出") |
| | | @ApiOperation("新增资金流水支出") |
| | | @PreAuthorize("@el.check('capitalFlowExpend:add')") |
| | | public ResponseEntity<Object> createCapitalFlowExpend(@Validated @RequestBody CapitalFlowExpend resources){ |
| | | return new ResponseEntity<>(capitalFlowExpendService.create(resources),HttpStatus.CREATED); |
| | | } |
| | | |
| | | @PutMapping |
| | | @Log("修改资金流水支出") |
| | | @ApiOperation("修改资金流水支出") |
| | | @PreAuthorize("@el.check('capitalFlowExpend:edit')") |
| | | public ResponseEntity<Object> updateCapitalFlowExpend(@Validated @RequestBody CapitalFlowExpend resources){ |
| | | capitalFlowExpendService.update(resources); |
| | | return new ResponseEntity<>(HttpStatus.NO_CONTENT); |
| | | } |
| | | |
| | | @DeleteMapping |
| | | @Log("删除资金流水支出") |
| | | @ApiOperation("删除资金流水支出") |
| | | @PreAuthorize("@el.check('capitalFlowExpend:del')") |
| | | public ResponseEntity<Object> deleteCapitalFlowExpend(@RequestBody Long[] ids) { |
| | | capitalFlowExpendService.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.capitalFlow.rest; |
| | | |
| | | import me.zhengjie.annotation.Log; |
| | | import me.zhengjie.modules.capitalFlow.domain.CapitalFlowIncome; |
| | | import me.zhengjie.modules.capitalFlow.service.CapitalFlowIncomeService; |
| | | import me.zhengjie.modules.capitalFlow.service.dto.CapitalFlowIncomeQueryCriteria; |
| | | 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-13 |
| | | **/ |
| | | @RestController |
| | | @RequiredArgsConstructor |
| | | @Api(tags = "资金流水收入管理") |
| | | @RequestMapping("/api/capitalFlowIncome") |
| | | public class CapitalFlowIncomeController { |
| | | |
| | | private final CapitalFlowIncomeService capitalFlowIncomeService; |
| | | |
| | | @Log("导出数据") |
| | | @ApiOperation("导出数据") |
| | | @GetMapping(value = "/download") |
| | | @PreAuthorize("@el.check('capitalFlowIncome:download')") |
| | | public void exportCapitalFlowIncome(HttpServletResponse response, CapitalFlowIncomeQueryCriteria criteria) throws IOException { |
| | | capitalFlowIncomeService.download(capitalFlowIncomeService.queryAll(criteria), response); |
| | | } |
| | | |
| | | @GetMapping |
| | | @Log("查询资金流水收入") |
| | | @ApiOperation("查询资金流水收入") |
| | | @PreAuthorize("@el.check('capitalFlowIncome:list')") |
| | | public ResponseEntity<Object> queryCapitalFlowIncome(CapitalFlowIncomeQueryCriteria criteria, Pageable pageable){ |
| | | return new ResponseEntity<>(capitalFlowIncomeService.queryAll(criteria,pageable),HttpStatus.OK); |
| | | } |
| | | |
| | | @GetMapping(value = "/all") |
| | | @Log("查询资金流水收入") |
| | | @ApiOperation("查询资金流水收入") |
| | | @PreAuthorize("@el.check('capitalFlowIncome:list')") |
| | | public ResponseEntity<Object> queryCapitalFlowIncome(CapitalFlowIncomeQueryCriteria criteria){ |
| | | return new ResponseEntity<>(capitalFlowIncomeService.queryAll(criteria),HttpStatus.OK); |
| | | } |
| | | |
| | | @PostMapping |
| | | @Log("新增资金流水收入") |
| | | @ApiOperation("新增资金流水收入") |
| | | @PreAuthorize("@el.check('capitalFlowIncome:add')") |
| | | public ResponseEntity<Object> createCapitalFlowIncome(@Validated @RequestBody CapitalFlowIncome resources){ |
| | | return new ResponseEntity<>(capitalFlowIncomeService.create(resources),HttpStatus.CREATED); |
| | | } |
| | | |
| | | @PutMapping |
| | | @Log("修改资金流水收入") |
| | | @ApiOperation("修改资金流水收入") |
| | | @PreAuthorize("@el.check('capitalFlowIncome:edit')") |
| | | public ResponseEntity<Object> updateCapitalFlowIncome(@Validated @RequestBody CapitalFlowIncome resources){ |
| | | capitalFlowIncomeService.update(resources); |
| | | return new ResponseEntity<>(HttpStatus.NO_CONTENT); |
| | | } |
| | | |
| | | @DeleteMapping |
| | | @Log("删除资金流水收入") |
| | | @ApiOperation("删除资金流水收入") |
| | | @PreAuthorize("@el.check('capitalFlowIncome:del')") |
| | | public ResponseEntity<Object> deleteCapitalFlowIncome(@RequestBody Long[] ids) { |
| | | capitalFlowIncomeService.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.capitalFlow.service; |
| | | |
| | | import me.zhengjie.modules.capitalFlow.domain.CapitalFlowExpend; |
| | | import me.zhengjie.modules.capitalFlow.service.dto.CapitalFlowExpendDto; |
| | | import me.zhengjie.modules.capitalFlow.service.dto.CapitalFlowExpendQueryCriteria; |
| | | 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-13 |
| | | **/ |
| | | public interface CapitalFlowExpendService { |
| | | |
| | | /** |
| | | * 查询数据分页 |
| | | * @param criteria 条件 |
| | | * @param pageable 分页参数 |
| | | * @return Map<String,Object> |
| | | */ |
| | | Map<String,Object> queryAll(CapitalFlowExpendQueryCriteria criteria, Pageable pageable); |
| | | |
| | | /** |
| | | * 查询所有数据不分页 |
| | | * @param criteria 条件参数 |
| | | * @return List<CapitalFlowExpendDto> |
| | | */ |
| | | List<CapitalFlowExpendDto> queryAll(CapitalFlowExpendQueryCriteria criteria); |
| | | |
| | | /** |
| | | * 根据ID查询 |
| | | * @param id ID |
| | | * @return CapitalFlowExpendDto |
| | | */ |
| | | CapitalFlowExpendDto findById(Long id); |
| | | |
| | | /** |
| | | * 创建 |
| | | * @param resources / |
| | | * @return CapitalFlowExpendDto |
| | | */ |
| | | CapitalFlowExpendDto create(CapitalFlowExpend resources); |
| | | |
| | | /** |
| | | * 编辑 |
| | | * @param resources / |
| | | */ |
| | | void update(CapitalFlowExpend resources); |
| | | |
| | | /** |
| | | * 多选删除 |
| | | * @param ids / |
| | | */ |
| | | void deleteAll(Long[] ids); |
| | | |
| | | /** |
| | | * 导出数据 |
| | | * @param all 待导出的数据 |
| | | * @param response / |
| | | * @throws IOException / |
| | | */ |
| | | void download(List<CapitalFlowExpendDto> all, HttpServletResponse response) throws IOException; |
| | | } |
| 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.capitalFlow.service; |
| | | |
| | | import me.zhengjie.modules.capitalFlow.domain.CapitalFlowIncome; |
| | | import me.zhengjie.modules.capitalFlow.service.dto.CapitalFlowIncomeDto; |
| | | import me.zhengjie.modules.capitalFlow.service.dto.CapitalFlowIncomeQueryCriteria; |
| | | 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-13 |
| | | **/ |
| | | public interface CapitalFlowIncomeService { |
| | | |
| | | /** |
| | | * 查询数据分页 |
| | | * @param criteria 条件 |
| | | * @param pageable 分页参数 |
| | | * @return Map<String,Object> |
| | | */ |
| | | Map<String,Object> queryAll(CapitalFlowIncomeQueryCriteria criteria, Pageable pageable); |
| | | |
| | | /** |
| | | * 查询所有数据不分页 |
| | | * @param criteria 条件参数 |
| | | * @return List<CapitalFlowIncomeDto> |
| | | */ |
| | | List<CapitalFlowIncomeDto> queryAll(CapitalFlowIncomeQueryCriteria criteria); |
| | | |
| | | /** |
| | | * 根据ID查询 |
| | | * @param id ID |
| | | * @return CapitalFlowIncomeDto |
| | | */ |
| | | CapitalFlowIncomeDto findById(Long id); |
| | | |
| | | /** |
| | | * 创建 |
| | | * @param resources / |
| | | * @return CapitalFlowIncomeDto |
| | | */ |
| | | CapitalFlowIncomeDto create(CapitalFlowIncome resources); |
| | | |
| | | /** |
| | | * 编辑 |
| | | * @param resources / |
| | | */ |
| | | void update(CapitalFlowIncome resources); |
| | | |
| | | /** |
| | | * 多选删除 |
| | | * @param ids / |
| | | */ |
| | | void deleteAll(Long[] ids); |
| | | |
| | | /** |
| | | * 导出数据 |
| | | * @param all 待导出的数据 |
| | | * @param response / |
| | | * @throws IOException / |
| | | */ |
| | | void download(List<CapitalFlowIncomeDto> all, HttpServletResponse response) throws IOException; |
| | | } |
| 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.capitalFlow.service; |
| | | |
| | | import me.zhengjie.modules.capitalFlow.domain.CapitalFlow; |
| | | import me.zhengjie.modules.capitalFlow.service.dto.CapitalFlowDto; |
| | | import me.zhengjie.modules.capitalFlow.service.dto.CapitalFlowQueryCriteria; |
| | | 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-13 |
| | | **/ |
| | | public interface CapitalFlowService { |
| | | |
| | | /** |
| | | * 查询数据分页 |
| | | * @param criteria 条件 |
| | | * @param pageable 分页参数 |
| | | * @return Map<String,Object> |
| | | */ |
| | | Map<String,Object> queryAll(CapitalFlowQueryCriteria criteria, Pageable pageable); |
| | | |
| | | /** |
| | | * 查询所有数据不分页 |
| | | * @param criteria 条件参数 |
| | | * @return List<CapitalFlowDto> |
| | | */ |
| | | List<CapitalFlowDto> queryAll(CapitalFlowQueryCriteria criteria); |
| | | |
| | | /** |
| | | * 根据ID查询 |
| | | * @param id ID |
| | | * @return CapitalFlowDto |
| | | */ |
| | | CapitalFlowDto findById(Long id); |
| | | |
| | | /** |
| | | * 创建 |
| | | * @param resources / |
| | | * @return CapitalFlowDto |
| | | */ |
| | | CapitalFlowDto create(CapitalFlow resources); |
| | | |
| | | /** |
| | | * 编辑 |
| | | * @param resources / |
| | | */ |
| | | void update(CapitalFlow resources); |
| | | |
| | | /** |
| | | * 多选删除 |
| | | * @param ids / |
| | | */ |
| | | void deleteAll(Long[] ids); |
| | | |
| | | /** |
| | | * 导出数据 |
| | | * @param all 待导出的数据 |
| | | * @param response / |
| | | * @throws IOException / |
| | | */ |
| | | void download(List<CapitalFlowDto> all, HttpServletResponse response) throws IOException; |
| | | } |
| 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.capitalFlow.service.dto; |
| | | |
| | | import lombok.Data; |
| | | import me.zhengjie.base.BaseDTO; |
| | | import me.zhengjie.modules.capitalFlow.domain.CapitalFlowExpend; |
| | | import me.zhengjie.modules.capitalFlow.domain.CapitalFlowIncome; |
| | | import org.apache.poi.hpsf.Decimal; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.sql.Timestamp; |
| | | import java.io.Serializable; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @website https://eladmin.vip |
| | | * @description / |
| | | * @author 赵士淞 |
| | | * @date 2023-02-13 |
| | | **/ |
| | | @Data |
| | | public class CapitalFlowDto extends BaseDTO implements Serializable { |
| | | |
| | | /** ID */ |
| | | private Long id; |
| | | |
| | | /** 流水年月 */ |
| | | private Timestamp flowYearMonth; |
| | | |
| | | /** 所属公司 */ |
| | | private Long companyId; |
| | | |
| | | /** 备注 */ |
| | | private String remarks; |
| | | |
| | | /** 公司名称 */ |
| | | private String companyName; |
| | | |
| | | /** 流水支出 */ |
| | | private List<CapitalFlowExpend> capitalFlowExpends; |
| | | |
| | | /** 流水支出金额 */ |
| | | private BigDecimal capitalFlowExpendsAmount; |
| | | |
| | | /** 流水收入 */ |
| | | private List<CapitalFlowIncome> capitalFlowIncomes; |
| | | |
| | | /** 流水收入金额 */ |
| | | private BigDecimal capitalFlowIncomesAmount; |
| | | } |
copy from eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/service/dto/SysUserCompanyDto.java
copy to eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/capitalFlow/service/dto/CapitalFlowExpendDto.java
| File was copied from eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/service/dto/SysUserCompanyDto.java |
| | |
| | | * See the License for the specific language governing permissions and |
| | | * limitations under the License. |
| | | */ |
| | | package me.zhengjie.modules.system.service.dto; |
| | | package me.zhengjie.modules.capitalFlow.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 wcd |
| | | * @date 2023-01-30 |
| | | * @author 赵士淞 |
| | | * @date 2023-02-13 |
| | | **/ |
| | | @Data |
| | | public class SysUserCompanyDto extends BaseDTO implements Serializable { |
| | | public class CapitalFlowExpendDto extends BaseDTO implements Serializable { |
| | | |
| | | /** ID */ |
| | | private Long id; |
| | | |
| | | /** 描述 */ |
| | | private String description; |
| | | /** 所属流水 */ |
| | | private Long flowId; |
| | | |
| | | /** 标签 */ |
| | | private String label; |
| | | /** 标题 */ |
| | | private String title; |
| | | |
| | | /** 值 */ |
| | | private String value; |
| | | /** 金额 */ |
| | | private BigDecimal amount; |
| | | |
| | | /** 用户id */ |
| | | private Long userId; |
| | | /** 备注 */ |
| | | private String remarks; |
| | | |
| | | /** 流水名称 */ |
| | | private String flowName; |
| | | } |
copy from eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/service/dto/SysUserCompanyQueryCriteria.java
copy to eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/capitalFlow/service/dto/CapitalFlowExpendQueryCriteria.java
| File was copied from eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/service/dto/SysUserCompanyQueryCriteria.java |
| | |
| | | * See the License for the specific language governing permissions and |
| | | * limitations under the License. |
| | | */ |
| | | package me.zhengjie.modules.system.service.dto; |
| | | package me.zhengjie.modules.capitalFlow.service.dto; |
| | | |
| | | import lombok.Data; |
| | | import java.util.List; |
| | |
| | | |
| | | /** |
| | | * @website https://eladmin.vip |
| | | * @author wcd |
| | | * @date 2023-01-30 |
| | | * @author 赵士淞 |
| | | * @date 2023-02-13 |
| | | **/ |
| | | @Data |
| | | public class SysUserCompanyQueryCriteria { |
| | | public class CapitalFlowExpendQueryCriteria{ |
| | | |
| | | /** 精确 */ |
| | | @Query |
| | | private Long flowId; |
| | | |
| | | /** 模糊 */ |
| | | @Query(type = Query.Type.INNER_LIKE) |
| | | private String label; |
| | | private String title; |
| | | } |
copy from eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/service/dto/SysUserCompanyDto.java
copy to eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/capitalFlow/service/dto/CapitalFlowIncomeDto.java
| File was copied from eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/service/dto/SysUserCompanyDto.java |
| | |
| | | * See the License for the specific language governing permissions and |
| | | * limitations under the License. |
| | | */ |
| | | package me.zhengjie.modules.system.service.dto; |
| | | package me.zhengjie.modules.capitalFlow.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 wcd |
| | | * @date 2023-01-30 |
| | | * @author 赵士淞 |
| | | * @date 2023-02-13 |
| | | **/ |
| | | @Data |
| | | public class SysUserCompanyDto extends BaseDTO implements Serializable { |
| | | public class CapitalFlowIncomeDto extends BaseDTO implements Serializable { |
| | | |
| | | /** ID */ |
| | | private Long id; |
| | | |
| | | /** 描述 */ |
| | | private String description; |
| | | /** 所属流水 */ |
| | | private Long flowId; |
| | | |
| | | /** 标签 */ |
| | | private String label; |
| | | /** 标题 */ |
| | | private String title; |
| | | |
| | | /** 值 */ |
| | | private String value; |
| | | /** 金额 */ |
| | | private BigDecimal amount; |
| | | |
| | | /** 用户id */ |
| | | private Long userId; |
| | | /** 备注 */ |
| | | private String remarks; |
| | | |
| | | /** 流水名称 */ |
| | | private String flowName; |
| | | } |
copy from eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/service/dto/SysUserCompanyQueryCriteria.java
copy to eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/capitalFlow/service/dto/CapitalFlowIncomeQueryCriteria.java
| File was copied from eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/service/dto/SysUserCompanyQueryCriteria.java |
| | |
| | | * See the License for the specific language governing permissions and |
| | | * limitations under the License. |
| | | */ |
| | | package me.zhengjie.modules.system.service.dto; |
| | | package me.zhengjie.modules.capitalFlow.service.dto; |
| | | |
| | | import lombok.Data; |
| | | import java.util.List; |
| | |
| | | |
| | | /** |
| | | * @website https://eladmin.vip |
| | | * @author wcd |
| | | * @date 2023-01-30 |
| | | * @author 赵士淞 |
| | | * @date 2023-02-13 |
| | | **/ |
| | | @Data |
| | | public class SysUserCompanyQueryCriteria { |
| | | public class CapitalFlowIncomeQueryCriteria{ |
| | | |
| | | /** 精确 */ |
| | | @Query |
| | | private Long flowId; |
| | | |
| | | /** 模糊 */ |
| | | @Query(type = Query.Type.INNER_LIKE) |
| | | private String label; |
| | | private String title; |
| | | } |
copy from eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/service/dto/SysUserCompanyQueryCriteria.java
copy to eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/capitalFlow/service/dto/CapitalFlowQueryCriteria.java
| File was copied from eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/service/dto/SysUserCompanyQueryCriteria.java |
| | |
| | | * See the License for the specific language governing permissions and |
| | | * limitations under the License. |
| | | */ |
| | | package me.zhengjie.modules.system.service.dto; |
| | | package me.zhengjie.modules.capitalFlow.service.dto; |
| | | |
| | | import lombok.Data; |
| | | import java.sql.Timestamp; |
| | | import java.util.List; |
| | | import me.zhengjie.annotation.Query; |
| | | |
| | | /** |
| | | * @website https://eladmin.vip |
| | | * @author wcd |
| | | * @date 2023-01-30 |
| | | * @author 赵士淞 |
| | | * @date 2023-02-13 |
| | | **/ |
| | | @Data |
| | | public class SysUserCompanyQueryCriteria { |
| | | public class CapitalFlowQueryCriteria{ |
| | | |
| | | /** 精确 */ |
| | | @Query(type = Query.Type.INNER_LIKE) |
| | | private String label; |
| | | private String flowYearMonth; |
| | | |
| | | /** 精确 */ |
| | | @Query |
| | | private Long companyId; |
| | | } |
| 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.capitalFlow.service.impl; |
| | | |
| | | import me.zhengjie.modules.capitalFlow.domain.CapitalFlowExpend; |
| | | import me.zhengjie.modules.capitalFlow.service.dto.CapitalFlowDto; |
| | | import me.zhengjie.modules.system.service.dto.SysCompanyDto; |
| | | import me.zhengjie.modules.system.service.impl.SysCompanyServiceImpl; |
| | | import me.zhengjie.utils.ValidationUtil; |
| | | import me.zhengjie.utils.FileUtil; |
| | | import lombok.RequiredArgsConstructor; |
| | | import me.zhengjie.modules.capitalFlow.repository.CapitalFlowExpendRepository; |
| | | import me.zhengjie.modules.capitalFlow.service.CapitalFlowExpendService; |
| | | import me.zhengjie.modules.capitalFlow.service.dto.CapitalFlowExpendDto; |
| | | import me.zhengjie.modules.capitalFlow.service.dto.CapitalFlowExpendQueryCriteria; |
| | | import me.zhengjie.modules.capitalFlow.service.mapstruct.CapitalFlowExpendMapper; |
| | | 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.sql.Timestamp; |
| | | import java.text.SimpleDateFormat; |
| | | 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-13 |
| | | **/ |
| | | @Service |
| | | @RequiredArgsConstructor |
| | | public class CapitalFlowExpendServiceImpl implements CapitalFlowExpendService { |
| | | |
| | | private final CapitalFlowExpendRepository capitalFlowExpendRepository; |
| | | private final CapitalFlowExpendMapper capitalFlowExpendMapper; |
| | | private final CapitalFlowServiceImpl capitalFlowServiceImpl; |
| | | private final SysCompanyServiceImpl sysCompanyServiceImpl; |
| | | |
| | | @Override |
| | | public Map<String,Object> queryAll(CapitalFlowExpendQueryCriteria criteria, Pageable pageable){ |
| | | Page<CapitalFlowExpend> page = capitalFlowExpendRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable); |
| | | // 将实体类转换为DTO(重写) |
| | | Function<CapitalFlowExpend, CapitalFlowExpendDto> func = new Function<CapitalFlowExpend, CapitalFlowExpendDto>(){ |
| | | @Override |
| | | public CapitalFlowExpendDto apply(CapitalFlowExpend t) { |
| | | // 将实体类转换成DTO |
| | | CapitalFlowExpendDto capitalFlowExpendDto = capitalFlowExpendMapper.toDto(t); |
| | | // 流水名称 |
| | | capitalFlowExpendDto.setFlowName(flowName(t)); |
| | | // 返回处理好的DTO |
| | | return capitalFlowExpendDto; |
| | | } |
| | | }; |
| | | return PageUtil.toPage(page.map(func)); |
| | | } |
| | | |
| | | @Override |
| | | public List<CapitalFlowExpendDto> queryAll(CapitalFlowExpendQueryCriteria criteria){ |
| | | return capitalFlowExpendMapper.toDto(capitalFlowExpendRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder))); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional |
| | | public CapitalFlowExpendDto findById(Long id) { |
| | | CapitalFlowExpend capitalFlowExpend = capitalFlowExpendRepository.findById(id).orElseGet(CapitalFlowExpend::new); |
| | | ValidationUtil.isNull(capitalFlowExpend.getId(),"CapitalFlowExpend","id",id); |
| | | return capitalFlowExpendMapper.toDto(capitalFlowExpend); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public CapitalFlowExpendDto create(CapitalFlowExpend resources) { |
| | | return capitalFlowExpendMapper.toDto(capitalFlowExpendRepository.save(resources)); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void update(CapitalFlowExpend resources) { |
| | | CapitalFlowExpend capitalFlowExpend = capitalFlowExpendRepository.findById(resources.getId()).orElseGet(CapitalFlowExpend::new); |
| | | ValidationUtil.isNull( capitalFlowExpend.getId(),"CapitalFlowExpend","id",resources.getId()); |
| | | capitalFlowExpend.copy(resources); |
| | | capitalFlowExpendRepository.save(capitalFlowExpend); |
| | | } |
| | | |
| | | @Override |
| | | public void deleteAll(Long[] ids) { |
| | | for (Long id : ids) { |
| | | capitalFlowExpendRepository.deleteById(id); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public void download(List<CapitalFlowExpendDto> all, HttpServletResponse response) throws IOException { |
| | | List<Map<String, Object>> list = new ArrayList<>(); |
| | | for (CapitalFlowExpendDto capitalFlowExpend : all) { |
| | | String flowName = flowName(capitalFlowExpendMapper.toEntity(capitalFlowExpend)); |
| | | Map<String,Object> map = new LinkedHashMap<>(); |
| | | map.put("所属流水", flowName); |
| | | map.put("标题", capitalFlowExpend.getTitle()); |
| | | map.put("金额", capitalFlowExpend.getAmount()); |
| | | map.put("备注", capitalFlowExpend.getRemarks()); |
| | | map.put("创建者", capitalFlowExpend.getCreateBy()); |
| | | map.put("创建时间", capitalFlowExpend.getCreateTime()); |
| | | map.put("更新者", capitalFlowExpend.getUpdateBy()); |
| | | map.put("更新时间", capitalFlowExpend.getUpdateTime()); |
| | | list.add(map); |
| | | } |
| | | FileUtil.downloadExcel(list, response); |
| | | } |
| | | |
| | | /** |
| | | * 流水名称 |
| | | * @param resources |
| | | * @return |
| | | */ |
| | | private String flowName(CapitalFlowExpend resources) { |
| | | // 查询资金流水数据 |
| | | CapitalFlowDto capitalFlowDto = capitalFlowServiceImpl.findById(resources.getFlowId()); |
| | | // 查询公司数据 |
| | | SysCompanyDto sysCompanyDto = sysCompanyServiceImpl.findById(capitalFlowDto.getCompanyId()); |
| | | return new SimpleDateFormat("yyyy-MM").format(capitalFlowDto.getFlowYearMonth()) + " - " + sysCompanyDto.getLabel(); |
| | | } |
| | | } |
| 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.capitalFlow.service.impl; |
| | | |
| | | import me.zhengjie.modules.capitalFlow.domain.CapitalFlowIncome; |
| | | import me.zhengjie.modules.capitalFlow.service.dto.CapitalFlowDto; |
| | | import me.zhengjie.modules.system.service.dto.SysCompanyDto; |
| | | import me.zhengjie.modules.system.service.impl.SysCompanyServiceImpl; |
| | | import me.zhengjie.utils.ValidationUtil; |
| | | import me.zhengjie.utils.FileUtil; |
| | | import lombok.RequiredArgsConstructor; |
| | | import me.zhengjie.modules.capitalFlow.repository.CapitalFlowIncomeRepository; |
| | | import me.zhengjie.modules.capitalFlow.service.CapitalFlowIncomeService; |
| | | import me.zhengjie.modules.capitalFlow.service.dto.CapitalFlowIncomeDto; |
| | | import me.zhengjie.modules.capitalFlow.service.dto.CapitalFlowIncomeQueryCriteria; |
| | | import me.zhengjie.modules.capitalFlow.service.mapstruct.CapitalFlowIncomeMapper; |
| | | 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.text.SimpleDateFormat; |
| | | 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-13 |
| | | **/ |
| | | @Service |
| | | @RequiredArgsConstructor |
| | | public class CapitalFlowIncomeServiceImpl implements CapitalFlowIncomeService { |
| | | |
| | | private final CapitalFlowIncomeRepository capitalFlowIncomeRepository; |
| | | private final CapitalFlowIncomeMapper capitalFlowIncomeMapper; |
| | | private final CapitalFlowServiceImpl capitalFlowServiceImpl; |
| | | private final SysCompanyServiceImpl sysCompanyServiceImpl; |
| | | |
| | | @Override |
| | | public Map<String,Object> queryAll(CapitalFlowIncomeQueryCriteria criteria, Pageable pageable){ |
| | | Page<CapitalFlowIncome> page = capitalFlowIncomeRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable); |
| | | // 将实体类转换为DTO(重写) |
| | | Function<CapitalFlowIncome, CapitalFlowIncomeDto> func = new Function<CapitalFlowIncome, CapitalFlowIncomeDto>(){ |
| | | @Override |
| | | public CapitalFlowIncomeDto apply(CapitalFlowIncome t) { |
| | | // 将实体类转换成DTO |
| | | CapitalFlowIncomeDto capitalFlowIncomeDto = capitalFlowIncomeMapper.toDto(t); |
| | | // 流水名称 |
| | | capitalFlowIncomeDto.setFlowName(flowName(t)); |
| | | // 返回处理好的DTO |
| | | return capitalFlowIncomeDto; |
| | | } |
| | | }; |
| | | return PageUtil.toPage(page.map(func)); |
| | | } |
| | | |
| | | @Override |
| | | public List<CapitalFlowIncomeDto> queryAll(CapitalFlowIncomeQueryCriteria criteria){ |
| | | return capitalFlowIncomeMapper.toDto(capitalFlowIncomeRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder))); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional |
| | | public CapitalFlowIncomeDto findById(Long id) { |
| | | CapitalFlowIncome capitalFlowIncome = capitalFlowIncomeRepository.findById(id).orElseGet(CapitalFlowIncome::new); |
| | | ValidationUtil.isNull(capitalFlowIncome.getId(),"CapitalFlowIncome","id",id); |
| | | return capitalFlowIncomeMapper.toDto(capitalFlowIncome); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public CapitalFlowIncomeDto create(CapitalFlowIncome resources) { |
| | | return capitalFlowIncomeMapper.toDto(capitalFlowIncomeRepository.save(resources)); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void update(CapitalFlowIncome resources) { |
| | | CapitalFlowIncome capitalFlowIncome = capitalFlowIncomeRepository.findById(resources.getId()).orElseGet(CapitalFlowIncome::new); |
| | | ValidationUtil.isNull( capitalFlowIncome.getId(),"CapitalFlowIncome","id",resources.getId()); |
| | | capitalFlowIncome.copy(resources); |
| | | capitalFlowIncomeRepository.save(capitalFlowIncome); |
| | | } |
| | | |
| | | @Override |
| | | public void deleteAll(Long[] ids) { |
| | | for (Long id : ids) { |
| | | capitalFlowIncomeRepository.deleteById(id); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public void download(List<CapitalFlowIncomeDto> all, HttpServletResponse response) throws IOException { |
| | | List<Map<String, Object>> list = new ArrayList<>(); |
| | | for (CapitalFlowIncomeDto capitalFlowIncome : all) { |
| | | String flowName = flowName(capitalFlowIncomeMapper.toEntity(capitalFlowIncome)); |
| | | Map<String,Object> map = new LinkedHashMap<>(); |
| | | map.put("所属流水", flowName); |
| | | map.put("标题", capitalFlowIncome.getTitle()); |
| | | map.put("金额", capitalFlowIncome.getAmount()); |
| | | map.put("备注", capitalFlowIncome.getRemarks()); |
| | | map.put("创建者", capitalFlowIncome.getCreateBy()); |
| | | map.put("创建时间", capitalFlowIncome.getCreateTime()); |
| | | map.put("更新者", capitalFlowIncome.getUpdateBy()); |
| | | map.put("更新时间", capitalFlowIncome.getUpdateTime()); |
| | | list.add(map); |
| | | } |
| | | FileUtil.downloadExcel(list, response); |
| | | } |
| | | |
| | | /** |
| | | * 流水名称 |
| | | * @param resources |
| | | * @return |
| | | */ |
| | | private String flowName(CapitalFlowIncome resources) { |
| | | // 查询资金流水数据 |
| | | CapitalFlowDto capitalFlowDto = capitalFlowServiceImpl.findById(resources.getFlowId()); |
| | | // 查询公司数据 |
| | | SysCompanyDto sysCompanyDto = sysCompanyServiceImpl.findById(capitalFlowDto.getCompanyId()); |
| | | return new SimpleDateFormat("yyyy-MM").format(capitalFlowDto.getFlowYearMonth()) + " - " + sysCompanyDto.getLabel(); |
| | | } |
| | | } |
| 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.capitalFlow.service.impl; |
| | | |
| | | 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.system.service.dto.SysCompanyDto; |
| | | import me.zhengjie.modules.system.service.impl.SysCompanyServiceImpl; |
| | | import me.zhengjie.utils.*; |
| | | import lombok.RequiredArgsConstructor; |
| | | import me.zhengjie.modules.capitalFlow.repository.CapitalFlowRepository; |
| | | import me.zhengjie.modules.capitalFlow.service.CapitalFlowService; |
| | | import me.zhengjie.modules.capitalFlow.service.dto.CapitalFlowDto; |
| | | import me.zhengjie.modules.capitalFlow.service.dto.CapitalFlowQueryCriteria; |
| | | import me.zhengjie.modules.capitalFlow.service.mapstruct.CapitalFlowMapper; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.data.domain.Page; |
| | | import org.springframework.data.domain.Pageable; |
| | | |
| | | 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-13 |
| | | **/ |
| | | @Service |
| | | @RequiredArgsConstructor |
| | | public class CapitalFlowServiceImpl implements CapitalFlowService { |
| | | |
| | | private final CapitalFlowRepository capitalFlowRepository; |
| | | private final CapitalFlowMapper capitalFlowMapper; |
| | | private final SysCompanyServiceImpl sysCompanyServiceImpl; |
| | | private final CapitalFlowExpendRepository capitalFlowExpendRepository; |
| | | private final CapitalFlowIncomeRepository capitalFlowIncomeRepository; |
| | | |
| | | @Override |
| | | public Map<String,Object> queryAll(CapitalFlowQueryCriteria criteria, Pageable pageable){ |
| | | // 判断资金流水查询类流水年月是否为空 |
| | | if (criteria.getFlowYearMonth() != null && !"".equals(criteria.getFlowYearMonth())) { |
| | | // 流水年月:国际时间转中国时间 |
| | | criteria.setFlowYearMonth(DateUtil.internationalTimeToChinaTime(criteria.getFlowYearMonth())); |
| | | } |
| | | Page<CapitalFlow> page = capitalFlowRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable); |
| | | // 将实体类转换为DTO(重写) |
| | | Function<CapitalFlow, CapitalFlowDto> func = new Function<CapitalFlow, CapitalFlowDto>(){ |
| | | @Override |
| | | public CapitalFlowDto apply(CapitalFlow t) { |
| | | // 将实体类转换成DTO |
| | | CapitalFlowDto capitalFlowDto = capitalFlowMapper.toDto(t); |
| | | // 公司名称 |
| | | capitalFlowDto.setCompanyName(companyName(t)); |
| | | // 流水支出 |
| | | capitalFlowDto.setCapitalFlowExpends(capitalFlowExpendRepository.findByFlowId(t.getId())); |
| | | // 流水支出金额 |
| | | capitalFlowDto.setCapitalFlowExpendsAmount(capitalFlowExpendRepository.sumAmountByFlowId(t.getId())); |
| | | // 流水收入 |
| | | capitalFlowDto.setCapitalFlowIncomes(capitalFlowIncomeRepository.findByFlowId(t.getId())); |
| | | // 流水收入金额 |
| | | capitalFlowDto.setCapitalFlowIncomesAmount(capitalFlowIncomeRepository.sumAmountByFlowId(t.getId())); |
| | | // 返回处理好的DTO |
| | | return capitalFlowDto; |
| | | } |
| | | }; |
| | | return PageUtil.toPage(page.map(func)); |
| | | } |
| | | |
| | | @Override |
| | | public List<CapitalFlowDto> queryAll(CapitalFlowQueryCriteria criteria){ |
| | | List<CapitalFlowDto> capitalFlowDtoList = capitalFlowMapper.toDto(capitalFlowRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder))); |
| | | // 循环资金流水列表 |
| | | for (int i = 0; i < capitalFlowDtoList.size(); i ++) { |
| | | // 资金流水 |
| | | CapitalFlowDto capitalFlowDto = capitalFlowDtoList.get(i); |
| | | // DTO赋值 |
| | | capitalFlowDto.setCompanyName(companyName(capitalFlowMapper.toEntity(capitalFlowDto))); |
| | | } |
| | | return capitalFlowDtoList; |
| | | } |
| | | |
| | | @Override |
| | | @Transactional |
| | | public CapitalFlowDto findById(Long id) { |
| | | CapitalFlow capitalFlow = capitalFlowRepository.findById(id).orElseGet(CapitalFlow::new); |
| | | ValidationUtil.isNull(capitalFlow.getId(),"CapitalFlow","id",id); |
| | | return capitalFlowMapper.toDto(capitalFlow); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public CapitalFlowDto create(CapitalFlow resources) { |
| | | return capitalFlowMapper.toDto(capitalFlowRepository.save(resources)); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void update(CapitalFlow resources) { |
| | | CapitalFlow capitalFlow = capitalFlowRepository.findById(resources.getId()).orElseGet(CapitalFlow::new); |
| | | ValidationUtil.isNull( capitalFlow.getId(),"CapitalFlow","id",resources.getId()); |
| | | capitalFlow.copy(resources); |
| | | capitalFlowRepository.save(capitalFlow); |
| | | } |
| | | |
| | | @Override |
| | | public void deleteAll(Long[] ids) { |
| | | for (Long id : ids) { |
| | | capitalFlowRepository.deleteById(id); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public void download(List<CapitalFlowDto> all, HttpServletResponse response) throws IOException { |
| | | List<Map<String, Object>> list = new ArrayList<>(); |
| | | for (CapitalFlowDto capitalFlow : all) { |
| | | String companyName = companyName(capitalFlowMapper.toEntity(capitalFlow)); |
| | | Map<String,Object> map = new LinkedHashMap<>(); |
| | | map.put("流水年月", capitalFlow.getFlowYearMonth()); |
| | | map.put("所属公司", companyName); |
| | | map.put("备注", capitalFlow.getRemarks()); |
| | | map.put("创建者", capitalFlow.getCreateBy()); |
| | | map.put("创建时间", capitalFlow.getCreateTime()); |
| | | map.put("更新者", capitalFlow.getUpdateBy()); |
| | | map.put("更新时间", capitalFlow.getUpdateTime()); |
| | | list.add(map); |
| | | } |
| | | FileUtil.downloadExcel(list, response); |
| | | } |
| | | |
| | | /** |
| | | * 公司名称 |
| | | * @param resources |
| | | * @return |
| | | */ |
| | | private String companyName(CapitalFlow resources) { |
| | | // 查询公司数据 |
| | | SysCompanyDto sysCompanyDto = sysCompanyServiceImpl.findById(resources.getCompanyId()); |
| | | return sysCompanyDto.getLabel(); |
| | | } |
| | | } |
copy from eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/service/mapstruct/SysUserCompanyMapper.java
copy to eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/capitalFlow/service/mapstruct/CapitalFlowExpendMapper.java
| File was copied from eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/service/mapstruct/SysUserCompanyMapper.java |
| | |
| | | * See the License for the specific language governing permissions and |
| | | * limitations under the License. |
| | | */ |
| | | package me.zhengjie.modules.system.service.mapstruct; |
| | | package me.zhengjie.modules.capitalFlow.service.mapstruct; |
| | | |
| | | import me.zhengjie.base.BaseMapper; |
| | | import me.zhengjie.modules.system.domain.SysUserCompany; |
| | | import me.zhengjie.modules.system.service.dto.SysUserCompanyDto; |
| | | import me.zhengjie.modules.capitalFlow.domain.CapitalFlowExpend; |
| | | import me.zhengjie.modules.capitalFlow.service.dto.CapitalFlowExpendDto; |
| | | import org.mapstruct.Mapper; |
| | | import org.mapstruct.ReportingPolicy; |
| | | |
| | | /** |
| | | * @website https://eladmin.vip |
| | | * @author wcd |
| | | * @date 2023-01-30 |
| | | * @author 赵士淞 |
| | | * @date 2023-02-13 |
| | | **/ |
| | | @Mapper(componentModel = "spring", unmappedTargetPolicy = ReportingPolicy.IGNORE) |
| | | public interface SysUserCompanyMapper extends BaseMapper<SysUserCompanyDto, SysUserCompany> { |
| | | public interface CapitalFlowExpendMapper extends BaseMapper<CapitalFlowExpendDto, CapitalFlowExpend> { |
| | | |
| | | } |
copy from eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/service/mapstruct/SysUserCompanyMapper.java
copy to eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/capitalFlow/service/mapstruct/CapitalFlowIncomeMapper.java
| File was copied from eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/service/mapstruct/SysUserCompanyMapper.java |
| | |
| | | * See the License for the specific language governing permissions and |
| | | * limitations under the License. |
| | | */ |
| | | package me.zhengjie.modules.system.service.mapstruct; |
| | | package me.zhengjie.modules.capitalFlow.service.mapstruct; |
| | | |
| | | import me.zhengjie.base.BaseMapper; |
| | | import me.zhengjie.modules.system.domain.SysUserCompany; |
| | | import me.zhengjie.modules.system.service.dto.SysUserCompanyDto; |
| | | import me.zhengjie.modules.capitalFlow.domain.CapitalFlowIncome; |
| | | import me.zhengjie.modules.capitalFlow.service.dto.CapitalFlowIncomeDto; |
| | | import org.mapstruct.Mapper; |
| | | import org.mapstruct.ReportingPolicy; |
| | | |
| | | /** |
| | | * @website https://eladmin.vip |
| | | * @author wcd |
| | | * @date 2023-01-30 |
| | | * @author 赵士淞 |
| | | * @date 2023-02-13 |
| | | **/ |
| | | @Mapper(componentModel = "spring", unmappedTargetPolicy = ReportingPolicy.IGNORE) |
| | | public interface SysUserCompanyMapper extends BaseMapper<SysUserCompanyDto, SysUserCompany> { |
| | | public interface CapitalFlowIncomeMapper extends BaseMapper<CapitalFlowIncomeDto, CapitalFlowIncome> { |
| | | |
| | | } |
copy from eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/service/mapstruct/SysUserCompanyMapper.java
copy to eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/capitalFlow/service/mapstruct/CapitalFlowMapper.java
| File was copied from eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/service/mapstruct/SysUserCompanyMapper.java |
| | |
| | | * See the License for the specific language governing permissions and |
| | | * limitations under the License. |
| | | */ |
| | | package me.zhengjie.modules.system.service.mapstruct; |
| | | package me.zhengjie.modules.capitalFlow.service.mapstruct; |
| | | |
| | | import me.zhengjie.base.BaseMapper; |
| | | import me.zhengjie.modules.system.domain.SysUserCompany; |
| | | import me.zhengjie.modules.system.service.dto.SysUserCompanyDto; |
| | | import me.zhengjie.modules.capitalFlow.domain.CapitalFlow; |
| | | import me.zhengjie.modules.capitalFlow.service.dto.CapitalFlowDto; |
| | | import org.mapstruct.Mapper; |
| | | import org.mapstruct.ReportingPolicy; |
| | | |
| | | /** |
| | | * @website https://eladmin.vip |
| | | * @author wcd |
| | | * @date 2023-01-30 |
| | | * @author 赵士淞 |
| | | * @date 2023-02-13 |
| | | **/ |
| | | @Mapper(componentModel = "spring", unmappedTargetPolicy = ReportingPolicy.IGNORE) |
| | | public interface SysUserCompanyMapper extends BaseMapper<SysUserCompanyDto, SysUserCompany> { |
| | | public interface CapitalFlowMapper extends BaseMapper<CapitalFlowDto, CapitalFlow> { |
| | | |
| | | } |
| 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.conferenceRoom.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.io.Serializable; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @website https://eladmin.vip |
| | | * @description / |
| | | * @author wcd |
| | | * @date 2023-02-07 |
| | | **/ |
| | | @Entity |
| | | @Data |
| | | @Table(name="meeting_room") |
| | | public class MeetingRoom extends BaseEntity implements Serializable { |
| | | |
| | | @Id |
| | | @GeneratedValue(strategy = GenerationType.IDENTITY) |
| | | @Column(name = "`id`") |
| | | @ApiModelProperty(value = "id") |
| | | private Long id; |
| | | |
| | | @Column(name = "`conference_room_name`",nullable = false) |
| | | @NotBlank |
| | | @ApiModelProperty(value = "会议室名称") |
| | | private String conferenceRoomName; |
| | | |
| | | @Column(name = "`conference_room_address`") |
| | | @ApiModelProperty(value = "会议室地址") |
| | | private String conferenceRoomAddress; |
| | | |
| | | @Column(name = "`capacity`") |
| | | @ApiModelProperty(value = "容纳人数") |
| | | private Long capacity; |
| | | |
| | | @Column(name = "`remarks`") |
| | | @ApiModelProperty(value = "备注") |
| | | private String remarks; |
| | | |
| | | public void copy(MeetingRoom source){ |
| | | BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true)); |
| | | } |
| | | } |
| 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.conferenceRoom.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.io.Serializable; |
| | | |
| | | /** |
| | | * @website https://eladmin.vip |
| | | * @description / |
| | | * @author wcd |
| | | * @date 2023-02-09 |
| | | **/ |
| | | @Entity |
| | | @Data |
| | | @Table(name="meeting_room_reservation") |
| | | public class MeetingRoomReservation extends BaseEntity implements Serializable { |
| | | |
| | | @Id |
| | | @GeneratedValue(strategy = GenerationType.IDENTITY) |
| | | @Column(name = "`id`") |
| | | @ApiModelProperty(value = "id") |
| | | private Long id; |
| | | |
| | | @Column(name = "`meeting_id`",nullable = false) |
| | | @NotNull |
| | | @ApiModelProperty(value = "会议室id") |
| | | private Long meetingId; |
| | | |
| | | @Column(name = "`meeting_theme`",nullable = false) |
| | | @NotBlank |
| | | @ApiModelProperty(value = "会议主题") |
| | | private String meetingTheme; |
| | | |
| | | @Column(name = "`start_time`",nullable = false) |
| | | @NotNull |
| | | @ApiModelProperty(value = "开始时间") |
| | | private Timestamp startTime; |
| | | |
| | | @Column(name = "`end_time`",nullable = false) |
| | | @NotNull |
| | | @ApiModelProperty(value = "结束时间") |
| | | private Timestamp endTime; |
| | | |
| | | @Column(name = "`number_of_participants`") |
| | | @ApiModelProperty(value = "参与人数") |
| | | private Long numberOfParticipants; |
| | | |
| | | @Column(name = "`remarks`") |
| | | @ApiModelProperty(value = "备注") |
| | | private String remarks; |
| | | |
| | | public void copy(MeetingRoomReservation source){ |
| | | BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true)); |
| | | } |
| | | } |
copy from eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/repository/SysUserCompanyRepository.java
copy to eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/conferenceRoom/repository/MeetingRoomRepository.java
| File was copied from eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/repository/SysUserCompanyRepository.java |
| | |
| | | * See the License for the specific language governing permissions and |
| | | * limitations under the License. |
| | | */ |
| | | package me.zhengjie.modules.system.repository; |
| | | package me.zhengjie.modules.conferenceRoom.repository; |
| | | |
| | | import me.zhengjie.modules.system.domain.SysUserCompany; |
| | | import me.zhengjie.modules.conferenceRoom.domain.MeetingRoom; |
| | | import org.springframework.data.jpa.repository.JpaRepository; |
| | | import org.springframework.data.jpa.repository.JpaSpecificationExecutor; |
| | | import org.springframework.data.jpa.repository.Query; |
| | | |
| | | /** |
| | | * @website https://eladmin.vip |
| | | * @author wcd |
| | | * @date 2023-01-30 |
| | | * @date 2023-02-07 |
| | | **/ |
| | | public interface SysUserCompanyRepository extends JpaRepository<SysUserCompany, Long>, JpaSpecificationExecutor<SysUserCompany> { |
| | | |
| | | /** |
| | | * 根据value查询公司(导出用) |
| | | * @return |
| | | */ |
| | | @Query |
| | | SysUserCompany findByValue(String value); |
| | | public interface MeetingRoomRepository extends JpaRepository<MeetingRoom, Long>, JpaSpecificationExecutor<MeetingRoom> { |
| | | } |
| 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.conferenceRoom.repository; |
| | | |
| | | import me.zhengjie.modules.attendance.domain.AttendanceLeave; |
| | | import me.zhengjie.modules.conferenceRoom.domain.MeetingRoomReservation; |
| | | 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; |
| | | import java.util.Set; |
| | | |
| | | /** |
| | | * @website https://eladmin.vip |
| | | * @author wcd |
| | | * @date 2023-02-09 |
| | | **/ |
| | | public interface MeetingRoomReservationRepository extends JpaRepository<MeetingRoomReservation, Long>, JpaSpecificationExecutor<MeetingRoomReservation> { |
| | | |
| | | // 会议室预约的时候验证时间是否存在(新增) |
| | | @Query(value = "SELECT * FROM meeting_room_reservation WHERE meeting_id = ?3 AND ((start_time >= ?1 and start_time <= ?2) OR \n" + |
| | | "(start_time <= ?1 and end_time >= ?2) OR (end_time >= ?1 and end_time <= ?2) OR (start_time >= ?1 and end_time <= ?2))", nativeQuery = true) |
| | | List<MeetingRoomReservation> checkReservationTime(String startTime, String endTime, Long userId); |
| | | |
| | | // 会议室修改预约的时候验证时间是否存在(编辑) |
| | | @Query(value = "SELECT * FROM meeting_room_reservation WHERE meeting_id = ?3 AND id NOT IN ?4 AND ((start_time >= ?1 and start_time <= ?2) OR \n" + |
| | | "(start_time <= ?1 and end_time >= ?2) OR (end_time >= ?1 and end_time <= ?2) OR (start_time >= ?1 and end_time <= ?2))", nativeQuery = true) |
| | | List<MeetingRoomReservation> checkReservationTimeEdit(String startTime, String endTime, Long userId, Set<Long> ids); |
| | | } |
| 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.conferenceRoom.rest; |
| | | |
| | | import me.zhengjie.annotation.Log; |
| | | import me.zhengjie.modules.conferenceRoom.domain.MeetingRoom; |
| | | import me.zhengjie.modules.conferenceRoom.service.MeetingRoomService; |
| | | import me.zhengjie.modules.conferenceRoom.service.dto.MeetingRoomQueryCriteria; |
| | | import me.zhengjie.modules.system.domain.CustomerResources; |
| | | 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 wcd |
| | | * @date 2023-02-07 |
| | | **/ |
| | | @RestController |
| | | @RequiredArgsConstructor |
| | | @Api(tags = "会议室信息管理") |
| | | @RequestMapping("/api/meetingRoom") |
| | | public class MeetingRoomController { |
| | | |
| | | private final MeetingRoomService meetingRoomService; |
| | | |
| | | @Log("导出数据") |
| | | @ApiOperation("导出数据") |
| | | @GetMapping(value = "/download") |
| | | @PreAuthorize("@el.check('meetingRoom:download')") |
| | | public void exportMeetingRoom(HttpServletResponse response, MeetingRoomQueryCriteria criteria) throws IOException { |
| | | meetingRoomService.download(meetingRoomService.queryAll(criteria), response); |
| | | } |
| | | |
| | | @GetMapping |
| | | @Log("查询会议室信息") |
| | | @ApiOperation("查询会议室信息") |
| | | @PreAuthorize("@el.check('meetingRoom:list')") |
| | | public ResponseEntity<Object> queryMeetingRoom(MeetingRoomQueryCriteria criteria, Pageable pageable){ |
| | | return new ResponseEntity<>(meetingRoomService.queryAll(criteria,pageable),HttpStatus.OK); |
| | | } |
| | | |
| | | @GetMapping(value = "/all") |
| | | @Log("查询会议室信息") |
| | | @ApiOperation("查询会议室信息") |
| | | @PreAuthorize("@el.check('meetingRoom:list')") |
| | | public ResponseEntity<Object> queryMeetingRoom(MeetingRoomQueryCriteria criteria){ |
| | | return new ResponseEntity<>(meetingRoomService.queryAll(criteria),HttpStatus.OK); |
| | | } |
| | | |
| | | @PostMapping |
| | | @Log("新增会议室信息") |
| | | @ApiOperation("新增会议室信息") |
| | | @PreAuthorize("@el.check('meetingRoom:add')") |
| | | public ResponseEntity<Object> createMeetingRoom(@Validated @RequestBody MeetingRoom resources){ |
| | | return new ResponseEntity<>(meetingRoomService.create(resources),HttpStatus.CREATED); |
| | | } |
| | | |
| | | @PutMapping |
| | | @Log("修改会议室信息") |
| | | @ApiOperation("修改会议室信息") |
| | | @PreAuthorize("@el.check('meetingRoom:edit')") |
| | | public ResponseEntity<Object> updateMeetingRoom(@Validated @RequestBody MeetingRoom resources){ |
| | | meetingRoomService.update(resources); |
| | | return new ResponseEntity<>(HttpStatus.NO_CONTENT); |
| | | } |
| | | |
| | | @DeleteMapping |
| | | @Log("删除会议室信息") |
| | | @ApiOperation("删除会议室信息") |
| | | @PreAuthorize("@el.check('meetingRoom:del')") |
| | | public ResponseEntity<Object> deleteMeetingRoom(@RequestBody Long[] ids) { |
| | | meetingRoomService.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.conferenceRoom.rest; |
| | | |
| | | import me.zhengjie.annotation.Log; |
| | | import me.zhengjie.modules.conferenceRoom.domain.MeetingRoomReservation; |
| | | import me.zhengjie.modules.conferenceRoom.service.MeetingRoomReservationService; |
| | | import me.zhengjie.modules.conferenceRoom.service.dto.MeetingRoomReservationQueryCriteria; |
| | | 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 wcd |
| | | * @date 2023-02-09 |
| | | **/ |
| | | @RestController |
| | | @RequiredArgsConstructor |
| | | @Api(tags = "会议室预约管理") |
| | | @RequestMapping("/api/meetingRoomReservation") |
| | | public class MeetingRoomReservationController { |
| | | |
| | | private final MeetingRoomReservationService meetingRoomReservationService; |
| | | |
| | | @Log("导出数据") |
| | | @ApiOperation("导出数据") |
| | | @GetMapping(value = "/download") |
| | | @PreAuthorize("@el.check('meetingRoomReservation:download')") |
| | | public void exportMeetingRoomReservation(HttpServletResponse response, MeetingRoomReservationQueryCriteria criteria) throws IOException { |
| | | meetingRoomReservationService.download(meetingRoomReservationService.queryAll(criteria), response); |
| | | } |
| | | |
| | | @GetMapping |
| | | @Log("查询会议室预约") |
| | | @ApiOperation("查询会议室预约") |
| | | @PreAuthorize("@el.check('meetingRoomReservation:list')") |
| | | public ResponseEntity<Object> queryMeetingRoomReservation(MeetingRoomReservationQueryCriteria criteria, Pageable pageable){ |
| | | return new ResponseEntity<>(meetingRoomReservationService.queryAll(criteria,pageable),HttpStatus.OK); |
| | | } |
| | | |
| | | @GetMapping(value = "/all") |
| | | @Log("查询会议室预约") |
| | | @ApiOperation("查询会议室预约") |
| | | @PreAuthorize("@el.check('meetingRoomReservation:list')") |
| | | public ResponseEntity<Object> queryMeetingRoomReservation(MeetingRoomReservationQueryCriteria criteria){ |
| | | return new ResponseEntity<>(meetingRoomReservationService.queryAll(criteria),HttpStatus.OK); |
| | | } |
| | | |
| | | @PostMapping |
| | | @Log("新增会议室预约") |
| | | @ApiOperation("新增会议室预约") |
| | | @PreAuthorize("@el.check('meetingRoomReservation:add')") |
| | | public ResponseEntity<Object> createMeetingRoomReservation(@Validated @RequestBody MeetingRoomReservation resources) throws Exception { |
| | | return new ResponseEntity<>(meetingRoomReservationService.create(resources),HttpStatus.CREATED); |
| | | } |
| | | |
| | | @PutMapping |
| | | @Log("修改会议室预约") |
| | | @ApiOperation("修改会议室预约") |
| | | @PreAuthorize("@el.check('meetingRoomReservation:edit')") |
| | | public ResponseEntity<Object> updateMeetingRoomReservation(@Validated @RequestBody MeetingRoomReservation resources) throws Exception { |
| | | meetingRoomReservationService.update(resources); |
| | | return new ResponseEntity<>(HttpStatus.NO_CONTENT); |
| | | } |
| | | |
| | | @DeleteMapping |
| | | @Log("删除会议室预约") |
| | | @ApiOperation("删除会议室预约") |
| | | @PreAuthorize("@el.check('meetingRoomReservation:del')") |
| | | public ResponseEntity<Object> deleteMeetingRoomReservation(@RequestBody Long[] ids) { |
| | | meetingRoomReservationService.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.conferenceRoom.service; |
| | | |
| | | import me.zhengjie.modules.conferenceRoom.domain.MeetingRoomReservation; |
| | | import me.zhengjie.modules.conferenceRoom.service.dto.MeetingRoomReservationDto; |
| | | import me.zhengjie.modules.conferenceRoom.service.dto.MeetingRoomReservationQueryCriteria; |
| | | 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 wcd |
| | | * @date 2023-02-09 |
| | | **/ |
| | | public interface MeetingRoomReservationService { |
| | | |
| | | /** |
| | | * 查询数据分页 |
| | | * @param criteria 条件 |
| | | * @param pageable 分页参数 |
| | | * @return Map<String,Object> |
| | | */ |
| | | Map<String,Object> queryAll(MeetingRoomReservationQueryCriteria criteria, Pageable pageable); |
| | | |
| | | /** |
| | | * 查询所有数据不分页 |
| | | * @param criteria 条件参数 |
| | | * @return List<MeetingRoomReservationDto> |
| | | */ |
| | | List<MeetingRoomReservationDto> queryAll(MeetingRoomReservationQueryCriteria criteria); |
| | | |
| | | /** |
| | | * 根据ID查询 |
| | | * @param id ID |
| | | * @return MeetingRoomReservationDto |
| | | */ |
| | | MeetingRoomReservationDto findById(Long id); |
| | | |
| | | /** |
| | | * 创建 |
| | | * @param resources / |
| | | * @return MeetingRoomReservationDto |
| | | */ |
| | | MeetingRoomReservationDto create(MeetingRoomReservation resources) throws Exception; |
| | | |
| | | /** |
| | | * 编辑 |
| | | * @param resources / |
| | | */ |
| | | void update(MeetingRoomReservation resources) throws Exception; |
| | | |
| | | /** |
| | | * 多选删除 |
| | | * @param ids / |
| | | */ |
| | | void deleteAll(Long[] ids); |
| | | |
| | | /** |
| | | * 导出数据 |
| | | * @param all 待导出的数据 |
| | | * @param response / |
| | | * @throws IOException / |
| | | */ |
| | | void download(List<MeetingRoomReservationDto> all, HttpServletResponse response) throws IOException; |
| | | } |
copy from eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/service/SysUserCompanyService.java
copy to eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/conferenceRoom/service/MeetingRoomService.java
| File was copied from eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/service/SysUserCompanyService.java |
| | |
| | | * See the License for the specific language governing permissions and |
| | | * limitations under the License. |
| | | */ |
| | | package me.zhengjie.modules.system.service; |
| | | package me.zhengjie.modules.conferenceRoom.service; |
| | | |
| | | import me.zhengjie.modules.system.domain.SysUserCompany; |
| | | import me.zhengjie.modules.system.service.dto.SysUserCompanyDto; |
| | | import me.zhengjie.modules.system.service.dto.SysUserCompanyQueryCriteria; |
| | | import me.zhengjie.modules.conferenceRoom.domain.MeetingRoom; |
| | | import me.zhengjie.modules.conferenceRoom.service.dto.MeetingRoomDto; |
| | | import me.zhengjie.modules.conferenceRoom.service.dto.MeetingRoomQueryCriteria; |
| | | import org.springframework.data.domain.Pageable; |
| | | import java.util.Map; |
| | | import java.util.List; |
| | |
| | | * @website https://eladmin.vip |
| | | * @description 服务接口 |
| | | * @author wcd |
| | | * @date 2023-01-30 |
| | | * @date 2023-02-07 |
| | | **/ |
| | | public interface SysUserCompanyService { |
| | | public interface MeetingRoomService { |
| | | |
| | | /** |
| | | * 查询数据分页 |
| | |
| | | * @param pageable 分页参数 |
| | | * @return Map<String,Object> |
| | | */ |
| | | Map<String,Object> queryAll(SysUserCompanyQueryCriteria criteria, Pageable pageable); |
| | | Map<String,Object> queryAll(MeetingRoomQueryCriteria criteria, Pageable pageable); |
| | | |
| | | /** |
| | | * 查询所有数据不分页 |
| | | * @param criteria 条件参数 |
| | | * @return List<SystemSettingDto> |
| | | * @return List<MeetingRoomDto> |
| | | */ |
| | | List<SysUserCompanyDto> queryAll(SysUserCompanyQueryCriteria criteria); |
| | | List<MeetingRoomDto> queryAll(MeetingRoomQueryCriteria criteria); |
| | | |
| | | /** |
| | | * 根据ID查询 |
| | | * @param id ID |
| | | * @return SystemSettingDto |
| | | * @return MeetingRoomDto |
| | | */ |
| | | SysUserCompanyDto findById(Long id); |
| | | MeetingRoomDto findById(Long id); |
| | | |
| | | /** |
| | | * 创建 |
| | | * @param resources / |
| | | * @return SystemSettingDto |
| | | * @return MeetingRoomDto |
| | | */ |
| | | SysUserCompanyDto create(SysUserCompany resources); |
| | | MeetingRoomDto create(MeetingRoom resources); |
| | | |
| | | /** |
| | | * 编辑 |
| | | * @param resources / |
| | | */ |
| | | void update(SysUserCompany resources); |
| | | void update(MeetingRoom resources); |
| | | |
| | | /** |
| | | * 多选删除 |
| | |
| | | * @param response / |
| | | * @throws IOException / |
| | | */ |
| | | void download(List<SysUserCompanyDto> all, HttpServletResponse response) throws IOException; |
| | | void download(List<MeetingRoomDto> all, HttpServletResponse response) throws IOException; |
| | | |
| | | /** |
| | | * 选择用户改变公司 |
| | | * @param resources |
| | | * @return |
| | | */ |
| | | SysUserCompany getCompName(SysUserCompanyDto resources); |
| | | |
| | | } |
| 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.conferenceRoom.service.dto; |
| | | |
| | | import lombok.Data; |
| | | import java.sql.Timestamp; |
| | | import java.io.Serializable; |
| | | import java.util.List; |
| | | |
| | | import com.alibaba.fastjson.annotation.JSONField; |
| | | import com.alibaba.fastjson.serializer.ToStringSerializer; |
| | | import me.zhengjie.base.BaseDTO; |
| | | |
| | | /** |
| | | * @website https://eladmin.vip |
| | | * @description / |
| | | * @author wcd |
| | | * @date 2023-02-07 |
| | | **/ |
| | | @Data |
| | | public class MeetingRoomDto extends BaseDTO implements Serializable { |
| | | |
| | | private Long id; |
| | | |
| | | /** 会议室名称 */ |
| | | private String conferenceRoomName; |
| | | |
| | | /** 会议室地址 */ |
| | | private String conferenceRoomAddress; |
| | | |
| | | /** 容纳人数 */ |
| | | private Long capacity; |
| | | |
| | | /** 备注 */ |
| | | private String remarks; |
| | | |
| | | /** 资产名称数组 */ |
| | | private List<String> snum; |
| | | } |
copy from eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/service/dto/SysUserCompanyQueryCriteria.java
copy to eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/conferenceRoom/service/dto/MeetingRoomQueryCriteria.java
| File was copied from eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/service/dto/SysUserCompanyQueryCriteria.java |
| | |
| | | * See the License for the specific language governing permissions and |
| | | * limitations under the License. |
| | | */ |
| | | package me.zhengjie.modules.system.service.dto; |
| | | package me.zhengjie.modules.conferenceRoom.service.dto; |
| | | |
| | | import lombok.Data; |
| | | import java.util.List; |
| | |
| | | /** |
| | | * @website https://eladmin.vip |
| | | * @author wcd |
| | | * @date 2023-01-30 |
| | | * @date 2023-02-07 |
| | | **/ |
| | | @Data |
| | | public class SysUserCompanyQueryCriteria { |
| | | |
| | | @Query(type = Query.Type.INNER_LIKE) |
| | | private String label; |
| | | public class MeetingRoomQueryCriteria{ |
| | | } |
| 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.conferenceRoom.service.dto; |
| | | |
| | | import lombok.Data; |
| | | import me.zhengjie.base.BaseDTO; |
| | | |
| | | import java.sql.Timestamp; |
| | | import java.io.Serializable; |
| | | |
| | | /** |
| | | * @website https://eladmin.vip |
| | | * @description / |
| | | * @author wcd |
| | | * @date 2023-02-09 |
| | | **/ |
| | | @Data |
| | | public class MeetingRoomReservationDto extends BaseDTO implements Serializable { |
| | | |
| | | private Long id; |
| | | |
| | | /** 会议室id */ |
| | | private Long meetingId; |
| | | |
| | | /** 会议主题 */ |
| | | private String meetingTheme; |
| | | |
| | | /** 开始时间 */ |
| | | private Timestamp startTime; |
| | | |
| | | /** 结束时间 */ |
| | | private Timestamp endTime; |
| | | |
| | | /** 参与人数 */ |
| | | private Long numberOfParticipants; |
| | | |
| | | /** 备注 */ |
| | | private String remarks; |
| | | |
| | | /** 会议室名称 */ |
| | | private String meetingName; |
| | | } |
| 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.conferenceRoom.service.dto; |
| | | |
| | | import lombok.Data; |
| | | |
| | | import java.sql.Timestamp; |
| | | import java.util.List; |
| | | import me.zhengjie.annotation.Query; |
| | | |
| | | /** |
| | | * @website https://eladmin.vip |
| | | * @author wcd |
| | | * @date 2023-02-09 |
| | | **/ |
| | | @Data |
| | | public class MeetingRoomReservationQueryCriteria{ |
| | | |
| | | @Query |
| | | private Long meetingId; |
| | | |
| | | @Query(type = Query.Type.INNER_LIKE, propName = "meetingTheme") |
| | | private String meetingTheme; |
| | | |
| | | @Query(type = Query.Type.BETWEEN, propName = "startTime") |
| | | private List<Timestamp> startTime; |
| | | |
| | | @Query(type = Query.Type.BETWEEN, propName = "endTime") |
| | | private List<Timestamp> endTime; |
| | | } |
| 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.conferenceRoom.service.impl; |
| | | |
| | | import me.zhengjie.exception.BadRequestException; |
| | | import me.zhengjie.modules.assetManagement.domain.AssetManagement; |
| | | import me.zhengjie.modules.assetManagement.domain.AssetUseManagement; |
| | | import me.zhengjie.modules.attendance.domain.AttendanceGoOut; |
| | | import me.zhengjie.modules.conferenceRoom.domain.MeetingRoom; |
| | | import me.zhengjie.modules.conferenceRoom.domain.MeetingRoomReservation; |
| | | import me.zhengjie.modules.conferenceRoom.repository.MeetingRoomRepository; |
| | | import me.zhengjie.modules.conferenceRoom.service.dto.MeetingRoomDto; |
| | | import me.zhengjie.modules.constant.Constant; |
| | | import me.zhengjie.modules.quartz.service.OpaiDingTalkService; |
| | | import me.zhengjie.modules.system.domain.CustomerResources; |
| | | import me.zhengjie.modules.system.domain.Role; |
| | | import me.zhengjie.modules.system.domain.User; |
| | | import me.zhengjie.modules.system.repository.UserRepository; |
| | | import me.zhengjie.utils.ValidationUtil; |
| | | import me.zhengjie.utils.FileUtil; |
| | | import lombok.RequiredArgsConstructor; |
| | | import me.zhengjie.modules.conferenceRoom.repository.MeetingRoomReservationRepository; |
| | | import me.zhengjie.modules.conferenceRoom.service.MeetingRoomReservationService; |
| | | import me.zhengjie.modules.conferenceRoom.service.dto.MeetingRoomReservationDto; |
| | | import me.zhengjie.modules.conferenceRoom.service.dto.MeetingRoomReservationQueryCriteria; |
| | | import me.zhengjie.modules.conferenceRoom.service.mapstruct.MeetingRoomReservationMapper; |
| | | import org.apache.commons.lang3.ObjectUtils; |
| | | 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.text.SimpleDateFormat; |
| | | import java.util.*; |
| | | import java.io.IOException; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.util.function.Function; |
| | | |
| | | /** |
| | | * @website https://eladmin.vip |
| | | * @description 服务实现 |
| | | * @author wcd |
| | | * @date 2023-02-09 |
| | | **/ |
| | | @Service |
| | | @RequiredArgsConstructor |
| | | public class MeetingRoomReservationServiceImpl implements MeetingRoomReservationService { |
| | | |
| | | private final MeetingRoomReservationRepository meetingRoomReservationRepository; |
| | | private final MeetingRoomReservationMapper meetingRoomReservationMapper; |
| | | private final MeetingRoomRepository meetingRoomRepository; |
| | | private final OpaiDingTalkService opaiDingTalkService; |
| | | private final UserRepository userRepository; |
| | | |
| | | @Override |
| | | public Map<String,Object> queryAll(MeetingRoomReservationQueryCriteria criteria, Pageable pageable){ |
| | | Page<MeetingRoomReservation> page = meetingRoomReservationRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable); |
| | | //将实体转换为Dto(重写) |
| | | Function<MeetingRoomReservation, MeetingRoomReservationDto> func = new Function<MeetingRoomReservation, MeetingRoomReservationDto>(){ |
| | | @Override |
| | | public MeetingRoomReservationDto apply(MeetingRoomReservation meetingRoomReservation) { |
| | | // 将实体类转换成DTO |
| | | MeetingRoomReservationDto meetingRoomReservationDto = meetingRoomReservationMapper.toDto(meetingRoomReservation); |
| | | // 查询会议室 |
| | | MeetingRoom meetingRoom = meetingRoomRepository.findById(meetingRoomReservationDto.getMeetingId()).orElseGet(MeetingRoom::new); |
| | | meetingRoomReservationDto.setMeetingName(meetingRoom.getConferenceRoomName()); |
| | | return meetingRoomReservationDto; |
| | | } |
| | | }; |
| | | return PageUtil.toPage(page.map(func)); |
| | | } |
| | | |
| | | @Override |
| | | public List<MeetingRoomReservationDto> queryAll(MeetingRoomReservationQueryCriteria criteria){ |
| | | return meetingRoomReservationMapper.toDto(meetingRoomReservationRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder))); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional |
| | | public MeetingRoomReservationDto findById(Long id) { |
| | | MeetingRoomReservation meetingRoomReservation = meetingRoomReservationRepository.findById(id).orElseGet(MeetingRoomReservation::new); |
| | | ValidationUtil.isNull(meetingRoomReservation.getId(),"MeetingRoomReservation","id",id); |
| | | return meetingRoomReservationMapper.toDto(meetingRoomReservation); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public MeetingRoomReservationDto create(MeetingRoomReservation resources) throws Exception { |
| | | SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
| | | String startTime = df.format(resources.getStartTime()); |
| | | String endTime = df.format(resources.getEndTime()); |
| | | //验证约时间是否冲突 |
| | | List<MeetingRoomReservation> meetingRoomReservations = meetingRoomReservationRepository.checkReservationTime(startTime,endTime,resources.getMeetingId()); |
| | | if(meetingRoomReservations.size() > 0){ |
| | | MeetingRoomReservation errorMeetingRoomReservation = meetingRoomReservations.get(0); |
| | | SimpleDateFormat errorFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
| | | throw new BadRequestException("预约时间冲突," + errorFormat.format(errorMeetingRoomReservation.getStartTime()) + "至" + errorFormat.format(errorMeetingRoomReservation.getEndTime()) |
| | | + "已经存在会议室预约,请调整时间"); |
| | | }else{ |
| | | //调用钉钉公共方法 |
| | | setDingding(resources); |
| | | } |
| | | return meetingRoomReservationMapper.toDto(meetingRoomReservationRepository.save(resources)); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void update(MeetingRoomReservation resources) throws Exception { |
| | | MeetingRoomReservation meetingRoomReservation = meetingRoomReservationRepository.findById(resources.getId()).orElseGet(MeetingRoomReservation::new); |
| | | ValidationUtil.isNull( meetingRoomReservation.getId(),"MeetingRoomReservation","id",resources.getId()); |
| | | meetingRoomReservation.copy(resources); |
| | | SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
| | | String startTime = df.format(resources.getStartTime()); |
| | | String endTime = df.format(resources.getEndTime()); |
| | | // 会议室预约id |
| | | Set<Long> ids = new HashSet<>(); |
| | | ids.add(meetingRoomReservation.getId()); |
| | | //验证时间是否冲突 |
| | | List<MeetingRoomReservation> meetingRoomReservations = meetingRoomReservationRepository.checkReservationTimeEdit(startTime,endTime, resources.getMeetingId(), ids); |
| | | if(meetingRoomReservations.size() > 0){ |
| | | MeetingRoomReservation errorMeetingRoomReservation = meetingRoomReservations.get(0); |
| | | SimpleDateFormat errorFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
| | | throw new BadRequestException("预约时间冲突," + errorFormat.format(errorMeetingRoomReservation.getStartTime()) + "至" + errorFormat.format(errorMeetingRoomReservation.getEndTime()) |
| | | + "已经存在会议室预约,请调整时间"); |
| | | }else{ |
| | | setDingding(resources); |
| | | } |
| | | meetingRoomReservationRepository.save(meetingRoomReservation); |
| | | } |
| | | |
| | | /** |
| | | * 发送钉钉公共方法 |
| | | * @param resources |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | public void setDingding(MeetingRoomReservation resources) throws Exception { |
| | | // 获取存储用户钉钉号 |
| | | List<String> dingDingList = new ArrayList<>(); |
| | | // 查询用户 |
| | | List<User> userList = userRepository.findAll(); |
| | | for(User user : userList){ |
| | | Role role = user.getRoles().iterator().next(); |
| | | // 获取项目组长级以上的用户的钉钉id |
| | | if(Long.valueOf(role.getLevel()) <= Constant.ROLE_LEVEL_LEADER){ |
| | | if(ObjectUtils.isNotEmpty(user.getDingding())){ |
| | | dingDingList.add(user.getDingding()); |
| | | } |
| | | } |
| | | } |
| | | // 查询会议室 |
| | | MeetingRoom meetingRoom = meetingRoomRepository.findById(resources.getMeetingId()).orElseGet(MeetingRoom::new); |
| | | // 发送内容至钉钉 |
| | | opaiDingTalkService.sendNotice(dingDingList, "会议室预约提示", "### 会议室预约提示 \n >" + |
| | | " \n 会议室:" + meetingRoom.getConferenceRoomName() + |
| | | " \n 开始时间: " + resources.getStartTime().toString().substring(0,19) + |
| | | " \n 结束时间: " + resources.getEndTime().toString().substring(0,19) + |
| | | " \n 会议室预约有变更,请登录PMS系统查看。", "card"); |
| | | } |
| | | |
| | | @Override |
| | | public void deleteAll(Long[] ids) { |
| | | for (Long id : ids) { |
| | | meetingRoomReservationRepository.deleteById(id); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public void download(List<MeetingRoomReservationDto> all, HttpServletResponse response) throws IOException { |
| | | List<Map<String, Object>> list = new ArrayList<>(); |
| | | for (MeetingRoomReservationDto meetingRoomReservation : all) { |
| | | // 查询会议室 |
| | | MeetingRoom meetingRoom = meetingRoomRepository.findById(meetingRoomReservation.getMeetingId()).orElseGet(MeetingRoom::new); |
| | | Map<String,Object> map = new LinkedHashMap<>(); |
| | | map.put("会议室", meetingRoom.getConferenceRoomName()); |
| | | map.put("会议主题", meetingRoomReservation.getMeetingTheme()); |
| | | map.put("开始时间", meetingRoomReservation.getStartTime()); |
| | | map.put("结束时间", meetingRoomReservation.getEndTime()); |
| | | map.put("参与人数", meetingRoomReservation.getNumberOfParticipants()); |
| | | map.put("备注", meetingRoomReservation.getRemarks()); |
| | | map.put("创建者", meetingRoomReservation.getCreateBy()); |
| | | map.put("创建时间", meetingRoomReservation.getCreateTime()); |
| | | map.put("更新者", meetingRoomReservation.getUpdateBy()); |
| | | map.put("更新时间", meetingRoomReservation.getUpdateTime()); |
| | | list.add(map); |
| | | } |
| | | FileUtil.downloadExcel(list, response); |
| | | } |
| | | } |
| 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.conferenceRoom.service.impl; |
| | | |
| | | import me.zhengjie.modules.assetManagement.domain.AssetManagement; |
| | | import me.zhengjie.modules.assetManagement.domain.AssetUseManagement; |
| | | import me.zhengjie.modules.assetManagement.repository.AssetManagementRepository; |
| | | import me.zhengjie.modules.assetManagement.repository.AssetUseManagementRepository; |
| | | import me.zhengjie.modules.assetManagement.service.dto.AssetUseManagementDto; |
| | | import me.zhengjie.modules.attendance.domain.Attendance; |
| | | import me.zhengjie.modules.attendance.service.dto.AttendanceDto; |
| | | import me.zhengjie.modules.conferenceRoom.domain.MeetingRoom; |
| | | import me.zhengjie.modules.system.domain.User; |
| | | import me.zhengjie.utils.ValidationUtil; |
| | | import me.zhengjie.utils.FileUtil; |
| | | import lombok.RequiredArgsConstructor; |
| | | import me.zhengjie.modules.conferenceRoom.repository.MeetingRoomRepository; |
| | | import me.zhengjie.modules.conferenceRoom.service.MeetingRoomService; |
| | | import me.zhengjie.modules.conferenceRoom.service.dto.MeetingRoomDto; |
| | | import me.zhengjie.modules.conferenceRoom.service.dto.MeetingRoomQueryCriteria; |
| | | import me.zhengjie.modules.conferenceRoom.service.mapstruct.MeetingRoomMapper; |
| | | import org.apache.commons.lang3.ObjectUtils; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import cn.hutool.core.lang.Snowflake; |
| | | import cn.hutool.core.util.IdUtil; |
| | | import org.springframework.data.domain.Page; |
| | | import org.springframework.data.domain.Pageable; |
| | | import me.zhengjie.utils.PageUtil; |
| | | import me.zhengjie.utils.QueryHelp; |
| | | |
| | | import java.util.*; |
| | | import java.io.IOException; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.util.function.Function; |
| | | |
| | | /** |
| | | * @website https://eladmin.vip |
| | | * @description 服务实现 |
| | | * @author wcd |
| | | * @date 2023-02-07 |
| | | **/ |
| | | @Service |
| | | @RequiredArgsConstructor |
| | | public class MeetingRoomServiceImpl implements MeetingRoomService { |
| | | |
| | | private final MeetingRoomRepository meetingRoomRepository; |
| | | private final MeetingRoomMapper meetingRoomMapper; |
| | | private final AssetUseManagementRepository assetUseManagementRepository; |
| | | private final AssetManagementRepository assetManagementRepository; |
| | | |
| | | @Override |
| | | public Map<String,Object> queryAll(MeetingRoomQueryCriteria criteria, Pageable pageable){ |
| | | Page<MeetingRoom> page = meetingRoomRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable); |
| | | //将实体转换为Dto(重写) |
| | | Function<MeetingRoom, MeetingRoomDto> func = new Function<MeetingRoom, MeetingRoomDto>(){ |
| | | |
| | | @Override |
| | | public MeetingRoomDto apply(MeetingRoom meetingRoom) { |
| | | // 将实体类转换成DTO |
| | | MeetingRoomDto meetingRoomDto = meetingRoomMapper.toDto(meetingRoom); |
| | | List<Long> sum = new ArrayList<>(); |
| | | // 查询资产管理 |
| | | List<AssetUseManagement> assetUseManagements = assetUseManagementRepository.findByMeetingId(meetingRoomDto.getId()); |
| | | for(int i = 0; i< assetUseManagements.size(); i++){ |
| | | sum.add(assetUseManagements.get(i).getAssetId()); |
| | | } |
| | | HashSet h = new HashSet(sum); |
| | | sum.clear(); |
| | | sum.addAll(h); |
| | | List<String> snum = new ArrayList<>(); |
| | | for(int i = 0; i < sum.size(); i++){ |
| | | // 查询资产记录 |
| | | AssetManagement assetManagement = assetManagementRepository.findById(sum.get(i)).orElseGet(AssetManagement::new); |
| | | if(ObjectUtils.isNotEmpty(assetManagement)){ |
| | | snum.add(assetManagement.getName()); |
| | | } |
| | | } |
| | | meetingRoomDto.setSnum(snum); |
| | | return meetingRoomDto; |
| | | } |
| | | }; |
| | | return PageUtil.toPage(page.map(func)); |
| | | } |
| | | |
| | | @Override |
| | | public List<MeetingRoomDto> queryAll(MeetingRoomQueryCriteria criteria){ |
| | | return meetingRoomMapper.toDto(meetingRoomRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder))); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional |
| | | public MeetingRoomDto findById(Long id) { |
| | | MeetingRoom meetingRoom = meetingRoomRepository.findById(id).orElseGet(MeetingRoom::new); |
| | | ValidationUtil.isNull(meetingRoom.getId(),"MeetingRoom","id",id); |
| | | return meetingRoomMapper.toDto(meetingRoom); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public MeetingRoomDto create(MeetingRoom resources) { |
| | | Snowflake snowflake = IdUtil.createSnowflake(1, 1); |
| | | resources.setId(snowflake.nextId()); |
| | | return meetingRoomMapper.toDto(meetingRoomRepository.save(resources)); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void update(MeetingRoom resources) { |
| | | MeetingRoom meetingRoom = meetingRoomRepository.findById(resources.getId()).orElseGet(MeetingRoom::new); |
| | | ValidationUtil.isNull( meetingRoom.getId(),"MeetingRoom","id",resources.getId()); |
| | | meetingRoom.copy(resources); |
| | | meetingRoomRepository.save(meetingRoom); |
| | | } |
| | | |
| | | @Override |
| | | public void deleteAll(Long[] ids) { |
| | | for (Long id : ids) { |
| | | meetingRoomRepository.deleteById(id); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public void download(List<MeetingRoomDto> all, HttpServletResponse response) throws IOException { |
| | | List<Map<String, Object>> list = new ArrayList<>(); |
| | | for (MeetingRoomDto meetingRoom : all) { |
| | | Map<String,Object> map = new LinkedHashMap<>(); |
| | | map.put("会议室名称", meetingRoom.getConferenceRoomName()); |
| | | map.put("会议室地址", meetingRoom.getConferenceRoomAddress()); |
| | | map.put("容纳人数", meetingRoom.getCapacity()); |
| | | List<Long> sum = new ArrayList<>(); |
| | | // 查询资产管理 |
| | | List<AssetUseManagement> assetUseManagements = assetUseManagementRepository.findByMeetingId(meetingRoom.getId()); |
| | | for(int i = 0; i< assetUseManagements.size(); i++){ |
| | | sum.add(assetUseManagements.get(i).getAssetId()); |
| | | } |
| | | HashSet h = new HashSet(sum); |
| | | sum.clear(); |
| | | sum.addAll(h); |
| | | List<String> snum = new ArrayList<>(); |
| | | for(int i = 0; i < sum.size(); i++){ |
| | | // 查询资产记录 |
| | | AssetManagement assetManagement = assetManagementRepository.findById(sum.get(i)).orElseGet(AssetManagement::new); |
| | | if(ObjectUtils.isNotEmpty(assetManagement)){ |
| | | snum.add(assetManagement.getName()); |
| | | } |
| | | } |
| | | map.put("设备", snum); |
| | | map.put("备注", meetingRoom.getRemarks()); |
| | | map.put("创建者", meetingRoom.getCreateBy()); |
| | | map.put("创建时间", meetingRoom.getCreateTime()); |
| | | map.put("更新者", meetingRoom.getUpdateBy()); |
| | | map.put("更新时间", meetingRoom.getUpdateTime()); |
| | | list.add(map); |
| | | } |
| | | FileUtil.downloadExcel(list, response); |
| | | } |
| | | } |
copy from eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/service/mapstruct/SysUserCompanyMapper.java
copy to eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/conferenceRoom/service/mapstruct/MeetingRoomMapper.java
| File was copied from eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/service/mapstruct/SysUserCompanyMapper.java |
| | |
| | | * See the License for the specific language governing permissions and |
| | | * limitations under the License. |
| | | */ |
| | | package me.zhengjie.modules.system.service.mapstruct; |
| | | package me.zhengjie.modules.conferenceRoom.service.mapstruct; |
| | | |
| | | import me.zhengjie.base.BaseMapper; |
| | | import me.zhengjie.modules.system.domain.SysUserCompany; |
| | | import me.zhengjie.modules.system.service.dto.SysUserCompanyDto; |
| | | import me.zhengjie.modules.conferenceRoom.domain.MeetingRoom; |
| | | import me.zhengjie.modules.conferenceRoom.service.dto.MeetingRoomDto; |
| | | import org.mapstruct.Mapper; |
| | | import org.mapstruct.ReportingPolicy; |
| | | |
| | | /** |
| | | * @website https://eladmin.vip |
| | | * @author wcd |
| | | * @date 2023-01-30 |
| | | * @date 2023-02-07 |
| | | **/ |
| | | @Mapper(componentModel = "spring", unmappedTargetPolicy = ReportingPolicy.IGNORE) |
| | | public interface SysUserCompanyMapper extends BaseMapper<SysUserCompanyDto, SysUserCompany> { |
| | | public interface MeetingRoomMapper extends BaseMapper<MeetingRoomDto, MeetingRoom> { |
| | | |
| | | } |
copy from eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/service/mapstruct/SysUserCompanyMapper.java
copy to eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/conferenceRoom/service/mapstruct/MeetingRoomReservationMapper.java
| File was copied from eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/service/mapstruct/SysUserCompanyMapper.java |
| | |
| | | * See the License for the specific language governing permissions and |
| | | * limitations under the License. |
| | | */ |
| | | package me.zhengjie.modules.system.service.mapstruct; |
| | | package me.zhengjie.modules.conferenceRoom.service.mapstruct; |
| | | |
| | | import me.zhengjie.base.BaseMapper; |
| | | import me.zhengjie.modules.system.domain.SysUserCompany; |
| | | import me.zhengjie.modules.system.service.dto.SysUserCompanyDto; |
| | | import me.zhengjie.modules.conferenceRoom.domain.MeetingRoomReservation; |
| | | import me.zhengjie.modules.conferenceRoom.service.dto.MeetingRoomReservationDto; |
| | | import org.mapstruct.Mapper; |
| | | import org.mapstruct.ReportingPolicy; |
| | | |
| | | /** |
| | | * @website https://eladmin.vip |
| | | * @author wcd |
| | | * @date 2023-01-30 |
| | | * @date 2023-02-09 |
| | | **/ |
| | | @Mapper(componentModel = "spring", unmappedTargetPolicy = ReportingPolicy.IGNORE) |
| | | public interface SysUserCompanyMapper extends BaseMapper<SysUserCompanyDto, SysUserCompany> { |
| | | public interface MeetingRoomReservationMapper extends BaseMapper<MeetingRoomReservationDto, MeetingRoomReservation> { |
| | | |
| | | } |
| | |
| | | // 公示状态:已公示 |
| | | public static final String PUBLICITY_STATUS_YES = "publicity_status_yes"; |
| | | |
| | | // 发票类型 |
| | | public static final String INVOICE_TYPE = "invoice_type"; |
| | | |
| | | // 款项类型 |
| | | public static final String FUND_TYPE = "fund_type"; |
| | | // 款项类型:合同费 |
| | | public static final String FUND_CONTRACT = "fund_contract"; |
| | | // 款项类型:服务费 |
| | | public static final String FUND_SERVICE = "fund_service"; |
| | | |
| | | // 合同类型 |
| | | public static final String CONTRACT_TYPE = "contract_type"; |
| | | // 合同类型:开发合同 |
| | | public static final String CONTRACT_DEVELOP = "contract_develop"; |
| | | // 合同类型:服务合同(年) |
| | | public static final String CONTRACT_SERVICE = "contract_service"; |
| | | // 合同类型:开发服务合同 |
| | | public static final String CONTRACT_DEVELOP_SERVICE = "contract_develop_service"; |
| | | |
| | | // 付款状态 |
| | | public static final String PAYMENT_STATE = "payment_state"; |
| | | // 付款状态:未付款 |
| | | public static final String PAYMENT_NOT = "payment_not"; |
| | | // 付款状态:部分付款 |
| | | public static final String PAYMENT_PART = "payment_part"; |
| | | // 付款状态:已付款 |
| | | public static final String PAYMENT_ALREADY = "payment_already"; |
| | | |
| | | // 合同状态 |
| | | public static final String CONTRACT_STATUS = "contract_status"; |
| | | |
| | | // key iv |
| | | public static final String key = "1234567890123456"; |
| | | public static final String iv = "1234567890123456"; |
| | | |
| | | // 提醒状态 |
| | | public static final String RESOURCES_TYPE = "resources_type"; |
| | | // 提醒状态:提醒 |
| | | public static final String RESOURCES_TYPE_REMIND = "resources_type_remind"; |
| | | // 提醒状态:不提醒 |
| | | public static final String RESOURCES_TYPE_NOREMIND = "resources_type_noRemind"; |
| | | } |
| 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-02 |
| | | **/ |
| | | @Entity |
| | | @Data |
| | | @Table(name="contract") |
| | | public class Contract extends BaseEntity implements Serializable { |
| | | |
| | | @Id |
| | | @GeneratedValue(strategy = GenerationType.IDENTITY) |
| | | @Column(name = "`contract_id`") |
| | | @ApiModelProperty(value = "ID") |
| | | private Long contractId; |
| | | |
| | | @Column(name = "`contract_number`") |
| | | @ApiModelProperty(value = "合同编号") |
| | | private String contractNumber; |
| | | |
| | | @Column(name = "`contract_name`") |
| | | @ApiModelProperty(value = "合同名称") |
| | | private String contractName; |
| | | |
| | | @Column(name = "`first_id`") |
| | | @ApiModelProperty(value = "甲方信息ID") |
| | | private Long firstId; |
| | | |
| | | @Column(name = "`second_id`") |
| | | @ApiModelProperty(value = "乙方信息ID") |
| | | private Long secondId; |
| | | |
| | | @Column(name = "`sign_date`") |
| | | @ApiModelProperty(value = "签订日期") |
| | | private Timestamp signDate; |
| | | |
| | | @Column(name = "`start_date`") |
| | | @ApiModelProperty(value = "起始日期") |
| | | private Timestamp startDate; |
| | | |
| | | @Column(name = "`end_date`") |
| | | @ApiModelProperty(value = "截止日期") |
| | | private Timestamp endDate; |
| | | |
| | | @Column(name = "`contract_area_code`") |
| | | @ApiModelProperty(value = "合同所属地区编码") |
| | | private String contractAreaCode; |
| | | |
| | | @Column(name = "`contract_area`") |
| | | @ApiModelProperty(value = "合同所属地区") |
| | | private String contractArea; |
| | | |
| | | @Column(name = "`contract_type`") |
| | | @ApiModelProperty(value = "合同类型") |
| | | private String contractType; |
| | | |
| | | @Column(name = "`contract_content`") |
| | | @ApiModelProperty(value = "合同内容") |
| | | private String contractContent; |
| | | |
| | | @Column(name = "`contract_amount`") |
| | | @ApiModelProperty(value = "合同费金额") |
| | | private BigDecimal contractAmount; |
| | | |
| | | @Column(name = "`contract_payment_date`") |
| | | @ApiModelProperty(value = "预计付款日期") |
| | | private Timestamp contractPaymentDate; |
| | | |
| | | @Column(name = "`contract_payment_state`") |
| | | @ApiModelProperty(value = "付款状态") |
| | | private String contractPaymentState; |
| | | |
| | | @Column(name = "`service_starts_date`") |
| | | @ApiModelProperty(value = "服务开始日期") |
| | | private Timestamp serviceStartsDate; |
| | | |
| | | @Column(name = "`service_amount`") |
| | | @ApiModelProperty(value = "服务费金额") |
| | | private BigDecimal serviceAmount; |
| | | |
| | | @Column(name = "`service_payment_date`") |
| | | @ApiModelProperty(value = "预计付款日期") |
| | | private Timestamp servicePaymentDate; |
| | | |
| | | @Column(name = "`service_payment_state`") |
| | | @ApiModelProperty(value = "付款状态") |
| | | private String servicePaymentState; |
| | | |
| | | @Column(name = "`related_documents_first`") |
| | | @ApiModelProperty(value = "合同初版文件") |
| | | private String relatedDocumentsFirst; |
| | | |
| | | @Column(name = "`related_documents_final`") |
| | | @ApiModelProperty(value = "合同终版文件") |
| | | private String relatedDocumentsFinal; |
| | | |
| | | @Column(name = "`contract_status`") |
| | | @ApiModelProperty(value = "合同状态") |
| | | private String contractStatus; |
| | | |
| | | @Column(name = "`remarks`") |
| | | @ApiModelProperty(value = "备注信息") |
| | | private String remarks; |
| | | |
| | | public void copy(Contract source){ |
| | | BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true)); |
| | | } |
| | | } |
| 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.io.Serializable; |
| | | |
| | | /** |
| | | * @website https://eladmin.vip |
| | | * @description / |
| | | * @author 赵士淞 |
| | | * @date 2023-02-02 |
| | | **/ |
| | | @Entity |
| | | @Data |
| | | @Table(name="contract_first") |
| | | public class ContractFirst extends BaseEntity implements Serializable { |
| | | |
| | | @Id |
| | | @GeneratedValue(strategy = GenerationType.IDENTITY) |
| | | @Column(name = "`first_id`") |
| | | @ApiModelProperty(value = "ID") |
| | | private Long firstId; |
| | | |
| | | @Column(name = "`first_name`") |
| | | @ApiModelProperty(value = "甲方名称") |
| | | private String firstName; |
| | | |
| | | @Column(name = "`first_person`") |
| | | @ApiModelProperty(value = "甲方联系人") |
| | | private String firstPerson; |
| | | |
| | | @Column(name = "`first_phone`") |
| | | @ApiModelProperty(value = "甲方联系电话") |
| | | private String firstPhone; |
| | | |
| | | @Column(name = "`first_email`") |
| | | @ApiModelProperty(value = "甲方邮件") |
| | | private String firstEmail; |
| | | |
| | | @Column(name = "`first_fax`") |
| | | @ApiModelProperty(value = "甲方传真") |
| | | private String firstFax; |
| | | |
| | | @Column(name = "`first_area_code`") |
| | | @ApiModelProperty(value = "甲方所在地区编码") |
| | | private String firstAreaCode; |
| | | |
| | | @Column(name = "`first_area`") |
| | | @ApiModelProperty(value = "甲方所在地区") |
| | | private String firstArea; |
| | | |
| | | @Column(name = "`first_address`") |
| | | @ApiModelProperty(value = "甲方详细地址") |
| | | private String firstAddress; |
| | | |
| | | @Column(name = "`remarks`") |
| | | @ApiModelProperty(value = "备注信息") |
| | | private String remarks; |
| | | |
| | | public void copy(ContractFirst source){ |
| | | BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true)); |
| | | } |
| | | } |
| 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-02 |
| | | **/ |
| | | @Entity |
| | | @Data |
| | | @Table(name="contract_invoice") |
| | | public class ContractInvoice extends BaseEntity implements Serializable { |
| | | |
| | | @Id |
| | | @GeneratedValue(strategy = GenerationType.IDENTITY) |
| | | @Column(name = "`invoice_id`") |
| | | @ApiModelProperty(value = "ID") |
| | | private Long invoiceId; |
| | | |
| | | @Column(name = "`contract_id`") |
| | | @ApiModelProperty(value = "合同ID") |
| | | private Long contractId; |
| | | |
| | | @Column(name = "`billing_time`") |
| | | @ApiModelProperty(value = "开票时间") |
| | | private Timestamp billingTime; |
| | | |
| | | @Column(name = "`invoice_type`") |
| | | @ApiModelProperty(value = "发票类型") |
| | | private String invoiceType; |
| | | |
| | | @Column(name = "`before_tax_amount`") |
| | | @ApiModelProperty(value = "税前金额") |
| | | private BigDecimal beforeTaxAmount; |
| | | |
| | | @Column(name = "`tax_rate`") |
| | | @ApiModelProperty(value = "税率") |
| | | private Double taxRate; |
| | | |
| | | @Column(name = "`tax_amount`") |
| | | @ApiModelProperty(value = "税额") |
| | | private BigDecimal taxAmount; |
| | | |
| | | @Column(name = "`after_tax_amount`") |
| | | @ApiModelProperty(value = "税后金额") |
| | | private BigDecimal afterTaxAmount; |
| | | |
| | | @Column(name = "`related_documents`") |
| | | @ApiModelProperty(value = "相关文件") |
| | | private String relatedDocuments; |
| | | |
| | | @Column(name = "`remarks`") |
| | | @ApiModelProperty(value = "备注信息") |
| | | private String remarks; |
| | | |
| | | public void copy(ContractInvoice source){ |
| | | BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true)); |
| | | } |
| | | } |
copy from eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/domain/SysUserCompany.java
copy to eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/contract/domain/ContractInvoicePayment.java
| File was copied from eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/domain/SysUserCompany.java |
| | |
| | | * See the License for the specific language governing permissions and |
| | | * limitations under the License. |
| | | */ |
| | | package me.zhengjie.modules.system.domain; |
| | | package me.zhengjie.modules.contract.domain; |
| | | |
| | | import lombok.Data; |
| | | import cn.hutool.core.bean.BeanUtil; |
| | |
| | | import me.zhengjie.base.BaseEntity; |
| | | |
| | | import javax.persistence.*; |
| | | import javax.validation.constraints.*; |
| | | import java.sql.Timestamp; |
| | | import java.io.Serializable; |
| | | |
| | | /** |
| | | * @website https://eladmin.vip |
| | | * @description / |
| | | * @author wcd |
| | | * @date 2023-01-30 |
| | | * @author 赵士淞 |
| | | * @date 2023-02-02 |
| | | **/ |
| | | @Entity |
| | | @Data |
| | | @Table(name="sys_user_company") |
| | | public class SysUserCompany extends BaseEntity implements Serializable { |
| | | @Table(name="contract_invoice_payment") |
| | | public class ContractInvoicePayment extends BaseEntity implements Serializable { |
| | | |
| | | @Id |
| | | @GeneratedValue(strategy = GenerationType.IDENTITY) |
| | | @Column(name = "`id`") |
| | | @ApiModelProperty(value = "id") |
| | | private Long id; |
| | | @Column(name = "`relation_id`") |
| | | @ApiModelProperty(value = "ID") |
| | | private Long relationId; |
| | | |
| | | @Column(name = "`description`") |
| | | @ApiModelProperty(value = "描述") |
| | | private String description; |
| | | @Column(name = "`invoice_id`") |
| | | @ApiModelProperty(value = "发票ID") |
| | | private Long invoiceId; |
| | | |
| | | @Column(name = "`label`") |
| | | @ApiModelProperty(value = "标签") |
| | | private String label; |
| | | @Column(name = "`payment_id`") |
| | | @ApiModelProperty(value = "付款ID") |
| | | private Long paymentId; |
| | | |
| | | @Column(name = "`value`") |
| | | @ApiModelProperty(value = "值") |
| | | private String value; |
| | | |
| | | public void copy(SysUserCompany source){ |
| | | public void copy(ContractInvoicePayment source){ |
| | | BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true)); |
| | | } |
| | | } |
| 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-02 |
| | | **/ |
| | | @Entity |
| | | @Data |
| | | @Table(name="contract_payment") |
| | | public class ContractPayment extends BaseEntity implements Serializable { |
| | | |
| | | @Id |
| | | @GeneratedValue(strategy = GenerationType.IDENTITY) |
| | | @Column(name = "`payment_id`") |
| | | @ApiModelProperty(value = "ID") |
| | | private Long paymentId; |
| | | |
| | | @Column(name = "`contract_id`") |
| | | @ApiModelProperty(value = "合同ID") |
| | | private Long contractId; |
| | | |
| | | @Column(name = "`payment_time`") |
| | | @ApiModelProperty(value = "付款时间") |
| | | private Timestamp paymentTime; |
| | | |
| | | @Column(name = "`fund_type`") |
| | | @ApiModelProperty(value = "款项类型") |
| | | private String fundType; |
| | | |
| | | @Column(name = "`payment_amount`") |
| | | @ApiModelProperty(value = "付款金额") |
| | | private BigDecimal paymentAmount; |
| | | |
| | | @Column(name = "`fund_belong`") |
| | | @ApiModelProperty(value = "款项内容") |
| | | private String fundBelong; |
| | | |
| | | @Column(name = "`fund_belong_start`") |
| | | @ApiModelProperty(value = "款项起始日期") |
| | | private Timestamp fundBelongStart; |
| | | |
| | | @Column(name = "`fund_belong_end`") |
| | | @ApiModelProperty(value = "款项结束日期") |
| | | private Timestamp fundBelongEnd; |
| | | |
| | | @Column(name = "`remarks`") |
| | | @ApiModelProperty(value = "备注信息") |
| | | private String remarks; |
| | | |
| | | public void copy(ContractPayment source){ |
| | | BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true)); |
| | | } |
| | | } |
| 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)); |
| | | } |
| | | } |
| 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.io.Serializable; |
| | | |
| | | /** |
| | | * @website https://eladmin.vip |
| | | * @description / |
| | | * @author 赵士淞 |
| | | * @date 2023-02-02 |
| | | **/ |
| | | @Entity |
| | | @Data |
| | | @Table(name="contract_second") |
| | | public class ContractSecond extends BaseEntity implements Serializable { |
| | | |
| | | @Id |
| | | @GeneratedValue(strategy = GenerationType.IDENTITY) |
| | | @Column(name = "`second_id`") |
| | | @ApiModelProperty(value = "ID") |
| | | private Long secondId; |
| | | |
| | | @Column(name = "`second_name`") |
| | | @ApiModelProperty(value = "乙方名称") |
| | | private String secondName; |
| | | |
| | | @Column(name = "`second_person`") |
| | | @ApiModelProperty(value = "乙方联系人") |
| | | private String secondPerson; |
| | | |
| | | @Column(name = "`second_phone`") |
| | | @ApiModelProperty(value = "乙方联系电话") |
| | | private String secondPhone; |
| | | |
| | | @Column(name = "`second_email`") |
| | | @ApiModelProperty(value = "乙方邮件") |
| | | private String secondEmail; |
| | | |
| | | @Column(name = "`second_fax`") |
| | | @ApiModelProperty(value = "乙方传真") |
| | | private String secondFax; |
| | | |
| | | @Column(name = "`second_area_code`") |
| | | @ApiModelProperty(value = "乙方所在地区编码") |
| | | private String secondAreaCode; |
| | | |
| | | @Column(name = "`second_area`") |
| | | @ApiModelProperty(value = "乙方所在地区") |
| | | private String secondArea; |
| | | |
| | | @Column(name = "`second_address`") |
| | | @ApiModelProperty(value = "乙方详细地址") |
| | | private String secondAddress; |
| | | |
| | | @Column(name = "`remarks`") |
| | | @ApiModelProperty(value = "备注信息") |
| | | private String remarks; |
| | | |
| | | public void copy(ContractSecond source){ |
| | | BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true)); |
| | | } |
| | | } |
copy from eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/repository/SysUserCompanyRepository.java
copy to eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/contract/repository/ContractFirstRepository.java
| File was copied from eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/repository/SysUserCompanyRepository.java |
| | |
| | | * See the License for the specific language governing permissions and |
| | | * limitations under the License. |
| | | */ |
| | | package me.zhengjie.modules.system.repository; |
| | | package me.zhengjie.modules.contract.repository; |
| | | |
| | | import me.zhengjie.modules.system.domain.SysUserCompany; |
| | | import me.zhengjie.modules.contract.domain.ContractFirst; |
| | | import org.springframework.data.jpa.repository.JpaRepository; |
| | | import org.springframework.data.jpa.repository.JpaSpecificationExecutor; |
| | | import org.springframework.data.jpa.repository.Query; |
| | | |
| | | /** |
| | | * @website https://eladmin.vip |
| | | * @author wcd |
| | | * @date 2023-01-30 |
| | | * @author 赵士淞 |
| | | * @date 2023-02-02 |
| | | **/ |
| | | public interface SysUserCompanyRepository extends JpaRepository<SysUserCompany, Long>, JpaSpecificationExecutor<SysUserCompany> { |
| | | |
| | | /** |
| | | * 根据value查询公司(导出用) |
| | | * @return |
| | | */ |
| | | @Query |
| | | SysUserCompany findByValue(String value); |
| | | public interface ContractFirstRepository extends JpaRepository<ContractFirst, Long>, JpaSpecificationExecutor<ContractFirst> { |
| | | } |
| 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.ContractInvoicePayment; |
| | | import org.springframework.data.jpa.repository.JpaRepository; |
| | | import org.springframework.data.jpa.repository.JpaSpecificationExecutor; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @website https://eladmin.vip |
| | | * @author 赵士淞 |
| | | * @date 2023-02-02 |
| | | **/ |
| | | public interface ContractInvoicePaymentRepository extends JpaRepository<ContractInvoicePayment, Long>, JpaSpecificationExecutor<ContractInvoicePayment> { |
| | | |
| | | /** |
| | | * 查询付款相关发票数据 |
| | | * @return |
| | | */ |
| | | List<ContractInvoicePayment> findByPaymentId(Long paymentId); |
| | | |
| | | /** |
| | | * 删除付款相关发票数据 |
| | | * @return |
| | | */ |
| | | void deleteByPaymentId(Long paymentId); |
| | | |
| | | /** |
| | | * 查询发票相关发票数据 |
| | | * @return |
| | | */ |
| | | List<ContractInvoicePayment> findByInvoiceId(Long invoiceId); |
| | | |
| | | /** |
| | | * 删除发票相关发票数据 |
| | | * @return |
| | | */ |
| | | void deleteByInvoiceId(Long invoiceId); |
| | | } |
| 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.ContractInvoice; |
| | | 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-02 |
| | | **/ |
| | | public interface ContractInvoiceRepository extends JpaRepository<ContractInvoice, Long>, JpaSpecificationExecutor<ContractInvoice> { |
| | | |
| | | /** |
| | | * 查询合同发票数据 |
| | | * @param contractId |
| | | * @return |
| | | */ |
| | | @Query(value = "SELECT * FROM contract_invoice WHERE contract_id = ?1",nativeQuery = true) |
| | | List<ContractInvoice> findByContractId(Long contractId); |
| | | |
| | | /** |
| | | * 统计合同发票总金额 |
| | | * @param contractId |
| | | * @return |
| | | */ |
| | | @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); |
| | | } |
| 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.ContractPayment; |
| | | 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-02 |
| | | **/ |
| | | public interface ContractPaymentRepository extends JpaRepository<ContractPayment, Long>, JpaSpecificationExecutor<ContractPayment> { |
| | | |
| | | /** |
| | | * 查询合同各款项付款金额 |
| | | * @param contractId |
| | | * @param fundType |
| | | * @return |
| | | */ |
| | | @Query(value = "SELECT SUM(payment_amount) AS totalAmount FROM contract_payment WHERE contract_id = ?1 AND fund_type = ?2",nativeQuery = true) |
| | | BigDecimal findByContractIdAndFundType(Long contractId, String fundType); |
| | | |
| | | /** |
| | | * 查询合同服务款项各年度付款金额 |
| | | * @param contractId |
| | | * @param fundBelongStart |
| | | * @return |
| | | */ |
| | | @Query(value = "SELECT SUM(payment_amount) AS totalAmount FROM contract_payment WHERE fund_type = 'fund_service' AND contract_id = ?1 AND fund_belong_start LIKE concat(?2,'%')",nativeQuery = true) |
| | | BigDecimal findByContractIdAndFundBelongStart(Long contractId, Integer fundBelongStart); |
| | | |
| | | /** |
| | | * 查询合同付款数据 |
| | | * @param contractId |
| | | * @return |
| | | */ |
| | | @Query(value = "SELECT * FROM contract_payment WHERE contract_id = ?1",nativeQuery = true) |
| | | List<ContractPayment> findByContractId(Long contractId); |
| | | |
| | | /** |
| | | * 统计合同付款总金额 |
| | | * @param contractId |
| | | * @return |
| | | */ |
| | | @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.repository; |
| | | |
| | | import me.zhengjie.modules.contract.domain.Contract; |
| | | 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-02 |
| | | **/ |
| | | public interface ContractRepository extends JpaRepository<Contract, Long>, JpaSpecificationExecutor<Contract> { |
| | | |
| | | /** |
| | | * 查询当天合同数据 |
| | | * @return |
| | | */ |
| | | @Query(value = "SELECT * FROM contract WHERE contract_number LIKE concat(?1,'%')",nativeQuery = true) |
| | | List<Contract> findLikeContractNumber(String contractNumber); |
| | | |
| | | /** |
| | | * 查询合同款总金额 |
| | | * @return |
| | | */ |
| | | @Query(value = "SELECT SUM(contract_amount) FROM contract WHERE " + |
| | | "CASE WHEN ?1 IS NOT NULL THEN contract_number = ?1 ELSE 1 = 1 END AND " + |
| | | "CASE WHEN ?2 IS NOT NULL THEN contract_name LIKE concat('%',?2,'%') ELSE 1 = 1 END AND " + |
| | | "CASE WHEN ?3 IS NOT NULL THEN first_id = ?3 ELSE 1 = 1 END AND " + |
| | | "CASE WHEN ?4 IS NOT NULL THEN second_id = ?4 ELSE 1 = 1 END AND " + |
| | | "CASE WHEN ?5 IS NOT NULL THEN sign_date BETWEEN ?5 AND ?6 ELSE 1 = 1 END AND " + |
| | | "CASE WHEN ?7 IS NOT NULL THEN contract_type = ?7 ELSE 1 = 1 END AND " + |
| | | "CASE WHEN ?8 IS NOT NULL THEN contract_payment_state = ?8 ELSE 1 = 1 END AND " + |
| | | "CASE WHEN ?9 IS NOT NULL THEN service_payment_state = ?9 ELSE 1 = 1 END AND " + |
| | | "CASE WHEN ?10 IS NOT NULL THEN contract_status = ?10 ELSE 1 = 1 END AND " + |
| | | "CASE WHEN ?11 IS NOT NULL THEN contract_area_code LIKE concat(?11,'%') ELSE 1 = 1 END",nativeQuery = true) |
| | | BigDecimal contractTotalMoney( |
| | | String contractNumber, String contractName, Long firstId, Long secondId, String signStartDate, String signEndDate, String contractType, String contractPaymentState, |
| | | String servicePaymentState, String contractStatus, String contractAreaCode |
| | | ); |
| | | |
| | | /** |
| | | * 查询有合同款的合同数据 |
| | | * @return |
| | | */ |
| | | @Query(value = "SELECT * FROM contract WHERE " + |
| | | "CASE WHEN ?1 IS NOT NULL THEN contract_number = ?1 ELSE 1 = 1 END AND " + |
| | | "CASE WHEN ?2 IS NOT NULL THEN contract_name LIKE concat('%',?2,'%') ELSE 1 = 1 END AND " + |
| | | "CASE WHEN ?3 IS NOT NULL THEN first_id = ?3 ELSE 1 = 1 END AND " + |
| | | "CASE WHEN ?4 IS NOT NULL THEN second_id = ?4 ELSE 1 = 1 END AND " + |
| | | "CASE WHEN ?5 IS NOT NULL THEN sign_date BETWEEN ?5 AND ?6 ELSE 1 = 1 END AND " + |
| | | "CASE WHEN ?7 IS NOT NULL THEN contract_type = ?7 ELSE 1 = 1 END AND " + |
| | | "CASE WHEN ?8 IS NOT NULL THEN contract_payment_state = ?8 ELSE 1 = 1 END AND " + |
| | | "CASE WHEN ?9 IS NOT NULL THEN service_payment_state = ?9 ELSE 1 = 1 END AND " + |
| | | "CASE WHEN ?10 IS NOT NULL THEN contract_status = ?10 ELSE 1 = 1 END AND " + |
| | | "CASE WHEN ?11 IS NOT NULL THEN contract_area_code LIKE concat(?11,'%') ELSE 1 = 1 END AND " + |
| | | "contract_amount IS NOT NULL AND contract_amount != ''",nativeQuery = true) |
| | | List<Contract> findContractAmountNotNull( |
| | | String contractNumber, String contractName, Long firstId, Long secondId, String signStartDate, String signEndDate, String contractType, String contractPaymentState, |
| | | String servicePaymentState, String contractStatus, String contractAreaCode |
| | | ); |
| | | |
| | | /** |
| | | * 查询运维服务总金额 |
| | | * @return |
| | | */ |
| | | @Query(value = "SELECT SUM(service_amount) FROM contract WHERE " + |
| | | "CASE WHEN ?1 IS NOT NULL THEN contract_number = ?1 ELSE 1 = 1 END AND " + |
| | | "CASE WHEN ?2 IS NOT NULL THEN contract_name LIKE concat('%',?2,'%') ELSE 1 = 1 END AND " + |
| | | "CASE WHEN ?3 IS NOT NULL THEN first_id = ?3 ELSE 1 = 1 END AND " + |
| | | "CASE WHEN ?4 IS NOT NULL THEN second_id = ?4 ELSE 1 = 1 END AND " + |
| | | "CASE WHEN ?5 IS NOT NULL THEN sign_date BETWEEN ?5 AND ?6 ELSE 1 = 1 END AND " + |
| | | "CASE WHEN ?7 IS NOT NULL THEN contract_type = ?7 ELSE 1 = 1 END AND " + |
| | | "CASE WHEN ?8 IS NOT NULL THEN contract_payment_state = ?8 ELSE 1 = 1 END AND " + |
| | | "CASE WHEN ?9 IS NOT NULL THEN service_payment_state = ?9 ELSE 1 = 1 END AND " + |
| | | "CASE WHEN ?10 IS NOT NULL THEN contract_status = ?10 ELSE 1 = 1 END AND " + |
| | | "CASE WHEN ?11 IS NOT NULL THEN contract_area_code LIKE concat(?11,'%') ELSE 1 = 1 END",nativeQuery = true) |
| | | BigDecimal serviceTotalMoney( |
| | | String contractNumber, String contractName, Long firstId, Long secondId, String signStartDate, String signEndDate, String contractType, String contractPaymentState, |
| | | String servicePaymentState, String contractStatus, String contractAreaCode |
| | | ); |
| | | |
| | | /** |
| | | * 查询有运维服务的合同数据 |
| | | * @return |
| | | */ |
| | | @Query(value = "SELECT * FROM contract WHERE " + |
| | | "CASE WHEN ?1 IS NOT NULL THEN contract_number = ?1 ELSE 1 = 1 END AND " + |
| | | "CASE WHEN ?2 IS NOT NULL THEN contract_name LIKE concat('%',?2,'%') ELSE 1 = 1 END AND " + |
| | | "CASE WHEN ?3 IS NOT NULL THEN first_id = ?3 ELSE 1 = 1 END AND " + |
| | | "CASE WHEN ?4 IS NOT NULL THEN second_id = ?4 ELSE 1 = 1 END AND " + |
| | | "CASE WHEN ?5 IS NOT NULL THEN sign_date BETWEEN ?5 AND ?6 ELSE 1 = 1 END AND " + |
| | | "CASE WHEN ?7 IS NOT NULL THEN contract_type = ?7 ELSE 1 = 1 END AND " + |
| | | "CASE WHEN ?8 IS NOT NULL THEN contract_payment_state = ?8 ELSE 1 = 1 END AND " + |
| | | "CASE WHEN ?9 IS NOT NULL THEN service_payment_state = ?9 ELSE 1 = 1 END AND " + |
| | | "CASE WHEN ?10 IS NOT NULL THEN contract_status = ?10 ELSE 1 = 1 END AND " + |
| | | "CASE WHEN ?11 IS NOT NULL THEN contract_area_code LIKE concat(?11,'%') ELSE 1 = 1 END AND " + |
| | | "service_amount IS NOT NULL AND service_amount != ''",nativeQuery = true) |
| | | List<Contract> findServiceAmountNotNull( |
| | | String contractNumber, String contractName, Long firstId, Long secondId, String signStartDate, String signEndDate, String contractType, String contractPaymentState, |
| | | String servicePaymentState, String contractStatus, String contractAreaCode |
| | | ); |
| | | } |
copy from eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/repository/SysUserCompanyRepository.java
copy to eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/contract/repository/ContractSecondRepository.java
| File was copied from eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/repository/SysUserCompanyRepository.java |
| | |
| | | * See the License for the specific language governing permissions and |
| | | * limitations under the License. |
| | | */ |
| | | package me.zhengjie.modules.system.repository; |
| | | package me.zhengjie.modules.contract.repository; |
| | | |
| | | import me.zhengjie.modules.system.domain.SysUserCompany; |
| | | import me.zhengjie.modules.contract.domain.ContractSecond; |
| | | import org.springframework.data.jpa.repository.JpaRepository; |
| | | import org.springframework.data.jpa.repository.JpaSpecificationExecutor; |
| | | import org.springframework.data.jpa.repository.Query; |
| | | |
| | | /** |
| | | * @website https://eladmin.vip |
| | | * @author wcd |
| | | * @date 2023-01-30 |
| | | * @author 赵士淞 |
| | | * @date 2023-02-02 |
| | | **/ |
| | | public interface SysUserCompanyRepository extends JpaRepository<SysUserCompany, Long>, JpaSpecificationExecutor<SysUserCompany> { |
| | | |
| | | /** |
| | | * 根据value查询公司(导出用) |
| | | * @return |
| | | */ |
| | | @Query |
| | | SysUserCompany findByValue(String value); |
| | | public interface ContractSecondRepository extends JpaRepository<ContractSecond, Long>, JpaSpecificationExecutor<ContractSecond> { |
| | | } |
| 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.Contract; |
| | | import me.zhengjie.modules.contract.service.ContractService; |
| | | import me.zhengjie.modules.contract.service.dto.ContractQueryCriteria; |
| | | 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-02 |
| | | **/ |
| | | @RestController |
| | | @RequiredArgsConstructor |
| | | @Api(tags = "合同详情管理") |
| | | @RequestMapping("/api/contract") |
| | | public class ContractController { |
| | | |
| | | private final ContractService contractService; |
| | | |
| | | @Log("导出数据") |
| | | @ApiOperation("导出数据") |
| | | @GetMapping(value = "/download") |
| | | @PreAuthorize("@el.check('contract:download')") |
| | | public void exportContract(HttpServletResponse response, ContractQueryCriteria criteria) throws IOException { |
| | | contractService.download(contractService.queryAll(criteria), response); |
| | | } |
| | | |
| | | @GetMapping |
| | | @Log("查询合同详情") |
| | | @ApiOperation("查询合同详情") |
| | | @PreAuthorize("@el.check('contract:list')") |
| | | public ResponseEntity<Object> queryContract(ContractQueryCriteria criteria, Pageable pageable){ |
| | | return new ResponseEntity<>(contractService.queryAll(criteria,pageable),HttpStatus.OK); |
| | | } |
| | | |
| | | @GetMapping(value = "/all") |
| | | @Log("查询合同详情") |
| | | @ApiOperation("查询合同详情") |
| | | @PreAuthorize("@el.check('contract:list')") |
| | | public ResponseEntity<Object> queryContract(ContractQueryCriteria criteria){ |
| | | return new ResponseEntity<>(contractService.queryAll(criteria),HttpStatus.OK); |
| | | } |
| | | |
| | | @PostMapping |
| | | @Log("新增合同详情") |
| | | @ApiOperation("新增合同详情") |
| | | @PreAuthorize("@el.check('contract:add')") |
| | | public ResponseEntity<Object> createContract(@Validated @RequestBody Contract resources){ |
| | | return new ResponseEntity<>(contractService.create(resources),HttpStatus.CREATED); |
| | | } |
| | | |
| | | @PutMapping |
| | | @Log("修改合同详情") |
| | | @ApiOperation("修改合同详情") |
| | | @PreAuthorize("@el.check('contract:edit')") |
| | | public ResponseEntity<Object> updateContract(@Validated @RequestBody Contract resources){ |
| | | contractService.update(resources); |
| | | return new ResponseEntity<>(HttpStatus.NO_CONTENT); |
| | | } |
| | | |
| | | @DeleteMapping |
| | | @Log("删除合同详情") |
| | | @ApiOperation("删除合同详情") |
| | | @PreAuthorize("@el.check('contract:del')") |
| | | public ResponseEntity<Object> deleteContract(@RequestBody Long[] ids) { |
| | | contractService.deleteAll(ids); |
| | | return new ResponseEntity<>(HttpStatus.OK); |
| | | } |
| | | |
| | | @GetMapping(value = "/contractTotalMoney") |
| | | @Log("查询合同款总金额") |
| | | @ApiOperation("查询合同款总金额") |
| | | @PreAuthorize("@el.check('contract:list')") |
| | | public ResponseEntity<Object> contractTotalMoney(ContractQueryCriteria criteria){ |
| | | return new ResponseEntity<>(contractService.contractTotalMoney(criteria),HttpStatus.OK); |
| | | } |
| | | |
| | | @GetMapping(value = "/contractDelayTotalAmount") |
| | | @Log("查询合同款延期数") |
| | | @ApiOperation("查询合同款延期数") |
| | | @PreAuthorize("@el.check('contract:list')") |
| | | public ResponseEntity<Object> contractDelayTotalAmount(ContractQueryCriteria criteria){ |
| | | return new ResponseEntity<>(contractService.contractDelayTotalAmount(criteria),HttpStatus.OK); |
| | | } |
| | | |
| | | @GetMapping(value = "/contractDelayTotalMoney") |
| | | @Log("查询合同款延期金额") |
| | | @ApiOperation("查询合同款延期金额") |
| | | @PreAuthorize("@el.check('contract:list')") |
| | | public ResponseEntity<Object> contractDelayTotalMoney(ContractQueryCriteria criteria){ |
| | | return new ResponseEntity<>(contractService.contractDelayTotalMoney(criteria),HttpStatus.OK); |
| | | } |
| | | |
| | | @GetMapping(value = "/advancePaymentTotalMoney") |
| | | @Log("查询预收款总金额") |
| | | @ApiOperation("查询预收款总金额") |
| | | @PreAuthorize("@el.check('contract:list')") |
| | | public ResponseEntity<Object> advancePaymentTotalMoney(ContractQueryCriteria criteria){ |
| | | return new ResponseEntity<>(contractService.advancePaymentTotalMoney(criteria),HttpStatus.OK); |
| | | } |
| | | |
| | | @GetMapping(value = "/serviceTotalMoney") |
| | | @Log("查询运维服务总金额") |
| | | @ApiOperation("查询运维服务总金额") |
| | | @PreAuthorize("@el.check('contract:list')") |
| | | public ResponseEntity<Object> serviceTotalMoney(ContractQueryCriteria criteria){ |
| | | return new ResponseEntity<>(contractService.serviceTotalMoney(criteria),HttpStatus.OK); |
| | | } |
| | | |
| | | @GetMapping(value = "/serviceDelayTotalAmount") |
| | | @Log("查询运维服务延期数") |
| | | @ApiOperation("查询运维服务延期数") |
| | | @PreAuthorize("@el.check('contract:list')") |
| | | public ResponseEntity<Object> serviceDelayTotalAmount(ContractQueryCriteria criteria){ |
| | | return new ResponseEntity<>(contractService.serviceDelayTotalAmount(criteria),HttpStatus.OK); |
| | | } |
| | | |
| | | @GetMapping(value = "/serviceDelayTotalMoney") |
| | | @Log("查询运维服务延期金额") |
| | | @ApiOperation("查询运维服务延期金额") |
| | | @PreAuthorize("@el.check('contract:list')") |
| | | public ResponseEntity<Object> serviceDelayTotalMoney(ContractQueryCriteria criteria){ |
| | | return new ResponseEntity<>(contractService.serviceDelayTotalMoney(criteria),HttpStatus.OK); |
| | | } |
| | | |
| | | @GetMapping(value = "/receivePaymentTotalMoney") |
| | | @Log("查询应收款总金额") |
| | | @ApiOperation("查询应收款总金额") |
| | | @PreAuthorize("@el.check('contract:list')") |
| | | public ResponseEntity<Object> receivePaymentTotalMoney(ContractQueryCriteria criteria){ |
| | | return new ResponseEntity<>(contractService.receivePaymentTotalMoney(criteria),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.rest; |
| | | |
| | | import me.zhengjie.annotation.Log; |
| | | import me.zhengjie.modules.contract.domain.ContractFirst; |
| | | import me.zhengjie.modules.contract.service.ContractFirstService; |
| | | import me.zhengjie.modules.contract.service.dto.ContractFirstQueryCriteria; |
| | | 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-02 |
| | | **/ |
| | | @RestController |
| | | @RequiredArgsConstructor |
| | | @Api(tags = "合同甲方管理") |
| | | @RequestMapping("/api/contractFirst") |
| | | public class ContractFirstController { |
| | | |
| | | private final ContractFirstService contractFirstService; |
| | | |
| | | @Log("导出数据") |
| | | @ApiOperation("导出数据") |
| | | @GetMapping(value = "/download") |
| | | @PreAuthorize("@el.check('contractFirst:download')") |
| | | public void exportContractFirst(HttpServletResponse response, ContractFirstQueryCriteria criteria) throws IOException { |
| | | contractFirstService.download(contractFirstService.queryAll(criteria), response); |
| | | } |
| | | |
| | | @GetMapping |
| | | @Log("查询合同甲方") |
| | | @ApiOperation("查询合同甲方") |
| | | @PreAuthorize("@el.check('contractFirst:list')") |
| | | public ResponseEntity<Object> queryContractFirst(ContractFirstQueryCriteria criteria, Pageable pageable){ |
| | | return new ResponseEntity<>(contractFirstService.queryAll(criteria,pageable),HttpStatus.OK); |
| | | } |
| | | |
| | | @GetMapping(value = "/all") |
| | | @Log("查询合同甲方") |
| | | @ApiOperation("查询合同甲方") |
| | | @PreAuthorize("@el.check('contractFirst:list')") |
| | | public ResponseEntity<Object> queryContractFirst(ContractFirstQueryCriteria criteria){ |
| | | return new ResponseEntity<>(contractFirstService.queryAll(criteria),HttpStatus.OK); |
| | | } |
| | | |
| | | @PostMapping |
| | | @Log("新增合同甲方") |
| | | @ApiOperation("新增合同甲方") |
| | | @PreAuthorize("@el.check('contractFirst:add')") |
| | | public ResponseEntity<Object> createContractFirst(@Validated @RequestBody ContractFirst resources){ |
| | | return new ResponseEntity<>(contractFirstService.create(resources),HttpStatus.CREATED); |
| | | } |
| | | |
| | | @PutMapping |
| | | @Log("修改合同甲方") |
| | | @ApiOperation("修改合同甲方") |
| | | @PreAuthorize("@el.check('contractFirst:edit')") |
| | | public ResponseEntity<Object> updateContractFirst(@Validated @RequestBody ContractFirst resources){ |
| | | contractFirstService.update(resources); |
| | | return new ResponseEntity<>(HttpStatus.NO_CONTENT); |
| | | } |
| | | |
| | | @DeleteMapping |
| | | @Log("删除合同甲方") |
| | | @ApiOperation("删除合同甲方") |
| | | @PreAuthorize("@el.check('contractFirst:del')") |
| | | public ResponseEntity<Object> deleteContractFirst(@RequestBody Long[] ids) { |
| | | contractFirstService.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.rest; |
| | | |
| | | import me.zhengjie.annotation.Log; |
| | | import me.zhengjie.modules.contract.domain.ContractInvoice; |
| | | import me.zhengjie.modules.contract.service.ContractInvoiceService; |
| | | import me.zhengjie.modules.contract.service.dto.ContractInvoiceDto; |
| | | import me.zhengjie.modules.contract.service.dto.ContractInvoiceQueryCriteria; |
| | | 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-02 |
| | | **/ |
| | | @RestController |
| | | @RequiredArgsConstructor |
| | | @Api(tags = "合同发票管理") |
| | | @RequestMapping("/api/contractInvoice") |
| | | public class ContractInvoiceController { |
| | | |
| | | private final ContractInvoiceService contractInvoiceService; |
| | | |
| | | @Log("导出数据") |
| | | @ApiOperation("导出数据") |
| | | @GetMapping(value = "/download") |
| | | @PreAuthorize("@el.check('contractInvoice:download')") |
| | | public void exportContractInvoice(HttpServletResponse response, ContractInvoiceQueryCriteria criteria) throws IOException { |
| | | contractInvoiceService.download(contractInvoiceService.queryAll(criteria), response); |
| | | } |
| | | |
| | | @GetMapping |
| | | @Log("查询合同发票") |
| | | @ApiOperation("查询合同发票") |
| | | @PreAuthorize("@el.check('contractInvoice:list')") |
| | | public ResponseEntity<Object> queryContractInvoice(ContractInvoiceQueryCriteria criteria, Pageable pageable){ |
| | | return new ResponseEntity<>(contractInvoiceService.queryAll(criteria,pageable),HttpStatus.OK); |
| | | } |
| | | |
| | | @GetMapping(value = "/all") |
| | | @Log("查询合同发票") |
| | | @ApiOperation("查询合同发票") |
| | | @PreAuthorize("@el.check('contractInvoice:list')") |
| | | public ResponseEntity<Object> queryContractInvoice(ContractInvoiceQueryCriteria criteria){ |
| | | return new ResponseEntity<>(contractInvoiceService.queryAll(criteria),HttpStatus.OK); |
| | | } |
| | | |
| | | @PostMapping |
| | | @Log("新增合同发票") |
| | | @ApiOperation("新增合同发票") |
| | | @PreAuthorize("@el.check('contractInvoice:add')") |
| | | public ResponseEntity<Object> createContractInvoice(@Validated @RequestBody ContractInvoiceDto resources){ |
| | | return new ResponseEntity<>(contractInvoiceService.create(resources),HttpStatus.CREATED); |
| | | } |
| | | |
| | | @PutMapping |
| | | @Log("修改合同发票") |
| | | @ApiOperation("修改合同发票") |
| | | @PreAuthorize("@el.check('contractInvoice:edit')") |
| | | public ResponseEntity<Object> updateContractInvoice(@Validated @RequestBody ContractInvoiceDto resources){ |
| | | contractInvoiceService.update(resources); |
| | | return new ResponseEntity<>(HttpStatus.NO_CONTENT); |
| | | } |
| | | |
| | | @DeleteMapping |
| | | @Log("删除合同发票") |
| | | @ApiOperation("删除合同发票") |
| | | @PreAuthorize("@el.check('contractInvoice:del')") |
| | | public ResponseEntity<Object> deleteContractInvoice(@RequestBody Long[] ids) { |
| | | contractInvoiceService.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.rest; |
| | | |
| | | import me.zhengjie.annotation.Log; |
| | | import me.zhengjie.modules.contract.domain.ContractInvoicePayment; |
| | | import me.zhengjie.modules.contract.service.ContractInvoicePaymentService; |
| | | import me.zhengjie.modules.contract.service.dto.ContractInvoicePaymentQueryCriteria; |
| | | 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-02 |
| | | **/ |
| | | @RestController |
| | | @RequiredArgsConstructor |
| | | @Api(tags = "合同发票付款关联管理") |
| | | @RequestMapping("/api/contractInvoicePayment") |
| | | public class ContractInvoicePaymentController { |
| | | |
| | | private final ContractInvoicePaymentService contractInvoicePaymentService; |
| | | |
| | | @Log("导出数据") |
| | | @ApiOperation("导出数据") |
| | | @GetMapping(value = "/download") |
| | | @PreAuthorize("@el.check('contractInvoicePayment:download')") |
| | | public void exportContractInvoicePayment(HttpServletResponse response, ContractInvoicePaymentQueryCriteria criteria) throws IOException { |
| | | contractInvoicePaymentService.download(contractInvoicePaymentService.queryAll(criteria), response); |
| | | } |
| | | |
| | | @GetMapping |
| | | @Log("查询合同发票付款关联") |
| | | @ApiOperation("查询合同发票付款关联") |
| | | @PreAuthorize("@el.check('contractInvoicePayment:list')") |
| | | public ResponseEntity<Object> queryContractInvoicePayment(ContractInvoicePaymentQueryCriteria criteria, Pageable pageable){ |
| | | return new ResponseEntity<>(contractInvoicePaymentService.queryAll(criteria,pageable),HttpStatus.OK); |
| | | } |
| | | |
| | | @GetMapping(value = "/all") |
| | | @Log("查询合同发票付款关联") |
| | | @ApiOperation("查询合同发票付款关联") |
| | | @PreAuthorize("@el.check('contractInvoicePayment:list')") |
| | | public ResponseEntity<Object> queryContractInvoicePayment(ContractInvoicePaymentQueryCriteria criteria){ |
| | | return new ResponseEntity<>(contractInvoicePaymentService.queryAll(criteria),HttpStatus.OK); |
| | | } |
| | | |
| | | @PostMapping |
| | | @Log("新增合同发票付款关联") |
| | | @ApiOperation("新增合同发票付款关联") |
| | | @PreAuthorize("@el.check('contractInvoicePayment:add')") |
| | | public ResponseEntity<Object> createContractInvoicePayment(@Validated @RequestBody ContractInvoicePayment resources){ |
| | | return new ResponseEntity<>(contractInvoicePaymentService.create(resources),HttpStatus.CREATED); |
| | | } |
| | | |
| | | @PutMapping |
| | | @Log("修改合同发票付款关联") |
| | | @ApiOperation("修改合同发票付款关联") |
| | | @PreAuthorize("@el.check('contractInvoicePayment:edit')") |
| | | public ResponseEntity<Object> updateContractInvoicePayment(@Validated @RequestBody ContractInvoicePayment resources){ |
| | | contractInvoicePaymentService.update(resources); |
| | | return new ResponseEntity<>(HttpStatus.NO_CONTENT); |
| | | } |
| | | |
| | | @DeleteMapping |
| | | @Log("删除合同发票付款关联") |
| | | @ApiOperation("删除合同发票付款关联") |
| | | @PreAuthorize("@el.check('contractInvoicePayment:del')") |
| | | public ResponseEntity<Object> deleteContractInvoicePayment(@RequestBody Long[] ids) { |
| | | contractInvoicePaymentService.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.rest; |
| | | |
| | | import me.zhengjie.annotation.Log; |
| | | import me.zhengjie.modules.contract.domain.ContractPayment; |
| | | import me.zhengjie.modules.contract.service.ContractPaymentService; |
| | | import me.zhengjie.modules.contract.service.dto.ContractPaymentDto; |
| | | import me.zhengjie.modules.contract.service.dto.ContractPaymentQueryCriteria; |
| | | 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-02 |
| | | **/ |
| | | @RestController |
| | | @RequiredArgsConstructor |
| | | @Api(tags = "合同付款管理") |
| | | @RequestMapping("/api/contractPayment") |
| | | public class ContractPaymentController { |
| | | |
| | | private final ContractPaymentService contractPaymentService; |
| | | |
| | | @Log("导出数据") |
| | | @ApiOperation("导出数据") |
| | | @GetMapping(value = "/download") |
| | | @PreAuthorize("@el.check('contractPayment:download')") |
| | | public void exportContractPayment(HttpServletResponse response, ContractPaymentQueryCriteria criteria) throws IOException { |
| | | contractPaymentService.download(contractPaymentService.queryAll(criteria), response); |
| | | } |
| | | |
| | | @GetMapping |
| | | @Log("查询合同付款") |
| | | @ApiOperation("查询合同付款") |
| | | @PreAuthorize("@el.check('contractPayment:list')") |
| | | public ResponseEntity<Object> queryContractPayment(ContractPaymentQueryCriteria criteria, Pageable pageable){ |
| | | return new ResponseEntity<>(contractPaymentService.queryAll(criteria,pageable),HttpStatus.OK); |
| | | } |
| | | |
| | | @GetMapping(value = "/all") |
| | | @Log("查询合同付款") |
| | | @ApiOperation("查询合同付款") |
| | | @PreAuthorize("@el.check('contractPayment:list')") |
| | | public ResponseEntity<Object> queryContractPayment(ContractPaymentQueryCriteria criteria){ |
| | | return new ResponseEntity<>(contractPaymentService.queryAll(criteria),HttpStatus.OK); |
| | | } |
| | | |
| | | @PostMapping |
| | | @Log("新增合同付款") |
| | | @ApiOperation("新增合同付款") |
| | | @PreAuthorize("@el.check('contractPayment:add')") |
| | | public ResponseEntity<Object> createContractPayment(@Validated @RequestBody ContractPaymentDto resources){ |
| | | return new ResponseEntity<>(contractPaymentService.create(resources),HttpStatus.CREATED); |
| | | } |
| | | |
| | | @PutMapping |
| | | @Log("修改合同付款") |
| | | @ApiOperation("修改合同付款") |
| | | @PreAuthorize("@el.check('contractPayment:edit')") |
| | | public ResponseEntity<Object> updateContractPayment(@Validated @RequestBody ContractPaymentDto resources){ |
| | | contractPaymentService.update(resources); |
| | | return new ResponseEntity<>(HttpStatus.NO_CONTENT); |
| | | } |
| | | |
| | | @DeleteMapping |
| | | @Log("删除合同付款") |
| | | @ApiOperation("删除合同付款") |
| | | @PreAuthorize("@el.check('contractPayment:del')") |
| | | public ResponseEntity<Object> deleteContractPayment(@RequestBody Long[] ids) { |
| | | contractPaymentService.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.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.rest; |
| | | |
| | | import me.zhengjie.annotation.Log; |
| | | import me.zhengjie.modules.contract.domain.ContractSecond; |
| | | import me.zhengjie.modules.contract.service.ContractSecondService; |
| | | import me.zhengjie.modules.contract.service.dto.ContractSecondQueryCriteria; |
| | | 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-02 |
| | | **/ |
| | | @RestController |
| | | @RequiredArgsConstructor |
| | | @Api(tags = "合同乙方管理") |
| | | @RequestMapping("/api/contractSecond") |
| | | public class ContractSecondController { |
| | | |
| | | private final ContractSecondService contractSecondService; |
| | | |
| | | @Log("导出数据") |
| | | @ApiOperation("导出数据") |
| | | @GetMapping(value = "/download") |
| | | @PreAuthorize("@el.check('contractSecond:download')") |
| | | public void exportContractSecond(HttpServletResponse response, ContractSecondQueryCriteria criteria) throws IOException { |
| | | contractSecondService.download(contractSecondService.queryAll(criteria), response); |
| | | } |
| | | |
| | | @GetMapping |
| | | @Log("查询合同乙方") |
| | | @ApiOperation("查询合同乙方") |
| | | @PreAuthorize("@el.check('contractSecond:list')") |
| | | public ResponseEntity<Object> queryContractSecond(ContractSecondQueryCriteria criteria, Pageable pageable){ |
| | | return new ResponseEntity<>(contractSecondService.queryAll(criteria,pageable),HttpStatus.OK); |
| | | } |
| | | |
| | | @GetMapping(value = "/all") |
| | | @Log("查询合同乙方") |
| | | @ApiOperation("查询合同乙方") |
| | | @PreAuthorize("@el.check('contractSecond:list')") |
| | | public ResponseEntity<Object> queryContractSecond(ContractSecondQueryCriteria criteria){ |
| | | return new ResponseEntity<>(contractSecondService.queryAll(criteria),HttpStatus.OK); |
| | | } |
| | | |
| | | @PostMapping |
| | | @Log("新增合同乙方") |
| | | @ApiOperation("新增合同乙方") |
| | | @PreAuthorize("@el.check('contractSecond:add')") |
| | | public ResponseEntity<Object> createContractSecond(@Validated @RequestBody ContractSecond resources){ |
| | | return new ResponseEntity<>(contractSecondService.create(resources),HttpStatus.CREATED); |
| | | } |
| | | |
| | | @PutMapping |
| | | @Log("修改合同乙方") |
| | | @ApiOperation("修改合同乙方") |
| | | @PreAuthorize("@el.check('contractSecond:edit')") |
| | | public ResponseEntity<Object> updateContractSecond(@Validated @RequestBody ContractSecond resources){ |
| | | contractSecondService.update(resources); |
| | | return new ResponseEntity<>(HttpStatus.NO_CONTENT); |
| | | } |
| | | |
| | | @DeleteMapping |
| | | @Log("删除合同乙方") |
| | | @ApiOperation("删除合同乙方") |
| | | @PreAuthorize("@el.check('contractSecond:del')") |
| | | public ResponseEntity<Object> deleteContractSecond(@RequestBody Long[] ids) { |
| | | contractSecondService.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.ContractFirst; |
| | | import me.zhengjie.modules.contract.service.dto.ContractFirstDto; |
| | | import me.zhengjie.modules.contract.service.dto.ContractFirstQueryCriteria; |
| | | 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-02 |
| | | **/ |
| | | public interface ContractFirstService { |
| | | |
| | | /** |
| | | * 查询数据分页 |
| | | * @param criteria 条件 |
| | | * @param pageable 分页参数 |
| | | * @return Map<String,Object> |
| | | */ |
| | | Map<String,Object> queryAll(ContractFirstQueryCriteria criteria, Pageable pageable); |
| | | |
| | | /** |
| | | * 查询所有数据不分页 |
| | | * @param criteria 条件参数 |
| | | * @return List<ContractFirstDto> |
| | | */ |
| | | List<ContractFirstDto> queryAll(ContractFirstQueryCriteria criteria); |
| | | |
| | | /** |
| | | * 根据ID查询 |
| | | * @param firstId ID |
| | | * @return ContractFirstDto |
| | | */ |
| | | ContractFirstDto findById(Long firstId); |
| | | |
| | | /** |
| | | * 创建 |
| | | * @param resources / |
| | | * @return ContractFirstDto |
| | | */ |
| | | ContractFirstDto create(ContractFirst resources); |
| | | |
| | | /** |
| | | * 编辑 |
| | | * @param resources / |
| | | */ |
| | | void update(ContractFirst resources); |
| | | |
| | | /** |
| | | * 多选删除 |
| | | * @param ids / |
| | | */ |
| | | void deleteAll(Long[] ids); |
| | | |
| | | /** |
| | | * 导出数据 |
| | | * @param all 待导出的数据 |
| | | * @param response / |
| | | * @throws IOException / |
| | | */ |
| | | void download(List<ContractFirstDto> all, HttpServletResponse response) throws IOException; |
| | | } |
| 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.ContractInvoicePayment; |
| | | import me.zhengjie.modules.contract.service.dto.ContractInvoicePaymentDto; |
| | | import me.zhengjie.modules.contract.service.dto.ContractInvoicePaymentQueryCriteria; |
| | | 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-02 |
| | | **/ |
| | | public interface ContractInvoicePaymentService { |
| | | |
| | | /** |
| | | * 查询数据分页 |
| | | * @param criteria 条件 |
| | | * @param pageable 分页参数 |
| | | * @return Map<String,Object> |
| | | */ |
| | | Map<String,Object> queryAll(ContractInvoicePaymentQueryCriteria criteria, Pageable pageable); |
| | | |
| | | /** |
| | | * 查询所有数据不分页 |
| | | * @param criteria 条件参数 |
| | | * @return List<ContractInvoicePaymentDto> |
| | | */ |
| | | List<ContractInvoicePaymentDto> queryAll(ContractInvoicePaymentQueryCriteria criteria); |
| | | |
| | | /** |
| | | * 根据ID查询 |
| | | * @param relationId ID |
| | | * @return ContractInvoicePaymentDto |
| | | */ |
| | | ContractInvoicePaymentDto findById(Long relationId); |
| | | |
| | | /** |
| | | * 创建 |
| | | * @param resources / |
| | | * @return ContractInvoicePaymentDto |
| | | */ |
| | | ContractInvoicePaymentDto create(ContractInvoicePayment resources); |
| | | |
| | | /** |
| | | * 编辑 |
| | | * @param resources / |
| | | */ |
| | | void update(ContractInvoicePayment resources); |
| | | |
| | | /** |
| | | * 多选删除 |
| | | * @param ids / |
| | | */ |
| | | void deleteAll(Long[] ids); |
| | | |
| | | /** |
| | | * 导出数据 |
| | | * @param all 待导出的数据 |
| | | * @param response / |
| | | * @throws IOException / |
| | | */ |
| | | void download(List<ContractInvoicePaymentDto> all, HttpServletResponse response) throws IOException; |
| | | } |
| 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.ContractInvoice; |
| | | import me.zhengjie.modules.contract.service.dto.ContractInvoiceDto; |
| | | import me.zhengjie.modules.contract.service.dto.ContractInvoiceQueryCriteria; |
| | | 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-02 |
| | | **/ |
| | | public interface ContractInvoiceService { |
| | | |
| | | /** |
| | | * 查询数据分页 |
| | | * @param criteria 条件 |
| | | * @param pageable 分页参数 |
| | | * @return Map<String,Object> |
| | | */ |
| | | Map<String,Object> queryAll(ContractInvoiceQueryCriteria criteria, Pageable pageable); |
| | | |
| | | /** |
| | | * 查询所有数据不分页 |
| | | * @param criteria 条件参数 |
| | | * @return List<ContractInvoiceDto> |
| | | */ |
| | | List<ContractInvoiceDto> queryAll(ContractInvoiceQueryCriteria criteria); |
| | | |
| | | /** |
| | | * 根据ID查询 |
| | | * @param invoiceId ID |
| | | * @return ContractInvoiceDto |
| | | */ |
| | | ContractInvoiceDto findById(Long invoiceId); |
| | | |
| | | /** |
| | | * 创建 |
| | | * @param resources / |
| | | * @return ContractInvoiceDto |
| | | */ |
| | | ContractInvoiceDto create(ContractInvoiceDto resources); |
| | | |
| | | /** |
| | | * 编辑 |
| | | * @param resources / |
| | | */ |
| | | void update(ContractInvoiceDto resources); |
| | | |
| | | /** |
| | | * 多选删除 |
| | | * @param ids / |
| | | */ |
| | | void deleteAll(Long[] ids); |
| | | |
| | | /** |
| | | * 导出数据 |
| | | * @param all 待导出的数据 |
| | | * @param response / |
| | | * @throws IOException / |
| | | */ |
| | | void download(List<ContractInvoiceDto> all, HttpServletResponse response) throws IOException; |
| | | } |
| 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.ContractPayment; |
| | | import me.zhengjie.modules.contract.service.dto.ContractPaymentDto; |
| | | import me.zhengjie.modules.contract.service.dto.ContractPaymentQueryCriteria; |
| | | 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-02 |
| | | **/ |
| | | public interface ContractPaymentService { |
| | | |
| | | /** |
| | | * 查询数据分页 |
| | | * @param criteria 条件 |
| | | * @param pageable 分页参数 |
| | | * @return Map<String,Object> |
| | | */ |
| | | Map<String,Object> queryAll(ContractPaymentQueryCriteria criteria, Pageable pageable); |
| | | |
| | | /** |
| | | * 查询所有数据不分页 |
| | | * @param criteria 条件参数 |
| | | * @return List<ContractPaymentDto> |
| | | */ |
| | | List<ContractPaymentDto> queryAll(ContractPaymentQueryCriteria criteria); |
| | | |
| | | /** |
| | | * 根据ID查询 |
| | | * @param paymentId ID |
| | | * @return ContractPaymentDto |
| | | */ |
| | | ContractPaymentDto findById(Long paymentId); |
| | | |
| | | /** |
| | | * 创建 |
| | | * @param resources / |
| | | * @return ContractPaymentDto |
| | | */ |
| | | ContractPaymentDto create(ContractPaymentDto resources); |
| | | |
| | | /** |
| | | * 编辑 |
| | | * @param resources / |
| | | */ |
| | | void update(ContractPaymentDto resources); |
| | | |
| | | /** |
| | | * 多选删除 |
| | | * @param ids / |
| | | */ |
| | | void deleteAll(Long[] ids); |
| | | |
| | | /** |
| | | * 导出数据 |
| | | * @param all 待导出的数据 |
| | | * @param response / |
| | | * @throws IOException / |
| | | */ |
| | | void download(List<ContractPaymentDto> all, HttpServletResponse response) throws IOException; |
| | | } |
| 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; |
| | | } |
copy from eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/service/SysUserCompanyService.java
copy to eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/contract/service/ContractSecondService.java
| File was copied from eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/service/SysUserCompanyService.java |
| | |
| | | * See the License for the specific language governing permissions and |
| | | * limitations under the License. |
| | | */ |
| | | package me.zhengjie.modules.system.service; |
| | | package me.zhengjie.modules.contract.service; |
| | | |
| | | import me.zhengjie.modules.system.domain.SysUserCompany; |
| | | import me.zhengjie.modules.system.service.dto.SysUserCompanyDto; |
| | | import me.zhengjie.modules.system.service.dto.SysUserCompanyQueryCriteria; |
| | | import me.zhengjie.modules.contract.domain.ContractSecond; |
| | | import me.zhengjie.modules.contract.service.dto.ContractSecondDto; |
| | | import me.zhengjie.modules.contract.service.dto.ContractSecondQueryCriteria; |
| | | import org.springframework.data.domain.Pageable; |
| | | import java.util.Map; |
| | | import java.util.List; |
| | |
| | | /** |
| | | * @website https://eladmin.vip |
| | | * @description 服务接口 |
| | | * @author wcd |
| | | * @date 2023-01-30 |
| | | * @author 赵士淞 |
| | | * @date 2023-02-02 |
| | | **/ |
| | | public interface SysUserCompanyService { |
| | | public interface ContractSecondService { |
| | | |
| | | /** |
| | | * 查询数据分页 |
| | |
| | | * @param pageable 分页参数 |
| | | * @return Map<String,Object> |
| | | */ |
| | | Map<String,Object> queryAll(SysUserCompanyQueryCriteria criteria, Pageable pageable); |
| | | Map<String,Object> queryAll(ContractSecondQueryCriteria criteria, Pageable pageable); |
| | | |
| | | /** |
| | | * 查询所有数据不分页 |
| | | * @param criteria 条件参数 |
| | | * @return List<SystemSettingDto> |
| | | * @return List<ContractSecondDto> |
| | | */ |
| | | List<SysUserCompanyDto> queryAll(SysUserCompanyQueryCriteria criteria); |
| | | List<ContractSecondDto> queryAll(ContractSecondQueryCriteria criteria); |
| | | |
| | | /** |
| | | * 根据ID查询 |
| | | * @param id ID |
| | | * @return SystemSettingDto |
| | | * @param secondId ID |
| | | * @return ContractSecondDto |
| | | */ |
| | | SysUserCompanyDto findById(Long id); |
| | | ContractSecondDto findById(Long secondId); |
| | | |
| | | /** |
| | | * 创建 |
| | | * @param resources / |
| | | * @return SystemSettingDto |
| | | * @return ContractSecondDto |
| | | */ |
| | | SysUserCompanyDto create(SysUserCompany resources); |
| | | ContractSecondDto create(ContractSecond resources); |
| | | |
| | | /** |
| | | * 编辑 |
| | | * @param resources / |
| | | */ |
| | | void update(SysUserCompany resources); |
| | | void update(ContractSecond resources); |
| | | |
| | | /** |
| | | * 多选删除 |
| | |
| | | * @param response / |
| | | * @throws IOException / |
| | | */ |
| | | void download(List<SysUserCompanyDto> all, HttpServletResponse response) throws IOException; |
| | | |
| | | /** |
| | | * 选择用户改变公司 |
| | | * @param resources |
| | | * @return |
| | | */ |
| | | SysUserCompany getCompName(SysUserCompanyDto resources); |
| | | void download(List<ContractSecondDto> all, HttpServletResponse response) throws IOException; |
| | | } |
| 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.Contract; |
| | | import me.zhengjie.modules.contract.service.dto.ContractDto; |
| | | import me.zhengjie.modules.contract.service.dto.ContractQueryCriteria; |
| | | import org.springframework.data.domain.Pageable; |
| | | |
| | | import java.math.BigDecimal; |
| | | 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-02 |
| | | **/ |
| | | public interface ContractService { |
| | | |
| | | /** |
| | | * 查询数据分页 |
| | | * @param criteria 条件 |
| | | * @param pageable 分页参数 |
| | | * @return Map<String,Object> |
| | | */ |
| | | Map<String,Object> queryAll(ContractQueryCriteria criteria, Pageable pageable); |
| | | |
| | | /** |
| | | * 查询所有数据不分页 |
| | | * @param criteria 条件参数 |
| | | * @return List<ContractDto> |
| | | */ |
| | | List<ContractDto> queryAll(ContractQueryCriteria criteria); |
| | | |
| | | /** |
| | | * 根据ID查询 |
| | | * @param contractId ID |
| | | * @return ContractDto |
| | | */ |
| | | ContractDto findById(Long contractId); |
| | | |
| | | /** |
| | | * 创建 |
| | | * @param resources / |
| | | * @return ContractDto |
| | | */ |
| | | ContractDto create(Contract resources); |
| | | |
| | | /** |
| | | * 编辑 |
| | | * @param resources / |
| | | */ |
| | | void update(Contract resources); |
| | | |
| | | /** |
| | | * 多选删除 |
| | | * @param ids / |
| | | */ |
| | | void deleteAll(Long[] ids); |
| | | |
| | | /** |
| | | * 导出数据 |
| | | * @param all 待导出的数据 |
| | | * @param response / |
| | | * @throws IOException / |
| | | */ |
| | | void download(List<ContractDto> all, HttpServletResponse response) throws IOException; |
| | | |
| | | /** |
| | | * 查询合同款总金额 |
| | | * @param criteria |
| | | * @return |
| | | */ |
| | | BigDecimal contractTotalMoney(ContractQueryCriteria criteria); |
| | | |
| | | /** |
| | | * 查询合同款延期数 |
| | | * @param criteria |
| | | * @return |
| | | */ |
| | | Integer contractDelayTotalAmount(ContractQueryCriteria criteria); |
| | | |
| | | /** |
| | | * 查询合同款延期金额 |
| | | * @param criteria |
| | | * @return |
| | | */ |
| | | BigDecimal contractDelayTotalMoney(ContractQueryCriteria criteria); |
| | | |
| | | /** |
| | | * 查询预收款总金额 |
| | | * @param criteria |
| | | * @return |
| | | */ |
| | | BigDecimal advancePaymentTotalMoney(ContractQueryCriteria criteria); |
| | | |
| | | /** |
| | | * 查询运维服务总金额 |
| | | * @param criteria |
| | | * @return |
| | | */ |
| | | BigDecimal serviceTotalMoney(ContractQueryCriteria criteria); |
| | | |
| | | /** |
| | | * 查询运维服务延期数 |
| | | * @param criteria |
| | | * @return |
| | | */ |
| | | Integer serviceDelayTotalAmount(ContractQueryCriteria criteria); |
| | | |
| | | /** |
| | | * 查询运维服务延期金额 |
| | | * @param criteria |
| | | * @return |
| | | */ |
| | | BigDecimal serviceDelayTotalMoney(ContractQueryCriteria criteria); |
| | | |
| | | /** |
| | | * 查询应收款总金额 |
| | | * @param criteria |
| | | * @return |
| | | */ |
| | | BigDecimal receivePaymentTotalMoney(ContractQueryCriteria criteria); |
| | | } |
| 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; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @website https://eladmin.vip |
| | | * @description / |
| | | * @author 赵士淞 |
| | | * @date 2023-02-02 |
| | | **/ |
| | | @Data |
| | | public class ContractDto extends BaseDTO implements Serializable { |
| | | |
| | | /** ID */ |
| | | private Long contractId; |
| | | |
| | | /** 合同编号 */ |
| | | private String contractNumber; |
| | | |
| | | /** 合同名称 */ |
| | | private String contractName; |
| | | |
| | | /** 甲方信息ID */ |
| | | private Long firstId; |
| | | |
| | | /** 乙方信息ID */ |
| | | private Long secondId; |
| | | |
| | | /** 签订日期 */ |
| | | private Timestamp signDate; |
| | | |
| | | /** 起始日期 */ |
| | | private Timestamp startDate; |
| | | |
| | | /** 截止日期 */ |
| | | private Timestamp endDate; |
| | | |
| | | /** 合同所属地区编码 */ |
| | | private String contractAreaCode; |
| | | |
| | | /** 合同所属地区 */ |
| | | private String contractArea; |
| | | |
| | | /** 合同类型 */ |
| | | private String contractType; |
| | | |
| | | /** 合同内容 */ |
| | | private String contractContent; |
| | | |
| | | /** 合同费金额 */ |
| | | private BigDecimal contractAmount; |
| | | |
| | | /** 预计付款日期 */ |
| | | private Timestamp contractPaymentDate; |
| | | |
| | | /** 付款状态 */ |
| | | private String contractPaymentState; |
| | | |
| | | /** 服务开始日期 */ |
| | | private Timestamp serviceStartsDate; |
| | | |
| | | /** 服务费金额 */ |
| | | private BigDecimal serviceAmount; |
| | | |
| | | /** 预计付款日期 */ |
| | | private Timestamp servicePaymentDate; |
| | | |
| | | /** 付款状态 */ |
| | | private String servicePaymentState; |
| | | |
| | | /** 合同初版文件 */ |
| | | private String relatedDocumentsFirst; |
| | | |
| | | /** 合同终版文件 */ |
| | | private String relatedDocumentsFinal; |
| | | |
| | | /** 合同状态 */ |
| | | private String contractStatus; |
| | | |
| | | /** 备注信息 */ |
| | | private String remarks; |
| | | |
| | | /** 延迟情况 */ |
| | | private String contractPostponement; |
| | | |
| | | /** 延迟情况 */ |
| | | private String servicePostponement; |
| | | |
| | | /** 预收款情况 */ |
| | | private BigDecimal advancePayment; |
| | | |
| | | /** 应收款情况 */ |
| | | private BigDecimal receivePayment; |
| | | |
| | | /** 开票总金额 */ |
| | | private BigDecimal billingTotalAmount; |
| | | |
| | | /** 付款总金额 */ |
| | | private BigDecimal paymentTotalAmount; |
| | | |
| | | /** 合同款付款金额 */ |
| | | private String contractPaymentAmount; |
| | | |
| | | /** 服务款付款金额 */ |
| | | private String servicePaymentAmount; |
| | | |
| | | /** 甲方姓名 */ |
| | | private String firstName; |
| | | |
| | | /** 乙方姓名 */ |
| | | private String secondName; |
| | | |
| | | /** 合同费数量 */ |
| | | 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.io.Serializable; |
| | | |
| | | /** |
| | | * @website https://eladmin.vip |
| | | * @description / |
| | | * @author 赵士淞 |
| | | * @date 2023-02-02 |
| | | **/ |
| | | @Data |
| | | public class ContractFirstDto extends BaseDTO implements Serializable { |
| | | |
| | | /** ID */ |
| | | private Long firstId; |
| | | |
| | | /** 甲方名称 */ |
| | | private String firstName; |
| | | |
| | | /** 甲方联系人 */ |
| | | private String firstPerson; |
| | | |
| | | /** 甲方联系电话 */ |
| | | private String firstPhone; |
| | | |
| | | /** 甲方邮件 */ |
| | | private String firstEmail; |
| | | |
| | | /** 甲方传真 */ |
| | | private String firstFax; |
| | | |
| | | /** 甲方所在地区编码 */ |
| | | private String firstAreaCode; |
| | | |
| | | /** 甲方所在地区 */ |
| | | private String firstArea; |
| | | |
| | | /** 甲方详细地址 */ |
| | | private String firstAddress; |
| | | |
| | | /** 备注信息 */ |
| | | private String remarks; |
| | | } |
copy from eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/service/dto/SysUserCompanyQueryCriteria.java
copy to eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/contract/service/dto/ContractFirstQueryCriteria.java
| File was copied from eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/service/dto/SysUserCompanyQueryCriteria.java |
| | |
| | | * See the License for the specific language governing permissions and |
| | | * limitations under the License. |
| | | */ |
| | | package me.zhengjie.modules.system.service.dto; |
| | | package me.zhengjie.modules.contract.service.dto; |
| | | |
| | | import lombok.Data; |
| | | import java.util.List; |
| | |
| | | |
| | | /** |
| | | * @website https://eladmin.vip |
| | | * @author wcd |
| | | * @date 2023-01-30 |
| | | * @author 赵士淞 |
| | | * @date 2023-02-02 |
| | | **/ |
| | | @Data |
| | | public class SysUserCompanyQueryCriteria { |
| | | public class ContractFirstQueryCriteria{ |
| | | |
| | | /** 模糊 */ |
| | | @Query(type = Query.Type.INNER_LIKE) |
| | | private String label; |
| | | private String firstName; |
| | | } |
| 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; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @website https://eladmin.vip |
| | | * @description / |
| | | * @author 赵士淞 |
| | | * @date 2023-02-02 |
| | | **/ |
| | | @Data |
| | | public class ContractInvoiceDto extends BaseDTO implements Serializable { |
| | | |
| | | /** ID */ |
| | | private Long invoiceId; |
| | | |
| | | /** 合同ID */ |
| | | private Long contractId; |
| | | |
| | | /** 开票时间 */ |
| | | private Timestamp billingTime; |
| | | |
| | | /** 发票类型 */ |
| | | private String invoiceType; |
| | | |
| | | /** 税前金额 */ |
| | | private BigDecimal beforeTaxAmount; |
| | | |
| | | /** 税率 */ |
| | | private Double taxRate; |
| | | |
| | | /** 税额 */ |
| | | private BigDecimal taxAmount; |
| | | |
| | | /** 税后金额 */ |
| | | private BigDecimal afterTaxAmount; |
| | | |
| | | /** 相关文件 */ |
| | | private String relatedDocuments; |
| | | |
| | | /** 备注信息 */ |
| | | private String remarks; |
| | | |
| | | /** 合同名称 */ |
| | | private String contractName; |
| | | |
| | | /** 付款信息 */ |
| | | private List<Long> contractPaymentIds; |
| | | } |
copy from eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/service/dto/SysUserCompanyDto.java
copy to eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/contract/service/dto/ContractInvoicePaymentDto.java
| File was copied from eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/service/dto/SysUserCompanyDto.java |
| | |
| | | * See the License for the specific language governing permissions and |
| | | * limitations under the License. |
| | | */ |
| | | package me.zhengjie.modules.system.service.dto; |
| | | package me.zhengjie.modules.contract.service.dto; |
| | | |
| | | import lombok.Data; |
| | | import me.zhengjie.base.BaseDTO; |
| | | |
| | | import java.sql.Timestamp; |
| | | import java.io.Serializable; |
| | | |
| | | /** |
| | | * @website https://eladmin.vip |
| | | * @description / |
| | | * @author wcd |
| | | * @date 2023-01-30 |
| | | * @author 赵士淞 |
| | | * @date 2023-02-02 |
| | | **/ |
| | | @Data |
| | | public class SysUserCompanyDto extends BaseDTO implements Serializable { |
| | | public class ContractInvoicePaymentDto extends BaseDTO implements Serializable { |
| | | |
| | | private Long id; |
| | | /** ID */ |
| | | private Long relationId; |
| | | |
| | | /** 描述 */ |
| | | private String description; |
| | | /** 发票ID */ |
| | | private Long invoiceId; |
| | | |
| | | /** 标签 */ |
| | | private String label; |
| | | |
| | | /** 值 */ |
| | | private String value; |
| | | |
| | | /** 用户id */ |
| | | private Long userId; |
| | | /** 付款ID */ |
| | | private Long paymentId; |
| | | } |
copy from eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/service/dto/SysUserCompanyQueryCriteria.java
copy to eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/contract/service/dto/ContractInvoicePaymentQueryCriteria.java
| File was copied from eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/service/dto/SysUserCompanyQueryCriteria.java |
| | |
| | | * See the License for the specific language governing permissions and |
| | | * limitations under the License. |
| | | */ |
| | | package me.zhengjie.modules.system.service.dto; |
| | | package me.zhengjie.modules.contract.service.dto; |
| | | |
| | | import lombok.Data; |
| | | import java.util.List; |
| | |
| | | |
| | | /** |
| | | * @website https://eladmin.vip |
| | | * @author wcd |
| | | * @date 2023-01-30 |
| | | * @author 赵士淞 |
| | | * @date 2023-02-02 |
| | | **/ |
| | | @Data |
| | | public class SysUserCompanyQueryCriteria { |
| | | |
| | | @Query(type = Query.Type.INNER_LIKE) |
| | | private String label; |
| | | public class ContractInvoicePaymentQueryCriteria{ |
| | | } |
copy from eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/service/dto/SysUserCompanyQueryCriteria.java
copy to eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/contract/service/dto/ContractInvoiceQueryCriteria.java
| File was copied from eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/service/dto/SysUserCompanyQueryCriteria.java |
| | |
| | | * See the License for the specific language governing permissions and |
| | | * limitations under the License. |
| | | */ |
| | | package me.zhengjie.modules.system.service.dto; |
| | | package me.zhengjie.modules.contract.service.dto; |
| | | |
| | | import lombok.Data; |
| | | import java.util.List; |
| | |
| | | |
| | | /** |
| | | * @website https://eladmin.vip |
| | | * @author wcd |
| | | * @date 2023-01-30 |
| | | * @author 赵士淞 |
| | | * @date 2023-02-02 |
| | | **/ |
| | | @Data |
| | | public class SysUserCompanyQueryCriteria { |
| | | public class ContractInvoiceQueryCriteria{ |
| | | |
| | | @Query(type = Query.Type.INNER_LIKE) |
| | | private String label; |
| | | /** 精确 */ |
| | | @Query |
| | | private Long contractId; |
| | | |
| | | /** 精确 */ |
| | | @Query |
| | | private String invoiceType; |
| | | } |
| 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; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @website https://eladmin.vip |
| | | * @description / |
| | | * @author 赵士淞 |
| | | * @date 2023-02-02 |
| | | **/ |
| | | @Data |
| | | public class ContractPaymentDto extends BaseDTO implements Serializable { |
| | | |
| | | /** ID */ |
| | | private Long paymentId; |
| | | |
| | | /** 合同ID */ |
| | | private Long contractId; |
| | | |
| | | /** 付款时间 */ |
| | | private Timestamp paymentTime; |
| | | |
| | | /** 款项类型 */ |
| | | private String fundType; |
| | | |
| | | /** 付款金额 */ |
| | | private BigDecimal paymentAmount; |
| | | |
| | | /** 款项内容 */ |
| | | private String fundBelong; |
| | | |
| | | /** 款项起始日期 */ |
| | | private Timestamp fundBelongStart; |
| | | |
| | | /** 款项结束日期 */ |
| | | private Timestamp fundBelongEnd; |
| | | |
| | | /** 备注信息 */ |
| | | private String remarks; |
| | | |
| | | /** 合同名称 */ |
| | | private String contractName; |
| | | |
| | | /** 发票信息 */ |
| | | private List<Long> contractInvoiceIds; |
| | | } |
copy from eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/service/dto/SysUserCompanyQueryCriteria.java
copy to eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/contract/service/dto/ContractPaymentQueryCriteria.java
| File was copied from eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/service/dto/SysUserCompanyQueryCriteria.java |
| | |
| | | * See the License for the specific language governing permissions and |
| | | * limitations under the License. |
| | | */ |
| | | package me.zhengjie.modules.system.service.dto; |
| | | package me.zhengjie.modules.contract.service.dto; |
| | | |
| | | import lombok.Data; |
| | | import java.util.List; |
| | |
| | | |
| | | /** |
| | | * @website https://eladmin.vip |
| | | * @author wcd |
| | | * @date 2023-01-30 |
| | | * @author 赵士淞 |
| | | * @date 2023-02-02 |
| | | **/ |
| | | @Data |
| | | public class SysUserCompanyQueryCriteria { |
| | | public class ContractPaymentQueryCriteria{ |
| | | |
| | | @Query(type = Query.Type.INNER_LIKE) |
| | | private String label; |
| | | /** 精确 */ |
| | | @Query |
| | | private Long contractId; |
| | | |
| | | /** 精确 */ |
| | | @Query |
| | | private 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.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; |
| | | } |
copy from eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/service/dto/SysUserCompanyQueryCriteria.java
copy to eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/contract/service/dto/ContractProjectQueryCriteria.java
| File was copied from eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/service/dto/SysUserCompanyQueryCriteria.java |
| | |
| | | * See the License for the specific language governing permissions and |
| | | * limitations under the License. |
| | | */ |
| | | package me.zhengjie.modules.system.service.dto; |
| | | package me.zhengjie.modules.contract.service.dto; |
| | | |
| | | import lombok.Data; |
| | | import java.util.List; |
| | |
| | | |
| | | /** |
| | | * @website https://eladmin.vip |
| | | * @author wcd |
| | | * @date 2023-01-30 |
| | | * @author 赵士淞 |
| | | * @date 2023-02-10 |
| | | **/ |
| | | @Data |
| | | public class SysUserCompanyQueryCriteria { |
| | | public class ContractProjectQueryCriteria{ |
| | | |
| | | @Query(type = Query.Type.INNER_LIKE) |
| | | private String label; |
| | | /** 精确 */ |
| | | @Query |
| | | private Long contractId; |
| | | |
| | | /** 精确 */ |
| | | @Query |
| | | private Long projectId; |
| | | |
| | | /** 精确 */ |
| | | @Query |
| | | private 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.service.dto; |
| | | |
| | | import lombok.Data; |
| | | |
| | | import java.sql.Timestamp; |
| | | import java.util.List; |
| | | import me.zhengjie.annotation.Query; |
| | | |
| | | /** |
| | | * @website https://eladmin.vip |
| | | * @author 赵士淞 |
| | | * @date 2023-02-02 |
| | | **/ |
| | | @Data |
| | | public class ContractQueryCriteria{ |
| | | |
| | | /** 精确 */ |
| | | @Query |
| | | private String contractNumber; |
| | | |
| | | /** 模糊 */ |
| | | @Query(type = Query.Type.INNER_LIKE) |
| | | private String contractName; |
| | | |
| | | /** 精确 */ |
| | | @Query |
| | | private Long firstId; |
| | | |
| | | /** 精确 */ |
| | | @Query |
| | | private Long secondId; |
| | | |
| | | /** 两者之间 */ |
| | | @Query(type = Query.Type.BETWEEN) |
| | | private List<Timestamp> signDate; |
| | | |
| | | /** 精确 */ |
| | | @Query |
| | | private String contractType; |
| | | |
| | | /** 精确 */ |
| | | @Query |
| | | private String contractPaymentState; |
| | | |
| | | /** 精确 */ |
| | | @Query |
| | | private String servicePaymentState; |
| | | |
| | | /** 精确 */ |
| | | @Query |
| | | private String contractStatus; |
| | | |
| | | /** 模糊 */ |
| | | @Query(type = Query.Type.INNER_LIKE) |
| | | private String contractAreaCode; |
| | | } |
| 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.io.Serializable; |
| | | |
| | | /** |
| | | * @website https://eladmin.vip |
| | | * @description / |
| | | * @author 赵士淞 |
| | | * @date 2023-02-02 |
| | | **/ |
| | | @Data |
| | | public class ContractSecondDto extends BaseDTO implements Serializable { |
| | | |
| | | /** ID */ |
| | | private Long secondId; |
| | | |
| | | /** 乙方名称 */ |
| | | private String secondName; |
| | | |
| | | /** 乙方联系人 */ |
| | | private String secondPerson; |
| | | |
| | | /** 乙方联系电话 */ |
| | | private String secondPhone; |
| | | |
| | | /** 乙方邮件 */ |
| | | private String secondEmail; |
| | | |
| | | /** 乙方传真 */ |
| | | private String secondFax; |
| | | |
| | | /** 乙方所在地区编码 */ |
| | | private String secondAreaCode; |
| | | |
| | | /** 乙方所在地区 */ |
| | | private String secondArea; |
| | | |
| | | /** 乙方详细地址 */ |
| | | private String secondAddress; |
| | | |
| | | /** 备注信息 */ |
| | | private String remarks; |
| | | } |
copy from eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/service/dto/SysUserCompanyQueryCriteria.java
copy to eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/contract/service/dto/ContractSecondQueryCriteria.java
| File was copied from eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/service/dto/SysUserCompanyQueryCriteria.java |
| | |
| | | * See the License for the specific language governing permissions and |
| | | * limitations under the License. |
| | | */ |
| | | package me.zhengjie.modules.system.service.dto; |
| | | package me.zhengjie.modules.contract.service.dto; |
| | | |
| | | import lombok.Data; |
| | | import java.util.List; |
| | |
| | | |
| | | /** |
| | | * @website https://eladmin.vip |
| | | * @author wcd |
| | | * @date 2023-01-30 |
| | | * @author 赵士淞 |
| | | * @date 2023-02-02 |
| | | **/ |
| | | @Data |
| | | public class SysUserCompanyQueryCriteria { |
| | | public class ContractSecondQueryCriteria{ |
| | | |
| | | /** 模糊 */ |
| | | @Query(type = Query.Type.INNER_LIKE) |
| | | private String label; |
| | | private String secondName; |
| | | } |
| 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.modules.contract.domain.ContractFirst; |
| | | import me.zhengjie.utils.ValidationUtil; |
| | | import me.zhengjie.utils.FileUtil; |
| | | import lombok.RequiredArgsConstructor; |
| | | import me.zhengjie.modules.contract.repository.ContractFirstRepository; |
| | | import me.zhengjie.modules.contract.service.ContractFirstService; |
| | | import me.zhengjie.modules.contract.service.dto.ContractFirstDto; |
| | | import me.zhengjie.modules.contract.service.dto.ContractFirstQueryCriteria; |
| | | import me.zhengjie.modules.contract.service.mapstruct.ContractFirstMapper; |
| | | 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.util.List; |
| | | import java.util.Map; |
| | | import java.io.IOException; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.util.ArrayList; |
| | | import java.util.LinkedHashMap; |
| | | |
| | | /** |
| | | * @website https://eladmin.vip |
| | | * @description 服务实现 |
| | | * @author 赵士淞 |
| | | * @date 2023-02-02 |
| | | **/ |
| | | @Service |
| | | @RequiredArgsConstructor |
| | | public class ContractFirstServiceImpl implements ContractFirstService { |
| | | |
| | | private final ContractFirstRepository contractFirstRepository; |
| | | private final ContractFirstMapper contractFirstMapper; |
| | | |
| | | @Override |
| | | public Map<String,Object> queryAll(ContractFirstQueryCriteria criteria, Pageable pageable){ |
| | | Page<ContractFirst> page = contractFirstRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable); |
| | | return PageUtil.toPage(page.map(contractFirstMapper::toDto)); |
| | | } |
| | | |
| | | @Override |
| | | public List<ContractFirstDto> queryAll(ContractFirstQueryCriteria criteria){ |
| | | return contractFirstMapper.toDto(contractFirstRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder))); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional |
| | | public ContractFirstDto findById(Long firstId) { |
| | | ContractFirst contractFirst = contractFirstRepository.findById(firstId).orElseGet(ContractFirst::new); |
| | | ValidationUtil.isNull(contractFirst.getFirstId(),"ContractFirst","firstId",firstId); |
| | | return contractFirstMapper.toDto(contractFirst); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public ContractFirstDto create(ContractFirst resources) { |
| | | return contractFirstMapper.toDto(contractFirstRepository.save(resources)); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void update(ContractFirst resources) { |
| | | ContractFirst contractFirst = contractFirstRepository.findById(resources.getFirstId()).orElseGet(ContractFirst::new); |
| | | ValidationUtil.isNull( contractFirst.getFirstId(),"ContractFirst","id",resources.getFirstId()); |
| | | contractFirst.copy(resources); |
| | | contractFirstRepository.save(contractFirst); |
| | | } |
| | | |
| | | @Override |
| | | public void deleteAll(Long[] ids) { |
| | | for (Long firstId : ids) { |
| | | contractFirstRepository.deleteById(firstId); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public void download(List<ContractFirstDto> all, HttpServletResponse response) throws IOException { |
| | | List<Map<String, Object>> list = new ArrayList<>(); |
| | | for (ContractFirstDto contractFirst : all) { |
| | | Map<String,Object> map = new LinkedHashMap<>(); |
| | | map.put("甲方名称", contractFirst.getFirstName()); |
| | | map.put("甲方联系人", contractFirst.getFirstPerson()); |
| | | map.put("甲方联系电话", contractFirst.getFirstPhone()); |
| | | map.put("甲方邮件", contractFirst.getFirstEmail()); |
| | | map.put("甲方传真", contractFirst.getFirstFax()); |
| | | map.put("甲方所在地区", contractFirst.getFirstArea()); |
| | | map.put("甲方详细地址", contractFirst.getFirstAddress()); |
| | | map.put("备注信息", contractFirst.getRemarks()); |
| | | map.put("创建者", contractFirst.getCreateBy()); |
| | | map.put("创建日期", contractFirst.getCreateTime()); |
| | | list.add(map); |
| | | } |
| | | FileUtil.downloadExcel(list, response); |
| | | } |
| | | } |
| 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.modules.contract.domain.ContractInvoicePayment; |
| | | import me.zhengjie.utils.ValidationUtil; |
| | | import me.zhengjie.utils.FileUtil; |
| | | import lombok.RequiredArgsConstructor; |
| | | import me.zhengjie.modules.contract.repository.ContractInvoicePaymentRepository; |
| | | import me.zhengjie.modules.contract.service.ContractInvoicePaymentService; |
| | | import me.zhengjie.modules.contract.service.dto.ContractInvoicePaymentDto; |
| | | import me.zhengjie.modules.contract.service.dto.ContractInvoicePaymentQueryCriteria; |
| | | import me.zhengjie.modules.contract.service.mapstruct.ContractInvoicePaymentMapper; |
| | | 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.util.List; |
| | | import java.util.Map; |
| | | import java.io.IOException; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.util.ArrayList; |
| | | import java.util.LinkedHashMap; |
| | | |
| | | /** |
| | | * @website https://eladmin.vip |
| | | * @description 服务实现 |
| | | * @author 赵士淞 |
| | | * @date 2023-02-02 |
| | | **/ |
| | | @Service |
| | | @RequiredArgsConstructor |
| | | public class ContractInvoicePaymentServiceImpl implements ContractInvoicePaymentService { |
| | | |
| | | private final ContractInvoicePaymentRepository contractInvoicePaymentRepository; |
| | | private final ContractInvoicePaymentMapper contractInvoicePaymentMapper; |
| | | |
| | | @Override |
| | | public Map<String,Object> queryAll(ContractInvoicePaymentQueryCriteria criteria, Pageable pageable){ |
| | | Page<ContractInvoicePayment> page = contractInvoicePaymentRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable); |
| | | return PageUtil.toPage(page.map(contractInvoicePaymentMapper::toDto)); |
| | | } |
| | | |
| | | @Override |
| | | public List<ContractInvoicePaymentDto> queryAll(ContractInvoicePaymentQueryCriteria criteria){ |
| | | return contractInvoicePaymentMapper.toDto(contractInvoicePaymentRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder))); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional |
| | | public ContractInvoicePaymentDto findById(Long relationId) { |
| | | ContractInvoicePayment contractInvoicePayment = contractInvoicePaymentRepository.findById(relationId).orElseGet(ContractInvoicePayment::new); |
| | | ValidationUtil.isNull(contractInvoicePayment.getRelationId(),"ContractInvoicePayment","relationId",relationId); |
| | | return contractInvoicePaymentMapper.toDto(contractInvoicePayment); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public ContractInvoicePaymentDto create(ContractInvoicePayment resources) { |
| | | return contractInvoicePaymentMapper.toDto(contractInvoicePaymentRepository.save(resources)); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void update(ContractInvoicePayment resources) { |
| | | ContractInvoicePayment contractInvoicePayment = contractInvoicePaymentRepository.findById(resources.getRelationId()).orElseGet(ContractInvoicePayment::new); |
| | | ValidationUtil.isNull( contractInvoicePayment.getRelationId(),"ContractInvoicePayment","id",resources.getRelationId()); |
| | | contractInvoicePayment.copy(resources); |
| | | contractInvoicePaymentRepository.save(contractInvoicePayment); |
| | | } |
| | | |
| | | @Override |
| | | public void deleteAll(Long[] ids) { |
| | | for (Long relationId : ids) { |
| | | contractInvoicePaymentRepository.deleteById(relationId); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public void download(List<ContractInvoicePaymentDto> all, HttpServletResponse response) throws IOException { |
| | | List<Map<String, Object>> list = new ArrayList<>(); |
| | | for (ContractInvoicePaymentDto contractInvoicePayment : all) { |
| | | Map<String,Object> map = new LinkedHashMap<>(); |
| | | map.put("发票ID", contractInvoicePayment.getInvoiceId()); |
| | | map.put("付款ID", contractInvoicePayment.getPaymentId()); |
| | | map.put("创建者", contractInvoicePayment.getCreateBy()); |
| | | map.put("创建日期", contractInvoicePayment.getCreateTime()); |
| | | list.add(map); |
| | | } |
| | | FileUtil.downloadExcel(list, response); |
| | | } |
| | | |
| | | /** |
| | | * 通过付款更换相关数据 |
| | | * @param paymentId |
| | | * @param invoiceIds |
| | | */ |
| | | @Transactional |
| | | public void operationMainPaymentId(Long paymentId, List<Long> invoiceIds) { |
| | | // 删除付款相关数据 |
| | | contractInvoicePaymentRepository.deleteByPaymentId(paymentId); |
| | | // 循环发票数组 |
| | | for(int i = 0; i < invoiceIds.size(); i ++) { |
| | | // 实体类 |
| | | ContractInvoicePayment contractInvoicePayment = new ContractInvoicePayment(); |
| | | contractInvoicePayment.setPaymentId(paymentId); |
| | | contractInvoicePayment.setInvoiceId(invoiceIds.get(i)); |
| | | // 保存 |
| | | contractInvoicePaymentRepository.save(contractInvoicePayment); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 通过发票更换相关数据 |
| | | * @param invoiceId |
| | | * @param paymentIds |
| | | */ |
| | | @Transactional |
| | | public void operationMainInvoiceId(Long invoiceId, List<Long> paymentIds) { |
| | | // 删除发票相关数据 |
| | | contractInvoicePaymentRepository.deleteByInvoiceId(invoiceId); |
| | | // 循环发票数组 |
| | | for(int i = 0; i < paymentIds.size(); i ++) { |
| | | // 实体类 |
| | | ContractInvoicePayment contractInvoicePayment = new ContractInvoicePayment(); |
| | | contractInvoicePayment.setInvoiceId(invoiceId); |
| | | contractInvoicePayment.setPaymentId(paymentIds.get(i)); |
| | | // 保存 |
| | | contractInvoicePaymentRepository.save(contractInvoicePayment); |
| | | } |
| | | } |
| | | } |
| 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.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; |
| | | import me.zhengjie.modules.contract.repository.ContractRepository; |
| | | import me.zhengjie.modules.contract.service.dto.ContractDto; |
| | | 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.ContractInvoiceRepository; |
| | | import me.zhengjie.modules.contract.service.ContractInvoiceService; |
| | | import me.zhengjie.modules.contract.service.dto.ContractInvoiceDto; |
| | | import me.zhengjie.modules.contract.service.dto.ContractInvoiceQueryCriteria; |
| | | import me.zhengjie.modules.contract.service.mapstruct.ContractInvoiceMapper; |
| | | 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.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-02 |
| | | **/ |
| | | @Service |
| | | @RequiredArgsConstructor |
| | | public class ContractInvoiceServiceImpl implements ContractInvoiceService { |
| | | |
| | | private final ContractInvoiceRepository contractInvoiceRepository; |
| | | private final ContractInvoiceMapper contractInvoiceMapper; |
| | | private final DictDetailRepository dictDetailRepository; |
| | | private final ContractInvoicePaymentRepository contractInvoicePaymentRepository; |
| | | private final ContractInvoicePaymentServiceImpl contractInvoicePaymentServiceImpl; |
| | | private final ContractRepository contractRepository; |
| | | |
| | | @Override |
| | | public Map<String,Object> queryAll(ContractInvoiceQueryCriteria criteria, Pageable pageable){ |
| | | Page<ContractInvoice> page = contractInvoiceRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable); |
| | | // 将实体类转换为DTO(重写) |
| | | Function<ContractInvoice, ContractInvoiceDto> func = new Function<ContractInvoice, ContractInvoiceDto>(){ |
| | | @Override |
| | | public ContractInvoiceDto apply(ContractInvoice t) { |
| | | // 将实体类转换成DTO |
| | | ContractInvoiceDto contractInvoiceDto = contractInvoiceMapper.toDto(t); |
| | | // 查询发票相关付款数据 |
| | | List<ContractInvoicePayment> contractInvoicePayments = contractInvoicePaymentRepository.findByInvoiceId(t.getInvoiceId()); |
| | | // 相关付款列表 |
| | | List<Long> contractPaymentIds = new ArrayList<>(); |
| | | // 循环发票相关付款数据 |
| | | for(int i = 0; i < contractInvoicePayments.size(); i ++) { |
| | | // 相关付款列表 |
| | | contractPaymentIds.add(contractInvoicePayments.get(i).getPaymentId()); |
| | | } |
| | | // DTO赋值 |
| | | contractInvoiceDto.setContractPaymentIds(contractPaymentIds); |
| | | // 查询合同数据 |
| | | Contract contract = contractRepository.findById(t.getContractId()).orElseGet(Contract::new); |
| | | // DTO赋值 |
| | | contractInvoiceDto.setContractName(contract.getContractName()); |
| | | // 返回处理好的DTO |
| | | return contractInvoiceDto; |
| | | } |
| | | }; |
| | | return PageUtil.toPage(page.map(func)); |
| | | } |
| | | |
| | | @Override |
| | | public List<ContractInvoiceDto> queryAll(ContractInvoiceQueryCriteria criteria){ |
| | | return contractInvoiceMapper.toDto(contractInvoiceRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder))); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional |
| | | public ContractInvoiceDto findById(Long invoiceId) { |
| | | ContractInvoice contractInvoice = contractInvoiceRepository.findById(invoiceId).orElseGet(ContractInvoice::new); |
| | | ValidationUtil.isNull(contractInvoice.getInvoiceId(),"ContractInvoice","invoiceId",invoiceId); |
| | | return contractInvoiceMapper.toDto(contractInvoice); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public ContractInvoiceDto create(ContractInvoiceDto resources) { |
| | | // DTO转实体类 |
| | | ContractInvoice ciEntity = contractInvoiceMapper.toEntity(resources); |
| | | // 保存 |
| | | ContractInvoice contractInvoice = contractInvoiceRepository.save(ciEntity); |
| | | // 操作付款发票关联表 |
| | | contractInvoicePaymentServiceImpl.operationMainInvoiceId(contractInvoice.getInvoiceId(), resources.getContractPaymentIds()); |
| | | // 返回 |
| | | return contractInvoiceMapper.toDto(contractInvoice); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void update(ContractInvoiceDto resources) { |
| | | // DTO转实体类 |
| | | ContractInvoice ciEntity = contractInvoiceMapper.toEntity(resources); |
| | | // 查询旧数据 |
| | | ContractInvoice contractInvoice = contractInvoiceRepository.findById(ciEntity.getInvoiceId()).orElseGet(ContractInvoice::new); |
| | | ValidationUtil.isNull( contractInvoice.getInvoiceId(),"ContractInvoice","id",ciEntity.getInvoiceId()); |
| | | // 新旧数据合并 |
| | | contractInvoice.copy(ciEntity); |
| | | // 保存 |
| | | contractInvoiceRepository.save(contractInvoice); |
| | | // 操作付款发票关联表 |
| | | contractInvoicePaymentServiceImpl.operationMainInvoiceId(contractInvoice.getInvoiceId(), resources.getContractPaymentIds()); |
| | | } |
| | | |
| | | @Override |
| | | public void deleteAll(Long[] ids) { |
| | | for (Long invoiceId : ids) { |
| | | // 删除 |
| | | contractInvoiceRepository.deleteById(invoiceId); |
| | | // 操作付款发票关联表 |
| | | contractInvoicePaymentServiceImpl.operationMainInvoiceId(invoiceId, new ArrayList<Long>()); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public void download(List<ContractInvoiceDto> all, HttpServletResponse response) throws IOException { |
| | | List<Map<String, Object>> list = new ArrayList<>(); |
| | | for (ContractInvoiceDto contractInvoice : all) { |
| | | 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("所属合同", contract.getContractName()); |
| | | map.put("开票时间", contractInvoice.getBillingTime()); |
| | | map.put("发票类型", invoiceType); |
| | | map.put("税前金额", contractInvoice.getBeforeTaxAmount()); |
| | | map.put("税率", contractInvoice.getTaxRate() + '%'); |
| | | map.put("税额", contractInvoice.getTaxAmount()); |
| | | map.put("税后金额", contractInvoice.getAfterTaxAmount()); |
| | | map.put("备注信息", contractInvoice.getRemarks()); |
| | | map.put("创建者", contractInvoice.getCreateBy()); |
| | | map.put("创建日期", contractInvoice.getCreateTime()); |
| | | list.add(map); |
| | | } |
| | | FileUtil.downloadExcel(list, response); |
| | | } |
| | | } |
| 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.modules.constant.Constant; |
| | | import me.zhengjie.modules.contract.domain.Contract; |
| | | 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.ContractRepository; |
| | | import me.zhengjie.modules.contract.service.dto.ContractDto; |
| | | import me.zhengjie.modules.contract.service.mapstruct.ContractMapper; |
| | | 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.ContractPaymentRepository; |
| | | import me.zhengjie.modules.contract.service.ContractPaymentService; |
| | | import me.zhengjie.modules.contract.service.dto.ContractPaymentDto; |
| | | import me.zhengjie.modules.contract.service.dto.ContractPaymentQueryCriteria; |
| | | import me.zhengjie.modules.contract.service.mapstruct.ContractPaymentMapper; |
| | | 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.text.SimpleDateFormat; |
| | | 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-02 |
| | | **/ |
| | | @Service |
| | | @RequiredArgsConstructor |
| | | public class ContractPaymentServiceImpl implements ContractPaymentService { |
| | | |
| | | private final ContractPaymentRepository contractPaymentRepository; |
| | | private final ContractPaymentMapper contractPaymentMapper; |
| | | private final DictDetailRepository dictDetailRepository; |
| | | private final ContractInvoicePaymentRepository contractInvoicePaymentRepository; |
| | | private final ContractInvoicePaymentServiceImpl contractInvoicePaymentServiceImpl; |
| | | private final ContractServiceImpl contractServiceImpl; |
| | | private final ContractMapper contractMapper; |
| | | private final ContractRepository contractRepository; |
| | | |
| | | @Override |
| | | public Map<String,Object> queryAll(ContractPaymentQueryCriteria criteria, Pageable pageable){ |
| | | Page<ContractPayment> page = contractPaymentRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable); |
| | | // 将实体类转换为DTO(重写) |
| | | Function<ContractPayment, ContractPaymentDto> func = new Function<ContractPayment, ContractPaymentDto>(){ |
| | | @Override |
| | | public ContractPaymentDto apply(ContractPayment t) { |
| | | // 将实体类转换成DTO |
| | | ContractPaymentDto contractPaymentDto = contractPaymentMapper.toDto(t); |
| | | // 查询付款相关发票数据 |
| | | List<ContractInvoicePayment> contractInvoicePayments = contractInvoicePaymentRepository.findByPaymentId(t.getPaymentId()); |
| | | // 相关发票列表 |
| | | List<Long> contractInvoiceIds = new ArrayList<>(); |
| | | // 循环付款相关发票数据 |
| | | for(int i = 0; i < contractInvoicePayments.size(); i ++) { |
| | | // 相关发票列表 |
| | | contractInvoiceIds.add(contractInvoicePayments.get(i).getInvoiceId()); |
| | | } |
| | | // DTO赋值 |
| | | contractPaymentDto.setContractInvoiceIds(contractInvoiceIds); |
| | | // 查询合同数据 |
| | | Contract contract = contractRepository.findById(t.getContractId()).orElseGet(Contract::new); |
| | | // DTO赋值 |
| | | contractPaymentDto.setContractName(contract.getContractName()); |
| | | // 返回处理好的DTO |
| | | return contractPaymentDto; |
| | | } |
| | | }; |
| | | return PageUtil.toPage(page.map(func)); |
| | | } |
| | | |
| | | @Override |
| | | public List<ContractPaymentDto> queryAll(ContractPaymentQueryCriteria criteria){ |
| | | return contractPaymentMapper.toDto(contractPaymentRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder))); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional |
| | | public ContractPaymentDto findById(Long paymentId) { |
| | | ContractPayment contractPayment = contractPaymentRepository.findById(paymentId).orElseGet(ContractPayment::new); |
| | | ValidationUtil.isNull(contractPayment.getPaymentId(),"ContractPayment","paymentId",paymentId); |
| | | return contractPaymentMapper.toDto(contractPayment); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public ContractPaymentDto create(ContractPaymentDto resources) { |
| | | // DTO转实体类 |
| | | ContractPayment cpEntity = contractPaymentMapper.toEntity(resources); |
| | | // 保存 |
| | | ContractPayment contractPayment = contractPaymentRepository.save(cpEntity); |
| | | // 操作付款发票关联表 |
| | | contractInvoicePaymentServiceImpl.operationMainPaymentId(contractPayment.getPaymentId(), resources.getContractInvoiceIds()); |
| | | // 查询合同数据 |
| | | ContractDto contractDto = contractServiceImpl.findById(resources.getContractId()); |
| | | // 更新合同付款状态 |
| | | Contract contract = contractServiceImpl.updatePaymentStatus(contractMapper.toEntity(contractDto)); |
| | | // 保存合同 |
| | | contractRepository.save(contract); |
| | | // 返回 |
| | | return contractPaymentMapper.toDto(contractPayment); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void update(ContractPaymentDto resources) { |
| | | // DTO转实体类 |
| | | ContractPayment cpEntity = contractPaymentMapper.toEntity(resources); |
| | | // 查询旧数据 |
| | | ContractPayment contractPayment = contractPaymentRepository.findById(cpEntity.getPaymentId()).orElseGet(ContractPayment::new); |
| | | ValidationUtil.isNull( contractPayment.getPaymentId(),"ContractPayment","id",cpEntity.getPaymentId()); |
| | | // 新旧数据合并 |
| | | contractPayment.copy(cpEntity); |
| | | // 保存 |
| | | contractPaymentRepository.save(contractPayment); |
| | | // 操作付款发票关联表 |
| | | contractInvoicePaymentServiceImpl.operationMainPaymentId(contractPayment.getPaymentId(), resources.getContractInvoiceIds()); |
| | | // 查询合同数据 |
| | | ContractDto contractDto = contractServiceImpl.findById(resources.getContractId()); |
| | | // 更新合同付款状态 |
| | | Contract contract = contractServiceImpl.updatePaymentStatus(contractMapper.toEntity(contractDto)); |
| | | // 保存合同 |
| | | contractRepository.save(contract); |
| | | } |
| | | |
| | | @Override |
| | | public void deleteAll(Long[] ids) { |
| | | for (Long paymentId : ids) { |
| | | // 查询旧数据 |
| | | ContractPayment contractPayment = contractPaymentRepository.findById(paymentId).orElseGet(ContractPayment::new); |
| | | // 删除 |
| | | contractPaymentRepository.deleteById(paymentId); |
| | | // 操作付款发票关联表 |
| | | contractInvoicePaymentServiceImpl.operationMainPaymentId(paymentId, new ArrayList<Long>()); |
| | | // 查询合同数据 |
| | | ContractDto contractDto = contractServiceImpl.findById(contractPayment.getContractId()); |
| | | // 更新合同付款状态 |
| | | Contract contract = contractServiceImpl.updatePaymentStatus(contractMapper.toEntity(contractDto)); |
| | | // 保存合同 |
| | | contractRepository.save(contract); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public void download(List<ContractPaymentDto> all, HttpServletResponse response) throws IOException { |
| | | List<Map<String, Object>> list = new ArrayList<>(); |
| | | for (ContractPaymentDto contractPayment : all) { |
| | | String fundType = contractPayment.getFundType() != null ? dictDetailRepository.findByDictNameAndValue(Constant.FUND_TYPE, contractPayment.getFundType()).getLabel() : ""; |
| | | String fundBelong = null; |
| | | if(contractPayment.getFundBelong() != null) { |
| | | fundBelong = contractPayment.getFundBelong(); |
| | | } else if(contractPayment.getFundBelongStart() != null && contractPayment.getFundBelongEnd() != null) { |
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
| | | String fundBelongStart = sdf.format(contractPayment.getFundBelongStart()); |
| | | String fundBelongEnd = sdf.format(contractPayment.getFundBelongEnd()); |
| | | fundBelong = fundBelongStart.substring(0, 10) + " 至 " + fundBelongEnd.substring(0, 10) + " 服务费"; |
| | | } |
| | | Contract contract = contractRepository.findById(contractPayment.getContractId()).orElseGet(Contract::new); |
| | | Map<String,Object> map = new LinkedHashMap<>(); |
| | | map.put("所属合同", contract.getContractName()); |
| | | map.put("付款时间", contractPayment.getPaymentTime()); |
| | | map.put("款项类型", fundType); |
| | | map.put("付款金额", contractPayment.getPaymentAmount()); |
| | | map.put("款项所属", fundBelong); |
| | | map.put("备注信息", contractPayment.getRemarks()); |
| | | map.put("创建者", contractPayment.getCreateBy()); |
| | | map.put("创建日期", contractPayment.getCreateTime()); |
| | | list.add(map); |
| | | } |
| | | FileUtil.downloadExcel(list, response); |
| | | } |
| | | } |
| 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("合同分配总金额超出服务费金额!"); |
| | | } |
| | | } |
| | | } |
| | | } |
| 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.modules.contract.domain.ContractSecond; |
| | | import me.zhengjie.utils.ValidationUtil; |
| | | import me.zhengjie.utils.FileUtil; |
| | | import lombok.RequiredArgsConstructor; |
| | | import me.zhengjie.modules.contract.repository.ContractSecondRepository; |
| | | import me.zhengjie.modules.contract.service.ContractSecondService; |
| | | import me.zhengjie.modules.contract.service.dto.ContractSecondDto; |
| | | import me.zhengjie.modules.contract.service.dto.ContractSecondQueryCriteria; |
| | | import me.zhengjie.modules.contract.service.mapstruct.ContractSecondMapper; |
| | | 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.util.List; |
| | | import java.util.Map; |
| | | import java.io.IOException; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.util.ArrayList; |
| | | import java.util.LinkedHashMap; |
| | | |
| | | /** |
| | | * @website https://eladmin.vip |
| | | * @description 服务实现 |
| | | * @author 赵士淞 |
| | | * @date 2023-02-02 |
| | | **/ |
| | | @Service |
| | | @RequiredArgsConstructor |
| | | public class ContractSecondServiceImpl implements ContractSecondService { |
| | | |
| | | private final ContractSecondRepository contractSecondRepository; |
| | | private final ContractSecondMapper contractSecondMapper; |
| | | |
| | | @Override |
| | | public Map<String,Object> queryAll(ContractSecondQueryCriteria criteria, Pageable pageable){ |
| | | Page<ContractSecond> page = contractSecondRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable); |
| | | return PageUtil.toPage(page.map(contractSecondMapper::toDto)); |
| | | } |
| | | |
| | | @Override |
| | | public List<ContractSecondDto> queryAll(ContractSecondQueryCriteria criteria){ |
| | | return contractSecondMapper.toDto(contractSecondRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder))); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional |
| | | public ContractSecondDto findById(Long secondId) { |
| | | ContractSecond contractSecond = contractSecondRepository.findById(secondId).orElseGet(ContractSecond::new); |
| | | ValidationUtil.isNull(contractSecond.getSecondId(),"ContractSecond","secondId",secondId); |
| | | return contractSecondMapper.toDto(contractSecond); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public ContractSecondDto create(ContractSecond resources) { |
| | | return contractSecondMapper.toDto(contractSecondRepository.save(resources)); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void update(ContractSecond resources) { |
| | | ContractSecond contractSecond = contractSecondRepository.findById(resources.getSecondId()).orElseGet(ContractSecond::new); |
| | | ValidationUtil.isNull( contractSecond.getSecondId(),"ContractSecond","id",resources.getSecondId()); |
| | | contractSecond.copy(resources); |
| | | contractSecondRepository.save(contractSecond); |
| | | } |
| | | |
| | | @Override |
| | | public void deleteAll(Long[] ids) { |
| | | for (Long secondId : ids) { |
| | | contractSecondRepository.deleteById(secondId); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public void download(List<ContractSecondDto> all, HttpServletResponse response) throws IOException { |
| | | List<Map<String, Object>> list = new ArrayList<>(); |
| | | for (ContractSecondDto contractSecond : all) { |
| | | Map<String,Object> map = new LinkedHashMap<>(); |
| | | map.put("乙方名称", contractSecond.getSecondName()); |
| | | map.put("乙方联系人", contractSecond.getSecondPerson()); |
| | | map.put("乙方联系电话", contractSecond.getSecondPhone()); |
| | | map.put("乙方邮件", contractSecond.getSecondEmail()); |
| | | map.put("乙方传真", contractSecond.getSecondFax()); |
| | | map.put("乙方所在地区", contractSecond.getSecondArea()); |
| | | map.put("乙方详细地址", contractSecond.getSecondAddress()); |
| | | map.put("备注信息", contractSecond.getRemarks()); |
| | | map.put("创建者", contractSecond.getCreateBy()); |
| | | map.put("创建日期", contractSecond.getCreateTime()); |
| | | list.add(map); |
| | | } |
| | | FileUtil.downloadExcel(list, response); |
| | | } |
| | | } |
| 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.modules.constant.Constant; |
| | | 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.service.ContractService; |
| | | import me.zhengjie.modules.contract.service.mapstruct.ContractMapper; |
| | | 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.text.ParseException; |
| | | import java.text.SimpleDateFormat; |
| | | import java.time.LocalDateTime; |
| | | import java.time.ZoneId; |
| | | import java.time.temporal.ChronoUnit; |
| | | import java.util.*; |
| | | import java.io.IOException; |
| | | import java.util.function.Function; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | |
| | | /** |
| | | * @website https://eladmin.vip |
| | | * @description 服务实现 |
| | | * @author 赵士淞 |
| | | * @date 2023-02-02 |
| | | **/ |
| | | @Service |
| | | @RequiredArgsConstructor |
| | | public class ContractServiceImpl implements ContractService { |
| | | |
| | | private final ContractRepository contractRepository; |
| | | private final ContractMapper contractMapper; |
| | | private final ContractPaymentRepository contractPaymentRepository; |
| | | private final ContractInvoicePaymentRepository contractInvoicePaymentRepository; |
| | | private final ContractInvoiceRepository contractInvoiceRepository; |
| | | private final DictDetailRepository dictDetailRepository; |
| | | private final ContractFirstServiceImpl contractFirstServiceImpl; |
| | | private final ContractSecondServiceImpl contractSecondServiceImpl; |
| | | private final ContractProjectRepository contractProjectRepository; |
| | | |
| | | @Override |
| | | public Map<String,Object> queryAll(ContractQueryCriteria criteria, Pageable pageable){ |
| | | Page<Contract> page = contractRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable); |
| | | // 将实体类转换为DTO(重写) |
| | | Function<Contract, ContractDto> func = new Function<Contract, ContractDto>(){ |
| | | @Override |
| | | public ContractDto apply(Contract t) { |
| | | // 将实体类转换成DTO |
| | | ContractDto contractDto = contractMapper.toDto(t); |
| | | // 合同款延期情况 |
| | | contractDto.setContractPostponement(contractPostponement(t)); |
| | | // 服务款延期情况 |
| | | contractDto.setServicePostponement(servicePostponement(t)); |
| | | // 预收款情况 |
| | | contractDto.setAdvancePayment(advancePayment(t)); |
| | | // 应收款情况 |
| | | contractDto.setReceivePayment(receivePayment(t)); |
| | | // 开票总金额 |
| | | contractDto.setBillingTotalAmount(contractInvoiceRepository.countTotalAmountByContractId(t.getContractId())); |
| | | // 付款总金额 |
| | | contractDto.setPaymentTotalAmount(contractPaymentRepository.countTotalAmountByContractId(t.getContractId())); |
| | | // 合同款付款金额 |
| | | contractDto.setContractPaymentAmount(contractPaymentAmount(t)); |
| | | // 服务款付款金额 |
| | | contractDto.setServicePaymentAmount(servicePaymentAmount(t)); |
| | | // 甲方姓名 |
| | | contractDto.setFirstName(contractFirstName(t)); |
| | | // 乙方姓名 |
| | | contractDto.setSecondName(contractSecondName(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; |
| | | } |
| | | }; |
| | | return PageUtil.toPage(page.map(func)); |
| | | } |
| | | |
| | | @Override |
| | | public List<ContractDto> queryAll(ContractQueryCriteria criteria){ |
| | | // 合同DTO列表 |
| | | List<ContractDto> contractDtoList = new ArrayList<>(); |
| | | // 查询合同列表 |
| | | List<Contract> contractList = contractRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder)); |
| | | // 循环合同列表 |
| | | for(int i = 0; i < contractList.size(); i ++) { |
| | | // 实体类转DTO |
| | | ContractDto contractDto = contractMapper.toDto(contractList.get(i)); |
| | | // 合同款延期情况 |
| | | contractDto.setContractPostponement(contractPostponement(contractList.get(i))); |
| | | // 服务款延期情况 |
| | | contractDto.setServicePostponement(servicePostponement(contractList.get(i))); |
| | | // 预收款情况 |
| | | contractDto.setAdvancePayment(advancePayment(contractList.get(i))); |
| | | // 应收款情况 |
| | | contractDto.setReceivePayment(receivePayment(contractList.get(i))); |
| | | // 开票总金额 |
| | | contractDto.setBillingTotalAmount(contractInvoiceRepository.countTotalAmountByContractId(contractList.get(i).getContractId())); |
| | | // 付款总金额 |
| | | contractDto.setPaymentTotalAmount(contractPaymentRepository.countTotalAmountByContractId(contractList.get(i).getContractId())); |
| | | // 甲方姓名 |
| | | contractDto.setFirstName(contractFirstName(contractList.get(i))); |
| | | // 乙方姓名 |
| | | contractDto.setSecondName(contractSecondName(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); |
| | | } |
| | | // 返回 |
| | | return contractDtoList; |
| | | } |
| | | |
| | | @Override |
| | | @Transactional |
| | | public ContractDto findById(Long contractId) { |
| | | Contract contract = contractRepository.findById(contractId).orElseGet(Contract::new); |
| | | ValidationUtil.isNull(contract.getContractId(),"Contract","contractId",contractId); |
| | | return contractMapper.toDto(contract); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public ContractDto create(Contract resources) { |
| | | // 当前日历类 |
| | | Calendar calendar = Calendar.getInstance(); |
| | | // 当前年份 |
| | | String year = String.valueOf(calendar.get(Calendar.YEAR)); |
| | | // 当前月份 |
| | | String month = calendar.get(Calendar.MONTH) + 1 >= 10 ? "" + (calendar.get(Calendar.MONTH) + 1) : "0" + (calendar.get(Calendar.MONTH) + 1); |
| | | // 当前日份 |
| | | String date = calendar.get(Calendar.DATE) >= 10 ? "" + calendar.get(Calendar.DATE) : "0" + calendar.get(Calendar.DATE); |
| | | // 查询当天合同数据 |
| | | List<Contract> contracts = contractRepository.findLikeContractNumber(year + "-" + month + date); |
| | | // 当天合同最大编号 |
| | | int maxNumber = 0; |
| | | // 循环当天合同数据 |
| | | for(int i = 0; i < contracts.size(); i ++) { |
| | | // 当前合同编号 |
| | | int nowNumber = Integer.valueOf(contracts.get(i).getContractNumber().substring(10, 13)); |
| | | // 最大合同编号 |
| | | maxNumber = nowNumber > maxNumber ? nowNumber : maxNumber; |
| | | } |
| | | // 计算下一编号 |
| | | String nextNumber = maxNumber + 1 >= 100 ? "" + (maxNumber + 1) : maxNumber + 1 >= 10 ? "0" + (maxNumber + 1) : "00" + (maxNumber + 1); |
| | | // 合同编号 |
| | | resources.setContractNumber(year + "-" + month + date + "-" + nextNumber); |
| | | // 更新金额相关数据 |
| | | Contract contract = updateAmountData(resources); |
| | | return contractMapper.toDto(contractRepository.save(contract)); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void update(Contract resources) { |
| | | Contract contract = contractRepository.findById(resources.getContractId()).orElseGet(Contract::new); |
| | | ValidationUtil.isNull( contract.getContractId(),"Contract","id",resources.getContractId()); |
| | | contract.copy(resources); |
| | | // 更新合同付款状态 |
| | | Contract contractOne = updatePaymentStatus(contract); |
| | | // 更新金额相关数据 |
| | | Contract contractTwo = updateAmountData(contractOne); |
| | | contractRepository.save(contractTwo); |
| | | } |
| | | |
| | | @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); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public void download(List<ContractDto> all, HttpServletResponse response) throws IOException { |
| | | List<Map<String, Object>> list = new ArrayList<>(); |
| | | for (ContractDto contract : all) { |
| | | String firstName = contractFirstName(contractMapper.toEntity(contract)); |
| | | String secondName = contractSecondName(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"); |
| | | String servicePaymentDate = null; |
| | | if(contract.getServicePaymentDate() != null) { |
| | | servicePaymentDate = sdf.format(contract.getServicePaymentDate()); |
| | | servicePaymentDate = servicePaymentDate.substring(5, 10); |
| | | } |
| | | String servicePaymentState = contract.getServicePaymentState() != null ? dictDetailRepository.findByDictNameAndValue(Constant.PAYMENT_STATE, contract.getServicePaymentState()).getLabel() : ""; |
| | | String contractStatus = contract.getContractStatus() != null ? dictDetailRepository.findByDictNameAndValue(Constant.CONTRACT_STATUS, contract.getContractStatus()).getLabel() : ""; |
| | | Map<String,Object> map = new LinkedHashMap<>(); |
| | | map.put("合同编号", contract.getContractNumber()); |
| | | map.put("合同名称", contract.getContractName()); |
| | | map.put("甲方姓名", firstName); |
| | | map.put("乙方姓名", secondName); |
| | | map.put("签订日期", contract.getSignDate()); |
| | | map.put("起始日期", contract.getStartDate()); |
| | | map.put("截止日期", contract.getEndDate()); |
| | | map.put("合同所属地区", contract.getContractArea()); |
| | | map.put("合同类型", contractType); |
| | | map.put("合同内容", contract.getContractContent()); |
| | | map.put("开票总金额", contract.getBillingTotalAmount()); |
| | | map.put("付款总金额", contract.getPaymentTotalAmount()); |
| | | map.put("预收款金额", contract.getAdvancePayment()); |
| | | map.put("应收款金额", contract.getReceivePayment()); |
| | | map.put("合同费金额", contract.getContractAmount()); |
| | | map.put("合同费预计付款日期", contract.getContractPaymentDate()); |
| | | map.put("合同费付款状态", contractPaymentState); |
| | | map.put("合同费延期情况", contract.getContractPostponement()); |
| | | map.put("服务开始日期", contract.getServiceStartsDate()); |
| | | map.put("服务费金额", contract.getServiceAmount()); |
| | | map.put("服务费预计付款日期", servicePaymentDate); |
| | | map.put("服务费付款状态", servicePaymentState); |
| | | map.put("服务费延期情况", contract.getServicePostponement()); |
| | | map.put("合同初版文件", contract.getRelatedDocumentsFirst()); |
| | | map.put("合同终版文件", contract.getRelatedDocumentsFinal()); |
| | | map.put("合同状态", contractStatus); |
| | | map.put("备注信息", contract.getRemarks()); |
| | | map.put("创建者", contract.getCreateBy()); |
| | | map.put("创建日期", contract.getCreateTime()); |
| | | list.add(map); |
| | | } |
| | | FileUtil.downloadExcel(list, response); |
| | | } |
| | | |
| | | /** |
| | | * 合同甲方姓名 |
| | | * @param resources |
| | | * @return |
| | | */ |
| | | public String contractFirstName(Contract resources) { |
| | | // 查询合同甲方数据 |
| | | ContractFirstDto contractFirstDto = contractFirstServiceImpl.findById(resources.getFirstId()); |
| | | return contractFirstDto.getFirstName(); |
| | | } |
| | | |
| | | /** |
| | | * 合同乙方姓名 |
| | | * @param resources |
| | | * @return |
| | | */ |
| | | public String contractSecondName(Contract resources) { |
| | | // 查询合同乙方数据 |
| | | ContractSecondDto contractSecondDto = contractSecondServiceImpl.findById(resources.getSecondId()); |
| | | return contractSecondDto.getSecondName(); |
| | | } |
| | | |
| | | /** |
| | | * 合同项目数量 |
| | | * @param resources |
| | | * @return |
| | | */ |
| | | 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); |
| | | } |
| | | |
| | | /** |
| | | * 合同款付款金额 |
| | | * @param resources |
| | | * @return |
| | | */ |
| | | public String contractPaymentAmount(Contract resources){ |
| | | // 查询合同各款项付款金额 |
| | | BigDecimal contractPaymentAmount = contractPaymentRepository.findByContractIdAndFundType(resources.getContractId(), Constant.FUND_CONTRACT); |
| | | return String.valueOf(contractPaymentAmount); |
| | | } |
| | | |
| | | /** |
| | | * 服务款付款金额 |
| | | * @param resources |
| | | * @return |
| | | */ |
| | | public String servicePaymentAmount(Contract resources){ |
| | | // 时间格式化 |
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
| | | // 服务开始年份 |
| | | String serviceStartsYear = null; |
| | | // 判断服务开始日期是否为空 |
| | | if(resources.getServiceStartsDate() != null) { |
| | | // 服务开始年份 |
| | | serviceStartsYear = resources.getServiceStartsDate().toString().substring(0, 4); |
| | | } |
| | | // 当前系统时间 |
| | | Date systemTime = new Date(); |
| | | // 当前系统年份 |
| | | String systemYear = sdf.format(systemTime).substring(0, 4); |
| | | |
| | | // 判断服务开始年份是否为空 |
| | | if(serviceStartsYear != null) { |
| | | // 返回字符串 |
| | | String returnString = ""; |
| | | // 服务开始年份与当前年份差 |
| | | int years = Integer.valueOf(systemYear) - Integer.valueOf(serviceStartsYear) + 1; |
| | | // 循环年份差 |
| | | for(int i = 0; i < years; i ++) { |
| | | // 查询合同服务款项各年度付款金额 |
| | | BigDecimal serviceAmount = contractPaymentRepository.findByContractIdAndFundBelongStart(resources.getContractId(), Integer.valueOf(serviceStartsYear) + i); |
| | | serviceAmount = serviceAmount == null ? new BigDecimal(0) : serviceAmount; |
| | | // 返回字符串 |
| | | returnString += serviceAmount + "、"; |
| | | } |
| | | return returnString; |
| | | } else { |
| | | return ""; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 预付款情况 |
| | | * @param resources |
| | | * @return |
| | | */ |
| | | private BigDecimal advancePayment(Contract resources) { |
| | | // 返回金额 |
| | | BigDecimal returnDecimal = new BigDecimal(0); |
| | | // 查询合同付款数据 |
| | | List<ContractPayment> contractPaymentList = contractPaymentRepository.findByContractId(resources.getContractId()); |
| | | // 循环合同付款数据 |
| | | for(int i = 0; i < contractPaymentList.size(); i ++) { |
| | | // 当前付款金额 |
| | | BigDecimal paymentAmount = contractPaymentList.get(i).getPaymentAmount(); |
| | | // 临时金额池 |
| | | BigDecimal tempDecimal = new BigDecimal(0); |
| | | // 查询付款相关发票数据 |
| | | List<ContractInvoicePayment> contractInvoicePaymentList = contractInvoicePaymentRepository.findByPaymentId(contractPaymentList.get(i).getPaymentId()); |
| | | // 循环付款相关发票数据 |
| | | for(int j = 0; j < contractInvoicePaymentList.size(); j ++) { |
| | | // 获取发票数据 |
| | | ContractInvoice contractInvoice = contractInvoiceRepository.findById(contractInvoicePaymentList.get(j).getInvoiceId()).orElseGet(ContractInvoice::new); |
| | | // 临时金额池 |
| | | tempDecimal = tempDecimal.add(contractInvoice.getAfterTaxAmount()); |
| | | } |
| | | // 临时金额 |
| | | BigDecimal temp = paymentAmount.subtract(tempDecimal); |
| | | temp = temp.compareTo(new BigDecimal(0)) < 1 ? new BigDecimal(0) : temp; |
| | | // 返回金额 |
| | | returnDecimal = returnDecimal.add(temp); |
| | | } |
| | | // 返回 |
| | | return returnDecimal; |
| | | } |
| | | |
| | | /** |
| | | * 应收款情况 |
| | | * @param resources |
| | | * @return |
| | | */ |
| | | private BigDecimal receivePayment(Contract resources) { |
| | | // 返回金额 |
| | | BigDecimal returnDecimal = new BigDecimal(0); |
| | | // 循环合同发票数据 |
| | | List<ContractInvoice> contractInvoiceList = contractInvoiceRepository.findByContractId(resources.getContractId()); |
| | | // 循环合同发票数据 |
| | | for(int i = 0; i < contractInvoiceList.size(); i ++) { |
| | | // 当前发票金额 |
| | | BigDecimal paymentAmount = contractInvoiceList.get(i).getAfterTaxAmount(); |
| | | // 临时金额池 |
| | | BigDecimal tempDecimal = new BigDecimal(0); |
| | | // 查询发票相关付款数据 |
| | | List<ContractInvoicePayment> contractInvoicePaymentList = contractInvoicePaymentRepository.findByInvoiceId(contractInvoiceList.get(i).getInvoiceId()); |
| | | // 循环发票相关付款数据 |
| | | for(int j = 0; j < contractInvoicePaymentList.size(); j ++) { |
| | | // 获取付款数据 |
| | | ContractPayment contractPayment = contractPaymentRepository.findById(contractInvoicePaymentList.get(j).getPaymentId()).orElseGet(ContractPayment::new); |
| | | // 临时金额池 |
| | | tempDecimal = tempDecimal.add(contractPayment.getPaymentAmount()); |
| | | } |
| | | // 临时金额 |
| | | BigDecimal temp = paymentAmount.subtract(tempDecimal); |
| | | temp = temp.compareTo(new BigDecimal(0)) < 1 ? new BigDecimal(0) : temp; |
| | | // 返回金额 |
| | | returnDecimal = returnDecimal.add(temp); |
| | | } |
| | | // 返回 |
| | | return returnDecimal; |
| | | } |
| | | |
| | | /** |
| | | * 合同款延期情况 |
| | | * @param resources |
| | | * @return |
| | | */ |
| | | public String contractPostponement(Contract resources) { |
| | | // 时间格式化 |
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
| | | |
| | | // 合同预计付款日期 |
| | | String contractPaymentDate = null; |
| | | // 合同预计付款时间 |
| | | Date contractPaymentTime = null; |
| | | // 判断合同预计付款日期是否为空 |
| | | if(resources.getContractPaymentDate() != null) { |
| | | // 合同预计付款日期 |
| | | contractPaymentDate = resources.getContractPaymentDate().toString(); |
| | | // 合同预计付款时间 |
| | | try { |
| | | contractPaymentTime = sdf.parse(contractPaymentDate.substring(0, 10) + " 00:00:00"); |
| | | } catch (ParseException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | |
| | | // 当前系统时间 |
| | | Date systemTime = new Date(); |
| | | |
| | | // 合同款总金额 |
| | | BigDecimal contractTotalAmount = resources.getContractAmount() == null ? new BigDecimal(0) : resources.getContractAmount(); |
| | | // 查询合同款项付款金额 |
| | | BigDecimal contractAmount = contractPaymentRepository.findByContractIdAndFundType(resources.getContractId(), Constant.FUND_CONTRACT); |
| | | contractAmount = contractAmount == null ? new BigDecimal(0) : contractAmount; |
| | | // 判断合同款总金额与付款金额 |
| | | if(contractTotalAmount.compareTo(contractAmount) == 1 && contractPaymentDate != null && systemTime.getTime() > contractPaymentTime.getTime()) { |
| | | // 两时间差 |
| | | ZoneId zoneId = ZoneId.systemDefault(); |
| | | LocalDateTime fromDateTime = LocalDateTime.ofInstant(contractPaymentTime.toInstant(), zoneId); |
| | | LocalDateTime toDateTime = LocalDateTime.ofInstant(systemTime.toInstant(), zoneId); |
| | | LocalDateTime tempDateTime = LocalDateTime.from(fromDateTime); |
| | | long days = tempDateTime.until(toDateTime, ChronoUnit.DAYS); |
| | | |
| | | return "延期" + days + "天"; |
| | | } else { |
| | | return ""; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 服务款延期情况 |
| | | * @param resources |
| | | * @return |
| | | */ |
| | | public String servicePostponement(Contract resources) { |
| | | // 时间格式化 |
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
| | | // 服务开始年份 |
| | | String serviceStartsYear = null; |
| | | // 判断服务开始日期是否为空 |
| | | if(resources.getServiceStartsDate() != null) { |
| | | // 服务开始年份 |
| | | serviceStartsYear = resources.getServiceStartsDate().toString().substring(0, 4); |
| | | } |
| | | // 服务预计付款月日 |
| | | String servicePaymentMonth = null; |
| | | // 判断服务预计付款日期是否为空 |
| | | if(resources.getServicePaymentDate() != null) { |
| | | // 服务预计付款月日 |
| | | servicePaymentMonth = resources.getServicePaymentDate().toString().substring(4, 10); |
| | | |
| | | } |
| | | // 当前系统时间 |
| | | Date systemTime = new Date(); |
| | | // 当前系统年份 |
| | | String systemYear = sdf.format(systemTime).substring(0, 4); |
| | | // 当前年付款时间 |
| | | Date systemPaymentTime = null; |
| | | // 判断服务预计付款日期是否为空 |
| | | if(resources.getServicePaymentDate() != null) { |
| | | // 当前年付款时间 |
| | | try { |
| | | systemPaymentTime = sdf.parse(systemYear + servicePaymentMonth + " 00:00:00"); |
| | | } catch (ParseException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | |
| | | // 服务款总金额 |
| | | BigDecimal serviceTotalAmount = resources.getServiceAmount() == null ? new BigDecimal(0) : resources.getServiceAmount(); |
| | | // 判断服务开始年份是否为空 |
| | | if(serviceStartsYear != null) { |
| | | // 返回字符串 |
| | | String returnString = ""; |
| | | // 服务开始年份与当前年份差 |
| | | int years = Integer.valueOf(systemYear) - Integer.valueOf(serviceStartsYear) + 1; |
| | | // 循环年份差 |
| | | for(int i = 0; i < years; i ++) { |
| | | // 查询合同服务款项各年度付款金额 |
| | | BigDecimal serviceAmount = contractPaymentRepository.findByContractIdAndFundBelongStart(resources.getContractId(), Integer.valueOf(serviceStartsYear) + i); |
| | | serviceAmount = serviceAmount == null ? new BigDecimal(0) : serviceAmount; |
| | | // 判断服务款总金额与付款金额 |
| | | if(serviceTotalAmount.compareTo(serviceAmount) == 1) { |
| | | // 判断是否是当年数据 |
| | | if(Integer.valueOf(serviceStartsYear) + i == Integer.valueOf(systemYear)) { |
| | | // 判断是否超出付款时间 |
| | | if(systemPaymentTime != null && systemTime.getTime() > systemPaymentTime.getTime()) { |
| | | // 两时间差 |
| | | ZoneId zoneId = ZoneId.systemDefault(); |
| | | LocalDateTime fromDateTime = LocalDateTime.ofInstant(systemPaymentTime.toInstant(), zoneId); |
| | | LocalDateTime toDateTime = LocalDateTime.ofInstant(systemTime.toInstant(), zoneId); |
| | | LocalDateTime tempDateTime = LocalDateTime.from(fromDateTime); |
| | | long days = tempDateTime.until(toDateTime, ChronoUnit.DAYS); |
| | | // 返回字符串 |
| | | returnString += "当前年度延期" + days + "天"; |
| | | } |
| | | } else { |
| | | // 返回字符串 |
| | | returnString += (Integer.valueOf(serviceStartsYear) + i) + "至" + (Integer.valueOf(serviceStartsYear) + (i + 1)) + "年度未结清、"; |
| | | } |
| | | } |
| | | } |
| | | return returnString; |
| | | } else { |
| | | return ""; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 更新金额相关数据 |
| | | * @param resources |
| | | * @return |
| | | */ |
| | | public Contract updateAmountData(Contract resources) { |
| | | // 判断合同类型 |
| | | if (Constant.CONTRACT_DEVELOP_SERVICE.equals(resources.getContractType())) { |
| | | // 不处理 |
| | | } else if (Constant.CONTRACT_SERVICE.equals(resources.getContractType())) { |
| | | // 合同费金额 |
| | | resources.setContractAmount(null); |
| | | // 预计付款日期 |
| | | resources.setContractPaymentDate(null); |
| | | // 付款状态 |
| | | resources.setContractPaymentState(null); |
| | | // 服务开始日期 |
| | | resources.setServiceStartsDate(resources.getStartDate()); |
| | | } else { |
| | | // 服务开始日期 |
| | | resources.setServiceStartsDate(null); |
| | | // 服务费金额 |
| | | resources.setServiceAmount(null); |
| | | // 预计付款日期 |
| | | resources.setServicePaymentDate(null); |
| | | // 付款状态 |
| | | resources.setServicePaymentState(null); |
| | | } |
| | | return resources; |
| | | } |
| | | |
| | | /** |
| | | * 更新合同付款状态 |
| | | * @param resources |
| | | */ |
| | | public Contract updatePaymentStatus(Contract resources) { |
| | | // 查询数据库旧数据 |
| | | Contract contract = contractRepository.findById(resources.getContractId()).orElseGet(Contract::new); |
| | | ValidationUtil.isNull( contract.getContractId(),"Contract","id",resources.getContractId()); |
| | | // 复制 |
| | | contract.copy(resources); |
| | | |
| | | // 时间格式化 |
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
| | | // 截止日期 |
| | | String endDate = contract.getEndDate().toString(); |
| | | // 截止时间 |
| | | Date endTime = null; |
| | | try { |
| | | endTime = sdf.parse(endDate.substring(0, 10) + " 23:59:59"); |
| | | } catch (ParseException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | // 服务开始日期 |
| | | String serviceStartsDate = null; |
| | | // 服务开始时间 |
| | | Date serviceStartsTime = null; |
| | | // 判断服务开始日期是否为空 |
| | | if(contract.getServiceStartsDate() != null) { |
| | | // 服务开始日期 |
| | | serviceStartsDate = contract.getServiceStartsDate().toString(); |
| | | // 服务开始时间 |
| | | try { |
| | | serviceStartsTime = sdf.parse(serviceStartsDate.substring(0, 10) + " 00:00:00"); |
| | | } catch (ParseException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | |
| | | // 判断合同款项付款状态 |
| | | if(!Constant.PAYMENT_ALREADY.equals(contract.getContractPaymentState())) { |
| | | // 合同款总金额 |
| | | BigDecimal contractTotalAmount = contract.getContractAmount() == null ? new BigDecimal(0) : contract.getContractAmount(); |
| | | // 查询合同款项付款金额 |
| | | BigDecimal contractAmount = contractPaymentRepository.findByContractIdAndFundType(contract.getContractId(), Constant.FUND_CONTRACT); |
| | | contractAmount = contractAmount == null ? new BigDecimal(0) : contractAmount; |
| | | // 判断合同款项付款金额 |
| | | if(Constant.CONTRACT_SERVICE.equals(contract.getContractType())) { |
| | | // 付款状态 |
| | | contract.setContractPaymentState(null); |
| | | } else if(contractAmount.compareTo(new BigDecimal(0)) == 0) { |
| | | // 付款状态 |
| | | contract.setContractPaymentState(Constant.PAYMENT_NOT); |
| | | } else if(contractAmount.compareTo(contractTotalAmount) > -1) { |
| | | // 付款状态 |
| | | contract.setContractPaymentState(Constant.PAYMENT_ALREADY); |
| | | } else { |
| | | // 付款状态 |
| | | contract.setContractPaymentState(Constant.PAYMENT_PART); |
| | | } |
| | | } |
| | | |
| | | // 判断服务款项付款状态 |
| | | if(!Constant.PAYMENT_ALREADY.equals(contract.getServicePaymentState())) { |
| | | // 判断服务开始日期是否为空 |
| | | if(serviceStartsTime == null) { |
| | | // 付款状态 |
| | | contract.setServicePaymentState(null); |
| | | } else { |
| | | // 两时间差 |
| | | ZoneId zoneId = ZoneId.systemDefault(); |
| | | LocalDateTime fromDateTime = LocalDateTime.ofInstant(serviceStartsTime.toInstant(), zoneId); |
| | | LocalDateTime toDateTime = LocalDateTime.ofInstant(endTime.toInstant(), zoneId); |
| | | LocalDateTime tempDateTime = LocalDateTime.from(fromDateTime); |
| | | long years = tempDateTime.until(toDateTime, ChronoUnit.YEARS); |
| | | years = years == 0 ? 1 : years; |
| | | // 服务款总金额 |
| | | BigDecimal serviceTotalAmount = contract.getServiceAmount() == null ? new BigDecimal(0) : contract.getServiceAmount(); |
| | | // 查询服务款项付款金额 |
| | | BigDecimal serviceAmount = contractPaymentRepository.findByContractIdAndFundType(contract.getContractId(), Constant.FUND_SERVICE); |
| | | serviceAmount = serviceAmount == null ? new BigDecimal(0) : serviceAmount; |
| | | // 判断服务款项付款金额 |
| | | if(Constant.CONTRACT_DEVELOP.equals(contract.getContractType())) { |
| | | // 付款状态 |
| | | contract.setServicePaymentState(null); |
| | | } else if(serviceAmount.compareTo(new BigDecimal(0)) == 0) { |
| | | // 付款状态 |
| | | contract.setServicePaymentState(Constant.PAYMENT_NOT); |
| | | } else if(serviceAmount.compareTo(serviceTotalAmount.multiply(new BigDecimal(years))) > -1) { |
| | | // 付款状态 |
| | | contract.setServicePaymentState(Constant.PAYMENT_ALREADY); |
| | | } else { |
| | | // 付款状态 |
| | | contract.setServicePaymentState(Constant.PAYMENT_PART); |
| | | } |
| | | } |
| | | } |
| | | |
| | | // 返回 |
| | | return contract; |
| | | } |
| | | |
| | | /** |
| | | * 查询合同款总金额 |
| | | * @param criteria |
| | | * @return |
| | | */ |
| | | @Override |
| | | public BigDecimal contractTotalMoney(ContractQueryCriteria criteria){ |
| | | // 搜索数据处理 |
| | | String signStartDate = criteria.getSignDate() != null ? criteria.getSignDate().get(0).toString() : null; |
| | | String signEndDate = criteria.getSignDate() != null ? criteria.getSignDate().get(1).toString() : null; |
| | | // 查询合同款总金额 |
| | | BigDecimal contractTotalMoney = contractRepository.contractTotalMoney( |
| | | criteria.getContractNumber(), criteria.getContractName(), criteria.getFirstId(), criteria.getSecondId(), signStartDate, signEndDate, criteria.getContractType(), |
| | | criteria.getContractPaymentState(), criteria.getServicePaymentState(), criteria.getContractStatus(), criteria.getContractAreaCode() |
| | | ); |
| | | return contractTotalMoney; |
| | | } |
| | | |
| | | /** |
| | | * 查询合同款延期数 |
| | | * @param criteria |
| | | * @return |
| | | */ |
| | | @Override |
| | | public Integer contractDelayTotalAmount(ContractQueryCriteria criteria){ |
| | | // 合同款延期数 |
| | | Integer contractDelayTotalAmount = 0; |
| | | // 搜索数据处理 |
| | | String signStartDate = criteria.getSignDate() != null ? criteria.getSignDate().get(0).toString() : null; |
| | | String signEndDate = criteria.getSignDate() != null ? criteria.getSignDate().get(1).toString() : null; |
| | | // 查询有合同款的合同数据 |
| | | List<Contract> contractList = contractRepository.findContractAmountNotNull( |
| | | criteria.getContractNumber(), criteria.getContractName(), criteria.getFirstId(), criteria.getSecondId(), signStartDate, signEndDate, criteria.getContractType(), |
| | | criteria.getContractPaymentState(), criteria.getServicePaymentState(), criteria.getContractStatus(), criteria.getContractAreaCode() |
| | | ); |
| | | // 循环有合同款的合同数据 |
| | | for(int i = 0; i < contractList.size(); i ++) { |
| | | // 查询合同各款项付款金额 |
| | | BigDecimal paymentAmount = contractPaymentRepository.findByContractIdAndFundType(contractList.get(i).getContractId(), Constant.FUND_CONTRACT); |
| | | // 判断是否超过付款时间 |
| | | if(new Date().getTime() > contractList.get(i).getContractPaymentDate().getTime()) { |
| | | // 判断合同各款项付款金额不为空且是否存在延期金额 |
| | | if(paymentAmount == null) { |
| | | // 合同款延期数 |
| | | contractDelayTotalAmount ++; |
| | | } else if(contractList.get(i).getContractAmount().compareTo(paymentAmount) == 1) { |
| | | // 合同款延期数 |
| | | contractDelayTotalAmount ++; |
| | | } |
| | | } |
| | | } |
| | | return contractDelayTotalAmount; |
| | | } |
| | | |
| | | /** |
| | | * 查询合同款延期金额 |
| | | * @param criteria |
| | | * @return |
| | | */ |
| | | @Override |
| | | public BigDecimal contractDelayTotalMoney(ContractQueryCriteria criteria){ |
| | | // 合同款延期金额 |
| | | BigDecimal contractDelayTotalMoney = new BigDecimal("0.00"); |
| | | // 搜索数据处理 |
| | | String signStartDate = criteria.getSignDate() != null ? criteria.getSignDate().get(0).toString() : null; |
| | | String signEndDate = criteria.getSignDate() != null ? criteria.getSignDate().get(1).toString() : null; |
| | | // 查询有合同款的合同数据 |
| | | List<Contract> contractList = contractRepository.findContractAmountNotNull( |
| | | criteria.getContractNumber(), criteria.getContractName(), criteria.getFirstId(), criteria.getSecondId(), signStartDate, signEndDate, criteria.getContractType(), |
| | | criteria.getContractPaymentState(), criteria.getServicePaymentState(), criteria.getContractStatus(), criteria.getContractAreaCode() |
| | | ); |
| | | // 循环有合同款的合同数据 |
| | | for(int i = 0; i < contractList.size(); i ++) { |
| | | // 查询合同各款项付款金额 |
| | | BigDecimal paymentAmount = contractPaymentRepository.findByContractIdAndFundType(contractList.get(i).getContractId(), Constant.FUND_CONTRACT); |
| | | // 判断是否超过付款时间 |
| | | if(new Date().getTime() > contractList.get(i).getContractPaymentDate().getTime()) { |
| | | // 判断合同各款项付款金额不为空且是否存在延期金额 |
| | | if(paymentAmount == null) { |
| | | // 合同款延期金额 |
| | | contractDelayTotalMoney = contractDelayTotalMoney.add(contractList.get(i).getContractAmount()); |
| | | } else if(contractList.get(i).getContractAmount().compareTo(paymentAmount) == 1) { |
| | | // 延期金额 |
| | | BigDecimal tempMoney = contractList.get(i).getContractAmount().subtract(paymentAmount); |
| | | // 合同款延期金额 |
| | | contractDelayTotalMoney = contractDelayTotalMoney.add(tempMoney); |
| | | } |
| | | } |
| | | } |
| | | return contractDelayTotalMoney; |
| | | } |
| | | |
| | | /** |
| | | * 查询预收款总金额 |
| | | * @param criteria |
| | | * @return |
| | | */ |
| | | @Override |
| | | public BigDecimal advancePaymentTotalMoney(ContractQueryCriteria criteria){ |
| | | // 预收款总金额 |
| | | BigDecimal advancePaymentTotalMoney = new BigDecimal("0.00"); |
| | | // 查询所有合同信息 |
| | | List<Contract> contractList = contractRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder)); |
| | | // 循环所有合同信息 |
| | | for(int i = 0; i < contractList.size(); i ++) { |
| | | // 预收款总金额 |
| | | advancePaymentTotalMoney = advancePaymentTotalMoney.add(advancePayment(contractList.get(i))); |
| | | } |
| | | return advancePaymentTotalMoney; |
| | | } |
| | | |
| | | /** |
| | | * 查询运维服务总金额 |
| | | * @param criteria |
| | | * @return |
| | | */ |
| | | @Override |
| | | public BigDecimal serviceTotalMoney(ContractQueryCriteria criteria){ |
| | | // 搜索数据处理 |
| | | String signStartDate = criteria.getSignDate() != null ? criteria.getSignDate().get(0).toString() : null; |
| | | String signEndDate = criteria.getSignDate() != null ? criteria.getSignDate().get(1).toString() : null; |
| | | // 查询运维服务总金额 |
| | | BigDecimal serviceTotalMoney = contractRepository.serviceTotalMoney( |
| | | criteria.getContractNumber(), criteria.getContractName(), criteria.getFirstId(), criteria.getSecondId(), signStartDate, signEndDate, criteria.getContractType(), |
| | | criteria.getContractPaymentState(), criteria.getServicePaymentState(), criteria.getContractStatus(), criteria.getContractAreaCode() |
| | | ); |
| | | return serviceTotalMoney; |
| | | } |
| | | |
| | | /** |
| | | * 查询运维服务延期数 |
| | | * @param criteria |
| | | * @return |
| | | */ |
| | | @Override |
| | | public Integer serviceDelayTotalAmount(ContractQueryCriteria criteria){ |
| | | // 运维服务延期数 |
| | | Integer serviceDelayTotalAmount = 0; |
| | | // 搜索数据处理 |
| | | String signStartDate = criteria.getSignDate() != null ? criteria.getSignDate().get(0).toString() : null; |
| | | String signEndDate = criteria.getSignDate() != null ? criteria.getSignDate().get(1).toString() : null; |
| | | // 查询有运维服务的合同数据 |
| | | List<Contract> contractList = contractRepository.findServiceAmountNotNull( |
| | | criteria.getContractNumber(), criteria.getContractName(), criteria.getFirstId(), criteria.getSecondId(), signStartDate, signEndDate, criteria.getContractType(), |
| | | criteria.getContractPaymentState(), criteria.getServicePaymentState(), criteria.getContractStatus(), criteria.getContractAreaCode() |
| | | ); |
| | | // 循环有运维服务的合同数据 |
| | | for(int i = 0; i < contractList.size(); i ++) { |
| | | // 时间格式化 |
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
| | | // 服务开始年份 |
| | | String serviceStartsYear = null; |
| | | // 判断服务开始日期是否为空 |
| | | if(contractList.get(i).getServiceStartsDate() != null) { |
| | | // 服务开始年份 |
| | | serviceStartsYear = contractList.get(i).getServiceStartsDate().toString().substring(0, 4); |
| | | } |
| | | // 服务预计付款月日 |
| | | String servicePaymentMonth = null; |
| | | // 判断服务预计付款日期是否为空 |
| | | if(contractList.get(i).getServicePaymentDate() != null) { |
| | | // 服务预计付款月日 |
| | | servicePaymentMonth = contractList.get(i).getServicePaymentDate().toString().substring(4, 10); |
| | | |
| | | } |
| | | // 当前系统时间 |
| | | Date systemTime = new Date(); |
| | | // 当前系统年份 |
| | | String systemYear = sdf.format(systemTime).substring(0, 4); |
| | | // 当前年付款时间 |
| | | Date systemPaymentTime = null; |
| | | // 判断服务预计付款日期是否为空 |
| | | if(contractList.get(i).getServicePaymentDate() != null) { |
| | | // 当前年付款时间 |
| | | try { |
| | | systemPaymentTime = sdf.parse(systemYear + servicePaymentMonth + " 00:00:00"); |
| | | } catch (ParseException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | |
| | | // 服务款总金额 |
| | | BigDecimal serviceTotalAmount = contractList.get(i).getServiceAmount() == null ? new BigDecimal(0) : contractList.get(i).getServiceAmount(); |
| | | // 判断服务开始年份是否为空 |
| | | if(serviceStartsYear != null) { |
| | | // 服务开始年份与当前年份差 |
| | | int years = Integer.valueOf(systemYear) - Integer.valueOf(serviceStartsYear) + 1; |
| | | // 循环年份差 |
| | | for(int j = 0; j < years; j ++) { |
| | | // 查询合同服务款项各年度付款金额 |
| | | BigDecimal serviceAmount = contractPaymentRepository.findByContractIdAndFundBelongStart(contractList.get(i).getContractId(), Integer.valueOf(serviceStartsYear) + j); |
| | | serviceAmount = serviceAmount == null ? new BigDecimal(0) : serviceAmount; |
| | | // 判断服务款总金额与付款金额 |
| | | if(serviceTotalAmount.compareTo(serviceAmount) == 1) { |
| | | // 判断是否是当年数据 |
| | | if(Integer.valueOf(serviceStartsYear) + j == Integer.valueOf(systemYear)) { |
| | | // 判断是否超出付款时间 |
| | | if(systemPaymentTime != null && systemTime.getTime() > systemPaymentTime.getTime()) { |
| | | // 运维服务延期数 |
| | | serviceDelayTotalAmount ++; |
| | | } |
| | | } else { |
| | | // 运维服务延期数 |
| | | serviceDelayTotalAmount ++; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | return serviceDelayTotalAmount; |
| | | } |
| | | |
| | | /** |
| | | * 查询运维服务延期金额 |
| | | * @param criteria |
| | | * @return |
| | | */ |
| | | @Override |
| | | public BigDecimal serviceDelayTotalMoney(ContractQueryCriteria criteria){ |
| | | // 运维服务延期金额 |
| | | BigDecimal serviceDelayTotalMoney = new BigDecimal("0.00"); |
| | | // 搜索数据处理 |
| | | String signStartDate = criteria.getSignDate() != null ? criteria.getSignDate().get(0).toString() : null; |
| | | String signEndDate = criteria.getSignDate() != null ? criteria.getSignDate().get(1).toString() : null; |
| | | // 查询有运维服务的合同数据 |
| | | List<Contract> contractList = contractRepository.findServiceAmountNotNull( |
| | | criteria.getContractNumber(), criteria.getContractName(), criteria.getFirstId(), criteria.getSecondId(), signStartDate, signEndDate, criteria.getContractType(), |
| | | criteria.getContractPaymentState(), criteria.getServicePaymentState(), criteria.getContractStatus(), criteria.getContractAreaCode() |
| | | ); |
| | | // 循环有运维服务的合同数据 |
| | | for(int i = 0; i < contractList.size(); i ++) { |
| | | // 时间格式化 |
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
| | | // 服务开始年份 |
| | | String serviceStartsYear = null; |
| | | // 判断服务开始日期是否为空 |
| | | if(contractList.get(i).getServiceStartsDate() != null) { |
| | | // 服务开始年份 |
| | | serviceStartsYear = contractList.get(i).getServiceStartsDate().toString().substring(0, 4); |
| | | } |
| | | // 服务预计付款月日 |
| | | String servicePaymentMonth = null; |
| | | // 判断服务预计付款日期是否为空 |
| | | if(contractList.get(i).getServicePaymentDate() != null) { |
| | | // 服务预计付款月日 |
| | | servicePaymentMonth = contractList.get(i).getServicePaymentDate().toString().substring(4, 10); |
| | | |
| | | } |
| | | // 当前系统时间 |
| | | Date systemTime = new Date(); |
| | | // 当前系统年份 |
| | | String systemYear = sdf.format(systemTime).substring(0, 4); |
| | | // 当前年付款时间 |
| | | Date systemPaymentTime = null; |
| | | // 判断服务预计付款日期是否为空 |
| | | if(contractList.get(i).getServicePaymentDate() != null) { |
| | | // 当前年付款时间 |
| | | try { |
| | | systemPaymentTime = sdf.parse(systemYear + servicePaymentMonth + " 00:00:00"); |
| | | } catch (ParseException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | |
| | | // 服务款总金额 |
| | | BigDecimal serviceTotalAmount = contractList.get(i).getServiceAmount() == null ? new BigDecimal(0) : contractList.get(i).getServiceAmount(); |
| | | // 判断服务开始年份是否为空 |
| | | if(serviceStartsYear != null) { |
| | | // 服务开始年份与当前年份差 |
| | | int years = Integer.valueOf(systemYear) - Integer.valueOf(serviceStartsYear) + 1; |
| | | // 循环年份差 |
| | | for(int j = 0; j < years; j ++) { |
| | | // 查询合同服务款项各年度付款金额 |
| | | BigDecimal serviceAmount = contractPaymentRepository.findByContractIdAndFundBelongStart(contractList.get(i).getContractId(), Integer.valueOf(serviceStartsYear) + j); |
| | | serviceAmount = serviceAmount == null ? new BigDecimal(0) : serviceAmount; |
| | | // 判断服务款总金额与付款金额 |
| | | if(serviceTotalAmount.compareTo(serviceAmount) == 1) { |
| | | // 判断是否是当年数据 |
| | | if(Integer.valueOf(serviceStartsYear) + j == Integer.valueOf(systemYear)) { |
| | | // 判断是否超出付款时间 |
| | | if(systemPaymentTime != null && systemTime.getTime() > systemPaymentTime.getTime()) { |
| | | // 延期金额 |
| | | BigDecimal tempMoney = serviceTotalAmount.subtract(serviceAmount); |
| | | // 运维服务延期金额 |
| | | serviceDelayTotalMoney = serviceDelayTotalMoney.add(tempMoney); |
| | | } |
| | | } else { |
| | | // 延期金额 |
| | | BigDecimal tempMoney = serviceTotalAmount.subtract(serviceAmount); |
| | | // 运维服务延期金额 |
| | | serviceDelayTotalMoney = serviceDelayTotalMoney.add(tempMoney); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | return serviceDelayTotalMoney; |
| | | } |
| | | |
| | | /** |
| | | * 查询应收款总金额 |
| | | * @param criteria |
| | | * @return |
| | | */ |
| | | @Override |
| | | public BigDecimal receivePaymentTotalMoney(ContractQueryCriteria criteria){ |
| | | // 应收款总金额 |
| | | BigDecimal receivePaymentTotalMoney = new BigDecimal("0.00"); |
| | | // 查询所有合同信息 |
| | | List<Contract> contractList = contractRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder)); |
| | | // 循环所有合同信息 |
| | | for(int i = 0; i < contractList.size(); i ++) { |
| | | // 应收款总金额 |
| | | receivePaymentTotalMoney = receivePaymentTotalMoney.add(receivePayment(contractList.get(i))); |
| | | } |
| | | return receivePaymentTotalMoney; |
| | | } |
| | | } |
copy from eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/service/mapstruct/SysUserCompanyMapper.java
copy to eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/contract/service/mapstruct/ContractFirstMapper.java
| File was copied from eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/service/mapstruct/SysUserCompanyMapper.java |
| | |
| | | * See the License for the specific language governing permissions and |
| | | * limitations under the License. |
| | | */ |
| | | package me.zhengjie.modules.system.service.mapstruct; |
| | | package me.zhengjie.modules.contract.service.mapstruct; |
| | | |
| | | import me.zhengjie.base.BaseMapper; |
| | | import me.zhengjie.modules.system.domain.SysUserCompany; |
| | | import me.zhengjie.modules.system.service.dto.SysUserCompanyDto; |
| | | import me.zhengjie.modules.contract.domain.ContractFirst; |
| | | import me.zhengjie.modules.contract.service.dto.ContractFirstDto; |
| | | import org.mapstruct.Mapper; |
| | | import org.mapstruct.ReportingPolicy; |
| | | |
| | | /** |
| | | * @website https://eladmin.vip |
| | | * @author wcd |
| | | * @date 2023-01-30 |
| | | * @author 赵士淞 |
| | | * @date 2023-02-02 |
| | | **/ |
| | | @Mapper(componentModel = "spring", unmappedTargetPolicy = ReportingPolicy.IGNORE) |
| | | public interface SysUserCompanyMapper extends BaseMapper<SysUserCompanyDto, SysUserCompany> { |
| | | public interface ContractFirstMapper extends BaseMapper<ContractFirstDto, ContractFirst> { |
| | | |
| | | } |
copy from eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/service/mapstruct/SysUserCompanyMapper.java
copy to eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/contract/service/mapstruct/ContractInvoiceMapper.java
| File was copied from eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/service/mapstruct/SysUserCompanyMapper.java |
| | |
| | | * See the License for the specific language governing permissions and |
| | | * limitations under the License. |
| | | */ |
| | | package me.zhengjie.modules.system.service.mapstruct; |
| | | package me.zhengjie.modules.contract.service.mapstruct; |
| | | |
| | | import me.zhengjie.base.BaseMapper; |
| | | import me.zhengjie.modules.system.domain.SysUserCompany; |
| | | import me.zhengjie.modules.system.service.dto.SysUserCompanyDto; |
| | | import me.zhengjie.modules.contract.domain.ContractInvoice; |
| | | import me.zhengjie.modules.contract.service.dto.ContractInvoiceDto; |
| | | import org.mapstruct.Mapper; |
| | | import org.mapstruct.ReportingPolicy; |
| | | |
| | | /** |
| | | * @website https://eladmin.vip |
| | | * @author wcd |
| | | * @date 2023-01-30 |
| | | * @author 赵士淞 |
| | | * @date 2023-02-02 |
| | | **/ |
| | | @Mapper(componentModel = "spring", unmappedTargetPolicy = ReportingPolicy.IGNORE) |
| | | public interface SysUserCompanyMapper extends BaseMapper<SysUserCompanyDto, SysUserCompany> { |
| | | public interface ContractInvoiceMapper extends BaseMapper<ContractInvoiceDto, ContractInvoice> { |
| | | |
| | | } |
copy from eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/service/mapstruct/SysUserCompanyMapper.java
copy to eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/contract/service/mapstruct/ContractInvoicePaymentMapper.java
| File was copied from eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/service/mapstruct/SysUserCompanyMapper.java |
| | |
| | | * See the License for the specific language governing permissions and |
| | | * limitations under the License. |
| | | */ |
| | | package me.zhengjie.modules.system.service.mapstruct; |
| | | package me.zhengjie.modules.contract.service.mapstruct; |
| | | |
| | | import me.zhengjie.base.BaseMapper; |
| | | import me.zhengjie.modules.system.domain.SysUserCompany; |
| | | import me.zhengjie.modules.system.service.dto.SysUserCompanyDto; |
| | | import me.zhengjie.modules.contract.domain.ContractInvoicePayment; |
| | | import me.zhengjie.modules.contract.service.dto.ContractInvoicePaymentDto; |
| | | import org.mapstruct.Mapper; |
| | | import org.mapstruct.ReportingPolicy; |
| | | |
| | | /** |
| | | * @website https://eladmin.vip |
| | | * @author wcd |
| | | * @date 2023-01-30 |
| | | * @author 赵士淞 |
| | | * @date 2023-02-02 |
| | | **/ |
| | | @Mapper(componentModel = "spring", unmappedTargetPolicy = ReportingPolicy.IGNORE) |
| | | public interface SysUserCompanyMapper extends BaseMapper<SysUserCompanyDto, SysUserCompany> { |
| | | public interface ContractInvoicePaymentMapper extends BaseMapper<ContractInvoicePaymentDto, ContractInvoicePayment> { |
| | | |
| | | } |
copy from eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/service/mapstruct/SysUserCompanyMapper.java
copy to eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/contract/service/mapstruct/ContractMapper.java
| File was copied from eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/service/mapstruct/SysUserCompanyMapper.java |
| | |
| | | * See the License for the specific language governing permissions and |
| | | * limitations under the License. |
| | | */ |
| | | package me.zhengjie.modules.system.service.mapstruct; |
| | | package me.zhengjie.modules.contract.service.mapstruct; |
| | | |
| | | import me.zhengjie.base.BaseMapper; |
| | | import me.zhengjie.modules.system.domain.SysUserCompany; |
| | | import me.zhengjie.modules.system.service.dto.SysUserCompanyDto; |
| | | import me.zhengjie.modules.contract.domain.Contract; |
| | | import me.zhengjie.modules.contract.service.dto.ContractDto; |
| | | import org.mapstruct.Mapper; |
| | | import org.mapstruct.ReportingPolicy; |
| | | |
| | | /** |
| | | * @website https://eladmin.vip |
| | | * @author wcd |
| | | * @date 2023-01-30 |
| | | * @author 赵士淞 |
| | | * @date 2023-02-02 |
| | | **/ |
| | | @Mapper(componentModel = "spring", unmappedTargetPolicy = ReportingPolicy.IGNORE) |
| | | public interface SysUserCompanyMapper extends BaseMapper<SysUserCompanyDto, SysUserCompany> { |
| | | public interface ContractMapper extends BaseMapper<ContractDto, Contract> { |
| | | |
| | | } |
copy from eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/service/mapstruct/SysUserCompanyMapper.java
copy to eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/contract/service/mapstruct/ContractPaymentMapper.java
| File was copied from eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/service/mapstruct/SysUserCompanyMapper.java |
| | |
| | | * See the License for the specific language governing permissions and |
| | | * limitations under the License. |
| | | */ |
| | | package me.zhengjie.modules.system.service.mapstruct; |
| | | package me.zhengjie.modules.contract.service.mapstruct; |
| | | |
| | | import me.zhengjie.base.BaseMapper; |
| | | import me.zhengjie.modules.system.domain.SysUserCompany; |
| | | import me.zhengjie.modules.system.service.dto.SysUserCompanyDto; |
| | | import me.zhengjie.modules.contract.domain.ContractPayment; |
| | | import me.zhengjie.modules.contract.service.dto.ContractPaymentDto; |
| | | import org.mapstruct.Mapper; |
| | | import org.mapstruct.ReportingPolicy; |
| | | |
| | | /** |
| | | * @website https://eladmin.vip |
| | | * @author wcd |
| | | * @date 2023-01-30 |
| | | * @author 赵士淞 |
| | | * @date 2023-02-02 |
| | | **/ |
| | | @Mapper(componentModel = "spring", unmappedTargetPolicy = ReportingPolicy.IGNORE) |
| | | public interface SysUserCompanyMapper extends BaseMapper<SysUserCompanyDto, SysUserCompany> { |
| | | public interface ContractPaymentMapper extends BaseMapper<ContractPaymentDto, ContractPayment> { |
| | | |
| | | } |
copy from eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/service/mapstruct/SysUserCompanyMapper.java
copy to eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/contract/service/mapstruct/ContractProjectMapper.java
| File was copied from eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/service/mapstruct/SysUserCompanyMapper.java |
| | |
| | | * See the License for the specific language governing permissions and |
| | | * limitations under the License. |
| | | */ |
| | | package me.zhengjie.modules.system.service.mapstruct; |
| | | package me.zhengjie.modules.contract.service.mapstruct; |
| | | |
| | | import me.zhengjie.base.BaseMapper; |
| | | import me.zhengjie.modules.system.domain.SysUserCompany; |
| | | import me.zhengjie.modules.system.service.dto.SysUserCompanyDto; |
| | | 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 wcd |
| | | * @date 2023-01-30 |
| | | * @author 赵士淞 |
| | | * @date 2023-02-10 |
| | | **/ |
| | | @Mapper(componentModel = "spring", unmappedTargetPolicy = ReportingPolicy.IGNORE) |
| | | public interface SysUserCompanyMapper extends BaseMapper<SysUserCompanyDto, SysUserCompany> { |
| | | public interface ContractProjectMapper extends BaseMapper<ContractProjectDto, ContractProject> { |
| | | |
| | | } |
copy from eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/service/mapstruct/SysUserCompanyMapper.java
copy to eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/contract/service/mapstruct/ContractSecondMapper.java
| File was copied from eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/service/mapstruct/SysUserCompanyMapper.java |
| | |
| | | * See the License for the specific language governing permissions and |
| | | * limitations under the License. |
| | | */ |
| | | package me.zhengjie.modules.system.service.mapstruct; |
| | | package me.zhengjie.modules.contract.service.mapstruct; |
| | | |
| | | import me.zhengjie.base.BaseMapper; |
| | | import me.zhengjie.modules.system.domain.SysUserCompany; |
| | | import me.zhengjie.modules.system.service.dto.SysUserCompanyDto; |
| | | import me.zhengjie.modules.contract.domain.ContractSecond; |
| | | import me.zhengjie.modules.contract.service.dto.ContractSecondDto; |
| | | import org.mapstruct.Mapper; |
| | | import org.mapstruct.ReportingPolicy; |
| | | |
| | | /** |
| | | * @website https://eladmin.vip |
| | | * @author wcd |
| | | * @date 2023-01-30 |
| | | * @author 赵士淞 |
| | | * @date 2023-02-02 |
| | | **/ |
| | | @Mapper(componentModel = "spring", unmappedTargetPolicy = ReportingPolicy.IGNORE) |
| | | public interface SysUserCompanyMapper extends BaseMapper<SysUserCompanyDto, SysUserCompany> { |
| | | public interface ContractSecondMapper extends BaseMapper<ContractSecondDto, ContractSecond> { |
| | | |
| | | } |
| | |
| | | * @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("存在任务日报的项目无法删除!"); |
| | | } |
| | | } |
| | | } |
| | | |
| New file |
| | |
| | | package me.zhengjie.modules.quartz.service.impl; |
| | | |
| | | |
| | | import cn.hutool.core.util.ObjectUtil; |
| | | import lombok.RequiredArgsConstructor; |
| | | import me.zhengjie.modules.attendance.domain.*; |
| | | import me.zhengjie.modules.attendance.repository.*; |
| | | import me.zhengjie.modules.attendance.service.impl.AttendanceLeaveServiceImpl; |
| | | import me.zhengjie.modules.attendance.service.impl.AttendanceServiceImpl; |
| | | import me.zhengjie.modules.constant.Constant; |
| | | import me.zhengjie.modules.system.domain.Job; |
| | | import me.zhengjie.modules.system.domain.Role; |
| | | import me.zhengjie.modules.system.domain.SysConfigHoliday; |
| | | import me.zhengjie.modules.system.domain.User; |
| | | import me.zhengjie.modules.system.repository.SysConfigHolidayRepository; |
| | | import me.zhengjie.modules.system.repository.UserRepository; |
| | | import org.apache.commons.lang3.ObjectUtils; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.transaction.Transactional; |
| | | import java.math.BigDecimal; |
| | | import java.sql.Timestamp; |
| | | import java.text.ParseException; |
| | | import java.text.SimpleDateFormat; |
| | | import java.time.DayOfWeek; |
| | | import java.time.Duration; |
| | | import java.time.LocalDate; |
| | | import java.time.LocalDateTime; |
| | | import java.time.format.DateTimeFormatter; |
| | | import java.time.temporal.TemporalAdjusters; |
| | | import java.util.*; |
| | | |
| | | @Service |
| | | @Transactional |
| | | @RequiredArgsConstructor |
| | | public class AttendanceMonthTalkServiceImpl { |
| | | |
| | | private final AttendanceRepository attendanceRepository; |
| | | private final UserRepository userRepository; |
| | | private final SysConfigHolidayRepository sysConfigHolidayRepository; |
| | | private final AttendanceGoOutRepository attendanceGoOutRepository; |
| | | private final AttendanceBusinessTravelRepository attendanceBusinessTravelRepository; |
| | | private final AttendanceLeaveRepository attendanceLeaveRepository; |
| | | private final AttendanceMonthRepository attendanceMonthRepository; |
| | | private final AttendanceMonthLeaveRepository attendanceMonthLeaveRepository; |
| | | private final AttendanceLeaveServiceImpl attendanceLeaveService; |
| | | |
| | | /** |
| | | * 月报set |
| | | */ |
| | | public void getMonthlyInfo() throws ParseException { |
| | | //节假日,工作日 |
| | | List<Timestamp> holiday = new ArrayList<>(), isWork = new ArrayList<>(); |
| | | // 查询节假日 |
| | | List<SysConfigHoliday> sysConfigHolidayList = sysConfigHolidayRepository.findAll(); |
| | | for(SysConfigHoliday sysConfigHoliday : sysConfigHolidayList){ |
| | | if(sysConfigHoliday.getDateType().equals(Constant.DATE_TYPE_WEEKDAY)){ |
| | | //工作日 |
| | | isWork.add(sysConfigHoliday.getHolidayDate()); |
| | | }else{ |
| | | holiday.add(sysConfigHoliday.getHolidayDate()); |
| | | } |
| | | } |
| | | |
| | | Map<Long, AttendanceMonth> info = new HashMap<>(); |
| | | DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern("yyyy-MM"); |
| | | LocalDate localDate = LocalDate.now(); |
| | | localDate = localDate.minusMonths(1); |
| | | //上月第一天 |
| | | String baseDate = dateTimeFormatter.format(localDate); |
| | | // 查询上个月考勤表 |
| | | List<Attendance> attendanceList = attendanceRepository.findAllLikeDate(baseDate + "%"); |
| | | for(Attendance attendance : attendanceList){ |
| | | // 查询用户 |
| | | User user = userRepository.findById(attendance.getUserId()).orElseGet(User::new); |
| | | Long userId = attendance.getUserId(); |
| | | if (!info.containsKey(userId)) { |
| | | info.put(userId, new AttendanceMonth()); |
| | | info.get(userId).setAttendanceDate(Timestamp.valueOf(baseDate + "-01 00:00:00")); |
| | | info.get(userId).setUserId(userId); |
| | | info.get(userId).setCompanyId(user.getCompanyId()); |
| | | info.get(userId).setDeptId(user.getDept().getId()); |
| | | // 查询岗位 |
| | | if(user.getJobs().size() != 0){ |
| | | Job job = user.getJobs().iterator().next(); |
| | | info.get(userId).setJobId(job.getId()); |
| | | } |
| | | } |
| | | DateTimeFormatter dateTimeFormatter1 = DateTimeFormatter.ofPattern("yyyy-MM-dd"); |
| | | Boolean isWeekend = LocalDate.parse(attendance.getAttendanceDate().toString().substring(0,10), dateTimeFormatter1).getDayOfWeek() == DayOfWeek.SATURDAY || LocalDate.parse(attendance.getAttendanceDate().toString().substring(0,10), dateTimeFormatter1).getDayOfWeek() == DayOfWeek.SUNDAY; |
| | | // 不是周末并且节假日表中不存在 或者 是周末并且工作日数组中存在 |
| | | if((!isWeekend && !holiday.contains(attendance.getAttendanceDate())) || (isWeekend && isWork.contains(attendance.getAttendanceDate()))){ |
| | | // 应出勤天数 |
| | | info.get(userId).setRequiredAttendanceDays(info.get(userId).getRequiredAttendanceDays() == null ? 1 : info.get(userId).getRequiredAttendanceDays() + 1); |
| | | // 实际出勤天数 |
| | | if(ObjectUtils.isNotEmpty(attendance.getActualWorkStartTime()) || ObjectUtils.isNotEmpty(attendance.getActualWorkEndTime())){ |
| | | info.get(userId).setActualAttendanceDays(info.get(userId).getActualAttendanceDays() == null ? 1 : info.get(userId).getActualAttendanceDays() + 1); |
| | | } |
| | | if(ObjectUtils.isNotEmpty(attendance.getActualWorkStartTime()) && attendance.getStartClockResults().equals(Constant.ATTENDANCE_START_LATE)){ |
| | | // 迟到次数 |
| | | info.get(userId).setCountOfBeingLate(info.get(userId).getCountOfBeingLate() == null ? 1 : info.get(userId).getCountOfBeingLate() + 1); |
| | | Duration onDuration = Duration.between(attendance.getRosteringWorkStartTime().toLocalDateTime(), attendance.getActualWorkStartTime().toLocalDateTime()); |
| | | // 迟到时长 |
| | | info.get(userId).setTimeOfBeingLate(info.get(userId).getTimeOfBeingLate() == null ? Double.valueOf(new BigDecimal((float) onDuration.getSeconds() / 3600).setScale(2, BigDecimal.ROUND_HALF_UP).toString()) : Double.valueOf(BigDecimal.valueOf(info.get(userId).getTimeOfBeingLate()).add(new BigDecimal((float) onDuration.getSeconds() / 3600).setScale(2, BigDecimal.ROUND_HALF_UP)).toString())); |
| | | } |
| | | if(ObjectUtils.isNotEmpty(attendance.getActualWorkEndTime()) && attendance.getEndClockResults().equals(Constant.ATTENDANCE_START_EARLY)){ |
| | | // 早退次数 |
| | | info.get(userId).setCountOfBeingEarly(info.get(userId).getCountOfBeingEarly() == null ? 1 : info.get(userId).getCountOfBeingEarly() + 1); |
| | | Duration offDuration = Duration.between(attendance.getActualWorkEndTime().toLocalDateTime(), attendance.getRosteringWorkEndTime().toLocalDateTime()); |
| | | // 早退时长 |
| | | info.get(userId).setTimeOfBeingEarly(info.get(userId).getTimeOfBeingEarly() == null ? Double.valueOf(new BigDecimal((float) offDuration.getSeconds() / 3600).setScale(2, BigDecimal.ROUND_HALF_UP).toString()) : Double.valueOf(BigDecimal.valueOf(info.get(userId).getTimeOfBeingEarly()).add(new BigDecimal((float) offDuration.getSeconds() / 3600).setScale(2, BigDecimal.ROUND_HALF_UP)).toString())); |
| | | } |
| | | if(attendance.getStartClockResults().equals(Constant.ATTENDANCE_STATE_NOTSIGNED)){ |
| | | // 上班缺卡次数 |
| | | info.get(userId).setOnCardNumber(info.get(userId).getOnCardNumber() == null ? 1 : info.get(userId).getOnCardNumber() + 1); |
| | | } |
| | | if(attendance.getEndClockResults().equals(Constant.ATTENDANCE_STATE_NOTSIGNED)){ |
| | | // 下班缺卡次数 |
| | | info.get(userId).setOffCardNumber(info.get(userId).getOffCardNumber() == null ? 1 : info.get(userId).getOffCardNumber() + 1); |
| | | } |
| | | } |
| | | } |
| | | |
| | | LocalDateTime startTime = localDate.with(TemporalAdjusters.firstDayOfMonth()).atTime(0, 0, 0); |
| | | LocalDateTime endTime = localDate.with(TemporalAdjusters.lastDayOfMonth()).atTime(23, 59, 59); |
| | | List<AttendanceMonth> insertData = new ArrayList<>(); |
| | | for (AttendanceMonth value : info.values()) { |
| | | // 查询当月外出 |
| | | List<AttendanceGoOut> goOutList = attendanceGoOutRepository.findByUserAndDate(value.getUserId(), startTime, endTime); |
| | | int goOutNumber = goOutList.size(); |
| | | // 外出次数 |
| | | value.setGoOutNumber(Long.valueOf(goOutNumber)); |
| | | Double goOutTimes = 0.0; |
| | | for(int i = 0; i < goOutList.size(); i++){ |
| | | goOutTimes = goOutTimes + goOutList.get(i).getOutDuration(); |
| | | } |
| | | // 外出时长 |
| | | value.setGoOutTime(goOutTimes); |
| | | // 查询当月的出差 |
| | | List<AttendanceBusinessTravel> businessTravelList = attendanceBusinessTravelRepository.findByUserAndSEDate(value.getUserId(), startTime, endTime); |
| | | int bussNumber = businessTravelList.size(); |
| | | // 出差次数 |
| | | value.setBussNumber(Long.valueOf(bussNumber)); |
| | | // 出差时长 |
| | | value.setBussTime(Double.valueOf(bussNumber * 8)); |
| | | // 应出勤时长 |
| | | value.setRequiredAttendanceTime(Double.valueOf(value.getRequiredAttendanceDays() * 8)); |
| | | // 查询当月请假 |
| | | List<AttendanceLeave> leaveList = attendanceLeaveRepository.findByUserIdAndDate(value.getUserId(), startTime, endTime); |
| | | // 当月请假时长 |
| | | Double leaveTimes = 0.0; |
| | | for(int i = 0; i < leaveList.size(); i++){ |
| | | // 时间单位为小时就直接加,否则就是天为单位需要乘8 |
| | | leaveTimes = leaveList.get(i).getLeaveDurationUnit().equals(Constant.LEAVE_TIME_TYPE_HOUR) ? leaveTimes + leaveList.get(i).getLeaveDuration() : leaveTimes + leaveList.get(i).getLeaveDuration() * 8; |
| | | } |
| | | // 实际出勤时长 |
| | | value.setActualAttendanceTime(Double.valueOf(value.getRequiredAttendanceTime() - leaveTimes)); |
| | | //验证考勤月报的确认按钮 |
| | | AttendanceMonth attendanceMonthly = attendanceMonthRepository.findByAttendanceDateAndUserId(baseDate + "-01 00:00:00", value.getUserId()); |
| | | if(ObjectUtil.isNotEmpty(attendanceMonthly) && attendanceMonthly.getIsAdmit() != null && attendanceMonthly.getIsAdmit().equals(Constant.APPROVE_STATUS_ACKNOWLEDGED)){ |
| | | value.setIsAdmit(attendanceMonthly.getIsAdmit()); |
| | | } |
| | | if(ObjectUtil.isNotEmpty(attendanceMonthly) && attendanceMonthly.getIsPublicity() != null && attendanceMonthly.getIsPublicity().equals(Constant.PUBLICITY_STATUS_YES)){ |
| | | value.setIsPublicity(attendanceMonthly.getIsPublicity()); |
| | | } |
| | | insertData.add(value); |
| | | } |
| | | // 删除上个月信息 |
| | | attendanceMonthRepository.deleteByActualAttendanceDays(baseDate + "-01 00:00:00"); |
| | | // 保存当前添加的记录 |
| | | attendanceMonthRepository.saveAll(insertData); |
| | | |
| | | // 查询月报相关请假类型表 |
| | | List<AttendanceMonthLeave> attendanceMonthLeaves = attendanceMonthLeaveRepository.findByAttendanceDate(baseDate + "-01 00:00:00"); |
| | | if(attendanceMonthLeaves.size() != 0){ |
| | | for(AttendanceMonthLeave attendanceMonthLeave : attendanceMonthLeaves){ |
| | | // 删除数据 |
| | | attendanceMonthLeaveRepository.deleteById(attendanceMonthLeave.getId()); |
| | | } |
| | | } |
| | | // 月报相关的请假类型添加 |
| | | for(int i = 0; i < insertData.size(); i++){ |
| | | // 查询当月请假 |
| | | List<AttendanceLeave> leaves = attendanceLeaveRepository.findByUserIdAndDate(insertData.get(i).getUserId(), startTime, endTime); |
| | | // 请假类型集合 |
| | | List<String> leaveTpeList = new ArrayList<>(); |
| | | for(int i1 = 0; i1 < leaves.size(); i1++){ |
| | | // 当前循环人员的所有请假类型 |
| | | leaveTpeList.add(leaves.get(i1).getLeaveType()); |
| | | } |
| | | |
| | | // 请假类型去重 |
| | | HashSet h = new HashSet(leaveTpeList); |
| | | leaveTpeList.clear(); |
| | | leaveTpeList.addAll(h); |
| | | |
| | | // 遍历请假类型集合添加数据 |
| | | for(int i2 = 0; i2 < leaveTpeList.size(); i2++){ |
| | | AttendanceMonthLeave attendanceMonthLeave = new AttendanceMonthLeave(); |
| | | attendanceMonthLeave.setAttendanceMonthId(insertData.get(i).getId()); |
| | | attendanceMonthLeave.setAttendanceDate(insertData.get(i).getAttendanceDate()); |
| | | attendanceMonthLeave.setUserId(insertData.get(i).getUserId()); |
| | | // 请假类型 |
| | | attendanceMonthLeave.setLeaveType(leaveTpeList.get(i2)); |
| | | // 根据请假类型查询请假 |
| | | List<AttendanceLeave> leaveList = attendanceLeaveRepository.findByUserIdAndDateAndLeaveType(insertData.get(i).getUserId(), startTime, endTime,leaveTpeList.get(i2)); |
| | | // 请假次数 |
| | | attendanceMonthLeave.setLeaveCount(Long.valueOf(leaveList.size())); |
| | | // 请假类型时长 |
| | | attendanceMonthLeave.setLeaveTime(getLeaveDuration(leaves,leaveTpeList.get(i2))); |
| | | //年假剩余时长 |
| | | if(leaveTpeList.get(i2).equals(Constant.LEAVE_TYPE_ANNUAL_LEAVE)){ |
| | | Double yearTime = attendanceLeaveService.getYearTimeLength(insertData.get(i).getUserId()); |
| | | attendanceMonthLeave.setSurplusDuration(yearTime); |
| | | } |
| | | attendanceMonthLeaveRepository.save(attendanceMonthLeave); |
| | | } |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 获取请假时长 |
| | | * @param leaveList |
| | | * @return |
| | | */ |
| | | public Double getLeaveDuration(List<AttendanceLeave> leaveList, String type){ |
| | | Double leaveTimes = 0.0; |
| | | for(int i = 0; i < leaveList.size(); i++){ |
| | | //时间单位为小时就直接加 |
| | | if(leaveList.get(i).getLeaveType().equals(type)){ |
| | | if(leaveList.get(i).getLeaveDurationUnit().equals(Constant.LEAVE_TIME_TYPE_HOUR)){ |
| | | leaveTimes = leaveList.get(i).getLeaveDuration() + leaveTimes; |
| | | } |
| | | } |
| | | //天为单位需要乘8 |
| | | if(leaveList.get(i).getLeaveDurationUnit().equals(Constant.LEAVE_TIME_TYPE_DAY)){ |
| | | leaveTimes = leaveList.get(i).getLeaveDuration() * 8 + leaveTimes; |
| | | } |
| | | } |
| | | return leaveTimes; |
| | | } |
| | | } |
| | |
| | | msg.getActionCard().setTitle(title); |
| | | msg.getActionCard().setMarkdown(content); |
| | | msg.getActionCard().setSingleTitle("详情"); |
| | | msg.getActionCard().setSingleUrl("http://pms.yhzhg.cn/"); |
| | | msg.getActionCard().setSingleUrl("http://pms-upgrade.yhzhg.cn/"); |
| | | msg.setMsgtype("action_card"); |
| | | } |
| | | request.setMsg(msg); |
| New file |
| | |
| | | package me.zhengjie.modules.quartz.task; |
| | | |
| | | import lombok.RequiredArgsConstructor; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import me.zhengjie.modules.quartz.service.impl.AttendanceMonthTalkServiceImpl; |
| | | import org.springframework.scheduling.annotation.Async; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.text.ParseException; |
| | | |
| | | /** |
| | | * 月报定时任务,每月初执行 |
| | | */ |
| | | @Slf4j |
| | | @Service |
| | | @RequiredArgsConstructor |
| | | @Async |
| | | public class AttendanceMonthlyMethod { |
| | | |
| | | private final AttendanceMonthTalkServiceImpl attendanceMonthService; |
| | | |
| | | public void getMonthlyData() throws ParseException { |
| | | // 调用方法 |
| | | attendanceMonthService.getMonthlyInfo(); |
| | | } |
| | | } |
| New file |
| | |
| | | package me.zhengjie.modules.quartz.task; |
| | | |
| | | import cn.hutool.core.util.ObjectUtil; |
| | | import lombok.RequiredArgsConstructor; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import me.zhengjie.modules.constant.Constant; |
| | | import me.zhengjie.modules.quartz.service.OpaiDingTalkService; |
| | | import me.zhengjie.modules.system.domain.*; |
| | | import me.zhengjie.modules.system.repository.*; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.sql.Timestamp; |
| | | import java.text.SimpleDateFormat; |
| | | import java.time.Instant; |
| | | import java.time.LocalDateTime; |
| | | import java.time.ZoneId; |
| | | import java.time.temporal.ChronoUnit; |
| | | import java.util.ArrayList; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * 客户资源管理提醒(延时) |
| | | * @author 魏传栋 |
| | | * @date 2023-01-10 |
| | | */ |
| | | @Slf4j |
| | | @Service |
| | | @RequiredArgsConstructor |
| | | public class ResourceReminderMethod { |
| | | |
| | | private final UserRepository userRepository; |
| | | private final OpaiDingTalkService opaiDingTalkService; |
| | | private final CustomerResourcesRepository customerResourcesRepository; |
| | | private final CustomerResourcesUserRepository customerResourcesUserRepository; |
| | | |
| | | /** |
| | | * 客户资源管理提醒 |
| | | * @throws Exception |
| | | */ |
| | | public void resourceReminder() throws Exception { |
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
| | | // 当前时间 |
| | | String nowTime = sdf.format(new Date()); |
| | | // 查询客户资源管理表 |
| | | List<CustomerResources> customerResourcesList = customerResourcesRepository.findAll(); |
| | | for(CustomerResources customerResources : customerResourcesList){ |
| | | // 表中的提醒时间与当前的时间一致,发送钉钉消息 |
| | | if(customerResources.getOpeningTime() != null && customerResources.getOpeningTime().compareTo(Timestamp.valueOf(nowTime)) == 0){ |
| | | // 钉钉List |
| | | List<String> dingDingList = new ArrayList<>(); |
| | | // 查询中间表 |
| | | List<CustomerResourcesUser> customerResourcesUserList = customerResourcesUserRepository.findByCustomerResourcesId(customerResources.getId()); |
| | | for(int i = 0; i < customerResourcesUserList.size(); i++){ |
| | | // 查询用户 |
| | | User user = userRepository.findById(customerResourcesUserList.get(i).getUserId()).orElseGet(User::new); |
| | | dingDingList.add(user.getDingding()); |
| | | } |
| | | // 发送信息至被提醒人钉钉 |
| | | opaiDingTalkService.sendNotice(dingDingList, "客户资源管理提示", "### 客户资源管理提示 \n >" + |
| | | " \n 标题:" + customerResources.getTitle() + |
| | | " \n 分类: " + customerResources.getClassification() + |
| | | " \n 新增客户资源,请登录PMS系统查看。", "card"); |
| | | } |
| | | } |
| | | } |
| | | } |
| 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.system.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.io.Serializable; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @website https://eladmin.vip |
| | | * @description / |
| | | * @author wcd |
| | | * @date 2023-02-02 |
| | | **/ |
| | | @Entity |
| | | @Data |
| | | @Table(name="customer_resources") |
| | | public class CustomerResources extends BaseEntity implements Serializable { |
| | | |
| | | @Id |
| | | @GeneratedValue(strategy = GenerationType.IDENTITY) |
| | | @Column(name = "`id`") |
| | | @ApiModelProperty(value = "id") |
| | | private Long id; |
| | | |
| | | @Column(name = "`title`",nullable = false) |
| | | @NotBlank |
| | | @ApiModelProperty(value = "标题") |
| | | private String title; |
| | | |
| | | @Column(name = "`classification`",nullable = false) |
| | | @NotBlank |
| | | @ApiModelProperty(value = "分类") |
| | | private String classification; |
| | | |
| | | @Column(name = "`record_time`",nullable = false) |
| | | @NotNull |
| | | @ApiModelProperty(value = "记录时间") |
| | | private Timestamp recordTime; |
| | | |
| | | @Column(name = "`record_content`") |
| | | @ApiModelProperty(value = "记录内容") |
| | | private String recordContent; |
| | | |
| | | @Column(name = "`opening_time`") |
| | | @ApiModelProperty(value = "开启提醒(提醒时间)") |
| | | private Timestamp openingTime; |
| | | |
| | | @Column(name = "`remarks`") |
| | | @ApiModelProperty(value = "备注") |
| | | private String remarks; |
| | | |
| | | @Transient |
| | | @ApiModelProperty(value = "提醒人") |
| | | private List<Long> remindPeople; |
| | | |
| | | @Transient |
| | | @ApiModelProperty(value = "提醒状态") |
| | | private String remind; |
| | | |
| | | public void copy(CustomerResources source){ |
| | | BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true)); |
| | | } |
| | | } |
copy from eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/domain/SysUserCompany.java
copy to eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/domain/CustomerResourcesUser.java
| File was copied from eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/domain/SysUserCompany.java |
| | |
| | | import me.zhengjie.base.BaseEntity; |
| | | |
| | | import javax.persistence.*; |
| | | import javax.validation.constraints.*; |
| | | import java.sql.Timestamp; |
| | | import java.io.Serializable; |
| | | |
| | | /** |
| | | * @website https://eladmin.vip |
| | | * @description / |
| | | * @author wcd |
| | | * @date 2023-01-30 |
| | | * @date 2023-02-03 |
| | | **/ |
| | | @Entity |
| | | @Data |
| | | @Table(name="sys_user_company") |
| | | public class SysUserCompany extends BaseEntity implements Serializable { |
| | | @Table(name="customer_resources_user") |
| | | public class CustomerResourcesUser extends BaseEntity implements Serializable { |
| | | |
| | | @Id |
| | | @GeneratedValue(strategy = GenerationType.IDENTITY) |
| | |
| | | @ApiModelProperty(value = "id") |
| | | private Long id; |
| | | |
| | | @Column(name = "`description`") |
| | | @ApiModelProperty(value = "描述") |
| | | private String description; |
| | | @Column(name = "`customer_resources_id`",nullable = false) |
| | | @NotNull |
| | | @ApiModelProperty(value = "客户资源 id") |
| | | private Long customerResourcesId; |
| | | |
| | | @Column(name = "`label`") |
| | | @ApiModelProperty(value = "标签") |
| | | private String label; |
| | | @Column(name = "`user_id`",nullable = false) |
| | | @NotNull |
| | | @ApiModelProperty(value = "用户 id") |
| | | private Long userId; |
| | | |
| | | @Column(name = "`value`") |
| | | @ApiModelProperty(value = "值") |
| | | private String value; |
| | | |
| | | public void copy(SysUserCompany source){ |
| | | public void copy(CustomerResourcesUser source){ |
| | | BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true)); |
| | | } |
| | | } |
| File was renamed from eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/domain/SysUserCompany.java |
| | |
| | | **/ |
| | | @Entity |
| | | @Data |
| | | @Table(name="sys_user_company") |
| | | public class SysUserCompany extends BaseEntity implements Serializable { |
| | | @Table(name="sys_company") |
| | | public class SysCompany extends BaseEntity implements Serializable { |
| | | |
| | | @Id |
| | | @GeneratedValue(strategy = GenerationType.IDENTITY) |
| | |
| | | @ApiModelProperty(value = "标签") |
| | | private String label; |
| | | |
| | | @Column(name = "`value`") |
| | | @ApiModelProperty(value = "值") |
| | | private String value; |
| | | |
| | | public void copy(SysUserCompany source){ |
| | | public void copy(SysCompany source){ |
| | | BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true)); |
| | | } |
| | | } |
| | |
| | | @ApiModelProperty(value = "公司id") |
| | | private Long companyId; |
| | | |
| | | @Column(name = "`related_documents`") |
| | | @ApiModelProperty(value = "相关文件") |
| | | private String relatedDocuments; |
| | | |
| | | @Column(name = "`remarks`") |
| | | @ApiModelProperty(value = "备注") |
| | | private String remarks; |
| | |
| | | private Timestamp birthday; |
| | | |
| | | // 魏传栋 - 始 |
| | | @Column(name = "company") |
| | | @ApiModelProperty(value = "所属公司") |
| | | private String company; |
| | | @Column(name = "company_id") |
| | | @ApiModelProperty(value = "所属公司Id") |
| | | private Long companyId; |
| | | // 魏传栋 - 终 |
| | | |
| | | @Email |
copy from eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/repository/SysUserCompanyRepository.java
copy to eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/repository/CustomerResourcesRepository.java
| File was copied from eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/repository/SysUserCompanyRepository.java |
| | |
| | | */ |
| | | package me.zhengjie.modules.system.repository; |
| | | |
| | | import me.zhengjie.modules.system.domain.SysUserCompany; |
| | | import me.zhengjie.modules.system.domain.CustomerResources; |
| | | import org.springframework.data.jpa.repository.JpaRepository; |
| | | import org.springframework.data.jpa.repository.JpaSpecificationExecutor; |
| | | import org.springframework.data.jpa.repository.Query; |
| | | |
| | | /** |
| | | * @website https://eladmin.vip |
| | | * @author wcd |
| | | * @date 2023-01-30 |
| | | * @date 2023-02-02 |
| | | **/ |
| | | public interface SysUserCompanyRepository extends JpaRepository<SysUserCompany, Long>, JpaSpecificationExecutor<SysUserCompany> { |
| | | |
| | | /** |
| | | * 根据value查询公司(导出用) |
| | | * @return |
| | | */ |
| | | @Query |
| | | SysUserCompany findByValue(String value); |
| | | public interface CustomerResourcesRepository extends JpaRepository<CustomerResources, Long>, JpaSpecificationExecutor<CustomerResources> { |
| | | } |
| 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.system.repository; |
| | | |
| | | import me.zhengjie.modules.system.domain.CustomerResourcesUser; |
| | | import me.zhengjie.modules.system.domain.SysConfigProportion; |
| | | 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.util.List; |
| | | |
| | | /** |
| | | * @website https://eladmin.vip |
| | | * @author wcd |
| | | * @date 2023-02-03 |
| | | **/ |
| | | public interface CustomerResourcesUserRepository extends JpaRepository<CustomerResourcesUser, Long>, JpaSpecificationExecutor<CustomerResourcesUser> { |
| | | |
| | | //根据客户资源id查询中间表 |
| | | @Query |
| | | List<CustomerResourcesUser> findByCustomerResourcesId(Long cuId); |
| | | |
| | | // 根据用户资源id删除中间表数据 |
| | | @Modifying |
| | | @Query(value = "delete from customer_resources_user where customer_resources_id = ?1",nativeQuery = true) |
| | | void deleteByCustomerResourcesId(Long custId); |
| | | } |
| File was renamed from eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/repository/SysUserCompanyRepository.java |
| | |
| | | */ |
| | | package me.zhengjie.modules.system.repository; |
| | | |
| | | import me.zhengjie.modules.system.domain.SysUserCompany; |
| | | import me.zhengjie.modules.system.domain.SysCompany; |
| | | import org.springframework.data.jpa.repository.JpaRepository; |
| | | import org.springframework.data.jpa.repository.JpaSpecificationExecutor; |
| | | import org.springframework.data.jpa.repository.Query; |
| | | |
| | | /** |
| | | * @website https://eladmin.vip |
| | | * @author wcd |
| | | * @date 2023-01-30 |
| | | **/ |
| | | public interface SysUserCompanyRepository extends JpaRepository<SysUserCompany, Long>, JpaSpecificationExecutor<SysUserCompany> { |
| | | public interface SysCompanyRepository extends JpaRepository<SysCompany, Long>, JpaSpecificationExecutor<SysCompany> { |
| | | |
| | | /** |
| | | * 根据value查询公司(导出用) |
| | | * @return |
| | | */ |
| | | @Query |
| | | SysUserCompany findByValue(String value); |
| | | } |
| 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.system.rest; |
| | | |
| | | import me.zhengjie.annotation.Log; |
| | | import me.zhengjie.modules.system.domain.CustomerResources; |
| | | import me.zhengjie.modules.system.service.CustomerResourcesService; |
| | | import me.zhengjie.modules.system.service.dto.CustomerResourcesQueryCriteria; |
| | | 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 wcd |
| | | * @date 2023-02-02 |
| | | **/ |
| | | @RestController |
| | | @RequiredArgsConstructor |
| | | @Api(tags = "客户资源管理管理") |
| | | @RequestMapping("/api/customerResources") |
| | | public class CustomerResourcesController { |
| | | |
| | | private final CustomerResourcesService customerResourcesService; |
| | | |
| | | @Log("导出数据") |
| | | @ApiOperation("导出数据") |
| | | @GetMapping(value = "/download") |
| | | @PreAuthorize("@el.check('customerResources:download')") |
| | | public void exportCustomerResources(HttpServletResponse response, CustomerResourcesQueryCriteria criteria) throws IOException { |
| | | customerResourcesService.download(customerResourcesService.queryAll(criteria), response); |
| | | } |
| | | |
| | | @GetMapping |
| | | @Log("查询客户资源管理") |
| | | @ApiOperation("查询客户资源管理") |
| | | @PreAuthorize("@el.check('customerResources:list')") |
| | | public ResponseEntity<Object> queryCustomerResources(CustomerResourcesQueryCriteria criteria, Pageable pageable){ |
| | | return new ResponseEntity<>(customerResourcesService.queryAll(criteria,pageable),HttpStatus.OK); |
| | | } |
| | | |
| | | @GetMapping(value = "/all") |
| | | @Log("查询客户资源管理") |
| | | @ApiOperation("查询客户资源管理") |
| | | @PreAuthorize("@el.check('customerResources:list')") |
| | | public ResponseEntity<Object> queryCustomerResources(CustomerResourcesQueryCriteria criteria){ |
| | | return new ResponseEntity<>(customerResourcesService.queryAll(criteria),HttpStatus.OK); |
| | | } |
| | | |
| | | @PostMapping |
| | | @Log("新增客户资源管理") |
| | | @ApiOperation("新增客户资源管理") |
| | | @PreAuthorize("@el.check('customerResources:add')") |
| | | public ResponseEntity<Object> createCustomerResources(@Validated @RequestBody CustomerResources resources) throws Exception { |
| | | customerResourcesService.create(resources); |
| | | return new ResponseEntity<>(HttpStatus.CREATED); |
| | | } |
| | | |
| | | @PutMapping |
| | | @Log("修改客户资源管理") |
| | | @ApiOperation("修改客户资源管理") |
| | | @PreAuthorize("@el.check('customerResources:edit')") |
| | | public ResponseEntity<Object> updateCustomerResources(@Validated @RequestBody CustomerResources resources) throws Exception { |
| | | customerResourcesService.update(resources); |
| | | return new ResponseEntity<>(HttpStatus.NO_CONTENT); |
| | | } |
| | | |
| | | @DeleteMapping |
| | | @Log("删除客户资源管理") |
| | | @ApiOperation("删除客户资源管理") |
| | | @PreAuthorize("@el.check('customerResources:del')") |
| | | public ResponseEntity<Object> deleteCustomerResources(@RequestBody Long[] ids) { |
| | | customerResourcesService.deleteAll(ids); |
| | | return new ResponseEntity<>(HttpStatus.OK); |
| | | } |
| | | |
| | | @PostMapping(value = "/getRemindUser") |
| | | @Log("查询被提醒人") |
| | | @ApiOperation("查询被提醒人") |
| | | public ResponseEntity<Object> getRemindUser(@Validated @RequestBody CustomerResources resources){ |
| | | return new ResponseEntity<>(customerResourcesService.getRemindUser(resources),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.system.rest; |
| | | |
| | | import me.zhengjie.annotation.Log; |
| | | import me.zhengjie.modules.system.domain.CustomerResourcesUser; |
| | | import me.zhengjie.modules.system.service.CustomerResourcesUserService; |
| | | import me.zhengjie.modules.system.service.dto.CustomerResourcesUserQueryCriteria; |
| | | 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 wcd |
| | | * @date 2023-02-03 |
| | | **/ |
| | | @RestController |
| | | @RequiredArgsConstructor |
| | | @Api(tags = "客户资源与用户中间表管理") |
| | | @RequestMapping("/api/customerResourcesUser") |
| | | public class CustomerResourcesUserController { |
| | | |
| | | private final CustomerResourcesUserService customerResourcesUserService; |
| | | |
| | | @Log("导出数据") |
| | | @ApiOperation("导出数据") |
| | | @GetMapping(value = "/download") |
| | | @PreAuthorize("@el.check('customerResourcesUser:list')") |
| | | public void exportCustomerResourcesUser(HttpServletResponse response, CustomerResourcesUserQueryCriteria criteria) throws IOException { |
| | | customerResourcesUserService.download(customerResourcesUserService.queryAll(criteria), response); |
| | | } |
| | | |
| | | @GetMapping |
| | | @Log("查询客户资源与用户中间表") |
| | | @ApiOperation("查询客户资源与用户中间表") |
| | | @PreAuthorize("@el.check('customerResourcesUser:list')") |
| | | public ResponseEntity<Object> queryCustomerResourcesUser(CustomerResourcesUserQueryCriteria criteria, Pageable pageable){ |
| | | return new ResponseEntity<>(customerResourcesUserService.queryAll(criteria,pageable),HttpStatus.OK); |
| | | } |
| | | |
| | | @PostMapping |
| | | @Log("新增客户资源与用户中间表") |
| | | @ApiOperation("新增客户资源与用户中间表") |
| | | @PreAuthorize("@el.check('customerResourcesUser:add')") |
| | | public ResponseEntity<Object> createCustomerResourcesUser(@Validated @RequestBody CustomerResourcesUser resources){ |
| | | return new ResponseEntity<>(customerResourcesUserService.create(resources),HttpStatus.CREATED); |
| | | } |
| | | |
| | | @PutMapping |
| | | @Log("修改客户资源与用户中间表") |
| | | @ApiOperation("修改客户资源与用户中间表") |
| | | @PreAuthorize("@el.check('customerResourcesUser:edit')") |
| | | public ResponseEntity<Object> updateCustomerResourcesUser(@Validated @RequestBody CustomerResourcesUser resources){ |
| | | customerResourcesUserService.update(resources); |
| | | return new ResponseEntity<>(HttpStatus.NO_CONTENT); |
| | | } |
| | | |
| | | @DeleteMapping |
| | | @Log("删除客户资源与用户中间表") |
| | | @ApiOperation("删除客户资源与用户中间表") |
| | | @PreAuthorize("@el.check('customerResourcesUser:del')") |
| | | public ResponseEntity<Object> deleteCustomerResourcesUser(@RequestBody Long[] ids) { |
| | | customerResourcesUserService.deleteAll(ids); |
| | | return new ResponseEntity<>(HttpStatus.OK); |
| | | } |
| | | } |
| | |
| | | return new ResponseEntity<>(PageUtil.toPage(deptDtos, deptDtos.size()),HttpStatus.OK); |
| | | } |
| | | |
| | | |
| | | |
| | | @ApiOperation("查询部门:根据ID获取同级与上级数据") |
| | | @PostMapping("/superior") |
| | | @PreAuthorize("@el.check('user:list','dept:list')") |
| File was renamed from eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/rest/SysUserCompanyController.java |
| | |
| | | package me.zhengjie.modules.system.rest; |
| | | |
| | | import me.zhengjie.annotation.Log; |
| | | import me.zhengjie.modules.system.domain.SysUserCompany; |
| | | import me.zhengjie.modules.system.service.SysUserCompanyService; |
| | | import me.zhengjie.modules.system.service.dto.SysUserCompanyDto; |
| | | import me.zhengjie.modules.system.service.dto.SysUserCompanyQueryCriteria; |
| | | import me.zhengjie.modules.system.domain.SysCompany; |
| | | import me.zhengjie.modules.system.service.SysCompanyService; |
| | | import me.zhengjie.modules.system.service.dto.SysCompanyDto; |
| | | import me.zhengjie.modules.system.service.dto.SysCompanyQueryCriteria; |
| | | import org.springframework.data.domain.Pageable; |
| | | import lombok.RequiredArgsConstructor; |
| | | import org.springframework.http.HttpStatus; |
| | |
| | | @RestController |
| | | @RequiredArgsConstructor |
| | | @Api(tags = "公司管理管理") |
| | | @RequestMapping("/api/sysUserCompany") |
| | | public class SysUserCompanyController { |
| | | @RequestMapping("/api/sysCompany") |
| | | public class SysCompanyController { |
| | | |
| | | private final SysUserCompanyService sysUserCompanyService; |
| | | private final SysCompanyService sysCompanyService; |
| | | |
| | | @Log("导出数据") |
| | | @ApiOperation("导出数据") |
| | | @GetMapping(value = "/download") |
| | | @PreAuthorize("@el.check('sysUserCompany:download')") |
| | | public void exportSystemSetting(HttpServletResponse response, SysUserCompanyQueryCriteria criteria) throws IOException { |
| | | sysUserCompanyService.download(sysUserCompanyService.queryAll(criteria), response); |
| | | @PreAuthorize("@el.check('sysCompany:download')") |
| | | public void exportSystemSetting(HttpServletResponse response, SysCompanyQueryCriteria criteria) throws IOException { |
| | | sysCompanyService.download(sysCompanyService.queryAll(criteria), response); |
| | | } |
| | | |
| | | @GetMapping |
| | | @Log("查询公司管理") |
| | | @ApiOperation("查询公司管理") |
| | | @PreAuthorize("@el.check('sysUserCompany:list')") |
| | | public ResponseEntity<Object> querySystemSetting(SysUserCompanyQueryCriteria criteria, Pageable pageable){ |
| | | return new ResponseEntity<>(sysUserCompanyService.queryAll(criteria,pageable),HttpStatus.OK); |
| | | @PreAuthorize("@el.check('sysCompany:list')") |
| | | public ResponseEntity<Object> querySystemSetting(SysCompanyQueryCriteria criteria, Pageable pageable){ |
| | | return new ResponseEntity<>(sysCompanyService.queryAll(criteria,pageable),HttpStatus.OK); |
| | | } |
| | | |
| | | @GetMapping(value = "/all") |
| | | @Log("查询公司管理") |
| | | @ApiOperation("查询公司管理") |
| | | @PreAuthorize("@el.check('sysUserCompany:list')") |
| | | public ResponseEntity<Object> querySystemSetting(SysUserCompanyQueryCriteria criteria){ |
| | | return new ResponseEntity<>(sysUserCompanyService.queryAll(criteria),HttpStatus.OK); |
| | | @PreAuthorize("@el.check('sysCompany:list')") |
| | | public ResponseEntity<Object> querySystemSetting(SysCompanyQueryCriteria criteria){ |
| | | return new ResponseEntity<>(sysCompanyService.queryAll(criteria),HttpStatus.OK); |
| | | } |
| | | |
| | | @PostMapping |
| | | @Log("新增公司管理") |
| | | @ApiOperation("新增公司管理") |
| | | @PreAuthorize("@el.check('sysUserCompany:add')") |
| | | public ResponseEntity<Object> createSystemSetting(@Validated @RequestBody SysUserCompany resources){ |
| | | return new ResponseEntity<>(sysUserCompanyService.create(resources),HttpStatus.CREATED); |
| | | @PreAuthorize("@el.check('sysCompany:add')") |
| | | public ResponseEntity<Object> createSystemSetting(@Validated @RequestBody SysCompany resources){ |
| | | return new ResponseEntity<>(sysCompanyService.create(resources),HttpStatus.CREATED); |
| | | } |
| | | |
| | | @PutMapping |
| | | @Log("修改公司管理") |
| | | @ApiOperation("修改公司管理") |
| | | @PreAuthorize("@el.check('sysUserCompany:edit')") |
| | | public ResponseEntity<Object> updateSystemSetting(@Validated @RequestBody SysUserCompany resources){ |
| | | sysUserCompanyService.update(resources); |
| | | @PreAuthorize("@el.check('sysCompany:edit')") |
| | | public ResponseEntity<Object> updateSystemSetting(@Validated @RequestBody SysCompany resources){ |
| | | sysCompanyService.update(resources); |
| | | return new ResponseEntity<>(HttpStatus.NO_CONTENT); |
| | | } |
| | | |
| | | @DeleteMapping |
| | | @Log("删除公司管理") |
| | | @ApiOperation("删除公司管理") |
| | | @PreAuthorize("@el.check('sysUserCompany:del')") |
| | | @PreAuthorize("@el.check('sysCompany:del')") |
| | | public ResponseEntity<Object> deleteSystemSetting(@RequestBody Long[] ids) { |
| | | sysUserCompanyService.deleteAll(ids); |
| | | sysCompanyService.deleteAll(ids); |
| | | return new ResponseEntity<>(HttpStatus.OK); |
| | | } |
| | | |
| | |
| | | @PostMapping(value = "/getCompName") |
| | | @Log("选择用户改变公司") |
| | | @ApiOperation("选择用户改变公司") |
| | | public ResponseEntity<Object> getCompName(@Validated @RequestBody SysUserCompanyDto resources){ |
| | | return new ResponseEntity<>(sysUserCompanyService.getCompName(resources), HttpStatus.OK); |
| | | public ResponseEntity<Object> getCompName(@Validated @RequestBody SysCompanyDto resources){ |
| | | return new ResponseEntity<>(sysCompanyService.getCompName(resources), HttpStatus.OK); |
| | | } |
| | | } |
copy from eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/service/SysUserCompanyService.java
copy to eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/service/CustomerResourcesService.java
| File was copied from eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/service/SysUserCompanyService.java |
| | |
| | | */ |
| | | package me.zhengjie.modules.system.service; |
| | | |
| | | import me.zhengjie.modules.system.domain.SysUserCompany; |
| | | import me.zhengjie.modules.system.service.dto.SysUserCompanyDto; |
| | | import me.zhengjie.modules.system.service.dto.SysUserCompanyQueryCriteria; |
| | | import me.zhengjie.modules.system.domain.CustomerResources; |
| | | import me.zhengjie.modules.system.domain.User; |
| | | import me.zhengjie.modules.system.service.dto.CustomerResourcesDto; |
| | | import me.zhengjie.modules.system.service.dto.CustomerResourcesQueryCriteria; |
| | | import org.springframework.data.domain.Pageable; |
| | | import java.util.Map; |
| | | import java.util.List; |
| | |
| | | * @website https://eladmin.vip |
| | | * @description 服务接口 |
| | | * @author wcd |
| | | * @date 2023-01-30 |
| | | * @date 2023-02-02 |
| | | **/ |
| | | public interface SysUserCompanyService { |
| | | public interface CustomerResourcesService { |
| | | |
| | | /** |
| | | * 查询数据分页 |
| | |
| | | * @param pageable 分页参数 |
| | | * @return Map<String,Object> |
| | | */ |
| | | Map<String,Object> queryAll(SysUserCompanyQueryCriteria criteria, Pageable pageable); |
| | | Map<String,Object> queryAll(CustomerResourcesQueryCriteria criteria, Pageable pageable); |
| | | |
| | | /** |
| | | * 查询所有数据不分页 |
| | | * @param criteria 条件参数 |
| | | * @return List<SystemSettingDto> |
| | | * @return List<CustomerResourcesDto> |
| | | */ |
| | | List<SysUserCompanyDto> queryAll(SysUserCompanyQueryCriteria criteria); |
| | | List<CustomerResourcesDto> queryAll(CustomerResourcesQueryCriteria criteria); |
| | | |
| | | /** |
| | | * 根据ID查询 |
| | | * @param id ID |
| | | * @return SystemSettingDto |
| | | * @return CustomerResourcesDto |
| | | */ |
| | | SysUserCompanyDto findById(Long id); |
| | | CustomerResourcesDto findById(Long id); |
| | | |
| | | /** |
| | | * 创建 |
| | | * @param resources / |
| | | * @return SystemSettingDto |
| | | * @return CustomerResourcesDto |
| | | */ |
| | | SysUserCompanyDto create(SysUserCompany resources); |
| | | void create(CustomerResources resources) throws Exception; |
| | | |
| | | /** |
| | | * 编辑 |
| | | * @param resources / |
| | | */ |
| | | void update(SysUserCompany resources); |
| | | void update(CustomerResources resources) throws Exception; |
| | | |
| | | /** |
| | | * 多选删除 |
| | |
| | | * @param response / |
| | | * @throws IOException / |
| | | */ |
| | | void download(List<SysUserCompanyDto> all, HttpServletResponse response) throws IOException; |
| | | void download(List<CustomerResourcesDto> all, HttpServletResponse response) throws IOException; |
| | | |
| | | /** |
| | | * 选择用户改变公司 |
| | | * 查询被提醒人 |
| | | * @param resources |
| | | * @return |
| | | */ |
| | | SysUserCompany getCompName(SysUserCompanyDto resources); |
| | | List<User> getRemindUser(CustomerResources resources); |
| | | } |
copy from eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/service/SysUserCompanyService.java
copy to eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/service/CustomerResourcesUserService.java
| File was copied from eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/service/SysUserCompanyService.java |
| | |
| | | */ |
| | | package me.zhengjie.modules.system.service; |
| | | |
| | | import me.zhengjie.modules.system.domain.SysUserCompany; |
| | | import me.zhengjie.modules.system.service.dto.SysUserCompanyDto; |
| | | import me.zhengjie.modules.system.service.dto.SysUserCompanyQueryCriteria; |
| | | import me.zhengjie.modules.system.domain.CustomerResourcesUser; |
| | | import me.zhengjie.modules.system.service.dto.CustomerResourcesUserDto; |
| | | import me.zhengjie.modules.system.service.dto.CustomerResourcesUserQueryCriteria; |
| | | import org.springframework.data.domain.Pageable; |
| | | import java.util.Map; |
| | | import java.util.List; |
| | |
| | | * @website https://eladmin.vip |
| | | * @description 服务接口 |
| | | * @author wcd |
| | | * @date 2023-01-30 |
| | | * @date 2023-02-03 |
| | | **/ |
| | | public interface SysUserCompanyService { |
| | | public interface CustomerResourcesUserService { |
| | | |
| | | /** |
| | | * 查询数据分页 |
| | |
| | | * @param pageable 分页参数 |
| | | * @return Map<String,Object> |
| | | */ |
| | | Map<String,Object> queryAll(SysUserCompanyQueryCriteria criteria, Pageable pageable); |
| | | Map<String,Object> queryAll(CustomerResourcesUserQueryCriteria criteria, Pageable pageable); |
| | | |
| | | /** |
| | | * 查询所有数据不分页 |
| | | * @param criteria 条件参数 |
| | | * @return List<SystemSettingDto> |
| | | * @return List<CustomerResourcesUserDto> |
| | | */ |
| | | List<SysUserCompanyDto> queryAll(SysUserCompanyQueryCriteria criteria); |
| | | List<CustomerResourcesUserDto> queryAll(CustomerResourcesUserQueryCriteria criteria); |
| | | |
| | | /** |
| | | * 根据ID查询 |
| | | * @param id ID |
| | | * @return SystemSettingDto |
| | | * @return CustomerResourcesUserDto |
| | | */ |
| | | SysUserCompanyDto findById(Long id); |
| | | CustomerResourcesUserDto findById(Long id); |
| | | |
| | | /** |
| | | * 创建 |
| | | * @param resources / |
| | | * @return SystemSettingDto |
| | | * @return CustomerResourcesUserDto |
| | | */ |
| | | SysUserCompanyDto create(SysUserCompany resources); |
| | | CustomerResourcesUserDto create(CustomerResourcesUser resources); |
| | | |
| | | /** |
| | | * 编辑 |
| | | * @param resources / |
| | | */ |
| | | void update(SysUserCompany resources); |
| | | void update(CustomerResourcesUser resources); |
| | | |
| | | /** |
| | | * 多选删除 |
| | |
| | | * @param response / |
| | | * @throws IOException / |
| | | */ |
| | | void download(List<SysUserCompanyDto> all, HttpServletResponse response) throws IOException; |
| | | |
| | | /** |
| | | * 选择用户改变公司 |
| | | * @param resources |
| | | * @return |
| | | */ |
| | | SysUserCompany getCompName(SysUserCompanyDto resources); |
| | | void download(List<CustomerResourcesUserDto> all, HttpServletResponse response) throws IOException; |
| | | } |
| File was renamed from eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/service/SysUserCompanyService.java |
| | |
| | | */ |
| | | package me.zhengjie.modules.system.service; |
| | | |
| | | import me.zhengjie.modules.system.domain.SysUserCompany; |
| | | import me.zhengjie.modules.system.service.dto.SysUserCompanyDto; |
| | | import me.zhengjie.modules.system.service.dto.SysUserCompanyQueryCriteria; |
| | | import me.zhengjie.modules.system.domain.SysCompany; |
| | | import me.zhengjie.modules.system.service.dto.SysCompanyDto; |
| | | import me.zhengjie.modules.system.service.dto.SysCompanyQueryCriteria; |
| | | import org.springframework.data.domain.Pageable; |
| | | import java.util.Map; |
| | | import java.util.List; |
| | |
| | | * @author wcd |
| | | * @date 2023-01-30 |
| | | **/ |
| | | public interface SysUserCompanyService { |
| | | public interface SysCompanyService { |
| | | |
| | | /** |
| | | * 查询数据分页 |
| | |
| | | * @param pageable 分页参数 |
| | | * @return Map<String,Object> |
| | | */ |
| | | Map<String,Object> queryAll(SysUserCompanyQueryCriteria criteria, Pageable pageable); |
| | | Map<String,Object> queryAll(SysCompanyQueryCriteria criteria, Pageable pageable); |
| | | |
| | | /** |
| | | * 查询所有数据不分页 |
| | | * @param criteria 条件参数 |
| | | * @return List<SystemSettingDto> |
| | | */ |
| | | List<SysUserCompanyDto> queryAll(SysUserCompanyQueryCriteria criteria); |
| | | List<SysCompanyDto> queryAll(SysCompanyQueryCriteria criteria); |
| | | |
| | | /** |
| | | * 根据ID查询 |
| | | * @param id ID |
| | | * @return SystemSettingDto |
| | | */ |
| | | SysUserCompanyDto findById(Long id); |
| | | SysCompanyDto findById(Long id); |
| | | |
| | | /** |
| | | * 创建 |
| | | * @param resources / |
| | | * @return SystemSettingDto |
| | | */ |
| | | SysUserCompanyDto create(SysUserCompany resources); |
| | | SysCompanyDto create(SysCompany resources); |
| | | |
| | | /** |
| | | * 编辑 |
| | | * @param resources / |
| | | */ |
| | | void update(SysUserCompany resources); |
| | | void update(SysCompany resources); |
| | | |
| | | /** |
| | | * 多选删除 |
| | |
| | | * @param response / |
| | | * @throws IOException / |
| | | */ |
| | | void download(List<SysUserCompanyDto> all, HttpServletResponse response) throws IOException; |
| | | void download(List<SysCompanyDto> all, HttpServletResponse response) throws IOException; |
| | | |
| | | /** |
| | | * 选择用户改变公司 |
| | | * @param resources |
| | | * @return |
| | | */ |
| | | SysUserCompany getCompName(SysUserCompanyDto resources); |
| | | SysCompany getCompName(SysCompanyDto resources); |
| | | } |
copy from eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/service/dto/SysUserCompanyDto.java
copy to eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/service/dto/CustomerResourcesDto.java
| File was copied from eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/service/dto/SysUserCompanyDto.java |
| | |
| | | import lombok.Data; |
| | | import me.zhengjie.base.BaseDTO; |
| | | |
| | | import java.sql.Timestamp; |
| | | import java.io.Serializable; |
| | | |
| | | /** |
| | | * @website https://eladmin.vip |
| | | * @description / |
| | | * @author wcd |
| | | * @date 2023-01-30 |
| | | * @date 2023-02-02 |
| | | **/ |
| | | @Data |
| | | public class SysUserCompanyDto extends BaseDTO implements Serializable { |
| | | public class CustomerResourcesDto extends BaseDTO implements Serializable { |
| | | |
| | | private Long id; |
| | | |
| | | /** 描述 */ |
| | | private String description; |
| | | /** 标题 */ |
| | | private String title; |
| | | |
| | | /** 标签 */ |
| | | private String label; |
| | | /** 分类 */ |
| | | private String classification; |
| | | |
| | | /** 值 */ |
| | | private String value; |
| | | /** 记录时间 */ |
| | | private Timestamp recordTime; |
| | | |
| | | /** 用户id */ |
| | | private Long userId; |
| | | /** 记录内容 */ |
| | | private String recordContent; |
| | | |
| | | /** 开启提醒(提醒时间) */ |
| | | private Timestamp openingTime; |
| | | |
| | | /** 备注 */ |
| | | private String remarks; |
| | | } |
copy from eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/service/dto/SysUserCompanyQueryCriteria.java
copy to eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/service/dto/CustomerResourcesQueryCriteria.java
| File was copied from eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/service/dto/SysUserCompanyQueryCriteria.java |
| | |
| | | /** |
| | | * @website https://eladmin.vip |
| | | * @author wcd |
| | | * @date 2023-01-30 |
| | | * @date 2023-02-02 |
| | | **/ |
| | | @Data |
| | | public class SysUserCompanyQueryCriteria { |
| | | public class CustomerResourcesQueryCriteria{ |
| | | |
| | | @Query(type = Query.Type.INNER_LIKE) |
| | | private String label; |
| | | //标题 |
| | | @Query(type = Query.Type.INNER_LIKE, propName = "title") |
| | | private String title; |
| | | |
| | | //分类 |
| | | @Query(type = Query.Type.INNER_LIKE, propName = "classification") |
| | | private String classification; |
| | | } |
copy from eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/service/dto/SysUserCompanyDto.java
copy to eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/service/dto/CustomerResourcesUserDto.java
| File was copied from eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/service/dto/SysUserCompanyDto.java |
| | |
| | | import lombok.Data; |
| | | import me.zhengjie.base.BaseDTO; |
| | | |
| | | import java.sql.Timestamp; |
| | | import java.io.Serializable; |
| | | |
| | | /** |
| | | * @website https://eladmin.vip |
| | | * @description / |
| | | * @author wcd |
| | | * @date 2023-01-30 |
| | | * @date 2023-02-03 |
| | | **/ |
| | | @Data |
| | | public class SysUserCompanyDto extends BaseDTO implements Serializable { |
| | | public class CustomerResourcesUserDto extends BaseDTO implements Serializable { |
| | | |
| | | private Long id; |
| | | |
| | | /** 描述 */ |
| | | private String description; |
| | | |
| | | /** 标签 */ |
| | | private String label; |
| | | |
| | | /** 值 */ |
| | | private String value; |
| | | /** 客户资源 id */ |
| | | private Long customerResourcesId; |
| | | |
| | | /** 用户id */ |
| | | private Long userId; |
| | | |
| | | } |
copy from eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/service/dto/SysUserCompanyQueryCriteria.java
copy to eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/service/dto/CustomerResourcesUserQueryCriteria.java
| File was copied from eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/service/dto/SysUserCompanyQueryCriteria.java |
| | |
| | | /** |
| | | * @website https://eladmin.vip |
| | | * @author wcd |
| | | * @date 2023-01-30 |
| | | * @date 2023-02-03 |
| | | **/ |
| | | @Data |
| | | public class SysUserCompanyQueryCriteria { |
| | | |
| | | @Query(type = Query.Type.INNER_LIKE) |
| | | private String label; |
| | | public class CustomerResourcesUserQueryCriteria{ |
| | | } |
| File was renamed from eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/service/dto/SysUserCompanyDto.java |
| | |
| | | * @date 2023-01-30 |
| | | **/ |
| | | @Data |
| | | public class SysUserCompanyDto extends BaseDTO implements Serializable { |
| | | public class SysCompanyDto extends BaseDTO implements Serializable { |
| | | |
| | | private Long id; |
| | | |
| | |
| | | |
| | | /** 标签 */ |
| | | private String label; |
| | | |
| | | /** 值 */ |
| | | private String value; |
| | | |
| | | /** 用户id */ |
| | | private Long userId; |
| File was renamed from eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/service/dto/SysUserCompanyQueryCriteria.java |
| | |
| | | * @date 2023-01-30 |
| | | **/ |
| | | @Data |
| | | public class SysUserCompanyQueryCriteria { |
| | | public class SysCompanyQueryCriteria { |
| | | |
| | | @Query(type = Query.Type.INNER_LIKE) |
| | | private String label; |
| | |
| | | |
| | | /** 备注 */ |
| | | private String remarks; |
| | | |
| | | /** 相关文件 */ |
| | | private String relatedDocuments; |
| | | } |
| | |
| | | |
| | | private Long levelId; |
| | | |
| | | private String levelName; |
| | | |
| | | private String gender; |
| | | |
| | | private String avatarName; |
| | |
| | | private Date pwdResetTime; |
| | | |
| | | // 魏传栋 - 始 |
| | | private String company; |
| | | private Long companyId; |
| | | // 魏传栋 - 终 |
| | | } |
| 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.system.service.impl; |
| | | |
| | | import me.zhengjie.modules.constant.Constant; |
| | | import me.zhengjie.modules.quartz.service.OpaiDingTalkService; |
| | | import me.zhengjie.modules.system.domain.CustomerResources; |
| | | import me.zhengjie.modules.system.domain.CustomerResourcesUser; |
| | | import me.zhengjie.modules.system.domain.User; |
| | | import me.zhengjie.modules.system.repository.CustomerResourcesUserRepository; |
| | | import me.zhengjie.modules.system.repository.UserRepository; |
| | | import me.zhengjie.utils.ValidationUtil; |
| | | import me.zhengjie.utils.FileUtil; |
| | | import lombok.RequiredArgsConstructor; |
| | | import me.zhengjie.modules.system.repository.CustomerResourcesRepository; |
| | | import me.zhengjie.modules.system.service.CustomerResourcesService; |
| | | import me.zhengjie.modules.system.service.dto.CustomerResourcesDto; |
| | | import me.zhengjie.modules.system.service.dto.CustomerResourcesQueryCriteria; |
| | | import me.zhengjie.modules.system.service.mapstruct.CustomerResourcesMapper; |
| | | import org.apache.commons.lang3.ObjectUtils; |
| | | 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.sql.Timestamp; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.*; |
| | | import java.io.IOException; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | |
| | | /** |
| | | * @website https://eladmin.vip |
| | | * @description 服务实现 |
| | | * @author wcd |
| | | * @date 2023-02-02 |
| | | **/ |
| | | @Service |
| | | @Transactional |
| | | @RequiredArgsConstructor |
| | | public class CustomerResourcesServiceImpl implements CustomerResourcesService { |
| | | |
| | | private final CustomerResourcesRepository customerResourcesRepository; |
| | | private final CustomerResourcesMapper customerResourcesMapper; |
| | | private final UserRepository userRepository; |
| | | private final OpaiDingTalkService opaiDingTalkService; |
| | | private final CustomerResourcesUserRepository customerResourcesUserRepository; |
| | | |
| | | @Override |
| | | public Map<String,Object> queryAll(CustomerResourcesQueryCriteria criteria, Pageable pageable){ |
| | | Page<CustomerResources> page = customerResourcesRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable); |
| | | return PageUtil.toPage(page.map(customerResourcesMapper::toDto)); |
| | | } |
| | | |
| | | @Override |
| | | public List<CustomerResourcesDto> queryAll(CustomerResourcesQueryCriteria criteria){ |
| | | return customerResourcesMapper.toDto(customerResourcesRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder))); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional |
| | | public CustomerResourcesDto findById(Long id) { |
| | | CustomerResources customerResources = customerResourcesRepository.findById(id).orElseGet(CustomerResources::new); |
| | | ValidationUtil.isNull(customerResources.getId(),"CustomerResources","id",id); |
| | | return customerResourcesMapper.toDto(customerResources); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void create(CustomerResources resources) throws Exception { |
| | | // 提醒时间为空,状态为提醒说明是立即提醒,发送钉钉消息 |
| | | if(ObjectUtils.isEmpty(resources.getOpeningTime()) && resources.getRemind().equals(Constant.RESOURCES_TYPE_REMIND)){ |
| | | // 调用 |
| | | resources = setDingding(resources); |
| | | } |
| | | // 保存 |
| | | customerResourcesRepository.save(resources); |
| | | // 中间表添加数据 |
| | | if(resources.getRemindPeople().size() != 0){ |
| | | for(int i = 0; i < resources.getRemindPeople().size(); i++){ |
| | | // 中间表添加数据 |
| | | CustomerResourcesUser customerResourcesUser = new CustomerResourcesUser(); |
| | | customerResourcesUser.setCustomerResourcesId(resources.getId()); |
| | | customerResourcesUser.setUserId(resources.getRemindPeople().get(i)); |
| | | customerResourcesUserRepository.save(customerResourcesUser); |
| | | } |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void update(CustomerResources resources) throws Exception { |
| | | CustomerResources customerResources = customerResourcesRepository.findById(resources.getId()).orElseGet(CustomerResources::new); |
| | | ValidationUtil.isNull( customerResources.getId(),"CustomerResources","id",resources.getId()); |
| | | customerResources.copy(resources); |
| | | // 提醒时间为空,状态为提醒说明是立即提醒,发送钉钉消息 |
| | | if(ObjectUtils.isEmpty(resources.getOpeningTime()) && resources.getRemind().equals(Constant.RESOURCES_TYPE_REMIND)){ |
| | | // 调用 |
| | | customerResources = setDingding(customerResources); |
| | | }else if(resources.getRemind().equals(Constant.RESOURCES_TYPE_NOREMIND)){ |
| | | customerResources.setOpeningTime(null); |
| | | } |
| | | customerResourcesRepository.save(customerResources); |
| | | // 删除中间表数据 |
| | | List<CustomerResourcesUser> customerResourcesUserList = customerResourcesUserRepository.findByCustomerResourcesId(customerResources.getId()); |
| | | for(int i = 0; i < customerResourcesUserList.size(); i++){ |
| | | customerResourcesUserRepository.deleteByCustomerResourcesId(customerResourcesUserList.get(i).getCustomerResourcesId()); |
| | | } |
| | | // 中间表添加数据 |
| | | if(resources.getRemindPeople().size() != 0){ |
| | | for(int i = 0; i < resources.getRemindPeople().size(); i++){ |
| | | // 中间表添加数据 |
| | | CustomerResourcesUser customerResourcesUser = new CustomerResourcesUser(); |
| | | customerResourcesUser.setCustomerResourcesId(resources.getId()); |
| | | customerResourcesUser.setUserId(resources.getRemindPeople().get(i)); |
| | | customerResourcesUserRepository.save(customerResourcesUser); |
| | | } |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 发送钉钉(公共) |
| | | * @param resources |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | public CustomerResources setDingding(CustomerResources resources) throws Exception { |
| | | // 获取当前时间 |
| | | SimpleDateFormat sf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
| | | String time = sf.format(new Date()); |
| | | resources.setOpeningTime(Timestamp.valueOf(time)); |
| | | // 获取存储用户钉钉号 |
| | | List<String> dingDingList = new ArrayList<>(); |
| | | if(resources.getRemindPeople().size() != 0){ |
| | | for(Long userId : resources.getRemindPeople()){ |
| | | // 查询用户 |
| | | User user = userRepository.findById(userId).orElseGet(User::new); |
| | | if(ObjectUtils.isNotEmpty(user.getDingding())){ |
| | | dingDingList.add(user.getDingding()); |
| | | } |
| | | } |
| | | } |
| | | // 发送内容至钉钉 |
| | | opaiDingTalkService.sendNotice(dingDingList, "客户资源管理提示", "### 客户资源管理提示 \n >" + |
| | | " \n 标题:" + resources.getTitle() + |
| | | " \n 分类: " + resources.getClassification() + |
| | | " \n 客户资源有变动,请登录PMS系统查看。", "card"); |
| | | return resources; |
| | | } |
| | | |
| | | @Override |
| | | public void deleteAll(Long[] ids) { |
| | | for (Long id : ids) { |
| | | // 查询中间表 |
| | | List<CustomerResourcesUser> customerResourcesUserList = customerResourcesUserRepository.findByCustomerResourcesId(id); |
| | | for(int i = 0; i < customerResourcesUserList.size(); i++){ |
| | | customerResourcesUserRepository.deleteByCustomerResourcesId(customerResourcesUserList.get(i).getCustomerResourcesId()); |
| | | } |
| | | customerResourcesRepository.deleteById(id); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public void download(List<CustomerResourcesDto> all, HttpServletResponse response) throws IOException { |
| | | List<Map<String, Object>> list = new ArrayList<>(); |
| | | for (CustomerResourcesDto customerResources : all) { |
| | | Map<String,Object> map = new LinkedHashMap<>(); |
| | | map.put("标题", customerResources.getTitle()); |
| | | map.put("分类", customerResources.getClassification()); |
| | | map.put("记录时间", customerResources.getRecordTime()); |
| | | map.put("记录内容", customerResources.getRecordContent()); |
| | | map.put("提醒时间", customerResources.getOpeningTime() == null ? "不提醒" : customerResources.getOpeningTime()); |
| | | map.put("备注", customerResources.getRemarks()); |
| | | map.put("创建者", customerResources.getCreateBy()); |
| | | map.put("创建时间", customerResources.getCreateTime()); |
| | | map.put("更新者", customerResources.getUpdateBy()); |
| | | map.put("更新时间", customerResources.getUpdateTime()); |
| | | list.add(map); |
| | | } |
| | | FileUtil.downloadExcel(list, response); |
| | | } |
| | | |
| | | /** |
| | | * 查询被提醒人 |
| | | * @param resources |
| | | * @return |
| | | */ |
| | | @Override |
| | | public List<User> getRemindUser(CustomerResources resources) { |
| | | // 根据客户资源管理Id查询被提醒人表 |
| | | List<CustomerResourcesUser> customerResourcesUserList = customerResourcesUserRepository.findByCustomerResourcesId(resources.getId()); |
| | | // 用户信息 |
| | | List<User> userList = new ArrayList<>(); |
| | | for(int i = 0; i < customerResourcesUserList.size(); i++){ |
| | | // 查询用户表 |
| | | User user = userRepository.findById(customerResourcesUserList.get(i).getUserId()).orElseGet(User::new); |
| | | userList.add(user); |
| | | } |
| | | return userList; |
| | | } |
| | | } |
| 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.system.service.impl; |
| | | |
| | | import me.zhengjie.modules.system.domain.CustomerResourcesUser; |
| | | import me.zhengjie.utils.ValidationUtil; |
| | | import me.zhengjie.utils.FileUtil; |
| | | import lombok.RequiredArgsConstructor; |
| | | import me.zhengjie.modules.system.repository.CustomerResourcesUserRepository; |
| | | import me.zhengjie.modules.system.service.CustomerResourcesUserService; |
| | | import me.zhengjie.modules.system.service.dto.CustomerResourcesUserDto; |
| | | import me.zhengjie.modules.system.service.dto.CustomerResourcesUserQueryCriteria; |
| | | import me.zhengjie.modules.system.service.mapstruct.CustomerResourcesUserMapper; |
| | | 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.util.List; |
| | | import java.util.Map; |
| | | import java.io.IOException; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.util.ArrayList; |
| | | import java.util.LinkedHashMap; |
| | | |
| | | /** |
| | | * @website https://eladmin.vip |
| | | * @description 服务实现 |
| | | * @author wcd |
| | | * @date 2023-02-03 |
| | | **/ |
| | | @Service |
| | | @RequiredArgsConstructor |
| | | public class CustomerResourcesUserServiceImpl implements CustomerResourcesUserService { |
| | | |
| | | private final CustomerResourcesUserRepository customerResourcesUserRepository; |
| | | private final CustomerResourcesUserMapper customerResourcesUserMapper; |
| | | |
| | | @Override |
| | | public Map<String,Object> queryAll(CustomerResourcesUserQueryCriteria criteria, Pageable pageable){ |
| | | Page<CustomerResourcesUser> page = customerResourcesUserRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable); |
| | | return PageUtil.toPage(page.map(customerResourcesUserMapper::toDto)); |
| | | } |
| | | |
| | | @Override |
| | | public List<CustomerResourcesUserDto> queryAll(CustomerResourcesUserQueryCriteria criteria){ |
| | | return customerResourcesUserMapper.toDto(customerResourcesUserRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder))); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional |
| | | public CustomerResourcesUserDto findById(Long id) { |
| | | CustomerResourcesUser customerResourcesUser = customerResourcesUserRepository.findById(id).orElseGet(CustomerResourcesUser::new); |
| | | ValidationUtil.isNull(customerResourcesUser.getId(),"CustomerResourcesUser","id",id); |
| | | return customerResourcesUserMapper.toDto(customerResourcesUser); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public CustomerResourcesUserDto create(CustomerResourcesUser resources) { |
| | | return customerResourcesUserMapper.toDto(customerResourcesUserRepository.save(resources)); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void update(CustomerResourcesUser resources) { |
| | | CustomerResourcesUser customerResourcesUser = customerResourcesUserRepository.findById(resources.getId()).orElseGet(CustomerResourcesUser::new); |
| | | ValidationUtil.isNull( customerResourcesUser.getId(),"CustomerResourcesUser","id",resources.getId()); |
| | | customerResourcesUser.copy(resources); |
| | | customerResourcesUserRepository.save(customerResourcesUser); |
| | | } |
| | | |
| | | @Override |
| | | public void deleteAll(Long[] ids) { |
| | | for (Long id : ids) { |
| | | customerResourcesUserRepository.deleteById(id); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public void download(List<CustomerResourcesUserDto> all, HttpServletResponse response) throws IOException { |
| | | List<Map<String, Object>> list = new ArrayList<>(); |
| | | for (CustomerResourcesUserDto customerResourcesUser : all) { |
| | | Map<String,Object> map = new LinkedHashMap<>(); |
| | | map.put("客户资源 id", customerResourcesUser.getCustomerResourcesId()); |
| | | map.put("用户 id", customerResourcesUser.getUserId()); |
| | | map.put("创建者", customerResourcesUser.getCreateBy()); |
| | | map.put("创建时间", customerResourcesUser.getCreateTime()); |
| | | map.put("更新者", customerResourcesUser.getUpdateBy()); |
| | | map.put("更新时间", customerResourcesUser.getUpdateTime()); |
| | | list.add(map); |
| | | } |
| | | FileUtil.downloadExcel(list, response); |
| | | } |
| | | } |
| 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.system.service.impl; |
| | | |
| | | import me.zhengjie.modules.system.domain.SysCompany; |
| | | import me.zhengjie.modules.system.domain.User; |
| | | import me.zhengjie.modules.system.repository.UserRepository; |
| | | import me.zhengjie.modules.system.service.dto.SysCompanyDto; |
| | | import me.zhengjie.modules.system.service.mapstruct.SysCompanyMapper; |
| | | import me.zhengjie.utils.ValidationUtil; |
| | | import me.zhengjie.utils.FileUtil; |
| | | import lombok.RequiredArgsConstructor; |
| | | import me.zhengjie.modules.system.repository.SysCompanyRepository; |
| | | import me.zhengjie.modules.system.service.SysCompanyService; |
| | | import me.zhengjie.modules.system.service.dto.SysCompanyQueryCriteria; |
| | | 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.util.List; |
| | | import java.util.Map; |
| | | import java.io.IOException; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.util.ArrayList; |
| | | import java.util.LinkedHashMap; |
| | | |
| | | /** |
| | | * @website https://eladmin.vip |
| | | * @description 服务实现 |
| | | * @author wcd |
| | | * @date 2023-01-30 |
| | | **/ |
| | | @Service |
| | | @RequiredArgsConstructor |
| | | public class SysCompanyServiceImpl implements SysCompanyService { |
| | | |
| | | private final SysCompanyRepository sysCompanyRepository; |
| | | private final SysCompanyMapper sysCompanyMapper; |
| | | private final UserRepository userRepository; |
| | | |
| | | @Override |
| | | public Map<String,Object> queryAll(SysCompanyQueryCriteria criteria, Pageable pageable){ |
| | | Page<SysCompany> page = sysCompanyRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable); |
| | | return PageUtil.toPage(page.map(sysCompanyMapper::toDto)); |
| | | } |
| | | |
| | | @Override |
| | | public List<SysCompanyDto> queryAll(SysCompanyQueryCriteria criteria){ |
| | | return sysCompanyMapper.toDto(sysCompanyRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder))); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional |
| | | public SysCompanyDto findById(Long id) { |
| | | SysCompany sysCompany = sysCompanyRepository.findById(id).orElseGet(SysCompany::new); |
| | | ValidationUtil.isNull(sysCompany.getId(),"SystemSetting","id",id); |
| | | return sysCompanyMapper.toDto(sysCompany); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public SysCompanyDto create(SysCompany resources) { |
| | | return sysCompanyMapper.toDto(sysCompanyRepository.save(resources)); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void update(SysCompany resources) { |
| | | SysCompany sysCompany = sysCompanyRepository.findById(resources.getId()).orElseGet(SysCompany::new); |
| | | ValidationUtil.isNull( sysCompany.getId(),"SystemSetting","id",resources.getId()); |
| | | sysCompany.copy(resources); |
| | | sysCompanyRepository.save(sysCompany); |
| | | } |
| | | |
| | | @Override |
| | | public void deleteAll(Long[] ids) { |
| | | for (Long id : ids) { |
| | | sysCompanyRepository.deleteById(id); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public void download(List<SysCompanyDto> all, HttpServletResponse response) throws IOException { |
| | | List<Map<String, Object>> list = new ArrayList<>(); |
| | | for (SysCompanyDto systemSetting : all) { |
| | | Map<String,Object> map = new LinkedHashMap<>(); |
| | | map.put("标签", systemSetting.getLabel()); |
| | | map.put("描述", systemSetting.getDescription()); |
| | | list.add(map); |
| | | } |
| | | FileUtil.downloadExcel(list, response); |
| | | } |
| | | |
| | | /** |
| | | * 选择用户改变公司 |
| | | * @param resources |
| | | * @return |
| | | */ |
| | | @Override |
| | | public SysCompany getCompName(SysCompanyDto resources) { |
| | | // 查询用户表 |
| | | User user = userRepository.findById(Long.valueOf(resources.getUserId())).orElseGet(User::new); |
| | | // 查询公司表 |
| | | SysCompany sysCompany = sysCompanyRepository.findById(user.getId()).orElseGet(SysCompany::new); |
| | | return sysCompany; |
| | | } |
| | | } |
| | |
| | | */ |
| | | package me.zhengjie.modules.system.service.impl; |
| | | |
| | | import me.zhengjie.modules.system.domain.SysUserCompany; |
| | | import me.zhengjie.modules.system.domain.SysCompany; |
| | | import me.zhengjie.modules.system.domain.SysUserContract; |
| | | import me.zhengjie.modules.system.domain.User; |
| | | import me.zhengjie.modules.system.repository.SysUserCompanyRepository; |
| | | import me.zhengjie.modules.system.repository.SysCompanyRepository; |
| | | import me.zhengjie.modules.system.repository.UserRepository; |
| | | import me.zhengjie.modules.system.service.dto.SysUserContractDto; |
| | | import me.zhengjie.modules.system.service.mapstruct.SysUserContractMapper; |
| | |
| | | private final SysUserContractRepository sysUserContractRepository; |
| | | private final SysUserContractMapper sysUserContractMapper; |
| | | private final UserRepository userRepository; |
| | | private final SysUserCompanyRepository sysUserCompanyRepository; |
| | | private final SysCompanyRepository sysCompanyRepository; |
| | | |
| | | @Override |
| | | public Map<String,Object> queryAll(SysUserContractQueryCriteria criteria, Pageable pageable){ |
| | |
| | | User user = userRepository.findById(sysUserContractDto.getUserId()).orElseGet(User::new); |
| | | sysUserContractDto.setUserName(user.getNickName()); |
| | | //查询公司信息 |
| | | SysUserCompany sysUserCompany = sysUserCompanyRepository.findById(sysUserContractDto.getCompanyId()).orElseGet(SysUserCompany::new); |
| | | sysUserContractDto.setCompName(sysUserCompany.getLabel()); |
| | | SysCompany sysCompany = sysCompanyRepository.findById(sysUserContractDto.getCompanyId()).orElseGet(SysCompany::new); |
| | | sysUserContractDto.setCompName(sysCompany.getLabel()); |
| | | return sysUserContractDto; |
| | | } |
| | | }; |
| | |
| | | for (SysUserContractDto sysContract : all) { |
| | | Map<String,Object> map = new LinkedHashMap<>(); |
| | | User user = userRepository.findById(sysContract.getUserId()).orElseGet(User::new); |
| | | SysUserCompany sysUserCompany = sysUserCompanyRepository.findById(sysContract.getCompanyId()).orElseGet(SysUserCompany::new); |
| | | SysCompany sysCompany = sysCompanyRepository.findById(sysContract.getCompanyId()).orElseGet(SysCompany::new); |
| | | map.put("所属员工", user.getNickName()); |
| | | map.put("合同名称", sysContract.getContractName()); |
| | | map.put("合同开始时间", sysContract.getContractStartTime()); |
| | | map.put("合同结束时间", sysContract.getContractEndTime()); |
| | | map.put("公司", sysUserCompany.getLabel()); |
| | | map.put("所属公司", sysCompany.getLabel()); |
| | | map.put("创建者", sysContract.getCreateBy()); |
| | | map.put("创建时间", sysContract.getCreateTime()); |
| | | map.put("更新者", sysContract.getUpdateBy()); |
| | |
| | | private final SysConfigHolidayRepository sysConfigHolidayRepository; |
| | | private final AttendanceGoOutRepository attendanceGoOutRepository; |
| | | private final AttendanceBusinessTravelRepository attendanceBusinessTravelRepository; |
| | | private final SysUserCompanyRepository sysUserCompanyRepository; |
| | | private final SysCompanyRepository sysCompanyRepository; |
| | | |
| | | @Override |
| | | public Object queryAll(UserQueryCriteria criteria, Pageable pageable) { |
| | |
| | | |
| | | @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 |
| | |
| | | user.setJobs(resources.getJobs()); |
| | | user.setPhone(resources.getPhone()); |
| | | user.setNickName(resources.getNickName()); |
| | | user.setCompany(resources.getCompany()); |
| | | user.setCompanyId(resources.getCompanyId()); |
| | | user.setGender(resources.getGender()); |
| | | user.setBirthday(resources.getBirthday()); |
| | | user.setAddress(resources.getAddress()); |
| | |
| | | for (UserDto userDTO : queryAll) { |
| | | List<String> roles = userDTO.getRoles().stream().map(RoleSmallDto::getName).collect(Collectors.toList()); |
| | | String levelName = userDTO.getLevelId() != null ? sysLevelRepository.findById(userDTO.getLevelId()).orElseGet(SysLevel::new).getName() : ""; |
| | | SysUserCompany sysUserCompany = sysUserCompanyRepository.findByValue(userDTO.getCompany()); |
| | | SysCompany sysCompany = sysCompanyRepository.findById(userDTO.getCompanyId()).orElseGet(SysCompany::new); |
| | | Map<String, Object> map = new LinkedHashMap<>(); |
| | | map.put("用户名", userDTO.getUsername()); |
| | | map.put("角色", roles); |
| | |
| | | map.put("钉钉号", userDTO.getDingding()); |
| | | map.put("排班", userDTO.getSysRostering().getName()); |
| | | map.put("级别", levelName); |
| | | map.put("所属公司", sysUserCompany == null ? "" : sysUserCompany.getLabel()); |
| | | map.put("所属公司", sysCompany == null ? "" : sysCompany.getLabel()); |
| | | map.put("状态", userDTO.getEnabled() ? "启用" : "禁用"); |
| | | map.put("手机号码", userDTO.getPhone()); |
| | | map.put("修改密码的时间", userDTO.getPwdResetTime()); |
copy from eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/service/mapstruct/SysUserCompanyMapper.java
copy to eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/service/mapstruct/CustomerResourcesMapper.java
| File was copied from eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/service/mapstruct/SysUserCompanyMapper.java |
| | |
| | | package me.zhengjie.modules.system.service.mapstruct; |
| | | |
| | | import me.zhengjie.base.BaseMapper; |
| | | import me.zhengjie.modules.system.domain.SysUserCompany; |
| | | import me.zhengjie.modules.system.service.dto.SysUserCompanyDto; |
| | | import me.zhengjie.modules.system.domain.CustomerResources; |
| | | import me.zhengjie.modules.system.service.dto.CustomerResourcesDto; |
| | | import org.mapstruct.Mapper; |
| | | import org.mapstruct.ReportingPolicy; |
| | | |
| | | /** |
| | | * @website https://eladmin.vip |
| | | * @author wcd |
| | | * @date 2023-01-30 |
| | | * @date 2023-02-02 |
| | | **/ |
| | | @Mapper(componentModel = "spring", unmappedTargetPolicy = ReportingPolicy.IGNORE) |
| | | public interface SysUserCompanyMapper extends BaseMapper<SysUserCompanyDto, SysUserCompany> { |
| | | public interface CustomerResourcesMapper extends BaseMapper<CustomerResourcesDto, CustomerResources> { |
| | | |
| | | } |
copy from eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/service/mapstruct/SysUserCompanyMapper.java
copy to eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/service/mapstruct/CustomerResourcesUserMapper.java
| File was copied from eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/service/mapstruct/SysUserCompanyMapper.java |
| | |
| | | package me.zhengjie.modules.system.service.mapstruct; |
| | | |
| | | import me.zhengjie.base.BaseMapper; |
| | | import me.zhengjie.modules.system.domain.SysUserCompany; |
| | | import me.zhengjie.modules.system.service.dto.SysUserCompanyDto; |
| | | import me.zhengjie.modules.system.domain.CustomerResourcesUser; |
| | | import me.zhengjie.modules.system.service.dto.CustomerResourcesUserDto; |
| | | import org.mapstruct.Mapper; |
| | | import org.mapstruct.ReportingPolicy; |
| | | |
| | | /** |
| | | * @website https://eladmin.vip |
| | | * @author wcd |
| | | * @date 2023-01-30 |
| | | * @date 2023-02-03 |
| | | **/ |
| | | @Mapper(componentModel = "spring", unmappedTargetPolicy = ReportingPolicy.IGNORE) |
| | | public interface SysUserCompanyMapper extends BaseMapper<SysUserCompanyDto, SysUserCompany> { |
| | | public interface CustomerResourcesUserMapper extends BaseMapper<CustomerResourcesUserDto, CustomerResourcesUser> { |
| | | |
| | | } |
| File was renamed from eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/service/mapstruct/SysUserCompanyMapper.java |
| | |
| | | package me.zhengjie.modules.system.service.mapstruct; |
| | | |
| | | import me.zhengjie.base.BaseMapper; |
| | | import me.zhengjie.modules.system.domain.SysUserCompany; |
| | | import me.zhengjie.modules.system.service.dto.SysUserCompanyDto; |
| | | import me.zhengjie.modules.system.domain.SysCompany; |
| | | import me.zhengjie.modules.system.service.dto.SysCompanyDto; |
| | | import org.mapstruct.Mapper; |
| | | import org.mapstruct.ReportingPolicy; |
| | | |
| | |
| | | * @date 2023-01-30 |
| | | **/ |
| | | @Mapper(componentModel = "spring", unmappedTargetPolicy = ReportingPolicy.IGNORE) |
| | | public interface SysUserCompanyMapper extends BaseMapper<SysUserCompanyDto, SysUserCompany> { |
| | | public interface SysCompanyMapper extends BaseMapper<SysCompanyDto, SysCompany> { |
| | | |
| | | } |
| | |
| | | Double findSumConsumedWorkloadByProjectIdAndTaskId(Long projectId, Long taskId); |
| | | |
| | | /** |
| | | * 根据项目ID、任务ID查询 |
| | | * 根据项目ID、任务ID、用户ID查询 |
| | | * @param projectId |
| | | * @param taskId |
| | | * @return |
| | | */ |
| | | List<TaskDaliy> findByProjectIdAndTaskId(Long projectId, Long taskId); |
| | | List<TaskDaliy> findByProjectIdAndTaskIdAndUserId(Long projectId, Long taskId, Long userId); |
| | | |
| | | /** |
| | | * 根据项目ID查询任务日报信息 |
| | |
| | | /** |
| | | * 根据项目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); |
| | | } |
| | |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public TaskUserDto create(TaskUser resources) throws Exception { |
| | | //查询任务名称 |
| | | ProjectTask projectTask = projectTaskRepository.findById(resources.getTaskId()).orElseGet(ProjectTask::new); |
| | | Task task = taskRepository.findById(resources.getTaskId()).orElseGet(Task::new); |
| | | //查询字典 |
| | | DictDetail dict = dictDetailRepository.seleteByValue(resources.getTaskStatus()); |
| | | //发送钉钉给审批人 |
| | |
| | | User user = userRepository.findById(resources.getUserId()).orElseGet(User::new); |
| | | sendList.add(user.getDingding()); |
| | | opaiDingTalkService.sendNotice(sendList, "任务创建提醒", "### 任务创建提示 \n >" + |
| | | " \n 任务名称:" + projectTask.getName() + |
| | | " \n 任务名称:" + task.getName() + |
| | | " \n 当前任务状态: " + dict.getLabel() + |
| | | " \n 任务创建成功,请登录PMS系统查看。", "card"); |
| | | return taskUserMapper.toDto(taskUserRepository.save(resources)); |
| | |
| | | //查询字典 |
| | | DictDetail dict = dictDetailRepository.seleteByValue(resources.getTaskStatus()); |
| | | //查询任务名称 |
| | | ProjectTask projectTask = projectTaskRepository.findById(resources.getTaskId()).orElseGet(ProjectTask::new); |
| | | Task task = taskRepository.findById(resources.getTaskId()).orElseGet(Task::new); |
| | | //发送钉钉给审批人 |
| | | List<String> sendList = new ArrayList<>(); |
| | | //查询所属用户信息 |
| | |
| | | sendList.add(user.getDingding()); |
| | | opaiDingTalkService.sendNotice(sendList, "任务变更提醒", "### 任务变更提示 \n >" + |
| | | "项目名称:" + project.getName() + |
| | | " \n 任务名称:" + projectTask.getName() + |
| | | " \n 任务名称:" + task.getName() + |
| | | " \n 当前任务状态: " + dict.getLabel() + |
| | | " \n 当前任务有新的变更,请登录PMS系统查看。", "card"); |
| | | } |
| | |
| | | // 根据ID查询 |
| | | TaskUser taskUser = taskUserRepository.findById(id).orElseGet(TaskUser::new); |
| | | ValidationUtil.isNull(taskUser.getId(),"TaskUser","id",id); |
| | | // 根据项目ID、任务ID查询项目日报列表 |
| | | List<TaskDaliy> taskDaliyList = taskDaliyRepository.findByProjectIdAndTaskId(taskUser.getProjectId(), taskUser.getTaskId()); |
| | | // 根据项目ID、任务ID、用户ID查询项目日报列表 |
| | | List<TaskDaliy> taskDaliyList = taskDaliyRepository.findByProjectIdAndTaskIdAndUserId(taskUser.getProjectId(), taskUser.getTaskId(), taskUser.getUserId()); |
| | | // 判断项目日报列表长度 |
| | | if (taskDaliyList.size() > 0) { |
| | | throw new BadRequestException("已填过项目日报的项目分配无法删除!"); |
| | |
| | | taskUserRepository.save(taskUser); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public List<Long> queryTaskUserIds(TaskUserQueryCriteria criteria){ |
| | | return taskUserRepository.findUserIdByTaskId(criteria.getTaskId()); |
| | | } |
| | | } |
| | |
| | | @ApiOperation("上传文件") |
| | | @PreAuthorize("@el.check('storage:add')") |
| | | public ResponseEntity<Object> createFile(@RequestParam String name, @RequestParam("file") MultipartFile file){ |
| | | localStorageService.create(name, file); |
| | | return new ResponseEntity<>(HttpStatus.CREATED); |
| | | LocalStorage localStorage = localStorageService.create(null, file); |
| | | return new ResponseEntity<>(localStorage, HttpStatus.CREATED); |
| | | } |
| | | |
| | | @ApiOperation("上传图片") |
| | |
| | | "core-js": "^2.6.12", |
| | | "echarts": "^4.2.1", |
| | | "echarts-wordcloud": "^1.1.3", |
| | | "element-china-area-data": "^5.0.2", |
| | | "element-ui": "^2.15.8", |
| | | "file-saver": "1.3.8", |
| | | "fuse.js": "3.4.4", |
| | |
| | | "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", |
copy from eladmin-web-master/src/api/system/sysUserCompany.js
copy to eladmin-web-master/src/api/assetManagement/assetManagement.js
| File was copied from eladmin-web-master/src/api/system/sysUserCompany.js |
| | |
| | | |
| | | export function getAll(params) { |
| | | return request({ |
| | | url: 'api/sysUserCompany/all', |
| | | url: 'api/assetManagement/all', |
| | | method: 'get', |
| | | params |
| | | }) |
| | |
| | | |
| | | export function add(data) { |
| | | return request({ |
| | | url: 'api/sysUserCompany', |
| | | url: 'api/assetManagement', |
| | | method: 'post', |
| | | data |
| | | }) |
| | |
| | | |
| | | export function del(ids) { |
| | | return request({ |
| | | url: 'api/sysUserCompany/', |
| | | url: 'api/assetManagement/', |
| | | method: 'delete', |
| | | data: ids |
| | | }) |
| | |
| | | |
| | | export function edit(data) { |
| | | return request({ |
| | | url: 'api/sysUserCompany', |
| | | url: 'api/assetManagement', |
| | | method: 'put', |
| | | data |
| | | }) |
| | | } |
| | | |
| | | export function getCompName(data) { |
| | | export function divide(data) { |
| | | return request({ |
| | | url: 'api/sysUserCompany/getCompName', |
| | | url: 'api/assetManagement/divide', |
| | | method: 'post', |
| | | data |
| | | }) |
| | | } |
| | | |
| | | export default { add, edit, del, getAll, getCompName } |
| | | export default { add, edit, del, getAll, divide } |
| New file |
| | |
| | | import request from '@/utils/request' |
| | | |
| | | export function getAll(params) { |
| | | return request({ |
| | | url: 'api/assetUseManagement/all', |
| | | method: 'get', |
| | | params |
| | | }) |
| | | } |
| | | |
| | | export function add(data) { |
| | | return request({ |
| | | url: 'api/assetUseManagement', |
| | | method: 'post', |
| | | data |
| | | }) |
| | | } |
| | | |
| | | export function del(ids) { |
| | | return request({ |
| | | url: 'api/assetUseManagement/', |
| | | method: 'delete', |
| | | data: ids |
| | | }) |
| | | } |
| | | |
| | | export function edit(data) { |
| | | return request({ |
| | | url: 'api/assetUseManagement', |
| | | method: 'put', |
| | | data |
| | | }) |
| | | } |
| | | |
| | | export default { add, edit, del, getAll } |
| New file |
| | |
| | | import request from '@/utils/request' |
| | | |
| | | export function getAll(params) { |
| | | return request({ |
| | | url: 'api/attendanceMonth/all', |
| | | method: 'get', |
| | | params |
| | | }) |
| | | } |
| | | |
| | | export function add(data) { |
| | | return request({ |
| | | url: 'api/attendanceMonth', |
| | | method: 'post', |
| | | data |
| | | }) |
| | | } |
| | | |
| | | export function del(ids) { |
| | | return request({ |
| | | url: 'api/attendanceMonth/', |
| | | method: 'delete', |
| | | data: ids |
| | | }) |
| | | } |
| | | |
| | | export function edit(data) { |
| | | return request({ |
| | | url: 'api/attendanceMonth', |
| | | method: 'put', |
| | | data |
| | | }) |
| | | } |
| | | |
| | | export function updateIsConfirm(data) { |
| | | return request({ |
| | | url: 'api/attendanceMonth/updateIsConfirm', |
| | | method: 'put', |
| | | data |
| | | }) |
| | | } |
| | | |
| | | export function publicity(ids) { |
| | | return request({ |
| | | url: 'api/attendanceMonth/publicity/', |
| | | method: 'put', |
| | | data: ids |
| | | }) |
| | | } |
| | | |
| | | export default { add, edit, del, getAll, updateIsConfirm, publicity } |
| New file |
| | |
| | | import request from '@/utils/request' |
| | | |
| | | export function getAll(params) { |
| | | return request({ |
| | | url: 'api/capitalFlow/all', |
| | | method: 'get', |
| | | params |
| | | }) |
| | | } |
| | | |
| | | export function add(data) { |
| | | return request({ |
| | | url: 'api/capitalFlow', |
| | | method: 'post', |
| | | data |
| | | }) |
| | | } |
| | | |
| | | export function del(ids) { |
| | | return request({ |
| | | url: 'api/capitalFlow/', |
| | | method: 'delete', |
| | | data: ids |
| | | }) |
| | | } |
| | | |
| | | export function edit(data) { |
| | | return request({ |
| | | url: 'api/capitalFlow', |
| | | method: 'put', |
| | | data |
| | | }) |
| | | } |
| | | |
| | | export default { getAll, add, edit, del } |
| New file |
| | |
| | | import request from '@/utils/request' |
| | | |
| | | export function getAll(params) { |
| | | return request({ |
| | | url: 'api/capitalFlowExpend/all', |
| | | method: 'get', |
| | | params |
| | | }) |
| | | } |
| | | |
| | | export function add(data) { |
| | | return request({ |
| | | url: 'api/capitalFlowExpend', |
| | | method: 'post', |
| | | data |
| | | }) |
| | | } |
| | | |
| | | export function del(ids) { |
| | | return request({ |
| | | url: 'api/capitalFlowExpend/', |
| | | method: 'delete', |
| | | data: ids |
| | | }) |
| | | } |
| | | |
| | | export function edit(data) { |
| | | return request({ |
| | | url: 'api/capitalFlowExpend', |
| | | method: 'put', |
| | | data |
| | | }) |
| | | } |
| | | |
| | | export default { getAll, add, edit, del } |
| New file |
| | |
| | | import request from '@/utils/request' |
| | | |
| | | export function getAll(params) { |
| | | return request({ |
| | | url: 'api/capitalFlowIncome/all', |
| | | method: 'get', |
| | | params |
| | | }) |
| | | } |
| | | |
| | | export function add(data) { |
| | | return request({ |
| | | url: 'api/capitalFlowIncome', |
| | | method: 'post', |
| | | data |
| | | }) |
| | | } |
| | | |
| | | export function del(ids) { |
| | | return request({ |
| | | url: 'api/capitalFlowIncome/', |
| | | method: 'delete', |
| | | data: ids |
| | | }) |
| | | } |
| | | |
| | | export function edit(data) { |
| | | return request({ |
| | | url: 'api/capitalFlowIncome', |
| | | method: 'put', |
| | | data |
| | | }) |
| | | } |
| | | |
| | | export default { getAll, add, edit, del } |
copy from eladmin-web-master/src/api/system/sysUserCompany.js
copy to eladmin-web-master/src/api/conferenceRoom/meetingRoom.js
| File was copied from eladmin-web-master/src/api/system/sysUserCompany.js |
| | |
| | | |
| | | export function getAll(params) { |
| | | return request({ |
| | | url: 'api/sysUserCompany/all', |
| | | url: 'api/meetingRoom/all', |
| | | method: 'get', |
| | | params |
| | | }) |
| | |
| | | |
| | | export function add(data) { |
| | | return request({ |
| | | url: 'api/sysUserCompany', |
| | | url: 'api/meetingRoom', |
| | | method: 'post', |
| | | data |
| | | }) |
| | |
| | | |
| | | export function del(ids) { |
| | | return request({ |
| | | url: 'api/sysUserCompany/', |
| | | url: 'api/meetingRoom/', |
| | | method: 'delete', |
| | | data: ids |
| | | }) |
| | |
| | | |
| | | export function edit(data) { |
| | | return request({ |
| | | url: 'api/sysUserCompany', |
| | | url: 'api/meetingRoom', |
| | | method: 'put', |
| | | data |
| | | }) |
| | | } |
| | | |
| | | export function getCompName(data) { |
| | | export function getInfo(data) { |
| | | return request({ |
| | | url: 'api/sysUserCompany/getCompName', |
| | | url: 'api/meetingRoom/getInfo', |
| | | method: 'post', |
| | | data |
| | | }) |
| | | } |
| | | |
| | | export default { add, edit, del, getAll, getCompName } |
| | | export default { add, edit, del, getAll, getInfo } |
| New file |
| | |
| | | import request from '@/utils/request' |
| | | |
| | | export function getAll(params) { |
| | | return request({ |
| | | url: 'api/meetingRoomReservation/all', |
| | | method: 'get', |
| | | params |
| | | }) |
| | | } |
| | | |
| | | export function add(data) { |
| | | return request({ |
| | | url: 'api/meetingRoomReservation', |
| | | method: 'post', |
| | | data |
| | | }) |
| | | } |
| | | |
| | | export function del(ids) { |
| | | return request({ |
| | | url: 'api/meetingRoomReservation/', |
| | | method: 'delete', |
| | | data: ids |
| | | }) |
| | | } |
| | | |
| | | export function edit(data) { |
| | | return request({ |
| | | url: 'api/meetingRoomReservation', |
| | | method: 'put', |
| | | data |
| | | }) |
| | | } |
| | | |
| | | export default { add, edit, del, getAll } |
| New file |
| | |
| | | import request from '@/utils/request' |
| | | import qs from 'qs' |
| | | |
| | | export function getAll(params) { |
| | | return request({ |
| | | url: 'api/contract/all', |
| | | method: 'get', |
| | | params |
| | | }) |
| | | } |
| | | |
| | | export function add(data) { |
| | | return request({ |
| | | url: 'api/contract', |
| | | method: 'post', |
| | | data |
| | | }) |
| | | } |
| | | |
| | | export function del(ids) { |
| | | return request({ |
| | | url: 'api/contract/', |
| | | method: 'delete', |
| | | data: ids |
| | | }) |
| | | } |
| | | |
| | | export function edit(data) { |
| | | return request({ |
| | | url: 'api/contract', |
| | | method: 'put', |
| | | data |
| | | }) |
| | | } |
| | | |
| | | export function contractTotalMoney(params) { |
| | | return request({ |
| | | url: 'api/contract/contractTotalMoney' + '?' + qs.stringify(params, { indices: false }), |
| | | method: 'get' |
| | | }) |
| | | } |
| | | |
| | | export function contractDelayTotalAmount(params) { |
| | | return request({ |
| | | url: 'api/contract/contractDelayTotalAmount' + '?' + qs.stringify(params, { indices: false }), |
| | | method: 'get' |
| | | }) |
| | | } |
| | | |
| | | export function contractDelayTotalMoney(params) { |
| | | return request({ |
| | | url: 'api/contract/contractDelayTotalMoney' + '?' + qs.stringify(params, { indices: false }), |
| | | method: 'get' |
| | | }) |
| | | } |
| | | |
| | | export function advancePaymentTotalMoney(params) { |
| | | return request({ |
| | | url: 'api/contract/advancePaymentTotalMoney' + '?' + qs.stringify(params, { indices: false }), |
| | | method: 'get' |
| | | }) |
| | | } |
| | | |
| | | export function serviceTotalMoney(params) { |
| | | return request({ |
| | | url: 'api/contract/serviceTotalMoney' + '?' + qs.stringify(params, { indices: false }), |
| | | method: 'get' |
| | | }) |
| | | } |
| | | |
| | | export function serviceDelayTotalAmount(params) { |
| | | return request({ |
| | | url: 'api/contract/serviceDelayTotalAmount' + '?' + qs.stringify(params, { indices: false }), |
| | | method: 'get' |
| | | }) |
| | | } |
| | | |
| | | export function serviceDelayTotalMoney(params) { |
| | | return request({ |
| | | url: 'api/contract/serviceDelayTotalMoney' + '?' + qs.stringify(params, { indices: false }), |
| | | method: 'get' |
| | | }) |
| | | } |
| | | |
| | | export function receivePaymentTotalMoney(params) { |
| | | return request({ |
| | | url: 'api/contract/receivePaymentTotalMoney' + '?' + qs.stringify(params, { indices: false }), |
| | | method: 'get' |
| | | }) |
| | | } |
| | | |
| | | export default { getAll, add, edit, del } |
| New file |
| | |
| | | import request from '@/utils/request' |
| | | |
| | | export function getAll(params) { |
| | | return request({ |
| | | url: 'api/contractFirst/all', |
| | | method: 'get', |
| | | params |
| | | }) |
| | | } |
| | | |
| | | export function add(data) { |
| | | return request({ |
| | | url: 'api/contractFirst', |
| | | method: 'post', |
| | | data |
| | | }) |
| | | } |
| | | |
| | | export function del(ids) { |
| | | return request({ |
| | | url: 'api/contractFirst/', |
| | | method: 'delete', |
| | | data: ids |
| | | }) |
| | | } |
| | | |
| | | export function edit(data) { |
| | | return request({ |
| | | url: 'api/contractFirst', |
| | | method: 'put', |
| | | data |
| | | }) |
| | | } |
| | | |
| | | export default { getAll, add, edit, del } |
| New file |
| | |
| | | import request from '@/utils/request' |
| | | |
| | | export function getAll(params) { |
| | | return request({ |
| | | url: 'api/contractInvoice/all', |
| | | method: 'get', |
| | | params |
| | | }) |
| | | } |
| | | |
| | | export function add(data) { |
| | | return request({ |
| | | url: 'api/contractInvoice', |
| | | method: 'post', |
| | | data |
| | | }) |
| | | } |
| | | |
| | | export function del(ids) { |
| | | return request({ |
| | | url: 'api/contractInvoice/', |
| | | method: 'delete', |
| | | data: ids |
| | | }) |
| | | } |
| | | |
| | | export function edit(data) { |
| | | return request({ |
| | | url: 'api/contractInvoice', |
| | | method: 'put', |
| | | data |
| | | }) |
| | | } |
| | | |
| | | export default { getAll, add, edit, del } |
| New file |
| | |
| | | import request from '@/utils/request' |
| | | |
| | | export function getAll(params) { |
| | | return request({ |
| | | url: 'api/contractPayment/all', |
| | | method: 'get', |
| | | params |
| | | }) |
| | | } |
| | | |
| | | export function add(data) { |
| | | return request({ |
| | | url: 'api/contractPayment', |
| | | method: 'post', |
| | | data |
| | | }) |
| | | } |
| | | |
| | | export function del(ids) { |
| | | return request({ |
| | | url: 'api/contractPayment/', |
| | | method: 'delete', |
| | | data: ids |
| | | }) |
| | | } |
| | | |
| | | export function edit(data) { |
| | | return request({ |
| | | url: 'api/contractPayment', |
| | | method: 'put', |
| | | data |
| | | }) |
| | | } |
| | | |
| | | export default { getAll, add, edit, del } |
| 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 } |
| New file |
| | |
| | | import request from '@/utils/request' |
| | | |
| | | export function getAll(params) { |
| | | return request({ |
| | | url: 'api/contractSecond/all', |
| | | method: 'get', |
| | | params |
| | | }) |
| | | } |
| | | |
| | | export function add(data) { |
| | | return request({ |
| | | url: 'api/contractSecond', |
| | | method: 'post', |
| | | data |
| | | }) |
| | | } |
| | | |
| | | export function del(ids) { |
| | | return request({ |
| | | url: 'api/contractSecond/', |
| | | method: 'delete', |
| | | data: ids |
| | | }) |
| | | } |
| | | |
| | | export function edit(data) { |
| | | return request({ |
| | | url: 'api/contractSecond', |
| | | method: 'put', |
| | | data |
| | | }) |
| | | } |
| | | |
| | | export default { getAll, add, edit, del } |
copy from eladmin-web-master/src/api/system/sysUserCompany.js
copy to eladmin-web-master/src/api/system/customerResources.js
| File was copied from eladmin-web-master/src/api/system/sysUserCompany.js |
| | |
| | | |
| | | export function getAll(params) { |
| | | return request({ |
| | | url: 'api/sysUserCompany/all', |
| | | url: 'api/customerResources/all', |
| | | method: 'get', |
| | | params |
| | | }) |
| | |
| | | |
| | | export function add(data) { |
| | | return request({ |
| | | url: 'api/sysUserCompany', |
| | | url: 'api/customerResources', |
| | | method: 'post', |
| | | data |
| | | }) |
| | |
| | | |
| | | export function del(ids) { |
| | | return request({ |
| | | url: 'api/sysUserCompany/', |
| | | url: 'api/customerResources/', |
| | | method: 'delete', |
| | | data: ids |
| | | }) |
| | |
| | | |
| | | export function edit(data) { |
| | | return request({ |
| | | url: 'api/sysUserCompany', |
| | | url: 'api/customerResources', |
| | | method: 'put', |
| | | data |
| | | }) |
| | | } |
| | | |
| | | export function getCompName(data) { |
| | | export function getRemindUser(data) { |
| | | return request({ |
| | | url: 'api/sysUserCompany/getCompName', |
| | | url: 'api/customerResources/getRemindUser', |
| | | method: 'post', |
| | | data |
| | | }) |
| | | } |
| | | |
| | | export default { add, edit, del, getAll, getCompName } |
| | | export default { add, edit, del, getAll, getRemindUser } |
| | |
| | | }) |
| | | } |
| | | |
| | | export default { add, edit, del, getDepts, getDeptSuperior } |
| | | export function getAll(params) { |
| | | return request({ |
| | | url: 'api/dept/all', |
| | | method: 'get', |
| | | params |
| | | }) |
| | | } |
| | | |
| | | export default { add, edit, del, getDepts, getDeptSuperior, getAll } |
| File was renamed from eladmin-web-master/src/api/system/sysUserCompany.js |
| | |
| | | |
| | | export function getAll(params) { |
| | | return request({ |
| | | url: 'api/sysUserCompany/all', |
| | | url: 'api/sysCompany/all', |
| | | method: 'get', |
| | | params |
| | | }) |
| | |
| | | |
| | | export function add(data) { |
| | | return request({ |
| | | url: 'api/sysUserCompany', |
| | | url: 'api/sysCompany', |
| | | method: 'post', |
| | | data |
| | | }) |
| | |
| | | |
| | | export function del(ids) { |
| | | return request({ |
| | | url: 'api/sysUserCompany/', |
| | | url: 'api/sysCompany/', |
| | | method: 'delete', |
| | | data: ids |
| | | }) |
| | |
| | | |
| | | export function edit(data) { |
| | | return request({ |
| | | url: 'api/sysUserCompany', |
| | | url: 'api/sysCompany', |
| | | method: 'put', |
| | | data |
| | | }) |
| | |
| | | |
| | | export function getCompName(data) { |
| | | return request({ |
| | | url: 'api/sysUserCompany/getCompName', |
| | | url: 'api/sysCompany/getCompName', |
| | | method: 'post', |
| | | data |
| | | }) |
| | |
| | | } |
| | | }, |
| | | /** |
| | | * 月日格式化 |
| | | * @param {Object} timestamp 时间戳 |
| | | */ |
| | | toMonthDay(timestamp) { |
| | | if (timestamp == null) { |
| | | return |
| | | } else { |
| | | const system = new Date(timestamp) |
| | | const month = system.getMonth() + 1 < 10 ? '0' + (system.getMonth() + 1) : system.getMonth() + 1 |
| | | const date = system.getDate() < 10 ? '0' + system.getDate() : system.getDate() |
| | | return month + '-' + date |
| | | } |
| | | }, |
| | | /** |
| | | * 时间格式化 |
| | | * @param {Object} timestamp |
| | | */ |
| | |
| | | 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) |
| | |
| | | // 公示状态:已公示 |
| | | export const PUBLICITY_STATUS_YES = 'publicity_status_yes' |
| | | |
| | | // 提醒状态 |
| | | export const RESOURCES_TYPE = 'resources_type' |
| | | // 提醒状态:提醒 |
| | | export const RESOURCES_TYPE_REMIND = 'resources_type_remind' |
| | | // 提醒状态:不提醒 |
| | | export const RESOURCES_TYPE_NOREMIND = 'resources_type_noRemind' |
| | | |
| | | // 资产类型 |
| | | export const ACCET_TYPE = 'asset_type' |
| | | // 资产类型:固定 |
| | | export const ACCET_TYPE_FIXED = 'asset_type_fixed' |
| | | // 资产类型:流动 |
| | | export const ACCET_TYPE_FLOW = 'asset_type_flow' |
| | | |
| | | // 资产使用状态 |
| | | export const ACCETS_USE = 'assets_use' |
| | | // 资产使用状态:使用中 |
| | | export const ACCETS_USE_IN = 'assets_use_in' |
| | | // 资产使用状态:已停止 |
| | | export const ACCETS_USE_STOP = 'assets_use_stop' |
| | | |
| | | // 发票类型 |
| | | export const INVOICE_TYPE = 'invoice_type' |
| | | |
| | | // 款项类型 |
| | | export const FUND_TYPE = 'fund_type' |
| | | // 款项类型:合同费 |
| | | export const FUND_CONTRACT = 'fund_contract' |
| | | // 款项类型:服务费 |
| | | export const FUND_SERVICE = 'fund_service' |
| | | |
| | | // 合同类型 |
| | | export const CONTRACT_TYPE = 'contract_type' |
| | | // 合同类型:服务合同(年) |
| | | export const CONTRACT_SERVICE = 'contract_service' |
| | | // 合同类型:开发服务合同 |
| | | export const CONTRACT_DEVELOP_SERVICE = 'contract_develop_service' |
| | | |
| | | // 付款状态 |
| | | export const PAYMENT_STATE = 'payment_state' |
| | | |
| | | // 合同状态 |
| | | export const CONTRACT_STATUS = 'contract_status' |
| | | |
| | | export default { |
| | | ROLE_LEVEL_SUPER, |
| | | ROLE_LEVEL_GENERAL, |
| | |
| | | BUSSINESS_APPROVE_STATUS_REFUSE, |
| | | PUBLICITY_STATUS, |
| | | PUBLICITY_STATUS_NOT, |
| | | PUBLICITY_STATUS_YES |
| | | PUBLICITY_STATUS_YES, |
| | | RESOURCES_TYPE, |
| | | RESOURCES_TYPE_REMIND, |
| | | RESOURCES_TYPE_NOREMIND, |
| | | ACCET_TYPE, |
| | | ACCET_TYPE_FIXED, |
| | | ACCET_TYPE_FLOW, |
| | | ACCETS_USE, |
| | | ACCETS_USE_IN, |
| | | ACCETS_USE_STOP, |
| | | INVOICE_TYPE, |
| | | FUND_TYPE, |
| | | FUND_CONTRACT, |
| | | FUND_SERVICE, |
| | | CONTRACT_TYPE, |
| | | CONTRACT_SERVICE, |
| | | CONTRACT_DEVELOP_SERVICE, |
| | | PAYMENT_STATE, |
| | | CONTRACT_STATUS |
| | | } |
| New file |
| | |
| | | <template> |
| | | <div class="app-container"> |
| | | <!--工具栏--> |
| | | <div class="head-container"> |
| | | <div> |
| | | <el-select v-model="query.assetId" filterable clearable placeholder="所属资产" style="width: 185px;" class="filter-item" @keyup.enter.native="crud.toQuery"> |
| | | <el-option |
| | | v-for="item in assetManagements" |
| | | :key="item.id" |
| | | :label="item.number" |
| | | :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-date-picker |
| | | v-model="query.useStartTime" |
| | | type="daterange" |
| | | clearable |
| | | class="date-item" |
| | | value-format="yyyy-MM-dd HH:mm:ss" |
| | | placeholder="请选择日期时间" |
| | | range-separator=" : " |
| | | start-placeholder="开始日期" |
| | | end-placeholder="开始日期" |
| | | /> |
| | | <el-date-picker |
| | | v-model="query.useEndTime" |
| | | type="daterange" |
| | | clearable |
| | | class="date-item" |
| | | value-format="yyyy-MM-dd HH:mm:ss" |
| | | placeholder="请选择日期时间" |
| | | range-separator=" : " |
| | | start-placeholder="结束日期" |
| | | end-placeholder="结束日期" |
| | | /> |
| | | <rrOperation /> |
| | | </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="100px"> |
| | | <el-form-item label="所属资产" prop="assetId"> |
| | | <el-select v-model="form.assetId" filterable clearable placeholder="请选择" style="width: 350px;"> |
| | | <el-option |
| | | v-for="item in assetManagements" |
| | | :key="item.id" |
| | | :label="item.number" |
| | | :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: 350px;"> |
| | | <el-option |
| | | v-for="item in users" |
| | | :key="item.id" |
| | | :label="item.nickName" |
| | | :value="item.id" |
| | | /> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="所属会议室"> |
| | | <el-select v-model="form.meetingId" filterable clearable placeholder="请选择" style="width: 350px;"> |
| | | <el-option |
| | | v-for="item in meetingRooms" |
| | | :key="item.id" |
| | | :label="item.conferenceRoomName" |
| | | :value="item.id" |
| | | /> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="开始日期" prop="useStartTime"> |
| | | <el-date-picker |
| | | v-model="form.useStartTime" |
| | | type="date" |
| | | placeholder="选择日期时间" |
| | | style="width: 350px;" |
| | | value-format="yyyy-MM-dd" |
| | | align="right" |
| | | :picker-options="{ |
| | | disabledDate(time) { |
| | | return form.useEndTime ? time.getTime() > new Date(form.useEndTime).getTime() - 8.64e7 : false; |
| | | } |
| | | }" |
| | | /> |
| | | </el-form-item> |
| | | <el-form-item label="结束时间" prop="useEndTime"> |
| | | <el-date-picker |
| | | v-model="form.useEndTime" |
| | | type="date" |
| | | placeholder="选择日期时间" |
| | | style="width: 350px;" |
| | | value-format="yyyy-MM-dd" |
| | | align="right" |
| | | :picker-options="{ |
| | | disabledDate(time) { |
| | | return form.useStartTime ? time.getTime() < new Date(form.useStartTime).getTime() - 8.64e7 : false; |
| | | } |
| | | }" |
| | | /> |
| | | </el-form-item> |
| | | <el-form-item label="备注"> |
| | | <el-input v-model="form.remarks" type="textarea" rows="3" style="width: 350px;" /> |
| | | </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 prop="assetId" label="所属资产" show-overflow-tooltip> |
| | | <template slot-scope="scope"> |
| | | <el-tag>{{ scope.row.assName }}</el-tag> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="userId" label="所属员工" show-overflow-tooltip> |
| | | <template slot-scope="scope"> |
| | | <el-tag v-if="scope.row.nickName !== ''">{{ scope.row.nickName }}</el-tag> |
| | | <el-tag v-if="scope.row.nickName == ''" type="info">{{ '无' }}</el-tag> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="meetingId" label="所属会议室" show-overflow-tooltip> |
| | | <template slot-scope="scope"> |
| | | <el-tag v-if="scope.row.meetName !== ''">{{ scope.row.meetName }}</el-tag> |
| | | <el-tag v-if="scope.row.meetName == ''" type="info">{{ '无' }}</el-tag> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="useStartTime" label="使用开始日期" show-overflow-tooltip> |
| | | <template slot-scope="scope"> |
| | | {{ crud.toDate(scope.row.useStartTime) }} |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="useEndTime" label="使用结束时间" show-overflow-tooltip> |
| | | <template slot-scope="scope"> |
| | | {{ crud.toDate(scope.row.useEndTime) }} |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="remarks" label="备注" show-overflow-tooltip /> |
| | | <el-table-column prop="createTime" label="创建时间" show-overflow-tooltip /> |
| | | <el-table-column v-if="checkPer(['admin','assetUseManagement:edit','assetUseManagement: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 crudAssetUseManagement from '@/api/assetManagement/assetUseManagement' |
| | | import crudAssetManagement from '@/api/assetManagement/assetManagement' |
| | | import crudMeetingRoom from '@/api/conferenceRoom/meetingRoom' |
| | | import crudUser from '@/api/system/user' |
| | | 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' |
| | | |
| | | const defaultForm = { id: null, assetId: null, userId: null, meetingId: null, useStartTime: null, useEndTime: null, remarks: null, createBy: null, createTime: null, updateBy: null, updateTime: null } |
| | | export default { |
| | | name: 'AssetUseManagement', |
| | | components: { pagination, crudOperation, rrOperation, udOperation }, |
| | | mixins: [presenter(), header(), form(defaultForm), crud()], |
| | | cruds() { |
| | | return CRUD({ title: '资产使用', url: 'api/assetUseManagement', idField: 'id', sort: 'id,desc', crudMethod: { ...crudAssetUseManagement }}) |
| | | }, |
| | | data() { |
| | | return { |
| | | permission: { |
| | | add: ['admin', 'assetUseManagement:add'], |
| | | edit: ['admin', 'assetUseManagement:edit'], |
| | | del: ['admin', 'assetUseManagement:del'], |
| | | download: ['admin', 'assetUseManagement:download'] |
| | | }, |
| | | rules: { |
| | | assetId: [ |
| | | { required: true, message: '资产不能为空', trigger: 'change' } |
| | | ], |
| | | useStartTime: [ |
| | | { required: true, message: '使用开始时间不能为空', trigger: 'blur' } |
| | | ] |
| | | }, |
| | | users: [], |
| | | assetManagements: [], |
| | | meetingRooms: [] } |
| | | }, |
| | | methods: { |
| | | // 钩子:在获取表格数据之前执行,false 则代表不获取数据 |
| | | [CRUD.HOOK.beforeRefresh]() { |
| | | // 用户 |
| | | crudUser.getAll().then(res => { |
| | | this.users = res |
| | | }) |
| | | // 资产 |
| | | crudAssetManagement.getAll().then(res => { |
| | | this.assetManagements = res |
| | | }) |
| | | // 会议室 |
| | | crudMeetingRoom.getAll().then(res => { |
| | | this.meetingRooms = res |
| | | }) |
| | | console.log(this.$route.params.assetId) |
| | | // 判断传参是否为空 |
| | | if (this.$route.params.assetId != null && this.$route.params.assetId !== '' && this.crud.query.assetId === undefined) { |
| | | // 检索条件赋值 |
| | | this.$set(this.crud.query, 'assetId', Number(this.$route.params.assetId)) |
| | | } |
| | | return true |
| | | }, |
| | | // 钩子:提交之前 |
| | | [CRUD.HOOK.beforeSubmit]() { |
| | | if (this.form.userId === '' || this.form.userId === undefined) { |
| | | this.form.userId = null |
| | | } |
| | | if (this.form.meetingId === '' || this.form.meetingId === undefined) { |
| | | this.form.meetingId = null |
| | | } |
| | | if (this.form.userId !== null && this.form.meetingId !== null) { |
| | | // 消息提示 |
| | | this.crud.notify('用户和会议室只能选择一个', CRUD.NOTIFICATION_TYPE.ERROR) |
| | | return false |
| | | } |
| | | if (this.form.userId == null && this.form.meetingId == null) { |
| | | // 消息提示 |
| | | this.crud.notify('用户和会议室必须选择一个', CRUD.NOTIFICATION_TYPE.ERROR) |
| | | return false |
| | | } |
| | | } |
| | | } |
| | | } |
| | | </script> |
| | | |
| | | <style scoped> |
| | | |
| | | </style> |
| New file |
| | |
| | | <template> |
| | | <div class="app-container"> |
| | | <!--工具栏--> |
| | | <div class="head-container"> |
| | | <div> |
| | | <el-input |
| | | v-model="query.number" |
| | | clearable |
| | | size="small" |
| | | placeholder="编号" |
| | | style="width: 185px;" |
| | | class="filter-item" |
| | | @keyup.enter.native="crud.toQuery" |
| | | /> |
| | | <el-input |
| | | v-model="query.name" |
| | | clearable |
| | | size="small" |
| | | placeholder="名称" |
| | | style="width: 185px;" |
| | | class="filter-item" |
| | | @keyup.enter.native="crud.toQuery" |
| | | /> |
| | | <el-select v-model="query.affiliatedCompanyId" filterable clearable placeholder="所属公司" style="width: 185px;" class="filter-item" @keyup.enter.native="crud.toQuery"> |
| | | <el-option |
| | | v-for="item in companyList" |
| | | :key="item.id" |
| | | :label="item.label" |
| | | :value="item.id" |
| | | /> |
| | | </el-select> |
| | | <el-select v-model="query.state" filterable clearable placeholder="使用状态" style="width: 185px;" class="filter-item" @keyup.enter.native="crud.toQuery"> |
| | | <el-option |
| | | v-for="item in dict[dictAccteUse]" |
| | | :key="item.value" |
| | | :label="item.label" |
| | | :value="item.value" |
| | | /> |
| | | </el-select> |
| | | <rrOperation /> |
| | | </div> |
| | | <!--如果想在工具栏加入更多按钮,可以使用插槽方式, slot = 'left' or 'right'--> |
| | | <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" |
| | | style="margin-left: 0px !important;" |
| | | @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-view" |
| | | :disabled="crud.selections.length !== 1" |
| | | style="margin-left: 4px !important;" |
| | | @click="toAssetUseManagement(crud.selections[0])" |
| | | > |
| | | 查看分配 |
| | | </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 label="编号" prop="number"> |
| | | <el-input v-model="form.number" style="width: 370px;" /> |
| | | </el-form-item> |
| | | <el-form-item label="名称" prop="name"> |
| | | <el-input v-model="form.name" style="width: 370px;" /> |
| | | </el-form-item> |
| | | <el-form-item label="型号"> |
| | | <el-input v-model="form.typeNumber" style="width: 370px;" /> |
| | | </el-form-item> |
| | | <el-form-item label="资产类型" prop="assetsType"> |
| | | <el-select v-model="form.assetsType" clearable style="width: 370px;"> |
| | | <el-option |
| | | v-for="item in dict[dictAccetType]" |
| | | :key="item.value" |
| | | :label="item.label" |
| | | :value="item.value" |
| | | /> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="购买日期"> |
| | | <el-date-picker |
| | | v-model="form.buyDate" |
| | | type="datetime" |
| | | placeholder="选择日期时间" |
| | | style="width: 370px;" |
| | | value-format="yyyy-MM-dd HH:mm:ss" |
| | | align="right" |
| | | /> |
| | | </el-form-item> |
| | | <el-form-item label="购买金额" prop="buyMoney"> |
| | | <money-input :key="random" v-model="form.buyMoney" :width="370" /> |
| | | </el-form-item> |
| | | <el-form-item label="所属公司" prop="affiliatedCompanyId"> |
| | | <el-select v-model="form.affiliatedCompanyId" style="width: 370px" clearable> |
| | | <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="state"> |
| | | <el-select v-model="form.state" clearable style="width: 370px;"> |
| | | <el-option |
| | | v-for="item in dict[dictAccteUse]" |
| | | :key="item.value" |
| | | :label="item.label" |
| | | :value="item.value" |
| | | /> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="备注"> |
| | | <el-input v-model="form.remarks" type="textarea" rows="3" 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-dialog :close-on-click-modal="false" :before-close="divideClose" :visible.sync="divideStatus" :title="crudStatusTitle" width="500px"> |
| | | <el-form ref="assUserManagementForm" :model="assUserManagementForm" :rules="rules" size="small" label-width="110px"> |
| | | <el-form-item label="编号"> |
| | | {{ assUserManagementForm.number }} |
| | | </el-form-item> |
| | | <el-form-item label="名称"> |
| | | {{ assUserManagementForm.name }} |
| | | </el-form-item> |
| | | <el-form-item label="员工"> |
| | | <el-select v-model="assUserManagementForm.userId" filterable clearable placeholder="请选择" style="width: 330px;"> |
| | | <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="所属会议室"> |
| | | <el-select v-model="assUserManagementForm.meetingId" filterable clearable placeholder="请选择" style="width: 330px;"> |
| | | <el-option |
| | | v-for="item in meetingRooms" |
| | | :key="item.id" |
| | | :label="item.conferenceRoomName" |
| | | :value="item.id" |
| | | /> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="使用开始日期" prop="useStartTime"> |
| | | <el-date-picker |
| | | v-model="assUserManagementForm.useStartTime" |
| | | type="date" |
| | | placeholder="选择日期时间" |
| | | style="width: 330px;" |
| | | value-format="yyyy-MM-dd" |
| | | align="right" |
| | | :picker-options="{ |
| | | disabledDate(time) { |
| | | return assUserManagementForm.useEndTime ? time.getTime() > new Date(assUserManagementForm.useEndTime).getTime() - 8.64e7 : false; |
| | | } |
| | | }" |
| | | /> |
| | | </el-form-item> |
| | | <el-form-item label="使用结束时间"> |
| | | <el-date-picker |
| | | v-model="assUserManagementForm.useEndTime" |
| | | type="date" |
| | | placeholder="选择日期时间" |
| | | style="width: 330px;" |
| | | value-format="yyyy-MM-dd" |
| | | align="right" |
| | | :picker-options="{ |
| | | disabledDate(time) { |
| | | return assUserManagementForm.useStartTime ? time.getTime() < new Date(assUserManagementForm.useStartTime).getTime() - 8.64e7 : false; |
| | | } |
| | | }" |
| | | /> |
| | | </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> |
| | | <!--表格渲染--> |
| | | <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 prop="number" label="编号" show-overflow-tooltip> |
| | | <template slot-scope="scope"> |
| | | {{ scope.row.number }} |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="name" label="名称" show-overflow-tooltip> |
| | | <template slot-scope="scope"> |
| | | {{ scope.row.name }} |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="typeNumber" label="型号" show-overflow-tooltip /> |
| | | <el-table-column prop="assetsType" label="资产类型" show-overflow-tooltip> |
| | | <template slot-scope="scope"> |
| | | <el-tag> |
| | | {{ dict.label[dictAccetType][scope.row.assetsType] }} |
| | | </el-tag> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="buyDate" label="购买日期" show-overflow-tooltip /> |
| | | <el-table-column prop="buyMoney" label="购买金额" show-overflow-tooltip> |
| | | <template slot-scope="scope"> |
| | | {{ crud.toMoney(scope.row.buyMoney) }} |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="affiliatedCompanyId" label="所属公司" show-overflow-tooltip> |
| | | <template slot-scope="scope"> |
| | | <template v-for="item in companyList"> |
| | | <el-tag v-if="scope.row.affiliatedCompanyId == item.id" :key="item.id">{{ item.label }}</el-tag> |
| | | </template> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="state" label="使用状态" show-overflow-tooltip> |
| | | <template slot-scope="scope"> |
| | | <el-tag v-if="scope.row.state === dictOnStart">{{ dict.label[dictAccteUse][scope.row.state] }}</el-tag> |
| | | <el-tag v-if="scope.row.state === dictOffStart" type="danger">{{ dict.label[dictAccteUse][scope.row.state] }}</el-tag> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="remarks" label="备注" /> |
| | | <el-table-column prop="createTime" label="创建时间" /> |
| | | <el-table-column v-if="checkPer(['admin','assetManagement:edit','assetManagement:del'])" 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 /> |
| | | </div> |
| | | </div> |
| | | </template> |
| | | |
| | | <script> |
| | | import crudAssetManagement from '@/api/assetManagement/assetManagement' |
| | | import crudSysCompany from '@/api/system/sysCompany' |
| | | import crudUser from '@/api/system/user' |
| | | import crudMeetingRoom from '@/api/conferenceRoom/meetingRoom' |
| | | 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 constant from '@/utils/constant' |
| | | import moneyInput from '../../assembly/moneyInput/index.vue' |
| | | |
| | | const defaultForm = { id: null, number: null, name: null, typeNumber: null, assetsType: null, buyDate: null, buyMoney: null, affiliatedCompanyId: null, state: null, remarks: null, createBy: null, createTime: null, updateBy: null, updateTime: null } |
| | | export default { |
| | | name: 'AssetManagement', |
| | | components: { pagination, crudOperation, rrOperation, udOperation, moneyInput }, |
| | | mixins: [presenter(), header(), form(defaultForm), crud()], |
| | | // 数据字典 |
| | | dicts: [constant.ACCET_TYPE, constant.ACCETS_USE], |
| | | cruds() { |
| | | return CRUD({ title: '资产记录', url: 'api/assetManagement', idField: 'id', sort: 'id,desc', crudMethod: { ...crudAssetManagement }}) |
| | | }, |
| | | data() { |
| | | // (千万内)验证 |
| | | var wageValidate = (rule, value, callback) => { |
| | | if (value != null && value !== '' && (isNaN(value) || Number(value) < 0 || Number(value) > 10000000)) { |
| | | callback(new Error('请输入 一千万 以内的正整数或两位小数')) |
| | | } else { |
| | | callback() |
| | | } |
| | | } |
| | | return { |
| | | permission: { |
| | | add: ['admin', 'assetManagement:add'], |
| | | edit: ['admin', 'assetManagement:edit'], |
| | | del: ['admin', 'assetManagement:del'], |
| | | download: ['admin', 'assetManagement:download'], |
| | | divide: ['admin', 'assetManagement:divide'], |
| | | seeDivide: ['admin', 'assetManagement:seeDivide'] |
| | | }, |
| | | rules: { |
| | | number: [ |
| | | { required: true, message: '编号不能为空', trigger: 'blur' } |
| | | ], |
| | | name: [ |
| | | { required: true, message: '名称不能为空', trigger: 'blur' } |
| | | ], |
| | | assetsType: [ |
| | | { required: true, message: '资产类型不能为空', trigger: 'change' } |
| | | ], |
| | | affiliatedCompanyId: [ |
| | | { required: true, message: '所属公司不能为空', trigger: 'change' } |
| | | ], |
| | | state: [ |
| | | { required: true, message: '使用状态不能为空', trigger: 'change' } |
| | | ], |
| | | useStartTime: [ |
| | | { required: true, message: '使用开始时间不能为空', trigger: 'change' } |
| | | ], |
| | | buyMoney: [ |
| | | { validator: wageValidate, trigger: 'blur' } |
| | | ] |
| | | }, |
| | | dictAccetType: constant.ACCET_TYPE, |
| | | companyList: [], |
| | | dictAccteUse: constant.ACCETS_USE, |
| | | dictOnStart: constant.ACCETS_USE_IN, |
| | | dictOffStart: constant.ACCETS_USE_STOP, |
| | | random: 0, |
| | | assUserManagementForm: { assetId: null, userId: null, meetingId: null, useStartTime: null, useEndTime: null, number: null, name: null, divideUserIds: [] }, |
| | | divideStatus: false, |
| | | divideLoading: false, |
| | | users: [], |
| | | meetingRooms: [], |
| | | crudStatusTitle: '分配资产', |
| | | assetUseManagements: [] |
| | | } |
| | | }, |
| | | methods: { |
| | | // 钩子:在获取表格数据之前执行,false 则代表不获取数据 |
| | | [CRUD.HOOK.beforeRefresh]() { |
| | | // 查询配置参数 |
| | | crudSysCompany.getAll().then(res => { |
| | | // 公司列表 |
| | | this.companyList = res |
| | | }) |
| | | // 用户 |
| | | crudUser.getAll().then(res => { |
| | | this.users = res |
| | | }) |
| | | // 会议室 |
| | | crudMeetingRoom.getAll().then(res => { |
| | | this.meetingRooms = res |
| | | }) |
| | | return true |
| | | }, |
| | | // 钩子: 在新增前执行 |
| | | [CRUD.HOOK.beforeToCU]() { |
| | | // 随机数 |
| | | this.random = Math.random() |
| | | }, |
| | | // 查看资产使用管理 |
| | | toAssetUseManagement(data) { |
| | | console.log(data) |
| | | // 跳转页面 |
| | | this.$router.push({ |
| | | name: 'assetUseManagement', |
| | | params: { |
| | | assetId: data.id |
| | | } |
| | | }) |
| | | }, |
| | | // 分配资产使用 |
| | | toDivide(data) { |
| | | if (data.state === this.dictOffStart) { |
| | | this.crud.notify('使用状态已停止,无法分配', CRUD.NOTIFICATION_TYPE.ERROR) |
| | | } else { |
| | | this.assUserManagementForm.assetId = data.id |
| | | this.assUserManagementForm.userId = data.userId |
| | | this.assUserManagementForm.number = data.number |
| | | this.assUserManagementForm.name = data.name |
| | | this.divideStatus = true |
| | | } |
| | | }, |
| | | // 分配表单提交 |
| | | divideSubmit() { |
| | | if (this.assUserManagementForm.userId === '' || this.assUserManagementForm.userId === undefined) { |
| | | this.assUserManagementForm.userId = null |
| | | } |
| | | if (this.assUserManagementForm.meetingId === '' || this.assUserManagementForm.meetingId === undefined) { |
| | | this.assUserManagementForm.meetingId = null |
| | | } |
| | | if (this.assUserManagementForm.userId !== null && this.assUserManagementForm.meetingId != null) { |
| | | // 消息提示 |
| | | this.crud.notify('用户和会议室只能选择一个', CRUD.NOTIFICATION_TYPE.ERROR) |
| | | return |
| | | } |
| | | if (this.assUserManagementForm.userId == null && this.assUserManagementForm.meetingId == null) { |
| | | // 消息提示 |
| | | this.crud.notify('用户和会议室必须选择一个', CRUD.NOTIFICATION_TYPE.ERROR) |
| | | return |
| | | } |
| | | // 分配表单加载 |
| | | this.divideLoading = true |
| | | // 表单验证 |
| | | this.$refs['assUserManagementForm'].validate((valid) => { |
| | | if (valid) { |
| | | // 分配任务 |
| | | crudAssetManagement.divide(this.assUserManagementForm).then(res => { |
| | | // 分配表单关闭 |
| | | this.divideClose() |
| | | // 消息提示 |
| | | this.crud.notify('资产分配成功', CRUD.NOTIFICATION_TYPE.SUCCESS) |
| | | // 刷新页面 |
| | | this.crud.refresh() |
| | | }) |
| | | this.divideLoading = false |
| | | } else { |
| | | // 分配表单加载 |
| | | this.divideLoading = false |
| | | return false |
| | | } |
| | | }) |
| | | }, |
| | | // 分配表单关闭 |
| | | divideClose() { |
| | | // 分配表单状态 |
| | | this.divideStatus = false |
| | | // 分配表单加载 |
| | | this.divideLoading = false |
| | | // 清除表单验证 |
| | | this.$nextTick(() => { |
| | | this.$refs['assUserManagementForm'].clearValidate() |
| | | }) |
| | | } |
| | | } |
| | | } |
| | | </script> |
| | | |
| | | <style scoped> |
| | | |
| | | </style> |
| | |
| | | 'user' |
| | | ]) |
| | | }, |
| | | watch: { |
| | | 'form.cardReplacementDistinguish'(value) { |
| | | if (this.form.cardReplacementTime) { |
| | | let time = null |
| | | if (value === 'card_replacement_differentiation_goOn') { |
| | | time = this.$store.state.user.user.sysRostering.workStartTime.split(':') |
| | | } else { |
| | | time = this.$store.state.user.user.sysRostering.workEndTime.split(':') |
| | | } |
| | | const date = new Date(this.form.cardReplacementTime).setHours(time[0], time[1], 0) |
| | | this.form.cardReplacementTime = new Date(date) |
| | | } |
| | | } |
| | | }, |
| | | // watch: { |
| | | // 'form.cardReplacementDistinguish'(value) { |
| | | // if (this.form.cardReplacementTime) { |
| | | // let time = null |
| | | // if (value === 'card_replacement_differentiation_goOn') { |
| | | // time = this.$store.state.user.user.sysRostering.workStartTime.split(':') |
| | | // } else { |
| | | // time = this.$store.state.user.user.sysRostering.workEndTime.split(':') |
| | | // } |
| | | // const date = new Date(this.form.cardReplacementTime).setHours(time[0], time[1], 0) |
| | | // this.form.cardReplacementTime = new Date(date) |
| | | // } |
| | | // } |
| | | // }, |
| | | methods: { |
| | | // 钩子:在获取表格数据之前执行,false 则代表不获取数据 |
| | | [CRUD.HOOK.beforeRefresh]() { |
| | |
| | | v-model="query.outStartTime" |
| | | type="daterange" |
| | | clearable |
| | | class="filter-item" |
| | | class="date-item" |
| | | value-format="yyyy-MM-dd HH:mm:ss" |
| | | placeholder="选择日期时间" |
| | | range-separator="至" |
| | | start-placeholder="外出开始时间" |
| | | end-placeholder="外出开始时间" |
| | | range-separator=" : " |
| | | start-placeholder="开始时间" |
| | | end-placeholder="开始时间" |
| | | /> |
| | | <el-date-picker |
| | | v-model="query.outEndTime" |
| | | type="daterange" |
| | | clearable |
| | | class="filter-item" |
| | | class="date-item" |
| | | value-format="yyyy-MM-dd HH:mm:ss" |
| | | placeholder="选择日期时间" |
| | | range-separator="至" |
| | | start-placeholder="外出结束时间" |
| | | end-placeholder="外出结束时间" |
| | | range-separator=" : " |
| | | start-placeholder="结束时间" |
| | | end-placeholder="结束时间" |
| | | /> |
| | | <rrOperation /> |
| | | </div> |
| | |
| | | v-model="query.leaveStartTime" |
| | | type="daterange" |
| | | clearable |
| | | class="filter-item" |
| | | class="date-item" |
| | | value-format="yyyy-MM-dd HH:mm:ss" |
| | | placeholder="请选择日期时间" |
| | | range-separator="至" |
| | | start-placeholder="请假开始日期" |
| | | end-placeholder="请假开始日期" |
| | | range-separator=" : " |
| | | start-placeholder="开始日期" |
| | | end-placeholder="开始日期" |
| | | /> |
| | | <el-date-picker |
| | | v-model="query.leaveEndTime" |
| | | type="daterange" |
| | | clearable |
| | | class="filter-item" |
| | | class="date-item" |
| | | value-format="yyyy-MM-dd HH:mm:ss" |
| | | placeholder="请选择日期时间" |
| | | range-separator="至" |
| | | start-placeholder="请假结束日期" |
| | | end-placeholder="请假结束日期" |
| | | range-separator=" : " |
| | | start-placeholder="结束日期" |
| | | end-placeholder="结束日期" |
| | | /> |
| | | <rrOperation /> |
| | | </div> |
| New file |
| | |
| | | <template> |
| | | <div class="app-container"> |
| | | <!--工具栏--> |
| | | <div class="head-container"> |
| | | <div> |
| | | <el-date-picker v-model="query.attendanceDate" type="month" clearable placeholder="统计年月" style="width: 185px;" class="filter-item" @keyup.enter.native="crud.toQuery" /> |
| | | <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> |
| | | <rrOperation /> |
| | | </div> |
| | | <!--如果想在工具栏加入更多按钮,可以使用插槽方式, slot = 'left' or 'right'--> |
| | | <crudOperation :permission="permission"> |
| | | <el-button |
| | | slot="right" |
| | | v-permission="permission.publicity" |
| | | class="filter-item" |
| | | size="mini" |
| | | type="primary" |
| | | icon="el-icon-s-check" |
| | | :disabled="crud.selections.length === 0" |
| | | style="margin-right: 6px;" |
| | | @click="multiplePublicity(crud.selections)" |
| | | >公示</el-button> |
| | | <el-button |
| | | slot="right" |
| | | v-permission="permission.admit" |
| | | class="filter-item" |
| | | size="mini" |
| | | type="primary" |
| | | icon="el-icon-share" |
| | | :disabled="crud.selections.length === 0 || crud.selections.length > 1" |
| | | @click="attendanceMAdmit(crud.selections[0])" |
| | | >承认</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="100px"> |
| | | <el-form-item label="统计年月" prop="attendanceDate"> |
| | | <el-date-picker |
| | | v-model="form.attendanceDate" |
| | | type="month" |
| | | style="width: 350px;" |
| | | placeholder="请选择" |
| | | value-format="yyyy-MM-dd HH:mm:ss" |
| | | /> |
| | | </el-form-item> |
| | | <el-form-item label="所属员工" prop="userId"> |
| | | <el-select v-model="form.userId" filterable clearable placeholder="请选择" style="width: 350px;"> |
| | | <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="companyId"> |
| | | <el-select v-model="form.companyId" filterable clearable placeholder="请选择" style="width: 350px;"> |
| | | <el-option |
| | | v-for="item in companys" |
| | | :key="item.id" |
| | | :label="item.label" |
| | | :value="item.id" |
| | | /> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="所属部门" prop="deptId"> |
| | | <treeselect |
| | | v-model="form.deptId" |
| | | :options="depts" |
| | | :load-options="loadDepts" |
| | | style="width: 350px" |
| | | placeholder="选择部门" |
| | | /> |
| | | </el-form-item> |
| | | <el-form-item label="所属岗位" prop="jobId"> |
| | | <el-select |
| | | v-model="form.jobId" |
| | | style="width: 350px" |
| | | :multiple-limit="1" |
| | | placeholder="请选择" |
| | | > |
| | | <el-option |
| | | v-for="item in jobs" |
| | | :key="item.name" |
| | | :label="item.name" |
| | | :value="item.id" |
| | | /> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="应出勤天数" prop="requiredAttendanceDays"> |
| | | <el-input v-model="form.requiredAttendanceDays" style="width: 350px;" /> |
| | | </el-form-item> |
| | | <el-form-item label="应出勤时长" prop="requiredAttendanceTime"> |
| | | <el-input v-model="form.requiredAttendanceTime" style="width: 350px;" /> |
| | | </el-form-item> |
| | | <el-form-item label="实际出勤天数" prop="actualAttendanceDays"> |
| | | <el-input v-model="form.actualAttendanceDays" style="width: 350px;" /> |
| | | </el-form-item> |
| | | <el-form-item label="实际出勤时长" prop="actualAttendanceTime"> |
| | | <el-input v-model="form.actualAttendanceTime" style="width: 350px;" /> |
| | | </el-form-item> |
| | | <el-form-item label="迟到次数" prop="countOfBeingLate"> |
| | | <el-input v-model="form.countOfBeingLate" style="width: 350px;" /> |
| | | </el-form-item> |
| | | <el-form-item label="迟到时长" prop="timeOfBeingLate"> |
| | | <el-input v-model="form.timeOfBeingLate" style="width: 350px;" /> |
| | | </el-form-item> |
| | | <el-form-item label="早退次数" prop="countOfBeingEarly"> |
| | | <el-input v-model="form.countOfBeingEarly" style="width: 350px;" /> |
| | | </el-form-item> |
| | | <el-form-item label="早退时长" prop="timeOfBeingEarly"> |
| | | <el-input v-model="form.timeOfBeingEarly" style="width: 350px;" /> |
| | | </el-form-item> |
| | | <el-form-item label="外出次数" prop="goOutNumber"> |
| | | <el-input v-model="form.goOutNumber" style="width: 350px;" /> |
| | | </el-form-item> |
| | | <el-form-item label="外出时长" prop="goOutTime"> |
| | | <el-input v-model="form.goOutTime" style="width: 350px;" /> |
| | | </el-form-item> |
| | | <el-form-item label="出差次数" prop="bussNumber"> |
| | | <el-input v-model="form.bussNumber" style="width: 350px;" /> |
| | | </el-form-item> |
| | | <el-form-item label="出差时长" prop="bussTime"> |
| | | <el-input v-model="form.bussTime" style="width: 350px;" /> |
| | | </el-form-item> |
| | | <el-form-item label="上班缺卡次数" prop="onCardNumber"> |
| | | <el-input v-model="form.onCardNumber" style="width: 350px;" /> |
| | | </el-form-item> |
| | | <el-form-item label="下班缺卡次数" prop="offCardNumber"> |
| | | <el-input v-model="form.offCardNumber" style="width: 350px;" /> |
| | | </el-form-item> |
| | | <el-form-item label="备注"> |
| | | <el-input v-model="form.remarks" :rows="3" type="textarea" style="width: 350px;" /> |
| | | </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" fixed="left" width="55" /> |
| | | <el-table-column fixed="left" type="expand"> |
| | | <template slot-scope="scope"> |
| | | <el-form label-position="left" class="my-demo-table-expand" style="margin-left: 264px;"> |
| | | <template v-if="scope.row.yearTime == undefined"> |
| | | <el-form-item |
| | | v-for="(item,adIndex) in (scope.row.leaveTypeList)" |
| | | :key="adIndex" |
| | | :label="'请假类型:' + dict.label[dictLeaveType][item.leaveType] + '\u00a0\u00a0\u00a0' + '请假次数:' |
| | | + item.leaveCount + '\u00a0\u00a0\u00a0' +'请假时间:' |
| | | + item.leaveTime + '(时)' + '\u00a0\u00a0\u00a0' + (item.leaveYearTime == undefined ? '' : '年假剩余:' |
| | | + item.leaveYearTime + '(时)')" |
| | | /> |
| | | </template> |
| | | <template v-if="scope.row.yearTime !== undefined"> |
| | | <el-form-item label="年假剩余:"> |
| | | <span>{{ scope.row.yearTime + '(时)' }}</span> |
| | | </el-form-item> |
| | | </template> |
| | | </el-form> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="attendanceDate" label="统计年月" fixed="left" width="125" align="center" show-overflow-tooltip> |
| | | <template slot-scope="scope"> |
| | | {{ crud.toMonth(scope.row.attendanceDate) }} |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="userId" label="姓名" fixed="left" width="125" align="center" show-overflow-tooltip> |
| | | <template slot-scope="scope"> |
| | | <el-tag>{{ scope.row.nickName }}</el-tag> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column label="基本信息" align="center" show-overflow-tooltip> |
| | | <el-table-column prop="companyId" label="公司" width="150"> |
| | | <template slot-scope="scope"> |
| | | <el-tag>{{ scope.row.companyName }}</el-tag> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="deptId" label="部门" width="150" show-overflow-tooltip> |
| | | <template slot-scope="scope"> |
| | | <el-tag>{{ scope.row.deptName }}</el-tag> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="jobId" label="岗位" width="150" show-overflow-tooltip> |
| | | <template slot-scope="scope"> |
| | | <el-tag>{{ scope.row.jobName }}</el-tag> |
| | | </template> |
| | | </el-table-column> |
| | | </el-table-column> |
| | | <el-table-column prop="requiredAttendanceDays" label="应出勤天数 / 应出勤时长" width="160" align="center" show-overflow-tooltip> |
| | | <template slot-scope="scope"> |
| | | {{ (scope.row.requiredAttendanceDays == null ? 0 : scope.row.requiredAttendanceDays) + ' / ' + (scope.row.requiredAttendanceTime == null ? 0 : scope.row.requiredAttendanceTime) }} |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="actualAttendanceDays" label="实际出勤天数 / 实际出勤时长" width="180" align="center" show-overflow-tooltip> |
| | | <template slot-scope="scope"> |
| | | {{ (scope.row.actualAttendanceDays == null ? 0 : scope.row.actualAttendanceDays) + ' / ' + (scope.row.actualAttendanceTime == null ? 0 : scope.row.actualAttendanceTime) }} |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="countOfBeingLate" label="迟到次数 / 迟到时长" width="150" align="center" show-overflow-tooltip> |
| | | <template slot-scope="scope"> |
| | | {{ (scope.row.countOfBeingLate == null ? 0 : scope.row.countOfBeingLate) + ' / ' + (scope.row.timeOfBeingLate == null ? 0 : scope.row.timeOfBeingLate) }} |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="countOfBeingEarly" label="早退次数 / 早退时长" width="150" align="center" show-overflow-tooltip> |
| | | <template slot-scope="scope"> |
| | | {{ (scope.row.countOfBeingEarly == null ? 0 : scope.row.countOfBeingEarly) + ' / ' + (scope.row.timeOfBeingEarly == null ? 0 : scope.row.timeOfBeingEarly) }} |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="onCardNumber" label=" 上班缺卡次数" width="150" align="center" show-overflow-tooltip> |
| | | <template slot-scope="scope"> |
| | | {{ (scope.row.onCardNumber == null ? 0 : scope.row.onCardNumber) }} |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="offCardNumber" label=" 下班缺卡次数" width="150" align="center" show-overflow-tooltip> |
| | | <template slot-scope="scope"> |
| | | {{ (scope.row.offCardNumber == null ? 0 : scope.row.offCardNumber) }} |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="goOutNumber" label="外出次数 / 外出时长" width="150" align="center" show-overflow-tooltip> |
| | | <template slot-scope="scope"> |
| | | {{ (scope.row.goOutNumber == null ? 0 : scope.row.goOutNumber) + ' / ' + (scope.row.goOutTime == null ? 0 : scope.row.goOutTime) }} |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="bussNumber" label="出差次数 / 出差时长" width="150" align="center" show-overflow-tooltip> |
| | | <template slot-scope="scope"> |
| | | {{ (scope.row.bussNumber == null ? 0 : scope.row.bussNumber) + ' / ' + (scope.row.bussTime == null ? 0 : scope.row.bussTime) }} |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column :show-overflow-tooltip="true" prop="isPublicity" label="公示状态" width="80" fixed="right"> |
| | | <template slot-scope="scope"> |
| | | <el-tag v-if="scope.row.isPublicity != null">{{ dict.label[publicityStatus][scope.row.isPublicity] }}</el-tag> |
| | | <el-tag v-if="scope.row.isPublicity == null">{{ '未公示' }}</el-tag> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column :show-overflow-tooltip="true" prop="isAdmit" label="承认状态" width="80" fixed="right"> |
| | | <template slot-scope="scope"> |
| | | <el-tag v-if="scope.row.isAdmit != null">{{ dict.label[approveStatus][scope.row.isAdmit] }}</el-tag> |
| | | <el-tag v-if="scope.row.isAdmit == null">{{ '未承认' }}</el-tag> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column v-if="checkPer(['admin','attendanceMonth:edit','attendanceMonth:del'])" label="操作" fixed="right" width="210px" align="center"> |
| | | <template slot-scope="scope"> |
| | | <udOperation |
| | | :data="scope.row" |
| | | :permission="permission" |
| | | > |
| | | <el-popover slot="left" :ref="`publicity_${scope.row.id}`" v-permission="permission.publicity" placement="top" width="180"> |
| | | <p>确定公示本条数据吗?</p> |
| | | <div style="text-align: right; margin: 0"> |
| | | <el-button size="mini" type="text" @click="publicityCancel(scope.row)">取消</el-button> |
| | | <el-button :loading="publicityLoading" type="primary" size="mini" @click="doPublicity(scope.row)">确定</el-button> |
| | | </div> |
| | | <el-button slot="reference" type="primary" icon="el-icon-s-check" size="mini" /> |
| | | </el-popover> |
| | | <el-popover slot="left" :ref="`admit_${scope.row.id}`" v-permission="permission.admit" placement="top" width="180"> |
| | | <p>确定承认本条数据吗?</p> |
| | | <div style="text-align: right; margin: 0"> |
| | | <el-button size="mini" type="text" @click="approveCancel(scope.row)">取消</el-button> |
| | | <el-button :loading="approveLoading" type="primary" size="mini" @click="doApprove(scope.row)">确定</el-button> |
| | | </div> |
| | | <el-button slot="reference" type="primary" icon="el-icon-finished" size="mini" style="margin-left: 3px;" /> |
| | | </el-popover> |
| | | </udOperation> |
| | | </template> |
| | | </el-table-column> |
| | | </el-table> |
| | | <!--分页组件--> |
| | | <pagination /> |
| | | </div> |
| | | </div> |
| | | </template> |
| | | |
| | | <script> |
| | | import crudAttendanceMonth from '@/api/attendance/attendanceMonth' |
| | | import crudSysCompany from '@/api/system/sysCompany' |
| | | import crudDept from '@/api/system/dept' |
| | | import crudJob from '@/api/system/job' |
| | | import '@riophae/vue-treeselect/dist/vue-treeselect.css' |
| | | import { LOAD_CHILDREN_OPTIONS } from '@riophae/vue-treeselect' |
| | | import Treeselect from '@riophae/vue-treeselect' |
| | | import CRUD, { presenter, header, form, crud } from '@crud/crud' |
| | | import crudUser from '@/api/system/user' |
| | | import rrOperation from '@crud/RR.operation' |
| | | import crudOperation from '@crud/CRUD.operation' |
| | | import udOperation from '@crud/UD.operation' |
| | | import pagination from '@crud/Pagination' |
| | | import constant from '@/utils/constant' |
| | | |
| | | const defaultForm = { id: null, attendanceDate: null, userId: null, companyId: null, deptId: null, jobId: null, requiredAttendanceDays: null, requiredAttendanceTime: null, actualAttendanceDays: null, actualAttendanceTime: null, countOfBeingLate: null, timeOfBeingLate: null, countOfBeingEarly: null, timeOfBeingEarly: null, goOutNumber: null, goOutTime: null, bussNumber: null, bussTime: null, onCardNumber: null, offCardNumber: null, isPublicity: null, isAdmit: null, remarks: null, createBy: null, createTime: null, updateBy: null, updateTime: null } |
| | | export default { |
| | | name: 'AttendanceMonth', |
| | | components: { pagination, crudOperation, rrOperation, udOperation, Treeselect }, |
| | | mixins: [presenter(), header(), form(defaultForm), crud()], |
| | | cruds() { |
| | | return CRUD({ title: '考勤月报', url: 'api/attendanceMonth', idField: 'id', sort: 'id,desc', crudMethod: { ...crudAttendanceMonth }}) |
| | | }, |
| | | // 数据字典 |
| | | dicts: [constant.LEAVE_TYPE, constant.PUBLICITY_STATUS, constant.APPROVE_STATUS], |
| | | data() { |
| | | // 时长(千内)验证 |
| | | var durationValidate = (rule, value, callback) => { |
| | | const reg = /^([0-9]|[1-9]\d{1,2})(\.\d{1,2})?$|1000$/ |
| | | if (value != null && value !== '' && !reg.test(value)) { |
| | | callback(new Error('请输入 一千 以内的正整数或两位小数')) |
| | | } else { |
| | | callback() |
| | | } |
| | | } |
| | | return { |
| | | permission: { |
| | | add: ['admin', 'attendanceMonth:add'], |
| | | edit: ['admin', 'attendanceMonth:edit'], |
| | | del: ['admin', 'attendanceMonth:del'], |
| | | download: ['admin', 'attendanceMonth:download'], |
| | | admit: ['admin', 'attendanceMonth:admit'], |
| | | publicity: ['admin', 'attendanceMonth:publicity'] |
| | | }, |
| | | rules: { |
| | | attendanceDate: [ |
| | | { required: true, message: '统计年月不能为空', trigger: 'blur' } |
| | | ], |
| | | userId: [ |
| | | { required: true, message: '所属用户不能为空', trigger: 'change' } |
| | | ], |
| | | companyId: [ |
| | | { required: true, message: '所属公司不能为空', trigger: 'change' } |
| | | ], |
| | | deptId: [ |
| | | { required: true, message: '所属部门不能为空', trigger: 'change' } |
| | | ], |
| | | jobId: [ |
| | | { required: true, message: '所属岗位不能为空', trigger: 'change' } |
| | | ], |
| | | requiredAttendanceDays: [ |
| | | { validator: durationValidate, trigger: 'blur' } |
| | | ], |
| | | requiredAttendanceTime: [ |
| | | { validator: durationValidate, trigger: 'blur' } |
| | | ], |
| | | actualAttendanceDays: [ |
| | | { validator: durationValidate, trigger: 'blur' } |
| | | ], |
| | | actualAttendanceTime: [ |
| | | { validator: durationValidate, trigger: 'blur' } |
| | | ], |
| | | countOfBeingLate: [ |
| | | { validator: durationValidate, trigger: 'blur' } |
| | | ], |
| | | timeOfBeingLate: [ |
| | | { validator: durationValidate, trigger: 'blur' } |
| | | ], |
| | | countOfBeingEarly: [ |
| | | { validator: durationValidate, trigger: 'blur' } |
| | | ], |
| | | timeOfBeingEarly: [ |
| | | { validator: durationValidate, trigger: 'blur' } |
| | | ], |
| | | goOutNumber: [ |
| | | { validator: durationValidate, trigger: 'blur' } |
| | | ], |
| | | goOutTime: [ |
| | | { validator: durationValidate, trigger: 'blur' } |
| | | ], |
| | | bussNumber: [ |
| | | { validator: durationValidate, trigger: 'blur' } |
| | | ], |
| | | bussTime: [ |
| | | { validator: durationValidate, trigger: 'blur' } |
| | | ], |
| | | onCardNumber: [ |
| | | { validator: durationValidate, trigger: 'blur' } |
| | | ], |
| | | offCardNumber: [ |
| | | { validator: durationValidate, trigger: 'blur' } |
| | | ] |
| | | }, |
| | | users: [], |
| | | dictLeaveType: constant.LEAVE_TYPE, |
| | | // 字典:公示状态 |
| | | publicityStatus: constant.PUBLICITY_STATUS, |
| | | // 字典:承认状态 |
| | | approveStatus: constant.APPROVE_STATUS, |
| | | // 承认弹窗加载 |
| | | approveLoading: false, |
| | | // 公示弹窗加载 |
| | | publicityLoading: false, |
| | | // 公司 |
| | | companys: [], |
| | | // 部门 |
| | | depts: [], |
| | | // 岗位 |
| | | jobs: [] } |
| | | }, |
| | | methods: { |
| | | // 钩子:在获取表格数据之前执行,false 则代表不获取数据 |
| | | [CRUD.HOOK.beforeRefresh]() { |
| | | crudUser.getAll().then(res => { |
| | | this.users = res |
| | | }) |
| | | crudSysCompany.getAll().then(res => { |
| | | this.companys = res |
| | | }) |
| | | return true |
| | | }, |
| | | // 新增与编辑前做的操作 |
| | | [CRUD.HOOK.afterToCU](crud, form) { |
| | | if (form.id == null) { |
| | | this.getDepts() |
| | | } else { |
| | | this.getSupDepts(form.deptId) |
| | | } |
| | | this.getJobs() |
| | | }, |
| | | // 获取弹窗内部门数据 |
| | | loadDepts({ action, parentNode, callback }) { |
| | | if (action === LOAD_CHILDREN_OPTIONS) { |
| | | crudDept.getDepts({ enabled: true, pid: parentNode.id }).then(res => { |
| | | parentNode.children = res.content.map(function(obj) { |
| | | if (obj.hasChildren) { |
| | | obj.children = null |
| | | } |
| | | return obj |
| | | }) |
| | | setTimeout(() => { |
| | | callback() |
| | | }, 200) |
| | | }) |
| | | } |
| | | }, |
| | | getDepts() { |
| | | crudDept.getDepts({ enabled: true }).then(res => { |
| | | this.depts = res.content.map(function(obj) { |
| | | if (obj.hasChildren) { |
| | | obj.children = null |
| | | } |
| | | return obj |
| | | }) |
| | | }) |
| | | }, |
| | | getSupDepts(deptId) { |
| | | crudDept.getDeptSuperior(deptId).then(res => { |
| | | const date = res.content |
| | | this.buildDepts(date) |
| | | this.depts = date |
| | | }) |
| | | }, |
| | | buildDepts(depts) { |
| | | depts.forEach(data => { |
| | | if (data.children) { |
| | | this.buildDepts(data.children) |
| | | } |
| | | if (data.hasChildren && !data.children) { |
| | | data.children = null |
| | | } |
| | | }) |
| | | }, |
| | | getJobs() { |
| | | crudJob.getAll().then(res => { |
| | | this.jobs = res |
| | | }).catch(() => { }) |
| | | }, |
| | | // 公示按钮 |
| | | multiplePublicity(data) { |
| | | // 确认框 |
| | | this.$confirm('此操作将公示 ' + data.length + ' 条月报, 是否继续?', '提示', { |
| | | confirmButtonText: '确定', |
| | | cancelButtonText: '取消', |
| | | type: 'success' |
| | | }).then(() => { |
| | | // ID列表 |
| | | const ids = [] |
| | | // 循环数据 |
| | | for (let i = 0; i < data.length; i++) { |
| | | // ID列表 |
| | | ids.push(data[i].id) |
| | | // 判断循环是否结束 |
| | | if (i === data.length - 1) { |
| | | // 公示月报 |
| | | crudAttendanceMonth.publicity(ids).then(res => { |
| | | // 搜索:刷新表格 |
| | | this.crud.toQuery() |
| | | // 消息提示 |
| | | this.crud.notify('公示成功', CRUD.NOTIFICATION_TYPE.SUCCESS) |
| | | }) |
| | | } |
| | | } |
| | | }) |
| | | }, |
| | | // 个人承认(选择按钮) |
| | | attendanceMAdmit(value) { |
| | | // 确认框 |
| | | this.$confirm('此操作将承认月报内容是否继续?', '提示', { |
| | | confirmButtonText: '确定', |
| | | cancelButtonText: '取消', |
| | | type: 'success' |
| | | }).then(() => { |
| | | this.form.id = value.id |
| | | crudAttendanceMonth.updateIsConfirm(this.form).then(res => { |
| | | // 消息提示 |
| | | this.$message({ |
| | | type: 'success', |
| | | message: '月报已承认!' |
| | | }) |
| | | // 刷新数据 |
| | | this.crud.refresh() |
| | | }) |
| | | }) |
| | | }, |
| | | // 公示弹窗确认 |
| | | doPublicity(data) { |
| | | // 公示弹窗加载 |
| | | this.publicityLoading = true |
| | | // 公示工资 |
| | | crudAttendanceMonth.publicity([data.id]).then(res => { |
| | | // 搜索:刷新表格 |
| | | this.crud.toQuery() |
| | | // 消息提示 |
| | | this.crud.notify('公示成功', CRUD.NOTIFICATION_TYPE.SUCCESS) |
| | | // 公示弹窗加载 |
| | | this.publicityLoading = false |
| | | // 公示弹窗隐藏 |
| | | this.$refs[`publicity_${data.id}`].showPopper = false |
| | | }).catch(() => { |
| | | // 公示弹窗加载 |
| | | this.publicityLoading = false |
| | | }) |
| | | }, |
| | | // 个人承认(按钮) |
| | | doApprove(value) { |
| | | // 承认弹窗加载 |
| | | this.approveLoading = true |
| | | this.form.id = value.id |
| | | crudAttendanceMonth.updateIsConfirm(this.form).then(res => { |
| | | // 搜索:刷新表格 |
| | | this.crud.toQuery() |
| | | // 消息提示 |
| | | this.crud.notify('承认成功', CRUD.NOTIFICATION_TYPE.SUCCESS) |
| | | // 承认弹窗加载 |
| | | this.approveLoading = false |
| | | // 承认弹窗隐藏 |
| | | this.$refs[`admit_${value.id}`].showPopper = false |
| | | }).catch(() => { |
| | | // 承认弹窗加载 |
| | | this.approveLoading = false |
| | | }) |
| | | }, |
| | | // 公示弹窗关闭 |
| | | publicityCancel(data) { |
| | | // 公示弹窗隐藏 |
| | | this.$refs[`publicity_${data.id}`].showPopper = false |
| | | }, |
| | | // 承认弹窗关闭 |
| | | approveCancel(data) { |
| | | // 承认弹窗隐藏 |
| | | this.$refs[`admit_${data.id}`].showPopper = false |
| | | } |
| | | } |
| | | } |
| | | </script> |
| | | |
| | | <style scoped> |
| | | .isConfirmCol{ |
| | | color:red |
| | | } |
| | | |
| | | .isConfirmSucc{ |
| | | color: rgb(34, 207, 63); |
| | | } |
| | | ::v-deep .vue-treeselect__control,::v-deep .vue-treeselect__placeholder,::v-deep .vue-treeselect__single-value { |
| | | height: 30px; |
| | | line-height: 30px; |
| | | } |
| | | </style> |
| New file |
| | |
| | | <template> |
| | | <div class="app-container"> |
| | | <!--工具栏--> |
| | | <div class="head-container"> |
| | | <div v-if="crud.props.searchToggle"> |
| | | <!-- 搜索 --> |
| | | <el-date-picker v-model="query.flowYearMonth" type="month" clearable placeholder="流水年月" style="width: 185px;" class="filter-item" @keyup.enter.native="crud.toQuery" /> |
| | | <el-select v-model="query.companyId" filterable clearable placeholder="所属公司" style="width: 185px;" class="filter-item" @keyup.enter.native="crud.toQuery"> |
| | | <el-option |
| | | v-for="item in companyList" |
| | | :key="item.id" |
| | | :label="item.label" |
| | | :value="item.id" |
| | | /> |
| | | </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="flowYearMonth"> |
| | | <el-date-picker v-model="form.flowYearMonth" type="month" style="width: 370px;" placeholder="请选择" value-format="yyyy-MM-dd HH:mm:ss" /> |
| | | </el-form-item> |
| | | <el-form-item label="所属公司" prop="companyId"> |
| | | <el-select v-model="form.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-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 type="expand"> |
| | | <template slot-scope="props"> |
| | | <div style="margin-left: 264px;"> |
| | | <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.capitalFlowExpends"> |
| | | <el-form-item :key="item.id" :label="item.title"> |
| | | <span>{{ crud.toMoney(item.amount) }}</span> |
| | | </el-form-item> |
| | | </template> |
| | | </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> |
| | | </el-form> |
| | | </div> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="flowYearMonth" label="流水年月"> |
| | | <template slot-scope="scope"> |
| | | {{ crud.toMonth(scope.row.flowYearMonth) }} |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="companyName" label="所属公司"> |
| | | <template slot-scope="scope"> |
| | | <el-tag>{{ scope.row.companyName }}</el-tag> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="capitalFlowExpendsAmount" label="支出总金额"> |
| | | <template slot-scope="scope"> |
| | | {{ crud.toMoney(scope.row.capitalFlowExpendsAmount) }} |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="capitalFlowIncomesAmount" label="收入总金额"> |
| | | <template slot-scope="scope"> |
| | | {{ crud.toMoney(scope.row.capitalFlowIncomesAmount) }} |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column label="结余总金额"> |
| | | <template slot-scope="scope"> |
| | | {{ crud.toMoney(scope.row.capitalFlowIncomesAmount - scope.row.capitalFlowExpendsAmount) }} |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="remarks" label="备注" /> |
| | | <el-table-column prop="createTime" label="创建时间" /> |
| | | <el-table-column v-if="checkPer(['admin','capitalFlow:edit','capitalFlow: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 crudCapitalFlow from '@/api/capitalFlow/capitalFlow' |
| | | 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 crudSysCompany from '@/api/system/sysCompany' |
| | | |
| | | const defaultForm = { id: null, flowYearMonth: null, companyId: null, remarks: null, createBy: null, createTime: null, updateBy: null, updateTime: null } |
| | | export default { |
| | | name: 'CapitalFlow', |
| | | components: { pagination, crudOperation, rrOperation, udOperation }, |
| | | mixins: [presenter(), header(), form(defaultForm), crud()], |
| | | cruds() { |
| | | return CRUD({ title: '资金流水', url: 'api/capitalFlow', idField: 'id', sort: 'id,desc', crudMethod: { ...crudCapitalFlow }}) |
| | | }, |
| | | data() { |
| | | return { |
| | | permission: { |
| | | add: ['admin', 'capitalFlow:add'], |
| | | edit: ['admin', 'capitalFlow:edit'], |
| | | del: ['admin', 'capitalFlow:del'], |
| | | download: ['admin', 'capitalFlow:download'] |
| | | }, |
| | | rules: { |
| | | flowYearMonth: [ |
| | | { required: true, message: '流水年月不能为空', trigger: 'change' } |
| | | ], |
| | | companyId: [ |
| | | { required: true, message: '所属公司不能为空', trigger: 'change' } |
| | | ] |
| | | }, |
| | | queryTypeOptions: [ |
| | | { key: 'flowYearMonth', display_name: '流水年月' }, |
| | | { key: 'companyId', display_name: '所属公司' } |
| | | ], |
| | | // 公司列表 |
| | | companyList: [] |
| | | } |
| | | }, |
| | | methods: { |
| | | // 钩子:在获取表格数据之前执行,false 则代表不获取数据 |
| | | [CRUD.HOOK.beforeRefresh]() { |
| | | // 获取公司数据 |
| | | this.getCompanyList() |
| | | return true |
| | | }, |
| | | // 获取公司数据 |
| | | getCompanyList() { |
| | | // 获取公司数据 |
| | | crudSysCompany.getAll().then(res => { |
| | | // 公司列表 |
| | | this.companyList = res |
| | | }) |
| | | } |
| | | } |
| | | } |
| | | </script> |
| | | |
| | | <style scoped> |
| | | .flow-label { |
| | | color: deeppink; |
| | | font-weight: bold; |
| | | font-size: 14px; |
| | | } |
| | | </style> |
| New file |
| | |
| | | <template> |
| | | <div class="app-container"> |
| | | <!--工具栏--> |
| | | <div class="head-container"> |
| | | <div v-if="crud.props.searchToggle"> |
| | | <!-- 搜索 --> |
| | | <el-select v-model="query.flowId" filterable clearable placeholder="所属流水" style="width: 185px;" class="filter-item" @keyup.enter.native="crud.toQuery"> |
| | | <el-option |
| | | v-for="item in capitalFlowList" |
| | | :key="item.id" |
| | | :label="item.flowYearMonth.substring(0,7) + ' - ' + item.companyName" |
| | | :value="item.id" |
| | | /> |
| | | </el-select> |
| | | <el-input v-model="query.title" clearable placeholder="标题" style="width: 185px;" class="filter-item" @keyup.enter.native="crud.toQuery" /> |
| | | <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="flowId"> |
| | | <el-select v-model="form.flowId" filterable clearable placeholder="请选择" style="width: 370px;"> |
| | | <el-option |
| | | v-for="item in capitalFlowList" |
| | | :key="item.id" |
| | | :label="item.flowYearMonth.substring(0,7) + ' - ' + item.companyName" |
| | | :value="item.id" |
| | | /> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="标题" prop="title"> |
| | | <el-input v-model="form.title" style="width: 370px;" /> |
| | | </el-form-item> |
| | | <el-form-item label="金额" prop="amount"> |
| | | <money-input :key="random" v-model="form.amount" :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 prop="flowName" label="所属流水"> |
| | | <template slot-scope="scope"> |
| | | <el-tag>{{ scope.row.flowName }}</el-tag> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="title" label="标题" /> |
| | | <el-table-column prop="amount" label="金额"> |
| | | <template slot-scope="scope"> |
| | | {{ crud.toMoney(scope.row.amount) }} |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="remarks" label="备注" /> |
| | | <el-table-column prop="createTime" label="创建时间" /> |
| | | <el-table-column v-if="checkPer(['admin','capitalFlowExpend:edit','capitalFlowExpend: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 crudCapitalFlowExpend from '@/api/capitalFlow/capitalFlowExpend' |
| | | 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 moneyInput from '../../assembly/moneyInput/index.vue' |
| | | import crudCapitalFlow from '@/api/capitalFlow/capitalFlow' |
| | | |
| | | const defaultForm = { id: null, flowId: null, title: null, amount: null, remarks: null, createBy: null, createTime: null, updateBy: null, updateTime: null } |
| | | export default { |
| | | name: 'CapitalFlowExpend', |
| | | components: { pagination, crudOperation, rrOperation, udOperation, moneyInput }, |
| | | mixins: [presenter(), header(), form(defaultForm), crud()], |
| | | cruds() { |
| | | return CRUD({ title: '流水支出', url: 'api/capitalFlowExpend', idField: 'id', sort: 'id,desc', crudMethod: { ...crudCapitalFlowExpend }}) |
| | | }, |
| | | data() { |
| | | // 金额(千万内)验证 |
| | | var amountValidate = (rule, value, callback) => { |
| | | if (value != null && value !== '' && (isNaN(value) || Number(value) < 0 || Number(value) > 1000000000)) { |
| | | callback(new Error('请输入 十亿 以内的正整数或两位小数')) |
| | | } else { |
| | | callback() |
| | | } |
| | | } |
| | | return { |
| | | permission: { |
| | | add: ['admin', 'capitalFlowExpend:add'], |
| | | edit: ['admin', 'capitalFlowExpend:edit'], |
| | | del: ['admin', 'capitalFlowExpend:del'], |
| | | download: ['admin', 'capitalFlowExpend:download'] |
| | | }, |
| | | rules: { |
| | | flowId: [ |
| | | { required: true, message: '所属流水不能为空', trigger: 'change' } |
| | | ], |
| | | title: [ |
| | | { required: true, message: '标题不能为空', trigger: 'blur' }, |
| | | { max: 50, message: '最大长度 50 个字符', trigger: 'blur' } |
| | | ], |
| | | amount: [ |
| | | { required: true, message: '金额不能为空', trigger: 'blur' }, |
| | | { validator: amountValidate, trigger: 'blur' } |
| | | ] |
| | | }, |
| | | queryTypeOptions: [ |
| | | { key: 'flowId', display_name: '所属流水' }, |
| | | { key: 'title', display_name: '标题' } |
| | | ], |
| | | // 随机数 |
| | | random: 0, |
| | | // 资金流水列表 |
| | | capitalFlowList: [] |
| | | } |
| | | }, |
| | | methods: { |
| | | // 钩子:在获取表格数据之前执行,false 则代表不获取数据 |
| | | [CRUD.HOOK.beforeRefresh]() { |
| | | // 获取资金流水数据 |
| | | this.getCapitalFlow() |
| | | return true |
| | | }, |
| | | // 获取资金流水数据 |
| | | getCapitalFlow() { |
| | | // 获取资金流水数据 |
| | | crudCapitalFlow.getAll().then(res => { |
| | | // 资金流水列表 |
| | | this.capitalFlowList = res |
| | | }) |
| | | }, |
| | | // 钩子: 开始 "新建/编辑" - 之前 |
| | | [CRUD.HOOK.beforeToCU]() { |
| | | // 随机数 |
| | | this.random = Math.random() |
| | | } |
| | | } |
| | | } |
| | | </script> |
| | | |
| | | <style scoped> |
| | | |
| | | </style> |
| New file |
| | |
| | | <template> |
| | | <div class="app-container"> |
| | | <!--工具栏--> |
| | | <div class="head-container"> |
| | | <div v-if="crud.props.searchToggle"> |
| | | <!-- 搜索 --> |
| | | <el-select v-model="query.flowId" filterable clearable placeholder="所属流水" style="width: 185px;" class="filter-item" @keyup.enter.native="crud.toQuery"> |
| | | <el-option |
| | | v-for="item in capitalFlowList" |
| | | :key="item.id" |
| | | :label="item.flowYearMonth.substring(0,7) + ' - ' + item.companyName" |
| | | :value="item.id" |
| | | /> |
| | | </el-select> |
| | | <el-input v-model="query.title" clearable placeholder="标题" style="width: 185px;" class="filter-item" @keyup.enter.native="crud.toQuery" /> |
| | | <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="flowId"> |
| | | <el-select v-model="form.flowId" filterable clearable placeholder="请选择" style="width: 370px;"> |
| | | <el-option |
| | | v-for="item in capitalFlowList" |
| | | :key="item.id" |
| | | :label="item.flowYearMonth.substring(0,7) + ' - ' + item.companyName" |
| | | :value="item.id" |
| | | /> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="标题" prop="title"> |
| | | <el-input v-model="form.title" style="width: 370px;" /> |
| | | </el-form-item> |
| | | <el-form-item label="金额" prop="amount"> |
| | | <money-input :key="random" v-model="form.amount" :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 prop="flowName" label="所属流水"> |
| | | <template slot-scope="scope"> |
| | | <el-tag>{{ scope.row.flowName }}</el-tag> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="title" label="标题" /> |
| | | <el-table-column prop="amount" label="金额"> |
| | | <template slot-scope="scope"> |
| | | {{ crud.toMoney(scope.row.amount) }} |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="remarks" label="备注" /> |
| | | <el-table-column prop="createTime" label="创建时间" /> |
| | | <el-table-column v-if="checkPer(['admin','capitalFlowIncome:edit','capitalFlowIncome: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 crudCapitalFlowIncome from '@/api/capitalFlow/capitalFlowIncome' |
| | | 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 moneyInput from '../../assembly/moneyInput/index.vue' |
| | | import crudCapitalFlow from '@/api/capitalFlow/capitalFlow' |
| | | |
| | | const defaultForm = { id: null, flowId: null, title: null, amount: null, remarks: null, createBy: null, createTime: null, updateBy: null, updateTime: null } |
| | | export default { |
| | | name: 'CapitalFlowIncome', |
| | | components: { pagination, crudOperation, rrOperation, udOperation, moneyInput }, |
| | | mixins: [presenter(), header(), form(defaultForm), crud()], |
| | | cruds() { |
| | | return CRUD({ title: '流水收入', url: 'api/capitalFlowIncome', idField: 'id', sort: 'id,desc', crudMethod: { ...crudCapitalFlowIncome }}) |
| | | }, |
| | | data() { |
| | | // 金额(千万内)验证 |
| | | var amountValidate = (rule, value, callback) => { |
| | | if (value != null && value !== '' && (isNaN(value) || Number(value) < 0 || Number(value) > 1000000000)) { |
| | | callback(new Error('请输入 十亿 以内的正整数或两位小数')) |
| | | } else { |
| | | callback() |
| | | } |
| | | } |
| | | return { |
| | | permission: { |
| | | add: ['admin', 'capitalFlowIncome:add'], |
| | | edit: ['admin', 'capitalFlowIncome:edit'], |
| | | del: ['admin', 'capitalFlowIncome:del'], |
| | | download: ['admin', 'capitalFlowIncome:download'] |
| | | }, |
| | | rules: { |
| | | flowId: [ |
| | | { required: true, message: '所属流水不能为空', trigger: 'change' } |
| | | ], |
| | | title: [ |
| | | { required: true, message: '标题不能为空', trigger: 'blur' }, |
| | | { max: 50, message: '最大长度 50 个字符', trigger: 'blur' } |
| | | ], |
| | | amount: [ |
| | | { required: true, message: '金额不能为空', trigger: 'blur' }, |
| | | { validator: amountValidate, trigger: 'blur' } |
| | | ] |
| | | }, |
| | | queryTypeOptions: [ |
| | | { key: 'flowId', display_name: '所属流水' }, |
| | | { key: 'title', display_name: '标题' } |
| | | ], |
| | | // 随机数 |
| | | random: 0, |
| | | // 资金流水列表 |
| | | capitalFlowList: [] |
| | | } |
| | | }, |
| | | methods: { |
| | | // 钩子:在获取表格数据之前执行,false 则代表不获取数据 |
| | | [CRUD.HOOK.beforeRefresh]() { |
| | | // 获取资金流水数据 |
| | | this.getCapitalFlow() |
| | | return true |
| | | }, |
| | | // 获取资金流水数据 |
| | | getCapitalFlow() { |
| | | // 获取资金流水数据 |
| | | crudCapitalFlow.getAll().then(res => { |
| | | // 资金流水列表 |
| | | this.capitalFlowList = res |
| | | }) |
| | | }, |
| | | // 钩子: 开始 "新建/编辑" - 之前 |
| | | [CRUD.HOOK.beforeToCU]() { |
| | | // 随机数 |
| | | this.random = Math.random() |
| | | } |
| | | } |
| | | } |
| | | </script> |
| | | |
| | | <style scoped> |
| | | |
| | | </style> |
| New file |
| | |
| | | <template> |
| | | <div class="app-container"> |
| | | <!--工具栏--> |
| | | <div class="head-container"> |
| | | <div> |
| | | <el-input |
| | | v-model="query.conferenceRoomName" |
| | | clearable |
| | | size="small" |
| | | placeholder="会议室名称" |
| | | style="width: 200px;" |
| | | class="filter-item" |
| | | @keyup.enter.native="crud.toQuery" |
| | | /> |
| | | <rrOperation /> |
| | | </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="95px"> |
| | | <el-form-item label="会议室名称" prop="conferenceRoomName"> |
| | | <el-input v-model="form.conferenceRoomName" style="width: 365px;" /> |
| | | </el-form-item> |
| | | <el-form-item label="会议室地址"> |
| | | <el-input v-model="form.conferenceRoomAddress" style="width: 365px;" /> |
| | | </el-form-item> |
| | | <el-form-item label="容纳人数"> |
| | | <el-input v-model="form.capacity" style="width: 365px;" /> |
| | | </el-form-item> |
| | | <el-form-item label="备注"> |
| | | <el-input v-model="form.remarks" type="textarea" rows="3" style="width: 365px;" /> |
| | | </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 prop="conferenceRoomName" label="会议室名称" show-overflow-tooltip> |
| | | <template slot-scope="scope"> |
| | | {{ scope.row.conferenceRoomName }} |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="conferenceRoomAddress" label="会议室地址" show-overflow-tooltip /> |
| | | <el-table-column prop="snum" label="设备" show-overflow-tooltip> |
| | | <template slot-scope="scope"> |
| | | {{ getEquipment(scope.row.snum) }} |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="capacity" label="容纳人数" show-overflow-tooltip /> |
| | | <el-table-column prop="remarks" label="备注" show-overflow-tooltip /> |
| | | <el-table-column prop="createTime" label="创建时间" show-overflow-tooltip /> |
| | | <el-table-column v-if="checkPer(['admin','meetingRoom:edit','meetingRoom: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 crudMeetingRoom from '@/api/conferenceRoom/meetingRoom' |
| | | 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' |
| | | |
| | | const defaultForm = { id: null, conferenceRoomName: null, conferenceRoomAddress: null, capacity: null, remarks: null, createBy: null, createTime: null, updateBy: null, updateTime: null } |
| | | export default { |
| | | name: 'MeetingRoom', |
| | | components: { pagination, crudOperation, rrOperation, udOperation }, |
| | | mixins: [presenter(), header(), form(defaultForm), crud()], |
| | | cruds() { |
| | | return CRUD({ title: '会议室信息', url: 'api/meetingRoom', idField: 'id', sort: 'id,desc', crudMethod: { ...crudMeetingRoom }}) |
| | | }, |
| | | data() { |
| | | return { |
| | | permission: { |
| | | add: ['admin', 'meetingRoom:add'], |
| | | edit: ['admin', 'meetingRoom:edit'], |
| | | del: ['admin', 'meetingRoom:del'], |
| | | download: ['admin', 'meetingRoom:download'] |
| | | }, |
| | | rules: { |
| | | id: [ |
| | | { required: true, message: '不能为空', trigger: 'blur' } |
| | | ], |
| | | conferenceRoomName: [ |
| | | { required: true, message: '会议室名称不能为空', trigger: 'blur' } |
| | | ], |
| | | createBy: [ |
| | | { required: true, message: '创建者不能为空', trigger: 'blur' } |
| | | ], |
| | | createTime: [ |
| | | { required: true, message: '创建时间不能为空', trigger: 'blur' } |
| | | ] |
| | | }} |
| | | }, |
| | | methods: { |
| | | // 钩子:在获取表格数据之前执行,false 则代表不获取数据 |
| | | [CRUD.HOOK.beforeRefresh]() { |
| | | return true |
| | | }, |
| | | // 获取设备 |
| | | getEquipment(data) { |
| | | const assList = [] |
| | | data.forEach(element => { |
| | | assList.push(element) |
| | | }) |
| | | const name = '"' + assList + '"' |
| | | const name1 = name.substring(1, name.length - 1) |
| | | return name1 |
| | | } |
| | | } |
| | | } |
| | | </script> |
| | | |
| | | <style scoped> |
| | | |
| | | </style> |
| New file |
| | |
| | | <template> |
| | | <div class="app-container"> |
| | | <!--工具栏--> |
| | | <div class="head-container"> |
| | | <div> |
| | | <el-select v-model="query.meetingId" filterable clearable placeholder="所属会议室" style="width: 185px;" class="filter-item" @keyup.enter.native="crud.toQuery"> |
| | | <el-option |
| | | v-for="item in meetings" |
| | | :key="item.id" |
| | | :label="item.conferenceRoomName" |
| | | :value="item.id" |
| | | /> |
| | | </el-select> |
| | | <el-input |
| | | v-model="query.meetingTheme" |
| | | clearable |
| | | size="small" |
| | | placeholder="会议主题" |
| | | style="width: 185px;" |
| | | class="filter-item" |
| | | @keyup.enter.native="crud.toQuery" |
| | | /> |
| | | <el-date-picker |
| | | v-model="query.startTime" |
| | | type="daterange" |
| | | clearable |
| | | class="date-item" |
| | | value-format="yyyy-MM-dd HH:mm:ss" |
| | | placeholder="请选择日期时间" |
| | | range-separator=" : " |
| | | start-placeholder="开始时间" |
| | | end-placeholder="开始时间" |
| | | /> |
| | | <el-date-picker |
| | | v-model="query.endTime" |
| | | type="daterange" |
| | | clearable |
| | | class="date-item" |
| | | value-format="yyyy-MM-dd HH:mm:ss" |
| | | placeholder="请选择日期时间" |
| | | range-separator=" : " |
| | | start-placeholder="结束时间" |
| | | end-placeholder="结束时间" |
| | | /> |
| | | <rrOperation /> |
| | | </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="100px"> |
| | | <el-form-item label="所属会议室" prop="meetingId"> |
| | | <el-select v-model="form.meetingId" filterable clearable placeholder="请选择" style="width: 350px;"> |
| | | <el-option |
| | | v-for="item in meetings" |
| | | :key="item.id" |
| | | :label="item.conferenceRoomName" |
| | | :value="item.id" |
| | | /> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="会议主题" prop="meetingTheme"> |
| | | <el-input v-model="form.meetingTheme" style="width: 350px;" /> |
| | | </el-form-item> |
| | | <el-form-item label="开始时间" prop="startTime"> |
| | | <el-date-picker |
| | | v-model="form.startTime" |
| | | :type="'datetime'" |
| | | placeholder="选择日期时间" |
| | | style="width: 350px;" |
| | | value-format="yyyy-MM-dd HH:mm:00" |
| | | align="right" |
| | | :picker-options="{ |
| | | disabledDate(time) { |
| | | return form.endTime ? time.getTime() > new Date(form.endTime).getTime() - 8.64e7 : false; |
| | | } |
| | | }" |
| | | /> |
| | | </el-form-item> |
| | | <el-form-item label="结束时间" prop="endTime"> |
| | | <el-date-picker |
| | | v-model="form.endTime" |
| | | :type="'datetime'" |
| | | placeholder="选择日期时间" |
| | | style="width: 350px;" |
| | | value-format="yyyy-MM-dd HH:mm:00" |
| | | align="right" |
| | | :picker-options="{ |
| | | disabledDate(time) { |
| | | return form.startTime ? time.getTime() < new Date(form.startTime).getTime() - 8.64e7 : false; |
| | | } |
| | | }" |
| | | /> |
| | | </el-form-item> |
| | | <el-form-item label="参与人数" prop="numberOfParticipants"> |
| | | <el-input v-model="form.numberOfParticipants" style="width: 350px;" /> |
| | | </el-form-item> |
| | | <el-form-item label="备注"> |
| | | <el-input v-model="form.remarks" type="textarea" rows="3" style="width: 350px;" /> |
| | | </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 prop="meetingId" label="所属会议室" show-overflow-tooltip> |
| | | <template slot-scope="scope"> |
| | | <el-tag>{{ scope.row.meetingName }}</el-tag> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="meetingTheme" label="会议主题" show-overflow-tooltip /> |
| | | <el-table-column prop="startTime" label="开始时间" show-overflow-tooltip /> |
| | | <el-table-column prop="endTime" label="结束时间" show-overflow-tooltip /> |
| | | <el-table-column prop="numberOfParticipants" label="参与人数" show-overflow-tooltip /> |
| | | <el-table-column prop="remarks" label="备注" /> |
| | | <el-table-column prop="createTime" label="创建时间" /> |
| | | <el-table-column v-if="checkPer(['admin','meetingRoomReservation:edit','meetingRoomReservation: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 crudMeetingRoomReservation from '@/api/conferenceRoom/meetingRoomReservation' |
| | | import crudMeetingRoom from '@/api/conferenceRoom/meetingRoom' |
| | | 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' |
| | | |
| | | const defaultForm = { id: null, meetingId: null, meetingTheme: null, startTime: null, endTime: null, numberOfParticipants: null, remarks: null, createBy: null, createTime: null, updateBy: null, updateTime: null } |
| | | export default { |
| | | name: 'MeetingRoomReservation', |
| | | components: { pagination, crudOperation, rrOperation, udOperation }, |
| | | mixins: [presenter(), header(), form(defaultForm), crud()], |
| | | cruds() { |
| | | return CRUD({ title: '会议室预约', url: 'api/meetingRoomReservation', idField: 'id', sort: 'id,desc', crudMethod: { ...crudMeetingRoomReservation }}) |
| | | }, |
| | | data() { |
| | | // 工资(千万内)验证 |
| | | var wageValidate = (rule, value, callback) => { |
| | | if (value != null && value !== '' && (isNaN(value) || Number(value) < 0 || Number(value) > 10000000)) { |
| | | callback(new Error('请输入 一千万 以内的正整数或两位小数')) |
| | | } else { |
| | | callback() |
| | | } |
| | | } |
| | | return { |
| | | permission: { |
| | | add: ['admin', 'meetingRoomReservation:add'], |
| | | edit: ['admin', 'meetingRoomReservation:edit'], |
| | | del: ['admin', 'meetingRoomReservation:del'], |
| | | download: ['admin', 'meetingRoomReservation:download'] |
| | | }, |
| | | rules: { |
| | | meetingId: [ |
| | | { required: true, message: '会议室id不能为空', trigger: 'blur' } |
| | | ], |
| | | meetingTheme: [ |
| | | { required: true, message: '会议主题不能为空', trigger: 'blur' } |
| | | ], |
| | | startTime: [ |
| | | { required: true, message: '开始时间不能为空', trigger: 'blur' } |
| | | ], |
| | | endTime: [ |
| | | { required: true, message: '结束时间不能为空', trigger: 'blur' } |
| | | ], |
| | | numberOfParticipants: [ |
| | | { validator: wageValidate, trigger: 'blur' } |
| | | ] |
| | | }, |
| | | meetings: [] } |
| | | }, |
| | | methods: { |
| | | // 钩子:在获取表格数据之前执行,false 则代表不获取数据 |
| | | [CRUD.HOOK.beforeRefresh]() { |
| | | // 所属会议室 |
| | | crudMeetingRoom.getAll().then(res => { |
| | | this.meetings = res |
| | | }) |
| | | return true |
| | | } |
| | | } |
| | | } |
| | | </script> |
| | | |
| | | <style scoped> |
| | | |
| | | </style> |
| New file |
| | |
| | | <template> |
| | | <div class="app-container"> |
| | | <!--工具栏--> |
| | | <div class="head-container"> |
| | | <div v-if="crud.props.searchToggle"> |
| | | <!-- 搜索 --> |
| | | <el-input v-model="query.contractNumber" clearable placeholder="合同编号" style="width: 185px;" class="filter-item" @keyup.enter.native="crud.toQuery" /> |
| | | <el-input v-model="query.contractName" clearable placeholder="合同名称" style="width: 185px;" class="filter-item" @keyup.enter.native="crud.toQuery" /> |
| | | <el-select v-model="query.firstId" filterable clearable placeholder="所属甲方" style="width: 185px;" class="filter-item" @keyup.enter.native="crud.toQuery"> |
| | | <el-option |
| | | v-for="item in customerFirst" |
| | | :key="item.firstId" |
| | | :label="item.firstName" |
| | | :value="item.firstId" |
| | | > |
| | | <span style="float: left">{{ item.firstName }}</span> |
| | | <span style="float: right; color: #8492a6; font-size: 13px">{{ item.firstPerson }}-{{ item.firstPhone }}</span> |
| | | </el-option> |
| | | </el-select> |
| | | <el-select v-model="query.secondId" filterable clearable placeholder="所属乙方" style="width: 185px;" class="filter-item" @keyup.enter.native="crud.toQuery"> |
| | | <el-option |
| | | v-for="item in customerSecond" |
| | | :key="item.secondId" |
| | | :label="item.secondName" |
| | | :value="item.secondId" |
| | | > |
| | | <span style="float: left">{{ item.secondName }}</span> |
| | | <span style="float: right; color: #8492a6; font-size: 13px">{{ item.secondPerson }}-{{ item.secondPhone }}</span> |
| | | </el-option> |
| | | </el-select> |
| | | <el-select v-model="query.contractType" filterable clearable placeholder="合同类型" style="width: 185px;" class="filter-item" @keyup.enter.native="crud.toQuery"> |
| | | <el-option |
| | | v-for="item in dict[contractType]" |
| | | :key="item.id" |
| | | :label="item.label" |
| | | :value="item.value" |
| | | /> |
| | | </el-select> |
| | | <el-select v-model="query.contractPaymentState" filterable clearable placeholder="合同费付款状态" style="width: 185px;" class="filter-item" @keyup.enter.native="crud.toQuery"> |
| | | <el-option |
| | | v-for="item in dict[paymentState]" |
| | | :key="item.id" |
| | | :label="item.label" |
| | | :value="item.value" |
| | | /> |
| | | </el-select> |
| | | <el-select v-model="query.servicePaymentState" filterable clearable placeholder="服务费付款状态" style="width: 185px;" class="filter-item" @keyup.enter.native="crud.toQuery"> |
| | | <el-option |
| | | v-for="item in dict[paymentState]" |
| | | :key="item.id" |
| | | :label="item.label" |
| | | :value="item.value" |
| | | /> |
| | | </el-select> |
| | | <el-select v-model="query.contractStatus" filterable clearable placeholder="合同状态" style="width: 185px;" class="filter-item" @keyup.enter.native="crud.toQuery"> |
| | | <el-option |
| | | v-for="item in dict[contractStatus]" |
| | | :key="item.id" |
| | | :label="item.label" |
| | | :value="item.value" |
| | | /> |
| | | </el-select> |
| | | <el-select v-model="query.provincial" filterable clearable placeholder="省级" style="width: 185px;" class="filter-item" @change="queryProvincialChange" @keyup.enter.native="crud.toQuery"> |
| | | <el-option |
| | | v-for="item in areaOptions" |
| | | :key="item.value" |
| | | :label="item.label" |
| | | :value="item.value" |
| | | /> |
| | | </el-select> |
| | | <el-select v-model="query.city" filterable clearable placeholder="市级" style="width: 185px;" class="filter-item" @change="queryCityChange" @keyup.enter.native="crud.toQuery"> |
| | | <el-option |
| | | v-for="item in queryCityList" |
| | | :key="item.value" |
| | | :label="item.label" |
| | | :value="item.value" |
| | | /> |
| | | </el-select> |
| | | <el-select v-model="query.region" filterable clearable placeholder="区级" style="width: 185px;" class="filter-item" @change="queryRegionChange" @keyup.enter.native="crud.toQuery"> |
| | | <el-option |
| | | v-for="item in queryRegionList" |
| | | :key="item.value" |
| | | :label="item.label" |
| | | :value="item.value" |
| | | /> |
| | | </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"> |
| | | <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) }} |
| | | </el-col> |
| | | <el-col :xs="12" :sm="12" :lg="6"> |
| | | 合同费延期数:{{ contractDelayTotalAmount }} |
| | | </el-col> |
| | | <el-col :xs="12" :sm="12" :lg="6"> |
| | | 合同费延期金额:{{ crud.toMoney(contractDelayTotalMoney) }} |
| | | </el-col> |
| | | <el-col :xs="12" :sm="12" :lg="6"> |
| | | 预收款总金额:{{ crud.toMoney(advancePaymentTotalMoney) }} |
| | | </el-col> |
| | | </el-row> |
| | | <el-row :gutter="40" style="color: red; font-weight: bolder;"> |
| | | <el-col :xs="12" :sm="12" :lg="6"> |
| | | 运维服务总金额:{{ crud.toMoney(serviceTotalMoney) }} |
| | | </el-col> |
| | | <el-col :xs="12" :sm="12" :lg="6"> |
| | | 运维服务延期数:{{ serviceDelayTotalAmount }} |
| | | </el-col> |
| | | <el-col :xs="12" :sm="12" :lg="6"> |
| | | 运维服务延期金额:{{ crud.toMoney(serviceDelayTotalMoney) }} |
| | | </el-col> |
| | | <el-col :xs="12" :sm="12" :lg="6"> |
| | | 应收款总金额:{{ crud.toMoney(receivePaymentTotalMoney) }} |
| | | </el-col> |
| | | </el-row> |
| | | <!--表单组件--> |
| | | <el-dialog :close-on-click-modal="false" :before-close="crud.cancelCU" :visible.sync="crud.status.cu > 0" :title="crud.status.title" width="710px"> |
| | | <el-form ref="form" :inline="true" :model="form" :rules="rules" size="small" label-width="120px"> |
| | | <el-form-item label="合同名称" prop="contractName"> |
| | | <el-input v-model="form.contractName" style="width: 535px;" /> |
| | | </el-form-item> |
| | | <el-form-item label="所属甲方" prop="firstId"> |
| | | <el-select v-model="form.firstId" filterable clearable placeholder="请选择" style="width: 535px;"> |
| | | <el-option |
| | | v-for="item in customerFirst" |
| | | :key="item.firstId" |
| | | :label="item.firstName" |
| | | :value="item.firstId" |
| | | > |
| | | <span style="float: left">{{ item.firstName }}</span> |
| | | <span style="float: right; color: #8492a6; font-size: 13px">{{ item.firstPerson }}-{{ item.firstPhone }}</span> |
| | | </el-option> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="所属乙方" prop="secondId"> |
| | | <el-select v-model="form.secondId" filterable clearable placeholder="请选择" style="width: 535px;"> |
| | | <el-option |
| | | v-for="item in customerSecond" |
| | | :key="item.secondId" |
| | | :label="item.secondName" |
| | | :value="item.secondId" |
| | | > |
| | | <span style="float: left">{{ item.secondName }}</span> |
| | | <span style="float: right; color: #8492a6; font-size: 13px">{{ item.secondPerson }}-{{ item.secondPhone }}</span> |
| | | </el-option> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="签订日期" prop="signDate"> |
| | | <el-date-picker v-model="form.signDate" type="date" style="width: 200px;" /> |
| | | </el-form-item> |
| | | <el-form-item label="所属地区" prop="contractArea"> |
| | | <el-cascader |
| | | v-model="selectedAreaOptions" |
| | | size="large" |
| | | :options="areaOptions" |
| | | style="width: 200px;" |
| | | @change="areaChange" |
| | | /> |
| | | </el-form-item> |
| | | <el-form-item label="起始日期" prop="startDate"> |
| | | <el-date-picker v-model="form.startDate" type="date" style="width: 200px;" /> |
| | | </el-form-item> |
| | | <el-form-item label="截止日期" prop="endDate"> |
| | | <el-date-picker v-model="form.endDate" type="date" style="width: 200px;" /> |
| | | </el-form-item> |
| | | <el-form-item label="合同类型" prop="contractType"> |
| | | <el-select v-model="form.contractType" filterable placeholder="请选择" style="width: 200px;" @change="contractTypeChange"> |
| | | <el-option |
| | | v-for="item in dict[contractType]" |
| | | :key="item.id" |
| | | :label="item.label" |
| | | :value="item.value" |
| | | /> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="合同内容" prop="contractContent"> |
| | | <el-input v-model="form.contractContent" style="width: 200px;" /> |
| | | </el-form-item> |
| | | <span v-if="form.contractType != contractService && form.contractType != null && form.contractType != ''"> |
| | | <el-divider>合同费用数据</el-divider> |
| | | <el-form-item label="合同费金额" prop="contractAmount"> |
| | | <money-input :key="random" v-model="form.contractAmount" :width="535" /> |
| | | </el-form-item> |
| | | <el-form-item label="预计付款日期" prop="contractPaymentDate"> |
| | | <el-date-picker v-model="form.contractPaymentDate" type="date" style="width: 200px;" /> |
| | | </el-form-item> |
| | | <el-form-item label="付款状态" prop="contractPaymentState"> |
| | | <el-select v-model="form.contractPaymentState" filterable placeholder="请选择" style="width: 200px;"> |
| | | <el-option |
| | | v-for="item in dict[paymentState]" |
| | | :key="item.id" |
| | | :label="item.label" |
| | | :value="item.value" |
| | | /> |
| | | </el-select> |
| | | </el-form-item> |
| | | </span> |
| | | <span v-if="form.contractType == contractService || form.contractType == contractDevelopService"> |
| | | <el-divider>运维服务费用数据</el-divider> |
| | | <el-form-item v-if="form.contractType == contractDevelopService" label="服务开始日期" prop="serviceStartsDate"> |
| | | <el-date-picker v-model="form.serviceStartsDate" type="date" style="width: 535px;" /> |
| | | </el-form-item> |
| | | <el-form-item label="运维服务费金额" prop="serviceAmount"> |
| | | <money-input :key="random" v-model="form.serviceAmount" :width="535" /> |
| | | </el-form-item> |
| | | <el-form-item label="预计付款日期" prop="servicePaymentDate"> |
| | | <el-date-picker v-model="form.servicePaymentDate" type="date" style="width: 200px;" /> |
| | | </el-form-item> |
| | | <el-form-item label="付款状态" prop="servicePaymentState"> |
| | | <el-select v-model="form.servicePaymentState" filterable placeholder="请选择" style="width: 200px;"> |
| | | <el-option |
| | | v-for="item in dict[paymentState]" |
| | | :key="item.id" |
| | | :label="item.label" |
| | | :value="item.value" |
| | | /> |
| | | </el-select> |
| | | </el-form-item> |
| | | </span> |
| | | <el-form-item label="合同初版文件" prop="relatedDocumentsFirst"> |
| | | <file-upload :key="random" ref="fileFirstUpload" :file-url="form.relatedDocumentsFirst == null || form.relatedDocumentsFirst === '' ? null : form.relatedDocumentsFirst" :limit="5" @fileInfo="getFirstFileInfo" /> |
| | | </el-form-item> |
| | | <el-form-item label="合同终版文件" prop="relatedDocumentsFinal"> |
| | | <file-upload :key="random" ref="fileFinalUpload" :file-url="form.relatedDocumentsFinal == null || form.relatedDocumentsFinal === '' ? null : form.relatedDocumentsFinal" :limit="5" @fileInfo="getFinalFileInfo" /> |
| | | </el-form-item> |
| | | <el-form-item label="合同状态" prop="contractStatus"> |
| | | <el-select v-model="form.contractStatus" filterable placeholder="请选择" style="width: 200px;"> |
| | | <el-option |
| | | v-for="item in dict[contractStatus]" |
| | | :key="item.id" |
| | | :label="item.label" |
| | | :value="item.value" |
| | | /> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="备注信息" prop="remarks"> |
| | | <el-input v-model="form.remarks" :rows="3" type="textarea" style="width: 535px;" /> |
| | | </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="submitCU">确认</el-button> |
| | | </div> |
| | | </el-dialog> |
| | | <!--表格渲染--> |
| | | <el-table ref="table" v-loading="crud.loading" :data="crud.data" stripe size="small" style="width: 100%;" @selection-change="crud.selectionChangeHandler"> |
| | | <el-table-column type="selection" width="55" /> |
| | | <el-table-column fixed="left" type="expand"> |
| | | <template slot-scope="props"> |
| | | <el-form label-position="left" class="my-demo-table-expand" style="margin-left: 264px;"> |
| | | <template v-if="props.row.contractType != contractService"> |
| | | <el-form-item label="合同费"> |
| | | <span>{{ crud.toMoney(props.row.contractPaymentAmount) }} / {{ crud.toMoney(props.row.contractAmount) }}</span> |
| | | </el-form-item> |
| | | </template> |
| | | <template v-if="props.row.contractType == contractService || props.row.contractType == contractDevelopService"> |
| | | <el-form-item |
| | | v-for="item in (parseInt(crud.toDate(new Date()).substring(0,4)) - parseInt(crud.toDate(props.row.serviceStartsDate).substring(0,4)) + 1)" |
| | | :key="item" |
| | | :label=" |
| | | (parseInt(crud.toDate(props.row.serviceStartsDate).substring(0,4)) + (item - 1)) + |
| | | crud.toDate(props.row.serviceStartsDate).substring(4,10) + |
| | | ' ~ ' + |
| | | ( |
| | | crud.toDate(new Date(props.row.serviceStartsDate).getTime() - 24 * 60 * 60 * 1000).substring(4,10) == '-12-31' ? |
| | | (parseInt(crud.toDate(props.row.serviceStartsDate).substring(0,4)) + (item - 1)) + |
| | | crud.toDate(new Date(props.row.serviceStartsDate).getTime() - 24 * 60 * 60 * 1000).substring(4,10) : |
| | | (parseInt(crud.toDate(props.row.serviceStartsDate).substring(0,4)) + item) + |
| | | crud.toDate(new Date(props.row.serviceStartsDate).getTime() - 24 * 60 * 60 * 1000).substring(4,10) |
| | | ) + |
| | | ' 运维服务费'" |
| | | > |
| | | <span>{{ crud.toMoney(props.row.servicePaymentAmount.split('、')[item - 1]) }} / {{ crud.toMoney(props.row.serviceAmount) }}</span> |
| | | </el-form-item> |
| | | </template> |
| | | </el-form> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column fixed="left" :show-overflow-tooltip="true" prop="contractNumber" label="合同编号" width="100" /> |
| | | <el-table-column fixed="left" :show-overflow-tooltip="true" prop="contractName" label="合同名称" width="100" /> |
| | | <el-table-column :show-overflow-tooltip="true" prop="firstName" label="所属甲方" width="100" /> |
| | | <el-table-column :show-overflow-tooltip="true" prop="secondName" label="所属乙方" width="100" /> |
| | | <el-table-column :show-overflow-tooltip="true" prop="signDate" label="签订日期" width="100"> |
| | | <template slot-scope="scope"> |
| | | {{ crud.toDate(scope.row.signDate) }} |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column label="发票详情"> |
| | | <template slot-scope="scope"> |
| | | <el-link type="info" @click="goContractInvoice(scope.row.contractId)">点击查看</el-link> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column label="付款详情"> |
| | | <template slot-scope="scope"> |
| | | <el-link type="info" @click="goContractPayment(scope.row.contractId)">点击查看</el-link> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column :show-overflow-tooltip="true" prop="billingTotalAmount" label="开票总金额" width="100"> |
| | | <template slot-scope="scope"> |
| | | {{ crud.toMoney(scope.row.billingTotalAmount) }} |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column :show-overflow-tooltip="true" prop="paymentTotalAmount" label="付款总金额" width="100"> |
| | | <template slot-scope="scope"> |
| | | {{ crud.toMoney(scope.row.paymentTotalAmount) }} |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column :show-overflow-tooltip="true" prop="advancePayment" label="预收款金额" width="100"> |
| | | <template slot-scope="scope"> |
| | | <span v-if="scope.row.advancePayment != null && scope.row.advancePayment != 0" style="color: red;"> |
| | | {{ crud.toMoney(scope.row.advancePayment) }} |
| | | </span> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column :show-overflow-tooltip="true" prop="receivePayment" label="应收款金额" width="100"> |
| | | <template slot-scope="scope"> |
| | | <span v-if="scope.row.receivePayment != null && scope.row.receivePayment != 0" style="color: red;"> |
| | | {{ crud.toMoney(scope.row.receivePayment) }} |
| | | </span> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column label="合同费数据"> |
| | | <el-table-column :show-overflow-tooltip="true" prop="contractAmount" label="合同费金额" width="100"> |
| | | <template slot-scope="scope"> |
| | | <span v-if="scope.row.contractAmount != null && scope.row.contractAmount != 0"> |
| | | {{ crud.toMoney(scope.row.contractAmount) }} |
| | | </span> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column :show-overflow-tooltip="true" prop="contractPaymentDate" label="预计付款日期" width="100"> |
| | | <template slot-scope="scope"> |
| | | {{ crud.toDate(scope.row.contractPaymentDate) }} |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column :show-overflow-tooltip="true" prop="contractPaymentState" label="付款状态" width="100"> |
| | | <template slot-scope="scope"> |
| | | {{ dict.label[paymentState][scope.row.contractPaymentState] }} |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column :show-overflow-tooltip="true" prop="contractPostponement" label="延期情况" width="100"> |
| | | <template slot-scope="scope"> |
| | | <span style="color: red;">{{ scope.row.contractPostponement }}</span> |
| | | </template> |
| | | </el-table-column> |
| | | </el-table-column> |
| | | <el-table-column label="运维服务费数据"> |
| | | <el-table-column :show-overflow-tooltip="true" prop="serviceStartsDate" label="服务开始日期" width="100"> |
| | | <template slot-scope="scope"> |
| | | {{ crud.toDate(scope.row.serviceStartsDate) }} |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column :show-overflow-tooltip="true" prop="serviceAmount" label="运维服务费金额" width="110"> |
| | | <template slot-scope="scope"> |
| | | <span v-if="scope.row.serviceAmount != null && scope.row.serviceAmount != 0"> |
| | | {{ crud.toMoney(scope.row.serviceAmount) }} |
| | | </span> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column :show-overflow-tooltip="true" prop="servicePaymentDate" label="预计付款日期" width="100"> |
| | | <template slot-scope="scope"> |
| | | {{ crud.toMonthDay(scope.row.servicePaymentDate) }} |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column :show-overflow-tooltip="true" prop="servicePaymentState" label="付款状态" width="100"> |
| | | <template slot-scope="scope"> |
| | | {{ dict.label[paymentState][scope.row.servicePaymentState] }} |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column :show-overflow-tooltip="true" prop="servicePostponement" label="延期情况" width="100"> |
| | | <template slot-scope="scope"> |
| | | <span style="color: red;">{{ scope.row.servicePostponement }}</span> |
| | | </template> |
| | | </el-table-column> |
| | | </el-table-column> |
| | | <el-table-column :show-overflow-tooltip="true" prop="startDate" label="起始日期" width="100"> |
| | | <template slot-scope="scope"> |
| | | {{ crud.toDate(scope.row.startDate) }} |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column :show-overflow-tooltip="true" prop="endDate" label="截止日期" width="100"> |
| | | <template slot-scope="scope"> |
| | | {{ crud.toDate(scope.row.endDate) }} |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column :show-overflow-tooltip="true" prop="contractArea" label="所属地区" width="100" /> |
| | | <el-table-column :show-overflow-tooltip="true" prop="contractType" label="合同类型" width="100"> |
| | | <template slot-scope="scope"> |
| | | {{ dict.label[contractType][scope.row.contractType] }} |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column :show-overflow-tooltip="true" prop="contractContent" 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','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> |
| | | |
| | | <script> |
| | | import crudContract from '@/api/contract/contract' |
| | | 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 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 DateRangePicker from '@/components/DateRangePicker' |
| | | import constant from '../../../utils/constant' |
| | | 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, 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, constant.FUND_TYPE], |
| | | cruds() { |
| | | return CRUD({ title: '合同详情', url: 'api/contract', idField: 'contractId', sort: 'contractId,desc', crudMethod: { ...crudContract }}) |
| | | }, |
| | | data() { |
| | | // 合同费金额校验规则 |
| | | var validateContractAmount = (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('合同费金额不能为空')) |
| | | } |
| | | } |
| | | // 服务费金额校验规则 |
| | | var validateServiceAmount = (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('服务费金额不能为空')) |
| | | } |
| | | } |
| | | // 分配金额校验规则 |
| | | 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'], |
| | | divide: ['admin', 'contract:divide'], |
| | | seeDivide: ['admin', 'contract:seeDivide'] |
| | | }, |
| | | rules: { |
| | | contractName: [ |
| | | { required: true, message: '请输入合同名称', trigger: 'blur' }, |
| | | { min: 2, max: 100, message: '长度在 2 到 100 个字符', trigger: 'blur' } |
| | | ], |
| | | firstId: [ |
| | | { required: true, message: '请选择所属甲方', trigger: 'change' } |
| | | ], |
| | | secondId: [ |
| | | { required: true, message: '请选择所属乙方', trigger: 'change' } |
| | | ], |
| | | signDate: [ |
| | | { required: true, message: '请选择签订日期', trigger: 'change' } |
| | | ], |
| | | startDate: [ |
| | | { required: true, message: '请选择起始日期', trigger: 'change' } |
| | | ], |
| | | endDate: [ |
| | | { required: true, message: '请选择截止日期', trigger: 'change' } |
| | | ], |
| | | contractArea: [ |
| | | { required: true, message: '请选择所属地区', trigger: 'change' } |
| | | ], |
| | | contractType: [ |
| | | { required: true, message: '请选择合同类型', trigger: 'change' } |
| | | ], |
| | | contractContent: [ |
| | | { min: 2, max: 50, message: '长度在 2 到 50 个字符', trigger: 'blur' } |
| | | ], |
| | | contractAmount: [ |
| | | { required: true, validator: validateContractAmount, trigger: 'blur' } |
| | | ], |
| | | contractPaymentDate: [ |
| | | { required: true, message: '请选择预计付款日期', trigger: 'change' } |
| | | ], |
| | | contractPaymentState: [ |
| | | { required: true, message: '请选择付款状态', trigger: 'change' } |
| | | ], |
| | | serviceStartsDate: [ |
| | | { required: true, message: '请选择服务开始日期', trigger: 'change' } |
| | | ], |
| | | serviceAmount: [ |
| | | { required: true, validator: validateServiceAmount, trigger: 'blur' } |
| | | ], |
| | | servicePaymentDate: [ |
| | | { required: true, message: '请选择预计付款日期', trigger: 'change' } |
| | | ], |
| | | servicePaymentState: [ |
| | | { required: true, message: '请选择付款状态', trigger: 'change' } |
| | | ], |
| | | contractStatus: [ |
| | | { required: true, message: '请选择合同状态', trigger: 'change' } |
| | | ] |
| | | }, |
| | | queryTypeOptions: [ |
| | | { key: 'contractNumber', display_name: '合同编号' }, |
| | | { key: 'contractName', display_name: '合同名称' }, |
| | | { key: 'firstId', display_name: '所属甲方' }, |
| | | { key: 'secondId', display_name: '所属乙方' }, |
| | | { key: 'signDate', display_name: '签订日期' }, |
| | | { key: 'contractType', display_name: '合同类型' }, |
| | | { key: 'contractPaymentState', display_name: '付款状态' }, |
| | | { key: 'servicePaymentState', display_name: '付款状态' }, |
| | | { key: 'contractStatus', display_name: '合同状态' }, |
| | | { key: 'contractAreaCode', display_name: '所属地区' }, |
| | | { key: 'provincial', display_name: '省级' }, |
| | | { key: 'city', display_name: '市级' }, |
| | | { key: 'region', display_name: '区级' } |
| | | ], |
| | | // 字典:合同类型 |
| | | contractType: constant.CONTRACT_TYPE, |
| | | // 字典:合同类型-服务合同(年) |
| | | contractService: constant.CONTRACT_SERVICE, |
| | | // 字典:合同类型-开发服务合同 |
| | | contractDevelopService: constant.CONTRACT_DEVELOP_SERVICE, |
| | | // 字典:付款状态 |
| | | paymentState: constant.PAYMENT_STATE, |
| | | // 字典:合同状态 |
| | | contractStatus: constant.CONTRACT_STATUS, |
| | | // 字典:款项类型 |
| | | fundType: constant.FUND_TYPE, |
| | | // 甲方数据 |
| | | customerFirst: [], |
| | | // 乙方数据 |
| | | customerSecond: [], |
| | | // 项目列表 |
| | | projects: [], |
| | | // 所属地区数据 |
| | | areaOptions: regionData, |
| | | // 选中地区数据 |
| | | selectedAreaOptions: [], |
| | | // 随机数 |
| | | random: 0, |
| | | // 提交触发次数 |
| | | triggerCount: 0, |
| | | // 搜索选择市级列表 |
| | | queryCityList: [], |
| | | // 搜索选择区级列表 |
| | | queryRegionList: [], |
| | | // 合同款总金额 |
| | | contractTotalMoney: 0, |
| | | // 合同款延期数 |
| | | contractDelayTotalAmount: 0, |
| | | // 合同款延期金额 |
| | | contractDelayTotalMoney: 0, |
| | | // 预收款总金额 |
| | | advancePaymentTotalMoney: 0, |
| | | // 运维服务总金额 |
| | | serviceTotalMoney: 0, |
| | | // 运维服务延期数 |
| | | serviceDelayTotalAmount: 0, |
| | | // 运维服务延期金额 |
| | | serviceDelayTotalMoney: 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: { |
| | | 'crud.query.contractAreaCode'(val) { |
| | | // 判断是否为空 |
| | | if (val == null) { |
| | | // 搜索选择市级列表 |
| | | this.queryCityList = [] |
| | | // 搜索选择区级列表 |
| | | this.queryRegionList = [] |
| | | } |
| | | } |
| | | }, |
| | | methods: { |
| | | // 钩子:在获取表格数据之前执行,false 则代表不获取数据 |
| | | [CRUD.HOOK.beforeRefresh]() { |
| | | // 获取甲方数据 |
| | | this.getCustomerFirst() |
| | | // 获取乙方数据 |
| | | this.getCustomerSecond() |
| | | // 获取项目列表 |
| | | this.getProjects() |
| | | // 获取合同款总金额 |
| | | this.getContractTotalMoney() |
| | | // 获取合同款延期数 |
| | | this.getContractDelayTotalAmount() |
| | | // 获取合同款延期金额 |
| | | this.getContractDelayTotalMoney() |
| | | // 获取预收款总金额 |
| | | this.getAdvancePaymentTotalMoney() |
| | | // 获取运维服务总金额 |
| | | this.getServiceTotalMoney() |
| | | // 获取运维服务延期数 |
| | | this.getServiceDelayTotalAmount() |
| | | // 获取运维服务延期金额 |
| | | this.getServiceDelayTotalMoney() |
| | | // 获取应收款总金额 |
| | | this.getReceivePaymentTotalMoney() |
| | | return true |
| | | }, |
| | | // 钩子:开始 "新建/编辑" - 之前 |
| | | [CRUD.HOOK.beforeToCU]() { |
| | | const that = this |
| | | // 选中地区数据置空 |
| | | that.selectedAreaOptions = [] |
| | | // 判断所属地区编码是否为空 |
| | | if (that.crud.form.contractAreaCode !== null && that.crud.form.contractAreaCode !== '') { |
| | | // 选中地区数据赋值 |
| | | that.selectedAreaOptions = that.crud.form.contractAreaCode.split('/') |
| | | } |
| | | // 随机数 |
| | | that.random = Math.random() |
| | | }, |
| | | // 获取甲方数据 |
| | | getCustomerFirst() { |
| | | const that = this |
| | | // 获取甲方数据 |
| | | crudContractFirst.getAll().then(res => { |
| | | // 获取甲方数据 |
| | | that.customerFirst = res |
| | | }) |
| | | }, |
| | | // 获取乙方数据 |
| | | getCustomerSecond() { |
| | | const that = this |
| | | // 获取乙方数据 |
| | | crudContractSecond.getAll().then(res => { |
| | | // 获取乙方数据 |
| | | that.customerSecond = res |
| | | }) |
| | | }, |
| | | // 获取项目列表 |
| | | getProjects() { |
| | | // 获取项目列表 |
| | | crudProject.getAll().then(res => { |
| | | // 项目列表 |
| | | this.projects = res |
| | | }) |
| | | }, |
| | | // 地区选择触发 |
| | | areaChange(arr) { |
| | | const that = this |
| | | // 所属地区编码赋值 |
| | | that.crud.form.contractAreaCode = arr[0] + '/' + arr[1] + '/' + arr[2] |
| | | // 所属地区赋值 |
| | | that.crud.form.contractArea = CodeToText[arr[0]] + '/' + CodeToText[arr[1]] + '/' + CodeToText[arr[2]] |
| | | }, |
| | | // 合同类型变更 |
| | | contractTypeChange() { |
| | | const that = this |
| | | // 随机数 |
| | | that.random = Math.random() |
| | | }, |
| | | // 表单提交 |
| | | submitCU() { |
| | | const that = this |
| | | // 提交触发次数 |
| | | that.triggerCount = 0 |
| | | // 通过“that.$refs.fileFirstUpload”找到子页面,“submit”是子页面的方法。 |
| | | that.$refs.fileFirstUpload.submit() |
| | | // 通过“that.$refs.fileFinalUpload”找到子页面,“submit”是子页面的方法。 |
| | | that.$refs.fileFinalUpload.submit() |
| | | }, |
| | | // 获取文件信息 |
| | | getFirstFileInfo(info) { |
| | | const that = this |
| | | // 判断返回数据 |
| | | if (info.length === 0) { |
| | | // 表单文件路径赋值 |
| | | that.crud.form.relatedDocumentsFirst = null |
| | | // 表单提交 |
| | | that.referSubmitCU() |
| | | // 终止 |
| | | return |
| | | } |
| | | // 循环返回数据 |
| | | for (let i = 0; i < info.length; i++) { |
| | | // 判断循环下标 |
| | | if (i === 0) { |
| | | // 表单文件路径赋值 |
| | | that.crud.form.relatedDocumentsFirst = info[i].response == null || info[i].response === '' ? info[i].url.substring(info[i].url.indexOf('/file/'), info[i].url.length) : '/file/' + info[i].response.type + '/' + info[i].response.realName |
| | | } else { |
| | | // 表单文件路径赋值 |
| | | that.crud.form.relatedDocumentsFirst += info[i].response == null || info[i].response === '' ? ',' + info[i].url.substring(info[i].url.indexOf('/file/'), info[i].url.length) : ',/file/' + info[i].response.type + '/' + info[i].response.realName |
| | | } |
| | | // 判断循环是否结束 |
| | | if (i === info.length - 1) { |
| | | // 表单提交 |
| | | that.referSubmitCU() |
| | | } |
| | | } |
| | | }, |
| | | // 获取文件信息 |
| | | getFinalFileInfo(info) { |
| | | const that = this |
| | | // 判断返回数据 |
| | | if (info.length === 0) { |
| | | // 表单文件路径赋值 |
| | | that.crud.form.relatedDocumentsFinal = null |
| | | // 表单提交 |
| | | that.referSubmitCU() |
| | | // 终止 |
| | | return |
| | | } |
| | | // 循环返回数据 |
| | | for (let i = 0; i < info.length; i++) { |
| | | // 判断循环下标 |
| | | if (i === 0) { |
| | | // 表单文件路径赋值 |
| | | that.crud.form.relatedDocumentsFinal = info[i].response == null || info[i].response === '' ? info[i].url.substring(info[i].url.indexOf('/file/'), info[i].url.length) : '/file/' + info[i].response.type + '/' + info[i].response.realName |
| | | } else { |
| | | // 表单文件路径赋值 |
| | | that.crud.form.relatedDocumentsFinal += info[i].response == null || info[i].response === '' ? ',' + info[i].url.substring(info[i].url.indexOf('/file/'), info[i].url.length) : ',/file/' + info[i].response.type + '/' + info[i].response.realName |
| | | } |
| | | // 判断循环是否结束 |
| | | if (i === info.length - 1) { |
| | | // 表单提交 |
| | | that.referSubmitCU() |
| | | } |
| | | } |
| | | }, |
| | | // 表单提交 |
| | | referSubmitCU() { |
| | | const that = this |
| | | // 提交触发次数自增 |
| | | that.triggerCount++ |
| | | // 判断提交触发次数 |
| | | if (that.triggerCount === 2) { |
| | | // 表单提交 |
| | | that.crud.submitCU() |
| | | } |
| | | }, |
| | | // 跳转合同发票详情 |
| | | goContractInvoice(contractId) { |
| | | const that = this |
| | | // 跳转合同发票详情页面 |
| | | that.$router.push({ path: '/contract/contractInvoice', query: { contractId: contractId }}) |
| | | }, |
| | | // 跳转合同付款详情 |
| | | goContractPayment(contractId) { |
| | | const that = this |
| | | // 跳转合同付款详情页面 |
| | | that.$router.push({ path: '/contract/contractPayment', query: { contractId: contractId }}) |
| | | }, |
| | | // 搜索省级变更 |
| | | queryProvincialChange(event) { |
| | | const that = this |
| | | // 搜索选择省级 |
| | | that.$set(that.crud.query, 'provincial', event) |
| | | // 搜索选择市级 |
| | | that.$set(that.crud.query, 'city', null) |
| | | // 搜索选择区级 |
| | | that.$set(that.crud.query, 'region', null) |
| | | // 搜索选择市级列表 |
| | | that.queryCityList = [] |
| | | // 搜索选择区级列表 |
| | | that.queryRegionList = [] |
| | | // 所属地区编码赋值 |
| | | that.$set(that.crud.query, 'contractAreaCode', that.crud.query.provincial) |
| | | // 循环所属地区数据 |
| | | that.areaOptions.forEach(function(item) { |
| | | // 判断是否为选中市级 |
| | | if (item.value === that.crud.query.provincial) { |
| | | // 搜索选择市级列表 |
| | | that.queryCityList = item.children |
| | | } |
| | | }) |
| | | }, |
| | | // 搜索市级变更 |
| | | queryCityChange(event) { |
| | | const that = this |
| | | // 搜索选择市级 |
| | | that.$set(that.crud.query, 'city', event) |
| | | // 搜索选择区级 |
| | | that.$set(that.crud.query, 'region', null) |
| | | // 搜索选择区级列表 |
| | | that.queryRegionList = [] |
| | | // 所属地区编码赋值 |
| | | that.$set(that.crud.query, 'contractAreaCode', that.crud.query.provincial + '/' + that.crud.query.city) |
| | | // 搜索选择市级列表 |
| | | that.queryCityList.forEach(function(item) { |
| | | // 判断是否为选中市级 |
| | | if (item.value === that.crud.query.city) { |
| | | // 搜索选择区级列表 |
| | | that.queryRegionList = item.children |
| | | } |
| | | }) |
| | | }, |
| | | // 搜索区级变更 |
| | | queryRegionChange(event) { |
| | | const that = this |
| | | // 搜索选择区级 |
| | | that.$set(that.crud.query, 'region', event) |
| | | // 所属地区编码赋值 |
| | | that.$set(that.crud.query, 'contractAreaCode', that.crud.query.provincial + '/' + that.crud.query.city + '/' + that.crud.query.region) |
| | | }, |
| | | // 获取合同款总金额 |
| | | getContractTotalMoney() { |
| | | // 获取合同款总金额 |
| | | contractTotalMoney({ ...this.crud.query }).then(res => { |
| | | // 合同款总金额 |
| | | this.contractTotalMoney = res |
| | | }) |
| | | }, |
| | | // 获取合同款延期数 |
| | | getContractDelayTotalAmount() { |
| | | // 获取合同款延期数 |
| | | contractDelayTotalAmount({ ...this.crud.query }).then(res => { |
| | | // 合同款延期数 |
| | | this.contractDelayTotalAmount = res |
| | | }) |
| | | }, |
| | | // 获取合同款延期金额 |
| | | getContractDelayTotalMoney() { |
| | | // 获取合同款延期金额 |
| | | contractDelayTotalMoney({ ...this.crud.query }).then(res => { |
| | | // 合同款延期金额 |
| | | this.contractDelayTotalMoney = res |
| | | }) |
| | | }, |
| | | // 获取预收款总金额 |
| | | getAdvancePaymentTotalMoney() { |
| | | // 获取预收款总金额 |
| | | advancePaymentTotalMoney({ ...this.crud.query }).then(res => { |
| | | // 预收款总金额 |
| | | this.advancePaymentTotalMoney = res |
| | | }) |
| | | }, |
| | | // 获取运维服务总金额 |
| | | getServiceTotalMoney() { |
| | | // 获取运维服务总金额 |
| | | serviceTotalMoney({ ...this.crud.query }).then(res => { |
| | | // 运维服务总金额 |
| | | this.serviceTotalMoney = res |
| | | }) |
| | | }, |
| | | // 获取运维服务延期数 |
| | | getServiceDelayTotalAmount() { |
| | | // 获取运维服务延期数 |
| | | serviceDelayTotalAmount({ ...this.crud.query }).then(res => { |
| | | // 运维服务延期数 |
| | | this.serviceDelayTotalAmount = res |
| | | }) |
| | | }, |
| | | // 获取运维服务延期金额 |
| | | getServiceDelayTotalMoney() { |
| | | // 获取运维服务延期金额 |
| | | serviceDelayTotalMoney({ ...this.crud.query }).then(res => { |
| | | // 运维服务延期金额 |
| | | this.serviceDelayTotalMoney = res |
| | | }) |
| | | }, |
| | | // 获取应收款总金额 |
| | | getReceivePaymentTotalMoney() { |
| | | // 获取应收款总金额 |
| | | receivePaymentTotalMoney({ ...this.crud.query }).then(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 |
| | | } |
| | | }) |
| | | } |
| | | } |
| | | } |
| | | </script> |
| | | |
| | | <style scoped> |
| | | |
| | | </style> |
| New file |
| | |
| | | <template> |
| | | <div class="app-container"> |
| | | <!--工具栏--> |
| | | <div class="head-container"> |
| | | <div v-if="crud.props.searchToggle"> |
| | | <!-- 搜索 --> |
| | | <el-input v-model="query.firstName" clearable placeholder="甲方" style="width: 185px;" class="filter-item" @keyup.enter.native="crud.toQuery" /> |
| | | <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="630px"> |
| | | <el-form ref="form" :inline="true" :model="form" :rules="rules" size="small" label-width="80px"> |
| | | <el-form-item label="甲方" prop="firstName"> |
| | | <el-input v-model="form.firstName" style="width: 495px;" /> |
| | | </el-form-item> |
| | | <el-form-item label="联系人" prop="firstPerson"> |
| | | <el-input v-model="form.firstPerson" style="width: 200px;" /> |
| | | </el-form-item> |
| | | <el-form-item label="联系电话" prop="firstPhone"> |
| | | <el-input v-model="form.firstPhone" style="width: 200px;" /> |
| | | </el-form-item> |
| | | <el-form-item label="邮箱" prop="firstEmail"> |
| | | <el-input v-model="form.firstEmail" style="width: 200px;" /> |
| | | </el-form-item> |
| | | <el-form-item label="传真" prop="firstFax"> |
| | | <el-input v-model="form.firstFax" style="width: 200px;" /> |
| | | </el-form-item> |
| | | <el-form-item label="所在地区" prop="firstArea"> |
| | | <el-cascader |
| | | v-model="selectedAreaOptions" |
| | | size="large" |
| | | :options="areaOptions" |
| | | style="width: 495px;" |
| | | @change="areaChange" |
| | | /> |
| | | </el-form-item> |
| | | <el-form-item label="详细地址" prop="firstAddress"> |
| | | <el-input v-model="form.firstAddress" :rows="3" type="textarea" style="width: 495px;" /> |
| | | </el-form-item> |
| | | <el-form-item label="备注信息" prop="remarks"> |
| | | <el-input v-model="form.remarks" :rows="3" type="textarea" style="width: 495px;" /> |
| | | </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="firstName" label="甲方" /> |
| | | <el-table-column :show-overflow-tooltip="true" prop="firstPerson" label="联系人" /> |
| | | <el-table-column :show-overflow-tooltip="true" prop="firstPhone" label="联系电话" /> |
| | | <el-table-column :show-overflow-tooltip="true" prop="firstEmail" label="邮箱" /> |
| | | <el-table-column :show-overflow-tooltip="true" prop="firstFax" label="传真" /> |
| | | <el-table-column :show-overflow-tooltip="true" prop="firstArea" label="所在地区" /> |
| | | <el-table-column :show-overflow-tooltip="true" prop="firstAddress" label="详细地址" /> |
| | | <el-table-column :show-overflow-tooltip="true" prop="remarks" label="备注信息" /> |
| | | <el-table-column v-if="checkPer(['admin','contractFirst:edit','contractFirst: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 crudContractFirst from '@/api/contract/contractFirst' |
| | | 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 { regionData, CodeToText } from 'element-china-area-data' |
| | | |
| | | const defaultForm = { firstId: null, firstName: null, firstPerson: null, firstPhone: null, firstEmail: null, firstFax: null, firstAreaCode: null, firstArea: null, firstAddress: null, remarks: null, createBy: null, updateBy: null, createTime: null, updateTime: null } |
| | | export default { |
| | | name: 'ContractFirst', |
| | | components: { pagination, crudOperation, rrOperation, udOperation }, |
| | | mixins: [presenter(), header(), form(defaultForm), crud()], |
| | | cruds() { |
| | | return CRUD({ title: '合同甲方', url: 'api/contractFirst', idField: 'firstId', sort: 'firstId,desc', crudMethod: { ...crudContractFirst }}) |
| | | }, |
| | | data() { |
| | | // 联系电话验证 |
| | | var validateFirstPhone = (rule, value, callback) => { |
| | | if (value) { |
| | | const reg = /^((0\d{2,3}-\d{7,8})|(1[34578]\d{9}))$/ |
| | | if (!reg.test(value)) { |
| | | callback(new Error('请输入正确的手机号或者座机号格式')) |
| | | } |
| | | callback() |
| | | } else { |
| | | callback(new Error('请输入联系电话')) |
| | | } |
| | | } |
| | | // 邮箱验证 |
| | | var validateFirstEmail = (rule, value, callback) => { |
| | | if (value) { |
| | | const reg = /^([a-zA-Z0-9]+[-_\.]?)+@[a-zA-Z0-9]+\.[a-z]+$/ |
| | | if (!reg.test(value)) { |
| | | callback(new Error('请输入正确的邮箱格式')) |
| | | } |
| | | callback() |
| | | } else { |
| | | callback() |
| | | } |
| | | } |
| | | // 传真验证 |
| | | var validateFirstFax = (rule, value, callback) => { |
| | | if (value) { |
| | | const reg = /^(\d{3,4}-)?\d{7,8}$/ |
| | | if (!reg.test(value)) { |
| | | callback(new Error('请输入正确的传真格式')) |
| | | } |
| | | callback() |
| | | } else { |
| | | callback() |
| | | } |
| | | } |
| | | return { |
| | | permission: { |
| | | add: ['admin', 'contractFirst:add'], |
| | | edit: ['admin', 'contractFirst:edit'], |
| | | del: ['admin', 'contractFirst:del'], |
| | | download: ['admin', 'contractFirst:download'] |
| | | }, |
| | | rules: { |
| | | firstName: [ |
| | | { required: true, message: '请输入甲方', trigger: 'blur' }, |
| | | { min: 2, max: 100, message: '长度在 2 到 100 个字符', trigger: 'blur' } |
| | | ], |
| | | firstPerson: [ |
| | | { required: true, message: '请输入联系人', trigger: 'blur' }, |
| | | { min: 2, max: 10, message: '长度在 2 到 10 个字符', trigger: 'blur' } |
| | | ], |
| | | firstPhone: [ |
| | | { required: true, validator: validateFirstPhone, trigger: 'blur' } |
| | | ], |
| | | firstEmail: [ |
| | | { validator: validateFirstEmail, trigger: 'blur' } |
| | | ], |
| | | firstFax: [ |
| | | { validator: validateFirstFax, trigger: 'blur' } |
| | | ], |
| | | firstArea: [ |
| | | { required: true, message: '请选择所在地区', trigger: 'blur' } |
| | | ], |
| | | firstAddress: [ |
| | | { required: true, message: '请输入详细地址', trigger: 'blur' }, |
| | | { min: 2, max: 100, message: '长度在 2 到 100 个字符', trigger: 'blur' } |
| | | ] |
| | | }, |
| | | queryTypeOptions: [ |
| | | { key: 'firstName', display_name: '甲方' } |
| | | ], |
| | | // 所属地区数据 |
| | | areaOptions: regionData, |
| | | // 选中地区数据 |
| | | selectedAreaOptions: [] |
| | | } |
| | | }, |
| | | methods: { |
| | | // 钩子:在获取表格数据之前执行,false 则代表不获取数据 |
| | | [CRUD.HOOK.beforeRefresh]() { |
| | | return true |
| | | }, |
| | | // 钩子:开始 "新建/编辑" - 之前 |
| | | [CRUD.HOOK.beforeToCU]() { |
| | | const that = this |
| | | // 选中地区数据置空 |
| | | that.selectedAreaOptions = [] |
| | | // 判断所在地区编码是否为空 |
| | | if (that.crud.form.firstAreaCode !== null && that.crud.form.firstAreaCode !== '') { |
| | | // 选中地区数据赋值 |
| | | that.selectedAreaOptions = that.crud.form.firstAreaCode.split('/') |
| | | } |
| | | }, |
| | | // 地区选择触发 |
| | | areaChange(arr) { |
| | | const that = this |
| | | // 所在地区编码赋值 |
| | | that.crud.form.firstAreaCode = arr[0] + '/' + arr[1] + '/' + arr[2] |
| | | // 所在地区赋值 |
| | | that.crud.form.firstArea = CodeToText[arr[0]] + '/' + CodeToText[arr[1]] + '/' + CodeToText[arr[2]] |
| | | } |
| | | } |
| | | } |
| | | </script> |
| | | |
| | | <style scoped> |
| | | |
| | | </style> |
| 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 contractList" |
| | | :key="item.contractId" |
| | | :label="item.contractNumber + ' - ' + item.contractName" |
| | | :value="item.contractId" |
| | | /> |
| | | </el-select> |
| | | <el-select v-model="query.invoiceType" filterable clearable placeholder="发票类型" style="width: 185px;" class="filter-item" @keyup.enter.native="crud.toQuery"> |
| | | <el-option |
| | | v-for="item in dict[invoiceType]" |
| | | :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="630px"> |
| | | <el-form ref="form" :inline="true" :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: 495px;" @change="contractIdChange"> |
| | | <el-option |
| | | v-for="item in contractList" |
| | | :key="item.contractId" |
| | | :label="item.contractNumber + ' - ' + item.contractName" |
| | | :value="item.contractId" |
| | | /> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="开票时间" prop="billingTime"> |
| | | <el-date-picker v-model="form.billingTime" type="datetime" style="width: 200px;" /> |
| | | </el-form-item> |
| | | <el-form-item label="发票类型" prop="invoiceType"> |
| | | <el-select v-model="form.invoiceType" filterable placeholder="请选择" style="width: 200px;"> |
| | | <el-option |
| | | v-for="item in dict[invoiceType]" |
| | | :key="item.id" |
| | | :label="item.label" |
| | | :value="item.value" |
| | | /> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="税前金额" prop="beforeTaxAmount"> |
| | | <money-input :key="random" v-model="form.beforeTaxAmount" :width="200" @change="amountOrRateChange" /> |
| | | </el-form-item> |
| | | <el-form-item label="税率" prop="taxRate"> |
| | | <el-input v-model="form.taxRate" style="width: 200px;" @change="amountOrRateChange"> |
| | | <template slot="append">%</template> |
| | | </el-input> |
| | | </el-form-item> |
| | | <el-form-item label="税额" prop="taxAmount"> |
| | | <money-input :key="randomAR" v-model="form.taxAmount" :width="200" /> |
| | | </el-form-item> |
| | | <el-form-item label="税后金额" prop="afterTaxAmount"> |
| | | <money-input :key="randomAR" v-model="form.afterTaxAmount" :width="200" /> |
| | | </el-form-item> |
| | | <el-form-item label="相关文件" prop="relatedDocuments"> |
| | | <file-upload :key="random" ref="fileUpload" :file-url="form.relatedDocuments == null || form.relatedDocuments === '' ? null : form.relatedDocuments" :limit="5" @fileInfo="getFileInfo" /> |
| | | </el-form-item> |
| | | <el-form-item label="相关付款"> |
| | | <el-select v-model="form.contractPaymentIds" filterable multiple placeholder="请选择" style="width: 495px;"> |
| | | <el-option |
| | | v-for="item in contractPaymentList" |
| | | :key="item.paymentId" |
| | | :label="item.paymentAmount" |
| | | :value="item.paymentId" |
| | | > |
| | | <span style="float: left">付款金额:{{ item.paymentAmount }}</span> |
| | | <span style="float: right; color: #8492a6; font-size: 13px">付款时间:{{ item.paymentTime }}</span> |
| | | </el-option> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="备注信息" prop="remarks"> |
| | | <el-input v-model="form.remarks" :rows="3" type="textarea" style="width: 495px;" /> |
| | | </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="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="billingTime" label="开票时间" /> |
| | | <el-table-column :show-overflow-tooltip="true" prop="invoiceType" label="发票类型"> |
| | | <template slot-scope="scope"> |
| | | {{ dict.label[invoiceType][scope.row.invoiceType] }} |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column :show-overflow-tooltip="true" prop="beforeTaxAmount" label="税前金额"> |
| | | <template slot-scope="scope"> |
| | | {{ crud.toMoney(scope.row.beforeTaxAmount) }} |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column :show-overflow-tooltip="true" prop="taxRate" label="税率"> |
| | | <template slot-scope="scope"> |
| | | {{ scope.row.taxRate }}% |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column :show-overflow-tooltip="true" prop="taxAmount" label="税额"> |
| | | <template slot-scope="scope"> |
| | | {{ crud.toMoney(scope.row.taxAmount) }} |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column :show-overflow-tooltip="true" prop="afterTaxAmount" label="税后金额"> |
| | | <template slot-scope="scope"> |
| | | {{ crud.toMoney(scope.row.afterTaxAmount) }} |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column :show-overflow-tooltip="true" prop="remarks" label="备注信息" /> |
| | | <el-table-column v-if="checkPer(['admin','contractInvoice:edit','contractInvoice: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 crudContractInvoice from '@/api/contract/contractInvoice' |
| | | 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 moneyInput from '../../assembly/moneyInput/index.vue' |
| | | import fileUpload from '../../assembly/fileUpload/index.vue' |
| | | import constant from '../../../utils/constant' |
| | | import crudContract from '@/api/contract/contract' |
| | | import crudContractPayment from '@/api/contract/contractPayment' |
| | | |
| | | const defaultForm = { invoiceId: null, contractId: null, billingTime: null, invoiceType: null, beforeTaxAmount: null, taxRate: null, taxAmount: null, afterTaxAmount: null, relatedDocuments: null, remarks: null, contractPaymentIds: [], createBy: null, updateBy: null, createTime: null, updateTime: null } |
| | | export default { |
| | | name: 'ContractInvoice', |
| | | components: { pagination, crudOperation, rrOperation, udOperation, moneyInput, fileUpload }, |
| | | mixins: [presenter(), header(), form(defaultForm), crud()], |
| | | dicts: [constant.INVOICE_TYPE], |
| | | cruds() { |
| | | return CRUD({ title: '合同发票', url: 'api/contractInvoice', idField: 'invoiceId', sort: 'invoiceId,desc', crudMethod: { ...crudContractInvoice }}) |
| | | }, |
| | | data() { |
| | | // 税前金额校验规则 |
| | | var validateBeforeTaxAmount = (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('税前金额不能为空')) |
| | | } |
| | | } |
| | | // 税率校验规则 |
| | | var validateTaxRate = (rule, value, callback) => { |
| | | if (value !== null) { |
| | | if (isNaN(Number(value))) { |
| | | callback(new Error('请输入数字值')) |
| | | } else { |
| | | if (value < 0 || value > 100) { |
| | | callback(new Error('税率不能超过100%')) |
| | | } else { |
| | | callback() |
| | | } |
| | | } |
| | | } else { |
| | | callback() |
| | | } |
| | | } |
| | | return { |
| | | permission: { |
| | | add: ['admin', 'contractInvoice:add'], |
| | | edit: ['admin', 'contractInvoice:edit'], |
| | | del: ['admin', 'contractInvoice:del'], |
| | | download: ['admin', 'contractInvoice:download'] |
| | | }, |
| | | rules: { |
| | | contractId: [ |
| | | { required: true, message: '请选择所属合同', trigger: 'change' } |
| | | ], |
| | | billingTime: [ |
| | | { required: true, message: '请选择开票时间', trigger: 'change' } |
| | | ], |
| | | invoiceType: [ |
| | | { required: true, message: '请选择发票类型', trigger: 'change' } |
| | | ], |
| | | beforeTaxAmount: [ |
| | | { required: true, validator: validateBeforeTaxAmount, trigger: 'blur' } |
| | | ], |
| | | taxRate: [ |
| | | { validator: validateTaxRate, trigger: 'blur' } |
| | | ] |
| | | }, |
| | | queryTypeOptions: [ |
| | | { key: 'contractId', display_name: '所属合同' }, |
| | | { key: 'invoiceType', display_name: '发票类型' } |
| | | ], |
| | | // 字典:发票类型 |
| | | invoiceType: constant.INVOICE_TYPE, |
| | | // 随机数 |
| | | random: 0, |
| | | randomAR: 0, |
| | | // 合同数据 |
| | | contractList: [], |
| | | // 付款数据 |
| | | contractPaymentList: [] |
| | | } |
| | | }, |
| | | methods: { |
| | | // 钩子:在获取表格数据之前执行,false 则代表不获取数据 |
| | | [CRUD.HOOK.beforeRefresh]() { |
| | | const that = this |
| | | // 获取合同数据 |
| | | that.getContractList() |
| | | // 检索条件赋值 |
| | | if (that.$route.query.contractId != null && that.crud.query.contractId === undefined) { |
| | | that.$set(that.crud.query, 'contractId', Number(that.$route.query.contractId)) |
| | | } |
| | | return true |
| | | }, |
| | | // 获取合同数据 |
| | | getContractList() { |
| | | const that = this |
| | | // 获取合同数据 |
| | | crudContract.getAll().then(res => { |
| | | // 获取合同数据 |
| | | that.contractList = res |
| | | }) |
| | | }, |
| | | // 钩子:开始 "新建/编辑" - 之前 |
| | | [CRUD.HOOK.beforeToCU]() { |
| | | const that = this |
| | | // 随机数 |
| | | that.random = Math.random() |
| | | that.randomAR = Math.random() |
| | | }, |
| | | // 钩子:新建 - 之前 |
| | | [CRUD.HOOK.beforeToAdd]() { |
| | | const that = this |
| | | // 判断检索条件 |
| | | if (that.crud.query.contractId !== undefined) { |
| | | // 表单赋值 |
| | | that.$set(that.crud.form, 'contractId', Number(that.crud.query.contractId)) |
| | | // 所属合同变更 |
| | | that.contractIdChange() |
| | | } |
| | | }, |
| | | // 钩子:编辑 - 之前 |
| | | [CRUD.HOOK.beforeToEdit]() { |
| | | const that = this |
| | | // 获取付款数据 |
| | | that.getContractPayment() |
| | | }, |
| | | // 所属合同变更 |
| | | contractIdChange() { |
| | | const that = this |
| | | // 相关付款 |
| | | that.crud.form.contractPaymentIds = [] |
| | | // 获取付款数据 |
| | | that.contractPaymentList = [] |
| | | // 判断所属合同是否为空 |
| | | if (that.crud.form.contractId != null && that.crud.form.contractId !== '') { |
| | | // 获取付款数据 |
| | | that.getContractPayment() |
| | | } |
| | | }, |
| | | // 获取付款数据 |
| | | getContractPayment() { |
| | | const that = this |
| | | // 获取付款数据 |
| | | crudContractPayment.getAll({ contractId: that.crud.form.contractId }).then(res => { |
| | | // 获取付款数据 |
| | | that.contractPaymentList = res |
| | | }) |
| | | }, |
| | | // 税前金额或税率变更 |
| | | amountOrRateChange() { |
| | | const that = this |
| | | // 判断税前金额和税率是否为空 |
| | | if (that.crud.form.beforeTaxAmount !== null && that.crud.form.beforeTaxAmount !== '' && that.crud.form.taxRate !== null && that.crud.form.taxRate !== '') { |
| | | // 税额 |
| | | that.crud.form.taxAmount = that.crud.form.beforeTaxAmount * (that.crud.form.taxRate / 100) |
| | | // 税后金额 |
| | | that.crud.form.afterTaxAmount = that.crud.form.beforeTaxAmount + that.crud.form.beforeTaxAmount * (that.crud.form.taxRate / 100) |
| | | // 随机数 |
| | | that.randomAR = Math.random() |
| | | } |
| | | }, |
| | | // 表单提交 |
| | | submitCU() { |
| | | const that = this |
| | | // 通过“that.$refs.fileUpload”找到子页面,“submit”是子页面的方法。 |
| | | that.$refs.fileUpload.submit() |
| | | }, |
| | | // 获取文件信息 |
| | | getFileInfo(info) { |
| | | const that = this |
| | | // 判断税率是否为空 |
| | | if (that.crud.form.taxRate == null || that.crud.form.taxRate === '') { |
| | | // 税率 |
| | | that.crud.form.taxRate = 0 |
| | | } |
| | | // 判断税额是否为空 |
| | | if (that.crud.form.taxAmount == null || that.crud.form.taxAmount === '') { |
| | | // 税额 |
| | | that.crud.form.taxAmount = 0 |
| | | } |
| | | // 判断税后金额是否为空 |
| | | if (that.crud.form.afterTaxAmount == null || that.crud.form.afterTaxAmount === '') { |
| | | // 税后金额 |
| | | that.crud.form.afterTaxAmount = that.crud.form.beforeTaxAmount |
| | | } |
| | | // 判断返回数据 |
| | | if (info.length === 0) { |
| | | // 表单文件路径赋值 |
| | | that.crud.form.relatedDocuments = null |
| | | // 表单提交 |
| | | that.crud.submitCU() |
| | | // 终止 |
| | | return |
| | | } |
| | | // 循环返回数据 |
| | | for (let i = 0; i < info.length; i++) { |
| | | // 判断循环下标 |
| | | if (i === 0) { |
| | | // 表单文件路径赋值 |
| | | that.crud.form.relatedDocuments = info[i].response == null || info[i].response === '' ? info[i].url.substring(info[i].url.indexOf('/file/'), info[i].url.length) : '/file/' + info[i].response.type + '/' + info[i].response.realName |
| | | } else { |
| | | // 表单文件路径赋值 |
| | | that.crud.form.relatedDocuments += info[i].response == null || info[i].response === '' ? ',' + info[i].url.substring(info[i].url.indexOf('/file/'), info[i].url.length) : ',/file/' + info[i].response.type + '/' + info[i].response.realName |
| | | } |
| | | // 判断循环是否结束 |
| | | if (i === info.length - 1) { |
| | | // 表单提交 |
| | | that.crud.submitCU() |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | </script> |
| | | |
| | | <style scoped> |
| | | |
| | | </style> |
| 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 contractList" |
| | | :key="item.contractId" |
| | | :label="item.contractNumber + ' - ' + item.contractName" |
| | | :value="item.contractId" |
| | | /> |
| | | </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="630px"> |
| | | <el-form ref="form" :inline="true" :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: 495px;" @change="contractIdChange"> |
| | | <el-option |
| | | v-for="item in contractList" |
| | | :key="item.contractId" |
| | | :label="item.contractNumber + ' - ' + item.contractName" |
| | | :value="item.contractId" |
| | | /> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="付款时间" prop="paymentTime"> |
| | | <el-date-picker v-model="form.paymentTime" type="datetime" style="width: 200px;" /> |
| | | </el-form-item> |
| | | <el-form-item label="款项类型" prop="fundType"> |
| | | <el-select v-model="form.fundType" filterable placeholder="请选择" style="width: 200px;"> |
| | | <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="paymentAmount"> |
| | | <money-input :key="random" v-model="form.paymentAmount" :width="200" /> |
| | | </el-form-item> |
| | | <span v-if="form.fundType == fundContract"> |
| | | <el-divider>合同费款项所属</el-divider> |
| | | <el-form-item label="所属内容" prop="fundBelong"> |
| | | <el-input v-model="form.fundBelong" style="width: 495px;" /> |
| | | </el-form-item> |
| | | </span> |
| | | <span v-if="form.fundType == fundService"> |
| | | <el-divider>服务费款项所属</el-divider> |
| | | <el-form-item label="所属年度" prop="fundBelongYear"> |
| | | <el-input v-model="form.fundBelongYear" style="width: 200px;" @change="changeFundBelongYear" /> |
| | | </el-form-item> |
| | | <el-form-item label=""> |
| | | <span style="width: 200px;" /> |
| | | </el-form-item> |
| | | <el-form-item label="开始日期" prop="fundBelongStart"> |
| | | <el-date-picker v-model="form.fundBelongStart" type="date" style="width: 200px;" disabled /> |
| | | </el-form-item> |
| | | <el-form-item label="结束日期" prop="fundBelongEnd"> |
| | | <el-date-picker v-model="form.fundBelongEnd" type="date" style="width: 200px;" disabled /> |
| | | </el-form-item> |
| | | </span> |
| | | <el-form-item label="相关发票"> |
| | | <el-select v-model="form.contractInvoiceIds" filterable multiple placeholder="请选择" style="width: 495px;"> |
| | | <el-option |
| | | v-for="item in contractInvoiceList" |
| | | :key="item.invoiceId" |
| | | :label="item.afterTaxAmount" |
| | | :value="item.invoiceId" |
| | | > |
| | | <span style="float: left">开票金额:{{ item.afterTaxAmount }}</span> |
| | | <span style="float: right; color: #8492a6; font-size: 13px">开票时间:{{ item.billingTime }}</span> |
| | | </el-option> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="备注信息" prop="remarks"> |
| | | <el-input v-model="form.remarks" :rows="3" type="textarea" style="width: 495px;" /> |
| | | </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="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="paymentTime" 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="paymentAmount" label="付款金额"> |
| | | <template slot-scope="scope"> |
| | | {{ crud.toMoney(scope.row.paymentAmount) }} |
| | | </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"> |
| | | {{ scope.row.fundBelong }} |
| | | </span> |
| | | <span v-if="scope.row.fundBelongStart != null && scope.row.fundBelongEnd != null"> |
| | | {{ scope.row.fundBelongStart.substring(0,10) }} 至 {{ scope.row.fundBelongEnd.substring(0,10) }} 服务费 |
| | | </span> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column :show-overflow-tooltip="true" prop="remarks" label="备注信息" /> |
| | | <el-table-column v-if="checkPer(['admin','contractPayment:edit','contractPayment: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 crudContractPayment from '@/api/contract/contractPayment' |
| | | 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 moneyInput from '../../assembly/moneyInput/index.vue' |
| | | import constant from '../../../utils/constant' |
| | | 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 } |
| | | export default { |
| | | name: 'ContractPayment', |
| | | components: { pagination, crudOperation, rrOperation, udOperation, moneyInput }, |
| | | mixins: [presenter(), header(), form(defaultForm), crud()], |
| | | dicts: [constant.FUND_TYPE], |
| | | cruds() { |
| | | return CRUD({ title: '合同付款', url: 'api/contractPayment', idField: 'paymentId', sort: 'paymentId,desc', crudMethod: { ...crudContractPayment }}) |
| | | }, |
| | | data() { |
| | | // 付款金额校验规则 |
| | | var validatePaymentAmount = (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', 'contractPayment:add'], |
| | | edit: ['admin', 'contractPayment:edit'], |
| | | del: ['admin', 'contractPayment:del'], |
| | | download: ['admin', 'contractPayment:download'] |
| | | }, |
| | | rules: { |
| | | contractId: [ |
| | | { required: true, message: '请选择所属合同', trigger: 'change' } |
| | | ], |
| | | paymentTime: [ |
| | | { required: true, message: '请选择付款时间', trigger: 'change' } |
| | | ], |
| | | fundType: [ |
| | | { required: true, message: '请选择款项类型', trigger: 'change' } |
| | | ], |
| | | paymentAmount: [ |
| | | { required: true, validator: validatePaymentAmount, trigger: 'blur' } |
| | | ], |
| | | fundBelong: [ |
| | | { min: 2, max: 100, message: '长度在 2 到 100 个字符', trigger: 'blur' } |
| | | ], |
| | | fundBelongYear: [ |
| | | { required: true, message: '请输入所属年度', trigger: 'blur' } |
| | | ], |
| | | fundBelongStart: [ |
| | | { required: true, message: '请选择款项开始日期', trigger: 'change' } |
| | | ], |
| | | fundBelongEnd: [ |
| | | { required: true, message: '请选择款项结束日期', trigger: 'change' } |
| | | ] |
| | | }, |
| | | queryTypeOptions: [ |
| | | { key: 'contractId', display_name: '所属合同' }, |
| | | { key: 'fundType', display_name: '款项类型' } |
| | | ], |
| | | // 字典:款项类型 |
| | | fundType: constant.FUND_TYPE, |
| | | // 字典:款项类型-合同费 |
| | | fundContract: constant.FUND_CONTRACT, |
| | | // 字典:款项类型-服务费 |
| | | fundService: constant.FUND_SERVICE, |
| | | // 随机数 |
| | | random: 0, |
| | | // 合同数据 |
| | | contractList: [], |
| | | // 发票数据 |
| | | contractInvoiceList: [], |
| | | // 当前合同信息 |
| | | currentContract: {} |
| | | } |
| | | }, |
| | | methods: { |
| | | // 钩子:在获取表格数据之前执行,false 则代表不获取数据 |
| | | [CRUD.HOOK.beforeRefresh]() { |
| | | // 获取合同数据 |
| | | this.getContractList() |
| | | // 检索条件赋值 |
| | | if (this.$route.query.contractId != null && this.crud.query.contractId === undefined) { |
| | | this.$set(this.crud.query, 'contractId', Number(this.$route.query.contractId)) |
| | | } |
| | | return true |
| | | }, |
| | | // 获取合同数据 |
| | | getContractList() { |
| | | const that = this |
| | | // 获取合同数据 |
| | | crudContract.getAll().then(res => { |
| | | // 获取合同数据 |
| | | that.contractList = res |
| | | // 判断是否传参进入 |
| | | if (that.$route.query.contractId != null) { |
| | | // 循环合同数据 |
| | | for (let i = 0; i < res.length; i++) { |
| | | if (res[i].contractId === Number(that.$route.query.contractId)) { |
| | | // 当前合同信息 |
| | | that.currentContract = res[i] |
| | | // 当前合同信息 - 服务结束日期 |
| | | that.currentContract.serviceEndDate = new Date(res[i].serviceStartsDate).getTime() - 24 * 60 * 60 * 1000 |
| | | } |
| | | } |
| | | } |
| | | }) |
| | | }, |
| | | // 钩子:开始 "新建/编辑" - 之前 |
| | | [CRUD.HOOK.beforeToCU]() { |
| | | const that = this |
| | | // 随机数 |
| | | that.random = Math.random() |
| | | // 表单合同所属年份 |
| | | if (that.crud.form.fundBelongStart != null) { |
| | | that.crud.form.fundBelongYear = that.crud.form.fundBelongStart.substring(0, 4) |
| | | } |
| | | }, |
| | | // 钩子:新建 - 之前 |
| | | [CRUD.HOOK.beforeToAdd]() { |
| | | const that = this |
| | | // 判断检索条件 |
| | | if (that.crud.query.contractId !== undefined) { |
| | | // 表单赋值 |
| | | that.$set(that.crud.form, 'contractId', Number(that.crud.query.contractId)) |
| | | // 所属合同变更 |
| | | that.contractIdChange() |
| | | } |
| | | }, |
| | | // 钩子:编辑 - 之前 |
| | | [CRUD.HOOK.beforeToEdit]() { |
| | | const that = this |
| | | // 获取发票数据 |
| | | that.getContractInvoice() |
| | | }, |
| | | // 所属合同变更 |
| | | contractIdChange() { |
| | | const that = this |
| | | // 相关发票 |
| | | that.crud.form.contractInvoiceIds = [] |
| | | // 获取发票数据 |
| | | that.contractInvoiceList = [] |
| | | // 判断所属合同是否为空 |
| | | if (that.crud.form.contractId != null && that.crud.form.contractId !== '') { |
| | | // 获取发票数据 |
| | | that.getContractInvoice() |
| | | } |
| | | }, |
| | | // 获取发票数据 |
| | | getContractInvoice() { |
| | | const that = this |
| | | // 获取发票数据 |
| | | crudContractInvoice.getAll({ contractId: that.crud.form.contractId }).then(res => { |
| | | // 获取发票数据 |
| | | that.contractInvoiceList = res |
| | | }) |
| | | }, |
| | | // 表单提交 |
| | | submitCU() { |
| | | const that = this |
| | | // 判断款项类型 |
| | | if (that.crud.form.fundType === that.fundContract) { |
| | | // 款项所属年度 |
| | | that.crud.form.fundBelongYear = null |
| | | // 款项开始日期 |
| | | that.crud.form.fundBelongStart = null |
| | | // 款项结束日期 |
| | | that.crud.form.fundBelongEnd = null |
| | | } else if (that.crud.form.fundType === that.fundService) { |
| | | // 款项所属 |
| | | that.crud.form.fundBelong = null |
| | | } else { |
| | | // 暂无 |
| | | } |
| | | // 表单提交 |
| | | that.crud.submitCU() |
| | | }, |
| | | // 所属年度变更 |
| | | changeFundBelongYear() { |
| | | const that = this |
| | | // 款项开始日期 |
| | | that.crud.form.fundBelongStart = that.crud.form.fundBelongYear + that.crud.toDate(that.currentContract.serviceStartsDate).substring(4, 10) |
| | | // 款项结束日期 |
| | | that.crud.form.fundBelongEnd = that.crud.toDate(that.currentContract.serviceEndDate).substring(4, 10) === '-12-31' |
| | | ? Number(that.crud.form.fundBelongYear) + that.crud.toDate(that.currentContract.serviceEndDate).substring(4, 10) |
| | | : (Number(that.crud.form.fundBelongYear) + 1) + that.crud.toDate(that.currentContract.serviceEndDate).substring(4, 10) |
| | | } |
| | | } |
| | | } |
| | | </script> |
| | | |
| | | <style scoped> |
| | | |
| | | </style> |
| 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> |
| New file |
| | |
| | | <template> |
| | | <div class="app-container"> |
| | | <!--工具栏--> |
| | | <div class="head-container"> |
| | | <div v-if="crud.props.searchToggle"> |
| | | <!-- 搜索 --> |
| | | <el-input v-model="query.secondName" clearable placeholder="乙方" style="width: 185px;" class="filter-item" @keyup.enter.native="crud.toQuery" /> |
| | | <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="630px"> |
| | | <el-form ref="form" :inline="true" :model="form" :rules="rules" size="small" label-width="80px"> |
| | | <el-form-item label="乙方" prop="secondName"> |
| | | <el-input v-model="form.secondName" style="width: 495px;" /> |
| | | </el-form-item> |
| | | <el-form-item label="联系人" prop="secondPerson"> |
| | | <el-input v-model="form.secondPerson" style="width: 200px;" /> |
| | | </el-form-item> |
| | | <el-form-item label="联系电话" prop="secondPhone"> |
| | | <el-input v-model="form.secondPhone" style="width: 200px;" /> |
| | | </el-form-item> |
| | | <el-form-item label="邮箱" prop="secondEmail"> |
| | | <el-input v-model="form.secondEmail" style="width: 200px;" /> |
| | | </el-form-item> |
| | | <el-form-item label="传真" prop="secondFax"> |
| | | <el-input v-model="form.secondFax" style="width: 200px;" /> |
| | | </el-form-item> |
| | | <el-form-item label="所在地区" prop="secondArea"> |
| | | <el-cascader |
| | | v-model="selectedAreaOptions" |
| | | size="large" |
| | | :options="areaOptions" |
| | | style="width: 495px;" |
| | | @change="areaChange" |
| | | /> |
| | | </el-form-item> |
| | | <el-form-item label="详细地址" prop="secondAddress"> |
| | | <el-input v-model="form.secondAddress" :rows="3" type="textarea" style="width: 495px;" /> |
| | | </el-form-item> |
| | | <el-form-item label="备注信息" prop="remarks"> |
| | | <el-input v-model="form.remarks" :rows="3" type="textarea" style="width: 495px;" /> |
| | | </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="secondName" label="乙方" /> |
| | | <el-table-column :show-overflow-tooltip="true" prop="secondPerson" label="联系人" /> |
| | | <el-table-column :show-overflow-tooltip="true" prop="secondPhone" label="联系电话" /> |
| | | <el-table-column :show-overflow-tooltip="true" prop="secondEmail" label="邮件" /> |
| | | <el-table-column :show-overflow-tooltip="true" prop="secondFax" label="传真" /> |
| | | <el-table-column :show-overflow-tooltip="true" prop="secondArea" label="所在地区" /> |
| | | <el-table-column :show-overflow-tooltip="true" prop="secondAddress" label="详细地址" /> |
| | | <el-table-column :show-overflow-tooltip="true" prop="remarks" label="备注信息" /> |
| | | <el-table-column v-if="checkPer(['admin','contractSecond:edit','contractSecond: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 crudContractSecond from '@/api/contract/contractSecond' |
| | | 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 { regionData, CodeToText } from 'element-china-area-data' |
| | | |
| | | const defaultForm = { secondId: null, secondName: null, secondPerson: null, secondPhone: null, secondEmail: null, secondFax: null, secondAreaCode: null, secondArea: null, secondAddress: null, remarks: null, createBy: null, updateBy: null, createTime: null, updateTime: null } |
| | | export default { |
| | | name: 'ContractSecond', |
| | | components: { pagination, crudOperation, rrOperation, udOperation }, |
| | | mixins: [presenter(), header(), form(defaultForm), crud()], |
| | | cruds() { |
| | | return CRUD({ title: '合同乙方', url: 'api/contractSecond', idField: 'secondId', sort: 'secondId,desc', crudMethod: { ...crudContractSecond }}) |
| | | }, |
| | | data() { |
| | | // 联系电话验证 |
| | | var validateSecondPhone = (rule, value, callback) => { |
| | | if (value) { |
| | | const reg = /^((0\d{2,3}-\d{7,8})|(1[34578]\d{9}))$/ |
| | | if (!reg.test(value)) { |
| | | callback(new Error('请输入正确的手机号或者座机号格式')) |
| | | } |
| | | callback() |
| | | } else { |
| | | callback(new Error('请输入联系电话')) |
| | | } |
| | | } |
| | | // 邮箱验证 |
| | | var validateSecondEmail = (rule, value, callback) => { |
| | | if (value) { |
| | | const reg = /^([a-zA-Z0-9]+[-_\.]?)+@[a-zA-Z0-9]+\.[a-z]+$/ |
| | | if (!reg.test(value)) { |
| | | callback(new Error('请输入正确的邮箱格式')) |
| | | } |
| | | callback() |
| | | } else { |
| | | callback() |
| | | } |
| | | } |
| | | // 传真验证 |
| | | var validateSecondFax = (rule, value, callback) => { |
| | | if (value) { |
| | | const reg = /^(\d{3,4}-)?\d{7,8}$/ |
| | | if (!reg.test(value)) { |
| | | callback(new Error('请输入正确的传真格式')) |
| | | } |
| | | callback() |
| | | } else { |
| | | callback() |
| | | } |
| | | } |
| | | return { |
| | | permission: { |
| | | add: ['admin', 'contractSecond:add'], |
| | | edit: ['admin', 'contractSecond:edit'], |
| | | del: ['admin', 'contractSecond:del'], |
| | | download: ['admin', 'contractSecond:download'] |
| | | }, |
| | | rules: { |
| | | secondName: [ |
| | | { required: true, message: '请输入乙方', trigger: 'blur' }, |
| | | { min: 2, max: 100, message: '长度在 2 到 100 个字符', trigger: 'blur' } |
| | | ], |
| | | secondPerson: [ |
| | | { required: true, message: '请输入联系人', trigger: 'blur' }, |
| | | { min: 2, max: 10, message: '长度在 2 到 10 个字符', trigger: 'blur' } |
| | | ], |
| | | secondPhone: [ |
| | | { required: true, validator: validateSecondPhone, trigger: 'blur' } |
| | | ], |
| | | secondEmail: [ |
| | | { validator: validateSecondEmail, trigger: 'blur' } |
| | | ], |
| | | secondFax: [ |
| | | { validator: validateSecondFax, trigger: 'blur' } |
| | | ], |
| | | secondArea: [ |
| | | { required: true, message: '请选择所在地区', trigger: 'blur' } |
| | | ], |
| | | secondAddress: [ |
| | | { required: true, message: '请输入详细地址', trigger: 'blur' }, |
| | | { min: 2, max: 100, message: '长度在 2 到 100 个字符', trigger: 'blur' } |
| | | ] |
| | | }, |
| | | queryTypeOptions: [ |
| | | { key: 'secondName', display_name: '乙方' } |
| | | ], |
| | | // 所属地区数据 |
| | | areaOptions: regionData, |
| | | // 选中地区数据 |
| | | selectedAreaOptions: [] |
| | | } |
| | | }, |
| | | methods: { |
| | | // 钩子:在获取表格数据之前执行,false 则代表不获取数据 |
| | | [CRUD.HOOK.beforeRefresh]() { |
| | | return true |
| | | }, |
| | | // 钩子:开始 "新建/编辑" - 之前 |
| | | [CRUD.HOOK.beforeToCU]() { |
| | | const that = this |
| | | // 选中地区数据置空 |
| | | that.selectedAreaOptions = [] |
| | | // 判断所在地区编码是否为空 |
| | | if (that.crud.form.secondAreaCode !== null && that.crud.form.secondAreaCode !== '') { |
| | | // 选中地区数据赋值 |
| | | that.selectedAreaOptions = that.crud.form.secondAreaCode.split('/') |
| | | } |
| | | }, |
| | | // 地区选择触发 |
| | | areaChange(arr) { |
| | | const that = this |
| | | // 所在地区编码赋值 |
| | | that.crud.form.secondAreaCode = arr[0] + '/' + arr[1] + '/' + arr[2] |
| | | // 所在地区赋值 |
| | | that.crud.form.secondArea = CodeToText[arr[0]] + '/' + CodeToText[arr[1]] + '/' + CodeToText[arr[2]] |
| | | } |
| | | } |
| | | } |
| | | </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() |
| | | } |
| File was renamed from eladmin-web-master/src/views/system/userCompany/index.vue |
| | |
| | | <div class="head-container"> |
| | | <div v-if="crud.props.searchToggle"> |
| | | <!-- 搜索 --> |
| | | <el-input v-model="query.label" clearable size="small" placeholder="输入标题搜索" style="width: 200px;" class="filter-item" @keyup.enter.native="crud.toQuery" /> |
| | | <el-input v-model="query.label" clearable size="small" placeholder="标题搜索" style="width: 200px;" class="filter-item" @keyup.enter.native="crud.toQuery" /> |
| | | <rrOperation /> |
| | | </div> |
| | | <!--如果想在工具栏加入更多按钮,可以使用插槽方式, slot = 'left' or 'right'--> |
| | |
| | | <!--表单组件--> |
| | | <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="label"> |
| | | <el-form-item label="名称" prop="label"> |
| | | <el-input v-model="form.label" style="width: 370px;" /> |
| | | </el-form-item> |
| | | <el-form-item label="值" prop="value"> |
| | | <el-input v-model="form.value" style="width: 370px;" /> |
| | | </el-form-item> |
| | | <el-form-item label="描述"> |
| | | <el-input v-model="form.description" style="width: 370px;" /> |
| | | <el-input v-model="form.description" type="textarea" rows="3" style="width: 370px;" /> |
| | | </el-form-item> |
| | | </el-form> |
| | | <div slot="footer" class="dialog-footer"> |
| | |
| | | <!--表格渲染--> |
| | | <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 prop="label" label="标签"> |
| | | <el-table-column prop="label" label="名称"> |
| | | <template slot-scope="scope"> |
| | | {{ scope.row.label }} |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="value" label="值"> |
| | | <template slot-scope="scope"> |
| | | {{ scope.row.value }} |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="description" label="描述" /> |
| | | <el-table-column prop="createTime" label="创建日期" /> |
| | | <el-table-column v-if="checkPer(['admin','sysUserCompany:edit','sysUserCompany:del'])" label="操作" width="150px" align="center"> |
| | | <el-table-column v-if="checkPer(['admin','sysCompany:edit','sysCompany:del'])" label="操作" width="150px" align="center"> |
| | | <template slot-scope="scope"> |
| | | <udOperation |
| | | :data="scope.row" |
| | |
| | | </template> |
| | | |
| | | <script> |
| | | import crudSysUserCompany from '@/api/system/sysUserCompany' |
| | | 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 udOperation from '@crud/UD.operation' |
| | | import pagination from '@crud/Pagination' |
| | | |
| | | const defaultForm = { id: null, name: null, description: null, label: null, value: null, createBy: null, updateBy: null, createTime: null, updateTime: null } |
| | | const defaultForm = { id: null, name: null, description: null, label: null, createBy: null, updateBy: null, createTime: null, updateTime: null } |
| | | export default { |
| | | name: 'SysUserCompany', |
| | | components: { pagination, crudOperation, rrOperation, udOperation }, |
| | | mixins: [presenter(), header(), form(defaultForm), crud()], |
| | | cruds() { |
| | | return CRUD({ title: '公司管理', url: 'api/sysUserCompany', idField: 'id', sort: 'id,desc', crudMethod: { ...crudSysUserCompany }}) |
| | | return CRUD({ title: '公司管理', url: 'api/sysCompany', idField: 'id', sort: 'id,desc', crudMethod: { ...crudSysCompany }}) |
| | | }, |
| | | data() { |
| | | return { |
| | | permission: { |
| | | add: ['admin', 'sysUserCompany:add'], |
| | | edit: ['admin', 'sysUserCompany:edit'], |
| | | del: ['admin', 'sysUserCompany:del'], |
| | | download: ['admin', 'sysUserCompany:download'] |
| | | add: ['admin', 'sysCompany:add'], |
| | | edit: ['admin', 'sysCompany:edit'], |
| | | del: ['admin', 'sysCompany:del'], |
| | | download: ['admin', 'sysCompany:download'] |
| | | }, |
| | | rules: { |
| | | label: [ |
| | | { required: true, message: '标签不能为空', trigger: 'blur' } |
| | | ], |
| | | value: [ |
| | | { required: true, message: '值不能为空', trigger: 'blur' } |
| | | { required: true, message: '名称不能为空', trigger: 'blur' } |
| | | ] |
| | | }} |
| | | }, |
| | |
| | | <el-date-picker |
| | | v-model="query.holidayDate" |
| | | clearable |
| | | placeholder="请选择日期" |
| | | placeholder="日期" |
| | | style="width: 185px" |
| | | class="filter-item" |
| | | value-format="yyyy-MM-dd" |
| | |
| | | <el-input |
| | | v-model="query.name" |
| | | clearable |
| | | placeholder="请输入名称" |
| | | placeholder="名称" |
| | | style="width: 185px" |
| | | class="filter-item" |
| | | @keyup.enter.native="crud.toQuery" |
| | | /> |
| | | <el-select v-model="query.dateType" filterable clearable placeholder="请选择日期类型" style="width: 185px;" class="filter-item" @keyup.enter.native="crud.toQuery"> |
| | | <el-select v-model="query.dateType" filterable clearable placeholder="日期类型" style="width: 185px;" class="filter-item" @keyup.enter.native="crud.toQuery"> |
| | | <el-option |
| | | v-for="item in dict[dickDateType]" |
| | | :key="item.value" |
| | |
| | | <el-input |
| | | v-model="query.gearAmountStart" |
| | | clearable |
| | | placeholder="请输入档位起始金额" |
| | | placeholder="档位起始金额" |
| | | style="width: 185px" |
| | | class="filter-item" |
| | | @keyup.enter.native="crud.toQuery" |
| | |
| | | <el-input |
| | | v-model="query.gearAmountEnd" |
| | | clearable |
| | | placeholder="请输入截止金额" |
| | | placeholder="截止金额" |
| | | style="width: 185px" |
| | | class="filter-item" |
| | | @keyup.enter.native="crud.toQuery" |
| | |
| | | <el-input |
| | | v-model="query.title" |
| | | clearable |
| | | placeholder="请输入标题" |
| | | placeholder="标题" |
| | | style="width: 185px" |
| | | class="filter-item" |
| | | @keyup.enter.native="crud.toQuery" |
| New file |
| | |
| | | <template> |
| | | <div class="app-container"> |
| | | <!--工具栏--> |
| | | <div class="head-container"> |
| | | <div> |
| | | <el-input |
| | | v-model="query.title" |
| | | clearable |
| | | size="small" |
| | | placeholder="标题" |
| | | style="width: 200px;" |
| | | class="filter-item" |
| | | @keyup.enter.native="crud.toQuery" |
| | | /> |
| | | <el-select v-model="query.classification" filterable clearable placeholder="分类" style="width: 185px;" class="filter-item" @keyup.enter.native="crud.toQuery"> |
| | | <el-option |
| | | v-for="item in classifications" |
| | | :key="item.id" |
| | | :label="item.classification" |
| | | :value="item.classification" |
| | | /> |
| | | </el-select> |
| | | <rrOperation /> |
| | | </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="title"> |
| | | <el-input v-model="form.title" style="width: 370px;" /> |
| | | </el-form-item> |
| | | <el-form-item label="分类" prop="classification"> |
| | | <el-autocomplete |
| | | v-model="form.classification" |
| | | class="inline-input" |
| | | :fetch-suggestions="querySearch" |
| | | placeholder="请输入内容" |
| | | style="width: 370px;" |
| | | @select="handleSubmit" |
| | | /> |
| | | </el-form-item> |
| | | <el-form-item label="记录时间" prop="recordTime"> |
| | | <el-date-picker |
| | | v-model="form.recordTime" |
| | | type="datetime" |
| | | placeholder="选择日期时间" |
| | | style="width: 370px;" |
| | | value-format="yyyy-MM-dd HH:mm:ss" |
| | | align="right" |
| | | default-time="09:00:00" |
| | | /> |
| | | </el-form-item> |
| | | <el-form-item label="记录内容"> |
| | | <el-input v-model="form.recordContent" type="textarea" rows="3" style="width: 370px;" /> |
| | | </el-form-item> |
| | | <el-form-item label="是否提醒" prop="remind"> |
| | | <el-select v-model="form.remind" clearable style="width: 370px;" @change="remindChange()"> |
| | | <el-option |
| | | v-for="item in dict[dictResourceType]" |
| | | :key="item.value" |
| | | :label="item.label" |
| | | :value="item.value" |
| | | /> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item v-if="form.remind === dictResourcesTypeRemind" label="选择类型" prop="resource"> |
| | | <el-radio-group v-model="form.resource" @change="remindChange()"> |
| | | <el-radio label="立即提醒" /> |
| | | <el-radio label="稍后提醒" /> |
| | | </el-radio-group> |
| | | </el-form-item> |
| | | <el-form-item v-if="form.remind === dictResourcesTypeRemind && form.resource === resourceTitle" label="提醒时间" prop="openingTime"> |
| | | <el-date-picker |
| | | v-model="form.openingTime" |
| | | type="datetime" |
| | | placeholder="选择日期时间" |
| | | style="width: 370px;" |
| | | value-format="yyyy-MM-dd HH:00:00" |
| | | align="right" |
| | | default-time="09:00:00" |
| | | /> |
| | | </el-form-item> |
| | | <el-form-item v-if="form.remind === dictResourcesTypeRemind" label="提醒人" prop="remindPeople"> |
| | | <el-select v-model="form.remindPeople" filterable multiple placeholder="请选择人员" style="width: 370px;" @change="change"> |
| | | <el-option |
| | | v-for="(item, index) in users" |
| | | :key="index" |
| | | :label="item.nickName" |
| | | :value="item.id" |
| | | /> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="备注"> |
| | | <el-input v-model="form.remarks" type="textarea" rows="3" 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 prop="title" label="标题" show-overflow-tooltip> |
| | | <template slot-scope="scope"> |
| | | {{ scope.row.title }} |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="classification" label="分类" show-overflow-tooltip /> |
| | | <el-table-column prop="recordTime" label="记录时间" show-overflow-tooltip /> |
| | | <el-table-column prop="recordContent" label="记录内容" show-overflow-tooltip /> |
| | | <el-table-column prop="openingTime" label="提醒时间" show-overflow-tooltip> |
| | | <template slot-scope="scope"> |
| | | <el-tag v-if="scope.row.openingTime == null" type="info">{{ '不提醒' }}</el-tag> |
| | | <el-tag v-if="scope.row.openingTime != null">{{ scope.row.openingTime }}</el-tag> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="remarks" label="备注" show-overflow-tooltip /> |
| | | <el-table-column prop="createTime" label="创建时间" show-overflow-tooltip /> |
| | | <el-table-column v-if="checkPer(['admin','customerResources:edit','customerResources: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 crudCustomerResources from '@/api/system/customerResources' |
| | | import CRUD, { presenter, header, form, crud } from '@crud/crud' |
| | | import crudUser from '@/api/system/user' |
| | | import rrOperation from '@crud/RR.operation' |
| | | import crudOperation from '@crud/CRUD.operation' |
| | | import udOperation from '@crud/UD.operation' |
| | | import pagination from '@crud/Pagination' |
| | | import constant from '@/utils/constant' |
| | | |
| | | const defaultForm = { id: null, title: null, classification: null, recordTime: null, recordContent: null, openingTime: null, remarks: null, createBy: null, createTime: null, updateBy: null, updateTime: null, remind: null, resource: [], remindPeople: [], type: null } |
| | | export default { |
| | | name: 'CustomerResources', |
| | | components: { pagination, crudOperation, rrOperation, udOperation }, |
| | | mixins: [presenter(), header(), form(defaultForm), crud()], |
| | | // 数据字典 |
| | | dicts: [constant.RESOURCES_TYPE], |
| | | cruds() { |
| | | return CRUD({ title: '客户资源管理', url: 'api/customerResources', idField: 'id', sort: 'id,desc', crudMethod: { ...crudCustomerResources }}) |
| | | }, |
| | | data() { |
| | | return { |
| | | permission: { |
| | | add: ['admin', 'customerResources:add'], |
| | | edit: ['admin', 'customerResources:edit'], |
| | | del: ['admin', 'customerResources:del'], |
| | | download: ['admin', 'customerResources:download'] |
| | | }, |
| | | rules: { |
| | | title: [ |
| | | { required: true, message: '标题不能为空', trigger: 'blur' } |
| | | ], |
| | | classification: [ |
| | | { required: true, message: '分类不能为空', trigger: 'change' } |
| | | ], |
| | | recordTime: [ |
| | | { required: true, message: '记录时间不能为空', trigger: 'blur' } |
| | | ], |
| | | remind: [ |
| | | { required: true, message: '提醒不能为空', trigger: 'change' } |
| | | ], |
| | | resource: [ |
| | | { required: true, message: '类型不能为空', trigger: 'change' } |
| | | ], |
| | | openingTime: [ |
| | | { required: true, message: '提醒时间不能为空', trigger: 'blur' } |
| | | ], |
| | | remindPeople: [ |
| | | { required: true, message: '提醒人不能为空', trigger: 'change' } |
| | | ] |
| | | }, |
| | | dictResourceType: constant.RESOURCES_TYPE, |
| | | dictResourcesTypeRemind: constant.RESOURCES_TYPE_REMIND, |
| | | dictResourcesTypeNoRemind: constant.RESOURCES_TYPE_NOREMIND, |
| | | resourceTitle: '稍后提醒', |
| | | resourceTitles: '立即提醒', |
| | | users: [], |
| | | time: ':00:00', |
| | | remindUsers: [], |
| | | classifications: [], |
| | | restaurants: [], |
| | | state: '', |
| | | timeout: null } |
| | | }, |
| | | methods: { |
| | | // 钩子:在获取表格数据之前执行,false 则代表不获取数据 |
| | | [CRUD.HOOK.beforeRefresh]() { |
| | | crudUser.getAll().then(res => { |
| | | this.users = res |
| | | }) |
| | | crudCustomerResources.getAll().then(res => { |
| | | this.classifications = res |
| | | }) |
| | | return true |
| | | }, |
| | | // 钩子:编辑之前 |
| | | [CRUD.HOOK.beforeToEdit]() { |
| | | if (this.form.openingTime !== null) { |
| | | this.form.remind = this.dictResourcesTypeRemind |
| | | if (this.form.openingTime.substring(13, 19) === this.time) { |
| | | this.form.resource = this.resourceTitle |
| | | } else { |
| | | this.form.resource = this.resourceTitles |
| | | } |
| | | crudCustomerResources.getRemindUser(this.form).then(res => { |
| | | const users = [] |
| | | res.forEach(data => { |
| | | users.push(data.id) |
| | | }) |
| | | this.form.remindPeople = users |
| | | }) |
| | | } else { |
| | | this.form.remind = this.dictResourcesTypeNoRemind |
| | | } |
| | | }, |
| | | // 改变时间 |
| | | remindChange() { |
| | | this.form.openingTime = null |
| | | this.form.remindPeople = [] |
| | | }, |
| | | // 多选 |
| | | change() { |
| | | this.$forceUpdate() |
| | | }, |
| | | handleSubmit() { |
| | | }, |
| | | // 输入框获取焦点时调用的方法 |
| | | querySearch(queryString, cb) { |
| | | let results = [] |
| | | if (queryString === null || queryString === '') { |
| | | cb(results) |
| | | } else { |
| | | results = this.classifications |
| | | results = queryString ? results.filter(this.createFilter(queryString)) : results |
| | | cb(results) |
| | | } |
| | | }, |
| | | createFilter(queryString) { |
| | | return (item) => { |
| | | item.value = item.classification |
| | | return item.value.toUpperCase().match(queryString.toUpperCase()) |
| | | } |
| | | } |
| | | } |
| | | } |
| | | </script> |
| | | |
| | | <style scoped> |
| | | |
| | | </style> |
| | |
| | | <el-input |
| | | v-model="query.name" |
| | | clearable |
| | | placeholder="请输入排班名称" |
| | | placeholder="排班名称" |
| | | style="width: 185px" |
| | | class="filter-item" |
| | | @keyup.enter.native="crud.toQuery" |
| | |
| | | >{{ item.label }}</el-radio> |
| | | </el-radio-group> |
| | | </el-form-item> |
| | | <el-form-item label="公司" prop="company"> |
| | | <el-select v-model="form.company" style="width: 437px" clearable> |
| | | <el-option v-for="item in companyList" :key="item.id" :label="item.label" :value="item.value" /> |
| | | <el-form-item label="公司" prop="companyId"> |
| | | <el-select v-model="form.companyId" style="width: 437px" clearable> |
| | | <el-option v-for="item in companyList" :key="item.id" :label="item.label" :value="item.id" /> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item style="margin-bottom: 0;" label="角色" prop="roles"> |
| | |
| | | v-model="roleDatas" |
| | | style="width: 437px" |
| | | multiple |
| | | :multiple-limit="1" |
| | | placeholder="请选择" |
| | | @remove-tag="deleteTag" |
| | | @change="changeRole" |
| | |
| | | </template> |
| | | </el-table-column> |
| | | <!-- 魏传栋 - 始 --> |
| | | <el-table-column :show-overflow-tooltip="true" prop="company" label="公司" width="150"> |
| | | <el-table-column :show-overflow-tooltip="true" prop="companyId" label="公司" width="150"> |
| | | <template slot-scope="scope"> |
| | | <template v-for="item in companyList"> |
| | | <span v-if="scope.row.company == item.value" :key="item.id">{{ item.label }}</span> |
| | | <span v-if="scope.row.companyId == item.id" :key="item.id">{{ item.label }}</span> |
| | | </template> |
| | | </template> |
| | | </el-table-column> |
| | |
| | | import { LOAD_CHILDREN_OPTIONS } from '@riophae/vue-treeselect' |
| | | import crudRostering from '@/api/system/rostering' |
| | | import crudLevel from '@/api/system/level' |
| | | import crudSysUserCompany from '@/api/system/sysUserCompany' |
| | | import crudSysCompany from '@/api/system/sysCompany' |
| | | let userRoles = [] |
| | | let userJobs = [] |
| | | const defaultForm = { id: null, username: null, nickName: null, gender: '男', email: null, enabled: 'false', roles: [], jobs: [], dept: { id: null }, phone: null, birthday: null, address: null, dingding: null, sysRostering: { id: null }, levelId: null } |
| | |
| | | { min: 2, max: 100, message: '长度在 2 到 100 个字符', trigger: 'blur' } |
| | | ], |
| | | // 魏传栋 - 始 |
| | | company: [ |
| | | companyId: [ |
| | | { required: true, message: '请选择公司', trigger: 'blur' } |
| | | ] |
| | | // 魏传栋 - 终 |
| | |
| | | // 钩子:在获取表格数据之前执行,false 则代表不获取数据 |
| | | [CRUD.HOOK.beforeRefresh]() { |
| | | // 查询配置参数 |
| | | crudSysUserCompany.getAll().then(res => { |
| | | crudSysCompany.getAll().then(res => { |
| | | // 公司列表 |
| | | this.companyList = res |
| | | }) |
| | |
| | | v-model="query.contractName" |
| | | clearable |
| | | size="small" |
| | | placeholder="输入合同名称" |
| | | placeholder="合同名称" |
| | | style="width: 200px;" |
| | | class="filter-item" |
| | | @keyup.enter.native="crud.toQuery" |
| | |
| | | v-model="query.contractStartTime" |
| | | type="daterange" |
| | | clearable |
| | | class="filter-item" |
| | | class="date-item" |
| | | value-format="yyyy-MM-dd HH:mm:ss" |
| | | placeholder="请选择日期时间" |
| | | range-separator="至" |
| | | start-placeholder="合同开始日期" |
| | | end-placeholder="合同开始日期" |
| | | range-separator=" : " |
| | | start-placeholder="开始日期" |
| | | end-placeholder="开始日期" |
| | | /> |
| | | <el-date-picker |
| | | v-model="query.contractEndTime" |
| | | type="daterange" |
| | | clearable |
| | | class="filter-item" |
| | | class="date-item" |
| | | value-format="yyyy-MM-dd HH:mm:ss" |
| | | placeholder="请选择日期时间" |
| | | range-separator="至" |
| | | start-placeholder="合同结束日期" |
| | | end-placeholder="合同结束日期" |
| | | range-separator=" : " |
| | | start-placeholder="结束日期" |
| | | end-placeholder="结束日期" |
| | | /> |
| | | <el-select v-model="query.companyId" filterable clearable placeholder="所属公司" style="width: 185px;" class="filter-item" @keyup.enter.native="crud.toQuery"> |
| | | <el-option |
| | |
| | | <el-form-item label="备注" prop="remarks"> |
| | | <el-input v-model="form.remarks" type="textarea" rows="3" style="width: 370px;" /> |
| | | </el-form-item> |
| | | <el-form-item label="相关文件" prop="relatedDocuments"> |
| | | <file-upload :key="random" ref="fileUpload" :file-url="form.relatedDocuments == null || form.relatedDocuments === '' ? null : form.relatedDocuments" :limit="5" @fileInfo="getFileInfo" /> |
| | | </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> |
| | | <el-button :loading="crud.status.cu === 2" type="primary" @click="submitCU">确认</el-button> |
| | | </div> |
| | | </el-dialog> |
| | | <!--表格渲染--> |
| | |
| | | import crudOperation from '@crud/CRUD.operation' |
| | | import udOperation from '@crud/UD.operation' |
| | | import pagination from '@crud/Pagination' |
| | | import crudSysUserCompany from '@/api/system/sysUserCompany' |
| | | import crudSysCompany from '@/api/system/sysCompany' |
| | | import crudUser from '@/api/system/user' |
| | | import fileUpload from '../../assembly/fileUpload/index.vue' |
| | | |
| | | const defaultForm = { id: null, userId: null, contractName: null, contractStartTime: null, contractEndTime: null, companyId: null, createBy: null, createTime: null, updateBy: null, updateTime: null, remarks: null } |
| | | const defaultForm = { id: null, userId: null, contractName: null, contractStartTime: null, contractEndTime: null, companyId: null, createBy: null, createTime: null, updateBy: null, updateTime: null, relatedDocuments: null, remarks: null } |
| | | export default { |
| | | name: 'SysUserContract', |
| | | components: { pagination, crudOperation, rrOperation, udOperation }, |
| | | components: { pagination, crudOperation, rrOperation, udOperation, fileUpload }, |
| | | mixins: [presenter(), header(), form(defaultForm), crud()], |
| | | cruds() { |
| | | return CRUD({ title: '合同部分', url: 'api/sysUserContract', idField: 'id', sort: 'id,desc', crudMethod: { ...crudSysContract }}) |
| | |
| | | ] |
| | | }, |
| | | companyList: [], |
| | | users: [] } |
| | | users: [], |
| | | // 随机数 |
| | | random: 0 } |
| | | }, |
| | | methods: { |
| | | [CRUD.HOOK.beforeRefresh]() { |
| | | this.getUsers() |
| | | // 查询配置参数 |
| | | crudSysUserCompany.getAll().then(res => { |
| | | crudSysCompany.getAll().then(res => { |
| | | // 公司列表 |
| | | this.companyList = res |
| | | }) |
| | | return true |
| | | }, |
| | | // 钩子:开始 "新建/编辑" - 之前 |
| | | [CRUD.HOOK.beforeToCU]() { |
| | | const that = this |
| | | // 随机数 |
| | | that.random = Math.random() |
| | | }, |
| | | // 查询员工 |
| | | getUsers() { |
| | |
| | | var form = JSON.stringify({ |
| | | 'userId': data |
| | | }) |
| | | crudSysUserCompany.getCompName(form).then(res => { |
| | | crudSysCompany.getCompName(form).then(res => { |
| | | this.form.companyId = res.label |
| | | }) |
| | | } else { |
| | | this.form.companyId = null |
| | | } |
| | | }, |
| | | // 表单提交 |
| | | submitCU() { |
| | | const that = this |
| | | // 通过“that.$refs.fileUpload”找到子页面,“submit”是子页面的方法。 |
| | | that.$refs.fileUpload.submit() |
| | | }, |
| | | // 获取文件信息 |
| | | getFileInfo(info) { |
| | | const that = this |
| | | // 判断返回数据 |
| | | if (info.length === 0) { |
| | | // 表单文件路径赋值 |
| | | that.crud.form.relatedDocuments = null |
| | | // 表单提交 |
| | | that.crud.submitCU() |
| | | // 终止 |
| | | return |
| | | } |
| | | // 循环返回数据 |
| | | for (let i = 0; i < info.length; i++) { |
| | | // 判断循环下标 |
| | | if (i === 0) { |
| | | // 表单文件路径赋值 |
| | | that.crud.form.relatedDocuments = info[i].response == null || info[i].response === '' ? info[i].url.substring(info[i].url.indexOf('/file/'), info[i].url.length) : '/file/' + info[i].response.type + '/' + info[i].response.realName |
| | | } else { |
| | | // 表单文件路径赋值 |
| | | that.crud.form.relatedDocuments += info[i].response == null || info[i].response === '' ? ',' + info[i].url.substring(info[i].url.indexOf('/file/'), info[i].url.length) : ',/file/' + info[i].response.type + '/' + info[i].response.realName |
| | | } |
| | | // 判断循环是否结束 |
| | | if (i === info.length - 1) { |
| | | // 表单提交 |
| | | that.crud.submitCU() |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | |
| | | :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状态 |
| | |
| | | this.form.taskStartDate = this.formTasks[i].planStartTime |
| | | this.form.taskEndDate = this.formTasks[i].planEndTime |
| | | 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 |
| | | }) |
| | | } |
| | | } |
| | | } |