| 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.io.Serializable; |
| | | |
| | | /** |
| | | * @website https://eladmin.vip |
| | | * @description / |
| | | * @author 赵士淞 |
| | | * @date 2023-02-13 |
| | | **/ |
| | | @Entity |
| | | @Data |
| | | @Table(name="capital_flow") |
| | | public class CapitalFlow extends BaseEntity implements Serializable { |
| | | |
| | | @Id |
| | | @GeneratedValue(strategy = GenerationType.IDENTITY) |
| | | @Column(name = "`id`") |
| | | @ApiModelProperty(value = "ID") |
| | | private Long id; |
| | | |
| | | @Column(name = "`flow_year_month`",nullable = false) |
| | | @NotNull |
| | | @ApiModelProperty(value = "流水年月") |
| | | private Timestamp flowYearMonth; |
| | | |
| | | @Column(name = "`company_id`",nullable = false) |
| | | @NotNull |
| | | @ApiModelProperty(value = "所属公司") |
| | | private Long companyId; |
| | | |
| | | @Column(name = "`remarks`") |
| | | @ApiModelProperty(value = "备注") |
| | | private String remarks; |
| | | |
| | | 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); |
| | | } |
| 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.CapitalFlow; |
| | | import org.springframework.data.jpa.repository.JpaRepository; |
| | | import org.springframework.data.jpa.repository.JpaSpecificationExecutor; |
| | | |
| | | /** |
| | | * @website https://eladmin.vip |
| | | * @author 赵士淞 |
| | | * @date 2023-02-13 |
| | | **/ |
| | | 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; |
| | | } |
| 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 java.sql.Timestamp; |
| | | import java.math.BigDecimal; |
| | | import java.io.Serializable; |
| | | |
| | | /** |
| | | * @website https://eladmin.vip |
| | | * @description / |
| | | * @author 赵士淞 |
| | | * @date 2023-02-13 |
| | | **/ |
| | | @Data |
| | | public class CapitalFlowExpendDto extends BaseDTO implements Serializable { |
| | | |
| | | /** ID */ |
| | | private Long id; |
| | | |
| | | /** 所属流水 */ |
| | | private Long flowId; |
| | | |
| | | /** 标题 */ |
| | | private String title; |
| | | |
| | | /** 金额 */ |
| | | private BigDecimal amount; |
| | | |
| | | /** 备注 */ |
| | | private String remarks; |
| | | |
| | | /** 流水名称 */ |
| | | private String flowName; |
| | | } |
| 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 java.util.List; |
| | | import me.zhengjie.annotation.Query; |
| | | |
| | | /** |
| | | * @website https://eladmin.vip |
| | | * @author 赵士淞 |
| | | * @date 2023-02-13 |
| | | **/ |
| | | @Data |
| | | public class CapitalFlowExpendQueryCriteria{ |
| | | |
| | | /** 精确 */ |
| | | @Query |
| | | private Long flowId; |
| | | |
| | | /** 模糊 */ |
| | | @Query(type = Query.Type.INNER_LIKE) |
| | | private String title; |
| | | } |
| 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 java.sql.Timestamp; |
| | | import java.math.BigDecimal; |
| | | import java.io.Serializable; |
| | | |
| | | /** |
| | | * @website https://eladmin.vip |
| | | * @description / |
| | | * @author 赵士淞 |
| | | * @date 2023-02-13 |
| | | **/ |
| | | @Data |
| | | public class CapitalFlowIncomeDto extends BaseDTO implements Serializable { |
| | | |
| | | /** ID */ |
| | | private Long id; |
| | | |
| | | /** 所属流水 */ |
| | | private Long flowId; |
| | | |
| | | /** 标题 */ |
| | | private String title; |
| | | |
| | | /** 金额 */ |
| | | private BigDecimal amount; |
| | | |
| | | /** 备注 */ |
| | | private String remarks; |
| | | |
| | | /** 流水名称 */ |
| | | private String flowName; |
| | | } |
| 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 java.util.List; |
| | | import me.zhengjie.annotation.Query; |
| | | |
| | | /** |
| | | * @website https://eladmin.vip |
| | | * @author 赵士淞 |
| | | * @date 2023-02-13 |
| | | **/ |
| | | @Data |
| | | public class CapitalFlowIncomeQueryCriteria{ |
| | | |
| | | /** 精确 */ |
| | | @Query |
| | | private Long flowId; |
| | | |
| | | /** 模糊 */ |
| | | @Query(type = Query.Type.INNER_LIKE) |
| | | private String title; |
| | | } |
| 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 java.sql.Timestamp; |
| | | import java.util.List; |
| | | import me.zhengjie.annotation.Query; |
| | | |
| | | /** |
| | | * @website https://eladmin.vip |
| | | * @author 赵士淞 |
| | | * @date 2023-02-13 |
| | | **/ |
| | | @Data |
| | | public class CapitalFlowQueryCriteria{ |
| | | |
| | | /** 精确 */ |
| | | @Query(type = Query.Type.INNER_LIKE) |
| | | 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(); |
| | | } |
| | | } |
| 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.mapstruct; |
| | | |
| | | import me.zhengjie.base.BaseMapper; |
| | | 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 赵士淞 |
| | | * @date 2023-02-13 |
| | | **/ |
| | | @Mapper(componentModel = "spring", unmappedTargetPolicy = ReportingPolicy.IGNORE) |
| | | public interface CapitalFlowExpendMapper extends BaseMapper<CapitalFlowExpendDto, CapitalFlowExpend> { |
| | | |
| | | } |
| 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.mapstruct; |
| | | |
| | | import me.zhengjie.base.BaseMapper; |
| | | 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 赵士淞 |
| | | * @date 2023-02-13 |
| | | **/ |
| | | @Mapper(componentModel = "spring", unmappedTargetPolicy = ReportingPolicy.IGNORE) |
| | | public interface CapitalFlowIncomeMapper extends BaseMapper<CapitalFlowIncomeDto, CapitalFlowIncome> { |
| | | |
| | | } |
| 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.mapstruct; |
| | | |
| | | import me.zhengjie.base.BaseMapper; |
| | | 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 赵士淞 |
| | | * @date 2023-02-13 |
| | | **/ |
| | | @Mapper(componentModel = "spring", unmappedTargetPolicy = ReportingPolicy.IGNORE) |
| | | public interface CapitalFlowMapper extends BaseMapper<CapitalFlowDto, CapitalFlow> { |
| | | |
| | | } |
| 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 } |
| 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> |