Merge branch 'zhaoss' of http://192.168.1.110:5678/r/pms-upgrade into master
81 files added
30 files modified
| New file |
| | |
| | | package me.zhengjie.utils; |
| | | |
| | | import nl.basjes.shaded.org.springframework.util.ObjectUtils; |
| | | import org.springframework.http.HttpEntity; |
| | | import org.springframework.http.HttpHeaders; |
| | | import org.springframework.http.HttpMethod; |
| | | import org.springframework.http.ResponseEntity; |
| | | import org.springframework.web.client.RestTemplate; |
| | | |
| | | import java.util.Map; |
| | | |
| | | public class HttpUtil { |
| | | |
| | | /** |
| | | * POST通信 |
| | | */ |
| | | public static <T> ResponseEntity<T> post(String url, Map body, HttpHeaders httpHeaders, Class<T> responseType){ |
| | | return new RestTemplate().postForEntity(url, new HttpEntity<>(body, httpHeaders), responseType); |
| | | } |
| | | |
| | | /** |
| | | * GET通信 |
| | | */ |
| | | public static <T> ResponseEntity<T> get(String url, Map<String, Object> params, HttpHeaders httpHeaders, Class<T> responseType){ |
| | | return new RestTemplate().exchange(url + toStringParams(params), HttpMethod.GET, new HttpEntity<>(httpHeaders), responseType); |
| | | } |
| | | |
| | | /** |
| | | * 通信参数字符串化 |
| | | */ |
| | | public static String toStringParams(Map<String, Object> params) { |
| | | StringBuilder stringBuilder = new StringBuilder(); |
| | | if (!ObjectUtils.isEmpty(params)) { |
| | | stringBuilder.append("?"); |
| | | for (Map.Entry entry : params.entrySet()) { |
| | | stringBuilder.append(entry.getKey()); |
| | | stringBuilder.append("="); |
| | | stringBuilder.append(entry.getValue()); |
| | | stringBuilder.append("&"); |
| | | } |
| | | } |
| | | return stringBuilder.toString(); |
| | | } |
| | | |
| | | } |
| New file |
| | |
| | | package me.zhengjie.utils; |
| | | |
| | | import java.lang.reflect.Field; |
| | | import java.util.ArrayList; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | public class ObjectUtil { |
| | | |
| | | /** |
| | | * Object 转 Map |
| | | * @param obj |
| | | * @return |
| | | * @throws IllegalAccessException |
| | | */ |
| | | public static Map<String, Object> toObjectMap(Object obj) throws IllegalAccessException { |
| | | Map<String, Object> map = new HashMap<String, Object>(); |
| | | Class<?> cla = obj.getClass(); |
| | | Field[] fields = cla.getDeclaredFields(); |
| | | for (Field field : fields) { |
| | | field.setAccessible(true); |
| | | String keyName = field.getName(); |
| | | Object value = field.get(obj); |
| | | if (value == null) |
| | | value = ""; |
| | | map.put(keyName, value); |
| | | } |
| | | return map; |
| | | } |
| | | |
| | | /** |
| | | * Object 转 List |
| | | * @param obj |
| | | * @return |
| | | */ |
| | | public static List<Object> toObjectList(Object obj) { |
| | | List<Object> list = new ArrayList<Object>(); |
| | | if (obj instanceof ArrayList<?>) { |
| | | for (Object o : (List<?>) obj) { |
| | | list.add(o); |
| | | } |
| | | return list; |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | } |
| | |
| | | <artifactId>yauaa</artifactId> |
| | | <version>5.23</version> |
| | | </dependency> |
| | | |
| | | <!-- 消息队列 --> |
| | | <dependency> |
| | | <groupId>org.springframework.boot</groupId> |
| | | <artifactId>spring-boot-starter-amqp</artifactId> |
| | | </dependency> |
| | | </dependencies> |
| | | |
| | | <!-- 打包 --> |
| New file |
| | |
| | | package me.zhengjie.modules.api; |
| | | |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import me.zhengjie.exception.BadRequestException; |
| | | import me.zhengjie.utils.HttpUtil; |
| | | import org.springframework.http.HttpHeaders; |
| | | import org.springframework.http.ResponseEntity; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import java.util.Map; |
| | | |
| | | @Component |
| | | public class Api { |
| | | |
| | | public Object get(String getUrl, Map<String, Object> getParams) { |
| | | // 发起通信 |
| | | ResponseEntity<String> strRes = HttpUtil.get(getUrl, getParams, new HttpHeaders(), String.class); |
| | | // 通信结构 |
| | | JSONObject objBody = JSONObject.parseObject(strRes.getBody()); |
| | | // 结果集 |
| | | return recordSet(objBody); |
| | | } |
| | | |
| | | public Object post(String postUrl, Map<String, Object> postParams) { |
| | | // 发起通信 |
| | | ResponseEntity<String> strRes = HttpUtil.post(postUrl, postParams, new HttpHeaders(), String.class); |
| | | // 通信结构 |
| | | JSONObject objBody = JSONObject.parseObject(strRes.getBody()); |
| | | // 结果集 |
| | | return recordSet(objBody); |
| | | |
| | | } |
| | | |
| | | private Object recordSet(JSONObject objBody) { |
| | | // 判断通信错误码 |
| | | if (objBody != null && objBody.get("msg") != null) { |
| | | // 错误信息 |
| | | throw new BadRequestException(objBody.get("msg").toString()); |
| | | } else if (objBody != null && objBody.get("result") != null) { |
| | | // 通信结果 |
| | | return objBody.get("result"); |
| | | } else { |
| | | // 通信结果 |
| | | return null; |
| | | } |
| | | } |
| | | } |
| 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.business.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-04-13 |
| | | **/ |
| | | @Entity |
| | | @Data |
| | | @Table(name="business_expense") |
| | | public class BusinessExpense extends BaseEntity implements Serializable { |
| | | |
| | | @Id |
| | | @GeneratedValue(strategy = GenerationType.IDENTITY) |
| | | @Column(name = "`id`") |
| | | @ApiModelProperty(value = "ID") |
| | | private Long id; |
| | | |
| | | @Column(name = "`expense_type`",nullable = false) |
| | | @NotBlank |
| | | @ApiModelProperty(value = "费用类型") |
| | | private String expenseType; |
| | | |
| | | @Column(name = "`business_plan_id`",nullable = false) |
| | | @NotNull |
| | | @ApiModelProperty(value = "所属营业计划") |
| | | private Long businessPlanId; |
| | | |
| | | @Column(name = "`project_id`") |
| | | @ApiModelProperty(value = "所属项目") |
| | | private Long projectId; |
| | | |
| | | @Column(name = "`remarks`") |
| | | @ApiModelProperty(value = "备注") |
| | | private String remarks; |
| | | |
| | | public void copy(BusinessExpense 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.business.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-04-13 |
| | | **/ |
| | | @Entity |
| | | @Data |
| | | @Table(name="business_expense_reimbursement") |
| | | public class BusinessExpenseReimbursement extends BaseEntity implements Serializable { |
| | | |
| | | @Id |
| | | @GeneratedValue(strategy = GenerationType.IDENTITY) |
| | | @Column(name = "`id`") |
| | | @ApiModelProperty(value = "ID") |
| | | private Long id; |
| | | |
| | | @Column(name = "`business_expense_id`",nullable = false) |
| | | @NotNull |
| | | @ApiModelProperty(value = "所属营业费用") |
| | | private Long businessExpenseId; |
| | | |
| | | @Column(name = "`reimbursement_content`",nullable = false) |
| | | @NotBlank |
| | | @ApiModelProperty(value = "报销内容") |
| | | private String reimbursementContent; |
| | | |
| | | @Column(name = "`reimbursement_amount`",nullable = false) |
| | | @NotNull |
| | | @ApiModelProperty(value = "报销金额") |
| | | private BigDecimal reimbursementAmount; |
| | | |
| | | @Column(name = "`reimbursement_voucher`") |
| | | @ApiModelProperty(value = "报销凭证") |
| | | private String reimbursementVoucher; |
| | | |
| | | @Column(name = "`remarks`") |
| | | @ApiModelProperty(value = "备注") |
| | | private String remarks; |
| | | |
| | | public void copy(BusinessExpenseReimbursement 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.business.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-04-12 |
| | | **/ |
| | | @Entity |
| | | @Data |
| | | @Table(name="business_plan") |
| | | public class BusinessPlan extends BaseEntity implements Serializable { |
| | | |
| | | @Id |
| | | @GeneratedValue(strategy = GenerationType.IDENTITY) |
| | | @Column(name = "`id`") |
| | | @ApiModelProperty(value = "ID") |
| | | private Long id; |
| | | |
| | | @Column(name = "`business_place`",nullable = false) |
| | | @NotBlank |
| | | @ApiModelProperty(value = "营业地") |
| | | private String businessPlace; |
| | | |
| | | @Column(name = "`business_content`",nullable = false) |
| | | @NotBlank |
| | | @ApiModelProperty(value = "营业内容") |
| | | private String businessContent; |
| | | |
| | | @Column(name = "`business_status`",nullable = false) |
| | | @NotBlank |
| | | @ApiModelProperty(value = "营业状态") |
| | | private String businessStatus; |
| | | |
| | | @Column(name = "`remarks`") |
| | | @ApiModelProperty(value = "备注") |
| | | private String remarks; |
| | | |
| | | public void copy(BusinessPlan 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.business.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-04-12 |
| | | **/ |
| | | @Entity |
| | | @Data |
| | | @Table(name="business_plan_personnel") |
| | | public class BusinessPlanPersonnel extends BaseEntity implements Serializable { |
| | | |
| | | @Id |
| | | @GeneratedValue(strategy = GenerationType.IDENTITY) |
| | | @Column(name = "`id`") |
| | | @ApiModelProperty(value = "ID") |
| | | private Long id; |
| | | |
| | | @Column(name = "`business_plan_id`",nullable = false) |
| | | @NotNull |
| | | @ApiModelProperty(value = "所属营业计划") |
| | | private Long businessPlanId; |
| | | |
| | | @Column(name = "`user_id`",nullable = false) |
| | | @NotNull |
| | | @ApiModelProperty(value = "所属用户") |
| | | private Long userId; |
| | | |
| | | @Column(name = "`business_plan_start_date`",nullable = false) |
| | | @NotNull |
| | | @ApiModelProperty(value = "营业计划开始日期") |
| | | private Timestamp businessPlanStartDate; |
| | | |
| | | @Column(name = "`business_plan_end_date`",nullable = false) |
| | | @NotNull |
| | | @ApiModelProperty(value = "营业计划结束日期") |
| | | private Timestamp businessPlanEndDate; |
| | | |
| | | @Column(name = "`remarks`") |
| | | @ApiModelProperty(value = "备注") |
| | | private String remarks; |
| | | |
| | | public void copy(BusinessPlanPersonnel source){ |
| | | BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true)); |
| | | } |
| | | } |
| New file |
| | |
| | | package me.zhengjie.modules.business.rabbit; |
| | | |
| | | import com.alibaba.fastjson.JSON; |
| | | import me.zhengjie.modules.business.service.BusinessExpenseService; |
| | | import me.zhengjie.modules.business.service.dto.BusinessExpenseDto; |
| | | import org.springframework.amqp.rabbit.annotation.RabbitHandler; |
| | | import org.springframework.amqp.rabbit.annotation.RabbitListener; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import java.util.Map; |
| | | |
| | | @Component |
| | | @RabbitListener(queues = "business.businessExpenseApply") |
| | | public class BusinessExpenseRabbit { |
| | | |
| | | @Autowired |
| | | private BusinessExpenseService businessExpenseService; |
| | | |
| | | @RabbitHandler |
| | | public void process(Map<String, Object> message) { |
| | | // Map 转 实体类 |
| | | BusinessExpenseDto businessExpenseDto = JSON.parseObject(JSON.toJSONString(message), BusinessExpenseDto.class); |
| | | // 新增营业费用 |
| | | businessExpenseService.create(businessExpenseDto); |
| | | } |
| | | } |
| 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.business.repository; |
| | | |
| | | import me.zhengjie.modules.business.domain.BusinessExpenseReimbursement; |
| | | 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-04-13 |
| | | **/ |
| | | public interface BusinessExpenseReimbursementRepository extends JpaRepository<BusinessExpenseReimbursement, Long>, JpaSpecificationExecutor<BusinessExpenseReimbursement> { |
| | | |
| | | // 根据营业费用ID查询 |
| | | List<BusinessExpenseReimbursement> findByBusinessExpenseId(Long businessExpenseId); |
| | | // 根据营业费用ID删除 |
| | | void deleteByBusinessExpenseId(Long businessExpenseId); |
| | | // 根据营业费用ID统计报销金额 |
| | | @Query(value = "SELECT SUM(reimbursement_amount) FROM business_expense_reimbursement WHERE business_expense_id = ?1", nativeQuery = true) |
| | | BigDecimal amountReimbursementAmountByBusinessExpenseId(Long businessExpenseId); |
| | | } |
| 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.business.repository; |
| | | |
| | | import me.zhengjie.modules.business.domain.BusinessExpense; |
| | | import org.springframework.data.jpa.repository.JpaRepository; |
| | | import org.springframework.data.jpa.repository.JpaSpecificationExecutor; |
| | | |
| | | /** |
| | | * @website https://eladmin.vip |
| | | * @author 赵士淞 |
| | | * @date 2023-04-13 |
| | | **/ |
| | | public interface BusinessExpenseRepository extends JpaRepository<BusinessExpense, Long>, JpaSpecificationExecutor<BusinessExpense> { |
| | | } |
| 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.business.repository; |
| | | |
| | | import me.zhengjie.modules.business.domain.BusinessPlanPersonnel; |
| | | 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-04-12 |
| | | **/ |
| | | public interface BusinessPlanPersonnelRepository extends JpaRepository<BusinessPlanPersonnel, Long>, JpaSpecificationExecutor<BusinessPlanPersonnel> { |
| | | |
| | | // 根据营业计划ID查询 |
| | | List<BusinessPlanPersonnel> findByBusinessPlanId(Long businessPlanId); |
| | | // 根据营业计划ID删除 |
| | | void deleteByBusinessPlanId(Long businessPlanId); |
| | | } |
| 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.business.repository; |
| | | |
| | | import me.zhengjie.modules.business.domain.BusinessPlan; |
| | | import org.springframework.data.jpa.repository.JpaRepository; |
| | | import org.springframework.data.jpa.repository.JpaSpecificationExecutor; |
| | | |
| | | /** |
| | | * @website https://eladmin.vip |
| | | * @author 赵士淞 |
| | | * @date 2023-04-12 |
| | | **/ |
| | | public interface BusinessPlanRepository extends JpaRepository<BusinessPlan, Long>, JpaSpecificationExecutor<BusinessPlan> { |
| | | } |
| 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.business.rest; |
| | | |
| | | import me.zhengjie.annotation.Log; |
| | | import me.zhengjie.modules.business.domain.BusinessExpense; |
| | | import me.zhengjie.modules.business.service.BusinessExpenseService; |
| | | import me.zhengjie.modules.business.service.dto.BusinessExpenseDto; |
| | | import me.zhengjie.modules.business.service.dto.BusinessExpenseQueryCriteria; |
| | | 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-04-13 |
| | | **/ |
| | | @RestController |
| | | @RequiredArgsConstructor |
| | | @Api(tags = "营业费用管理") |
| | | @RequestMapping("/api/businessExpense") |
| | | public class BusinessExpenseController { |
| | | |
| | | private final BusinessExpenseService businessExpenseService; |
| | | |
| | | @Log("导出数据") |
| | | @ApiOperation("导出数据") |
| | | @GetMapping(value = "/download") |
| | | @PreAuthorize("@el.check('businessExpense:download')") |
| | | public void exportBusinessExpense(HttpServletResponse response, BusinessExpenseQueryCriteria criteria) throws IOException { |
| | | businessExpenseService.download(businessExpenseService.queryAll(criteria), response); |
| | | } |
| | | |
| | | @GetMapping |
| | | @Log("查询营业费用") |
| | | @ApiOperation("查询营业费用") |
| | | @PreAuthorize("@el.check('businessExpense:list')") |
| | | public ResponseEntity<Object> queryBusinessExpense(BusinessExpenseQueryCriteria criteria, Pageable pageable){ |
| | | return new ResponseEntity<>(businessExpenseService.queryAll(criteria,pageable),HttpStatus.OK); |
| | | } |
| | | |
| | | @GetMapping(value = "/all") |
| | | @Log("查询营业费用") |
| | | @ApiOperation("查询营业费用") |
| | | @PreAuthorize("@el.check('businessExpense:list')") |
| | | public ResponseEntity<Object> queryBusinessExpense(BusinessExpenseQueryCriteria criteria){ |
| | | return new ResponseEntity<>(businessExpenseService.queryAll(criteria),HttpStatus.OK); |
| | | } |
| | | |
| | | @PostMapping |
| | | @Log("新增营业费用") |
| | | @ApiOperation("新增营业费用") |
| | | @PreAuthorize("@el.check('businessExpense:add')") |
| | | public ResponseEntity<Object> createBusinessExpense(@Validated @RequestBody BusinessExpenseDto resources){ |
| | | return new ResponseEntity<>(businessExpenseService.create(resources),HttpStatus.CREATED); |
| | | } |
| | | |
| | | @PutMapping |
| | | @Log("修改营业费用") |
| | | @ApiOperation("修改营业费用") |
| | | @PreAuthorize("@el.check('businessExpense:edit')") |
| | | public ResponseEntity<Object> updateBusinessExpense(@Validated @RequestBody BusinessExpenseDto resources){ |
| | | businessExpenseService.update(resources); |
| | | return new ResponseEntity<>(HttpStatus.NO_CONTENT); |
| | | } |
| | | |
| | | @DeleteMapping |
| | | @Log("删除营业费用") |
| | | @ApiOperation("删除营业费用") |
| | | @PreAuthorize("@el.check('businessExpense:del')") |
| | | public ResponseEntity<Object> deleteBusinessExpense(@RequestBody Long[] ids) { |
| | | businessExpenseService.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.business.rest; |
| | | |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import lombok.RequiredArgsConstructor; |
| | | import me.zhengjie.annotation.Log; |
| | | import me.zhengjie.modules.business.service.BusinessExpenseFlowableService; |
| | | import me.zhengjie.modules.business.service.dto.BusinessExpenseDto; |
| | | 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.*; |
| | | |
| | | /** |
| | | * @website https://eladmin.vip |
| | | * @author 赵士淞 |
| | | * @date 2023-04-13 |
| | | **/ |
| | | @RestController |
| | | @RequiredArgsConstructor |
| | | @Api(tags = "营业费用管理") |
| | | @RequestMapping("/api/businessExpenseFlowable") |
| | | public class BusinessExpenseFlowableController { |
| | | |
| | | private final BusinessExpenseFlowableService businessExpenseFlowableService; |
| | | |
| | | @GetMapping(value = "/report") |
| | | @Log("查询我发起的营业费用(Flowable)") |
| | | @ApiOperation("查询我发起的营业费用(Flowable)") |
| | | @PreAuthorize("@el.check('businessExpense:list')") |
| | | public ResponseEntity<Object> reportBusinessExpense() throws Exception { |
| | | return new ResponseEntity<>(businessExpenseFlowableService.report(),HttpStatus.OK); |
| | | } |
| | | |
| | | @GetMapping(value = "/approve") |
| | | @Log("查询待审批的营业费用(Flowable)") |
| | | @ApiOperation("查询待审批的营业费用(Flowable)") |
| | | @PreAuthorize("@el.check('businessExpense:list')") |
| | | public ResponseEntity<Object> approveBusinessExpense() throws Exception { |
| | | return new ResponseEntity<>(businessExpenseFlowableService.approve(),HttpStatus.OK); |
| | | } |
| | | |
| | | @PostMapping |
| | | @Log("新增营业费用(Flowable)") |
| | | @ApiOperation("新增营业费用(Flowable)") |
| | | @PreAuthorize("@el.check('businessExpenseFlowable:add')") |
| | | public ResponseEntity<Object> createBusinessExpense(@Validated @RequestBody BusinessExpenseDto resources) throws Exception { |
| | | businessExpenseFlowableService.create(resources); |
| | | return new ResponseEntity<>(HttpStatus.CREATED); |
| | | } |
| | | |
| | | @PostMapping(value = "/agree") |
| | | @Log("同意营业费用(Flowable)") |
| | | @ApiOperation("同意营业费用(Flowable)") |
| | | public ResponseEntity<Object> agreeBusinessExpense(@RequestBody String processInstanceId) throws Exception { |
| | | businessExpenseFlowableService.agree(processInstanceId); |
| | | return new ResponseEntity<>(HttpStatus.OK); |
| | | } |
| | | |
| | | @PostMapping(value = "/reject") |
| | | @Log("拒绝营业费用(Flowable)") |
| | | @ApiOperation("拒绝营业费用(Flowable)") |
| | | public ResponseEntity<Object> rejectBusinessExpense(@RequestBody String processInstanceId) throws Exception { |
| | | businessExpenseFlowableService.reject(processInstanceId); |
| | | 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.business.rest; |
| | | |
| | | import me.zhengjie.annotation.Log; |
| | | import me.zhengjie.modules.business.domain.BusinessExpenseReimbursement; |
| | | import me.zhengjie.modules.business.service.BusinessExpenseReimbursementService; |
| | | import me.zhengjie.modules.business.service.dto.BusinessExpenseReimbursementQueryCriteria; |
| | | 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-04-13 |
| | | **/ |
| | | @RestController |
| | | @RequiredArgsConstructor |
| | | @Api(tags = "营业费用明细管理") |
| | | @RequestMapping("/api/businessExpenseReimbursement") |
| | | public class BusinessExpenseReimbursementController { |
| | | |
| | | private final BusinessExpenseReimbursementService businessExpenseReimbursementService; |
| | | |
| | | @Log("导出数据") |
| | | @ApiOperation("导出数据") |
| | | @GetMapping(value = "/download") |
| | | @PreAuthorize("@el.check('businessExpenseReimbursement:download')") |
| | | public void exportBusinessExpenseReimbursement(HttpServletResponse response, BusinessExpenseReimbursementQueryCriteria criteria) throws IOException { |
| | | businessExpenseReimbursementService.download(businessExpenseReimbursementService.queryAll(criteria), response); |
| | | } |
| | | |
| | | @GetMapping |
| | | @Log("查询营业费用明细") |
| | | @ApiOperation("查询营业费用明细") |
| | | @PreAuthorize("@el.check('businessExpenseReimbursement:list')") |
| | | public ResponseEntity<Object> queryBusinessExpenseReimbursement(BusinessExpenseReimbursementQueryCriteria criteria, Pageable pageable){ |
| | | return new ResponseEntity<>(businessExpenseReimbursementService.queryAll(criteria,pageable),HttpStatus.OK); |
| | | } |
| | | |
| | | @GetMapping(value = "/all") |
| | | @Log("查询营业费用明细") |
| | | @ApiOperation("查询营业费用明细") |
| | | @PreAuthorize("@el.check('businessExpenseReimbursement:list')") |
| | | public ResponseEntity<Object> queryBusinessExpenseReimbursement(BusinessExpenseReimbursementQueryCriteria criteria){ |
| | | return new ResponseEntity<>(businessExpenseReimbursementService.queryAll(criteria),HttpStatus.OK); |
| | | } |
| | | |
| | | @PostMapping |
| | | @Log("新增营业费用明细") |
| | | @ApiOperation("新增营业费用明细") |
| | | @PreAuthorize("@el.check('businessExpenseReimbursement:add')") |
| | | public ResponseEntity<Object> createBusinessExpenseReimbursement(@Validated @RequestBody BusinessExpenseReimbursement resources){ |
| | | return new ResponseEntity<>(businessExpenseReimbursementService.create(resources),HttpStatus.CREATED); |
| | | } |
| | | |
| | | @PutMapping |
| | | @Log("修改营业费用明细") |
| | | @ApiOperation("修改营业费用明细") |
| | | @PreAuthorize("@el.check('businessExpenseReimbursement:edit')") |
| | | public ResponseEntity<Object> updateBusinessExpenseReimbursement(@Validated @RequestBody BusinessExpenseReimbursement resources){ |
| | | businessExpenseReimbursementService.update(resources); |
| | | return new ResponseEntity<>(HttpStatus.NO_CONTENT); |
| | | } |
| | | |
| | | @DeleteMapping |
| | | @Log("删除营业费用明细") |
| | | @ApiOperation("删除营业费用明细") |
| | | @PreAuthorize("@el.check('businessExpenseReimbursement:del')") |
| | | public ResponseEntity<Object> deleteBusinessExpenseReimbursement(@RequestBody Long[] ids) { |
| | | businessExpenseReimbursementService.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.business.rest; |
| | | |
| | | import me.zhengjie.annotation.Log; |
| | | import me.zhengjie.modules.business.domain.BusinessPlan; |
| | | import me.zhengjie.modules.business.service.BusinessPlanService; |
| | | import me.zhengjie.modules.business.service.dto.BusinessPlanDto; |
| | | import me.zhengjie.modules.business.service.dto.BusinessPlanQueryCriteria; |
| | | 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-04-12 |
| | | **/ |
| | | @RestController |
| | | @RequiredArgsConstructor |
| | | @Api(tags = "营业计划管理") |
| | | @RequestMapping("/api/businessPlan") |
| | | public class BusinessPlanController { |
| | | |
| | | private final BusinessPlanService businessPlanService; |
| | | |
| | | @Log("导出数据") |
| | | @ApiOperation("导出数据") |
| | | @GetMapping(value = "/download") |
| | | @PreAuthorize("@el.check('businessPlan:download')") |
| | | public void exportBusinessPlan(HttpServletResponse response, BusinessPlanQueryCriteria criteria) throws IOException { |
| | | businessPlanService.download(businessPlanService.queryAll(criteria), response); |
| | | } |
| | | |
| | | @GetMapping |
| | | @Log("查询营业计划") |
| | | @ApiOperation("查询营业计划") |
| | | @PreAuthorize("@el.check('businessPlan:list')") |
| | | public ResponseEntity<Object> queryBusinessPlan(BusinessPlanQueryCriteria criteria, Pageable pageable){ |
| | | return new ResponseEntity<>(businessPlanService.queryAll(criteria,pageable),HttpStatus.OK); |
| | | } |
| | | |
| | | @GetMapping(value = "/all") |
| | | @Log("查询营业计划") |
| | | @ApiOperation("查询营业计划") |
| | | @PreAuthorize("@el.check('businessPlan:list')") |
| | | public ResponseEntity<Object> queryBusinessPlan(BusinessPlanQueryCriteria criteria){ |
| | | return new ResponseEntity<>(businessPlanService.queryAll(criteria),HttpStatus.OK); |
| | | } |
| | | |
| | | @PostMapping |
| | | @Log("新增营业计划") |
| | | @ApiOperation("新增营业计划") |
| | | @PreAuthorize("@el.check('businessPlan:add')") |
| | | public ResponseEntity<Object> createBusinessPlan(@Validated @RequestBody BusinessPlanDto resources){ |
| | | return new ResponseEntity<>(businessPlanService.create(resources),HttpStatus.CREATED); |
| | | } |
| | | |
| | | @PutMapping |
| | | @Log("修改营业计划") |
| | | @ApiOperation("修改营业计划") |
| | | @PreAuthorize("@el.check('businessPlan:edit')") |
| | | public ResponseEntity<Object> updateBusinessPlan(@Validated @RequestBody BusinessPlanDto resources){ |
| | | businessPlanService.update(resources); |
| | | return new ResponseEntity<>(HttpStatus.NO_CONTENT); |
| | | } |
| | | |
| | | @DeleteMapping |
| | | @Log("删除营业计划") |
| | | @ApiOperation("删除营业计划") |
| | | @PreAuthorize("@el.check('businessPlan:del')") |
| | | public ResponseEntity<Object> deleteBusinessPlan(@RequestBody Long[] ids) { |
| | | businessPlanService.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.business.rest; |
| | | |
| | | import me.zhengjie.annotation.Log; |
| | | import me.zhengjie.modules.business.domain.BusinessPlanPersonnel; |
| | | import me.zhengjie.modules.business.service.BusinessPlanPersonnelService; |
| | | import me.zhengjie.modules.business.service.dto.BusinessPlanPersonnelQueryCriteria; |
| | | 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-04-12 |
| | | **/ |
| | | @RestController |
| | | @RequiredArgsConstructor |
| | | @Api(tags = "营业计划人员管理") |
| | | @RequestMapping("/api/businessPlanPersonnel") |
| | | public class BusinessPlanPersonnelController { |
| | | |
| | | private final BusinessPlanPersonnelService businessPlanPersonnelService; |
| | | |
| | | @Log("导出数据") |
| | | @ApiOperation("导出数据") |
| | | @GetMapping(value = "/download") |
| | | @PreAuthorize("@el.check('businessPlanPersonnel:download')") |
| | | public void exportBusinessPlanPersonnel(HttpServletResponse response, BusinessPlanPersonnelQueryCriteria criteria) throws IOException { |
| | | businessPlanPersonnelService.download(businessPlanPersonnelService.queryAll(criteria), response); |
| | | } |
| | | |
| | | @GetMapping |
| | | @Log("查询营业计划人员") |
| | | @ApiOperation("查询营业计划人员") |
| | | @PreAuthorize("@el.check('businessPlanPersonnel:list')") |
| | | public ResponseEntity<Object> queryBusinessPlanPersonnel(BusinessPlanPersonnelQueryCriteria criteria, Pageable pageable){ |
| | | return new ResponseEntity<>(businessPlanPersonnelService.queryAll(criteria,pageable),HttpStatus.OK); |
| | | } |
| | | |
| | | @GetMapping(value = "/all") |
| | | @Log("查询营业计划人员") |
| | | @ApiOperation("查询营业计划人员") |
| | | @PreAuthorize("@el.check('businessPlanPersonnel:list')") |
| | | public ResponseEntity<Object> queryBusinessPlanPersonnel(BusinessPlanPersonnelQueryCriteria criteria){ |
| | | return new ResponseEntity<>(businessPlanPersonnelService.queryAll(criteria),HttpStatus.OK); |
| | | } |
| | | |
| | | @PostMapping |
| | | @Log("新增营业计划人员") |
| | | @ApiOperation("新增营业计划人员") |
| | | @PreAuthorize("@el.check('businessPlanPersonnel:add')") |
| | | public ResponseEntity<Object> createBusinessPlanPersonnel(@Validated @RequestBody BusinessPlanPersonnel resources){ |
| | | return new ResponseEntity<>(businessPlanPersonnelService.create(resources),HttpStatus.CREATED); |
| | | } |
| | | |
| | | @PutMapping |
| | | @Log("修改营业计划人员") |
| | | @ApiOperation("修改营业计划人员") |
| | | @PreAuthorize("@el.check('businessPlanPersonnel:edit')") |
| | | public ResponseEntity<Object> updateBusinessPlanPersonnel(@Validated @RequestBody BusinessPlanPersonnel resources){ |
| | | businessPlanPersonnelService.update(resources); |
| | | return new ResponseEntity<>(HttpStatus.NO_CONTENT); |
| | | } |
| | | |
| | | @DeleteMapping |
| | | @Log("删除营业计划人员") |
| | | @ApiOperation("删除营业计划人员") |
| | | @PreAuthorize("@el.check('businessPlanPersonnel:del')") |
| | | public ResponseEntity<Object> deleteBusinessPlanPersonnel(@RequestBody Long[] ids) { |
| | | businessPlanPersonnelService.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.business.service; |
| | | |
| | | import me.zhengjie.modules.business.service.dto.BusinessExpenseDto; |
| | | |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * @website https://eladmin.vip |
| | | * @description 服务接口 |
| | | * @author 赵士淞 |
| | | * @date 2023-04-13 |
| | | **/ |
| | | public interface BusinessExpenseFlowableService { |
| | | |
| | | /** |
| | | * 我发起的 |
| | | * @return List<BusinessExpenseDto> |
| | | */ |
| | | Map<String, Object> report() throws Exception; |
| | | |
| | | /** |
| | | * 待审批的 |
| | | * @return List<BusinessExpenseDto> |
| | | */ |
| | | Map<String, Object> approve() throws Exception; |
| | | |
| | | /** |
| | | * 创建 |
| | | * @param resources / |
| | | */ |
| | | void create(BusinessExpenseDto resources) throws Exception; |
| | | |
| | | /** |
| | | * 同意 |
| | | * @param processInstanceId / |
| | | */ |
| | | void agree(String processInstanceId) throws Exception; |
| | | |
| | | /** |
| | | * 拒绝 |
| | | * @param processInstanceId / |
| | | */ |
| | | void reject(String processInstanceId) throws Exception; |
| | | } |
| 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.business.service; |
| | | |
| | | import me.zhengjie.modules.business.domain.BusinessExpenseReimbursement; |
| | | import me.zhengjie.modules.business.service.dto.BusinessExpenseReimbursementDto; |
| | | import me.zhengjie.modules.business.service.dto.BusinessExpenseReimbursementQueryCriteria; |
| | | 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-04-13 |
| | | **/ |
| | | public interface BusinessExpenseReimbursementService { |
| | | |
| | | /** |
| | | * 查询数据分页 |
| | | * @param criteria 条件 |
| | | * @param pageable 分页参数 |
| | | * @return Map<String,Object> |
| | | */ |
| | | Map<String,Object> queryAll(BusinessExpenseReimbursementQueryCriteria criteria, Pageable pageable); |
| | | |
| | | /** |
| | | * 查询所有数据不分页 |
| | | * @param criteria 条件参数 |
| | | * @return List<BusinessExpenseReimbursementDto> |
| | | */ |
| | | List<BusinessExpenseReimbursementDto> queryAll(BusinessExpenseReimbursementQueryCriteria criteria); |
| | | |
| | | /** |
| | | * 根据ID查询 |
| | | * @param id ID |
| | | * @return BusinessExpenseReimbursementDto |
| | | */ |
| | | BusinessExpenseReimbursementDto findById(Long id); |
| | | |
| | | /** |
| | | * 创建 |
| | | * @param resources / |
| | | * @return BusinessExpenseReimbursementDto |
| | | */ |
| | | BusinessExpenseReimbursementDto create(BusinessExpenseReimbursement resources); |
| | | |
| | | /** |
| | | * 编辑 |
| | | * @param resources / |
| | | */ |
| | | void update(BusinessExpenseReimbursement resources); |
| | | |
| | | /** |
| | | * 多选删除 |
| | | * @param ids / |
| | | */ |
| | | void deleteAll(Long[] ids); |
| | | |
| | | /** |
| | | * 导出数据 |
| | | * @param all 待导出的数据 |
| | | * @param response / |
| | | * @throws IOException / |
| | | */ |
| | | void download(List<BusinessExpenseReimbursementDto> 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.business.service; |
| | | |
| | | import me.zhengjie.modules.business.domain.BusinessExpense; |
| | | import me.zhengjie.modules.business.service.dto.BusinessExpenseDto; |
| | | import me.zhengjie.modules.business.service.dto.BusinessExpenseQueryCriteria; |
| | | 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-04-13 |
| | | **/ |
| | | public interface BusinessExpenseService { |
| | | |
| | | /** |
| | | * 查询数据分页 |
| | | * @param criteria 条件 |
| | | * @param pageable 分页参数 |
| | | * @return Map<String,Object> |
| | | */ |
| | | Map<String,Object> queryAll(BusinessExpenseQueryCriteria criteria, Pageable pageable); |
| | | |
| | | /** |
| | | * 查询所有数据不分页 |
| | | * @param criteria 条件参数 |
| | | * @return List<BusinessExpenseDto> |
| | | */ |
| | | List<BusinessExpenseDto> queryAll(BusinessExpenseQueryCriteria criteria); |
| | | |
| | | /** |
| | | * 根据ID查询 |
| | | * @param id ID |
| | | * @return BusinessExpenseDto |
| | | */ |
| | | BusinessExpenseDto findById(Long id); |
| | | |
| | | /** |
| | | * 创建 |
| | | * @param resources / |
| | | * @return BusinessExpenseDto |
| | | */ |
| | | BusinessExpenseDto create(BusinessExpenseDto resources); |
| | | |
| | | /** |
| | | * 编辑 |
| | | * @param resources / |
| | | */ |
| | | void update(BusinessExpenseDto resources); |
| | | |
| | | /** |
| | | * 多选删除 |
| | | * @param ids / |
| | | */ |
| | | void deleteAll(Long[] ids); |
| | | |
| | | /** |
| | | * 导出数据 |
| | | * @param all 待导出的数据 |
| | | * @param response / |
| | | * @throws IOException / |
| | | */ |
| | | void download(List<BusinessExpenseDto> 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.business.service; |
| | | |
| | | import me.zhengjie.modules.business.domain.BusinessPlanPersonnel; |
| | | import me.zhengjie.modules.business.service.dto.BusinessPlanPersonnelDto; |
| | | import me.zhengjie.modules.business.service.dto.BusinessPlanPersonnelQueryCriteria; |
| | | 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-04-12 |
| | | **/ |
| | | public interface BusinessPlanPersonnelService { |
| | | |
| | | /** |
| | | * 查询数据分页 |
| | | * @param criteria 条件 |
| | | * @param pageable 分页参数 |
| | | * @return Map<String,Object> |
| | | */ |
| | | Map<String,Object> queryAll(BusinessPlanPersonnelQueryCriteria criteria, Pageable pageable); |
| | | |
| | | /** |
| | | * 查询所有数据不分页 |
| | | * @param criteria 条件参数 |
| | | * @return List<BusinessPlanPersonnelDto> |
| | | */ |
| | | List<BusinessPlanPersonnelDto> queryAll(BusinessPlanPersonnelQueryCriteria criteria); |
| | | |
| | | /** |
| | | * 根据ID查询 |
| | | * @param id ID |
| | | * @return BusinessPlanPersonnelDto |
| | | */ |
| | | BusinessPlanPersonnelDto findById(Long id); |
| | | |
| | | /** |
| | | * 创建 |
| | | * @param resources / |
| | | * @return BusinessPlanPersonnelDto |
| | | */ |
| | | BusinessPlanPersonnelDto create(BusinessPlanPersonnel resources); |
| | | |
| | | /** |
| | | * 编辑 |
| | | * @param resources / |
| | | */ |
| | | void update(BusinessPlanPersonnel resources); |
| | | |
| | | /** |
| | | * 多选删除 |
| | | * @param ids / |
| | | */ |
| | | void deleteAll(Long[] ids); |
| | | |
| | | /** |
| | | * 导出数据 |
| | | * @param all 待导出的数据 |
| | | * @param response / |
| | | * @throws IOException / |
| | | */ |
| | | void download(List<BusinessPlanPersonnelDto> 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.business.service; |
| | | |
| | | import me.zhengjie.modules.business.domain.BusinessPlan; |
| | | import me.zhengjie.modules.business.service.dto.BusinessPlanDto; |
| | | import me.zhengjie.modules.business.service.dto.BusinessPlanQueryCriteria; |
| | | 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-04-12 |
| | | **/ |
| | | public interface BusinessPlanService { |
| | | |
| | | /** |
| | | * 查询数据分页 |
| | | * @param criteria 条件 |
| | | * @param pageable 分页参数 |
| | | * @return Map<String,Object> |
| | | */ |
| | | Map<String,Object> queryAll(BusinessPlanQueryCriteria criteria, Pageable pageable); |
| | | |
| | | /** |
| | | * 查询所有数据不分页 |
| | | * @param criteria 条件参数 |
| | | * @return List<BusinessPlanDto> |
| | | */ |
| | | List<BusinessPlanDto> queryAll(BusinessPlanQueryCriteria criteria); |
| | | |
| | | /** |
| | | * 根据ID查询 |
| | | * @param id ID |
| | | * @return BusinessPlanDto |
| | | */ |
| | | BusinessPlanDto findById(Long id); |
| | | |
| | | /** |
| | | * 创建 |
| | | * @param resources / |
| | | * @return BusinessPlanDto |
| | | */ |
| | | BusinessPlanDto create(BusinessPlanDto resources); |
| | | |
| | | /** |
| | | * 编辑 |
| | | * @param resources / |
| | | */ |
| | | void update(BusinessPlanDto resources); |
| | | |
| | | /** |
| | | * 多选删除 |
| | | * @param ids / |
| | | */ |
| | | void deleteAll(Long[] ids); |
| | | |
| | | /** |
| | | * 导出数据 |
| | | * @param all 待导出的数据 |
| | | * @param response / |
| | | * @throws IOException / |
| | | */ |
| | | void download(List<BusinessPlanDto> 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.business.service.dto; |
| | | |
| | | import lombok.Data; |
| | | import me.zhengjie.base.BaseDTO; |
| | | import me.zhengjie.modules.business.domain.BusinessExpenseReimbursement; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.sql.Timestamp; |
| | | import java.io.Serializable; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @website https://eladmin.vip |
| | | * @description / |
| | | * @author 赵士淞 |
| | | * @date 2023-04-13 |
| | | **/ |
| | | @Data |
| | | public class BusinessExpenseDto extends BaseDTO implements Serializable { |
| | | |
| | | /** ID */ |
| | | private Long id; |
| | | |
| | | /** 费用类型 */ |
| | | private String expenseType; |
| | | |
| | | /** 所属营业计划 */ |
| | | private Long businessPlanId; |
| | | |
| | | /** 所属营业计划内容 */ |
| | | private String businessPlanContent; |
| | | |
| | | /** 所属项目 */ |
| | | private Long projectId; |
| | | |
| | | /** 所属项目名称 */ |
| | | private String projectName; |
| | | |
| | | /** 备注 */ |
| | | private String remarks; |
| | | |
| | | /** 营业费用明细列表 */ |
| | | private List<BusinessExpenseReimbursementDto> businessExpenseReimbursementDtoList; |
| | | |
| | | /** 报销金额总计 */ |
| | | private BigDecimal amountReimbursementAmount; |
| | | |
| | | /** 流程实例ID */ |
| | | private String processInstanceId; |
| | | |
| | | /** 审批状态 */ |
| | | private String approve; |
| | | } |
| 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.business.service.dto; |
| | | |
| | | import lombok.Data; |
| | | import java.util.List; |
| | | import me.zhengjie.annotation.Query; |
| | | |
| | | /** |
| | | * @website https://eladmin.vip |
| | | * @author 赵士淞 |
| | | * @date 2023-04-13 |
| | | **/ |
| | | @Data |
| | | public class BusinessExpenseQueryCriteria{ |
| | | |
| | | /** 精确 */ |
| | | @Query |
| | | private String expenseType; |
| | | |
| | | /** 精确 */ |
| | | @Query |
| | | private Long businessPlanId; |
| | | |
| | | /** 精确 */ |
| | | @Query |
| | | private Long projectId; |
| | | } |
| 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.business.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-04-13 |
| | | **/ |
| | | @Data |
| | | public class BusinessExpenseReimbursementDto extends BaseDTO implements Serializable { |
| | | |
| | | /** ID */ |
| | | private Long id; |
| | | |
| | | /** 所属营业费用 */ |
| | | private Long businessExpenseId; |
| | | |
| | | /** 所属营业费用类型 */ |
| | | private String businessExpenseType; |
| | | |
| | | /** 报销内容 */ |
| | | private String reimbursementContent; |
| | | |
| | | /** 报销金额 */ |
| | | private BigDecimal reimbursementAmount; |
| | | |
| | | /** 报销凭证 */ |
| | | private String reimbursementVoucher; |
| | | |
| | | /** 备注 */ |
| | | private String remarks; |
| | | } |
| New file |
| | |
| | | /* |
| | | * Copyright 2019-2020 Zheng Jie |
| | | * |
| | | * Licensed under the Apache License, Version 2.0 (the "License"); |
| | | * you may not use this file except in compliance with the License. |
| | | * You may obtain a copy of the License at |
| | | * |
| | | * http://www.apache.org/licenses/LICENSE-2.0 |
| | | * |
| | | * Unless required by applicable law or agreed to in writing, software |
| | | * distributed under the License is distributed on an "AS IS" BASIS, |
| | | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| | | * See the License for the specific language governing permissions and |
| | | * limitations under the License. |
| | | */ |
| | | package me.zhengjie.modules.business.service.dto; |
| | | |
| | | import lombok.Data; |
| | | import java.util.List; |
| | | import me.zhengjie.annotation.Query; |
| | | |
| | | /** |
| | | * @website https://eladmin.vip |
| | | * @author 赵士淞 |
| | | * @date 2023-04-13 |
| | | **/ |
| | | @Data |
| | | public class BusinessExpenseReimbursementQueryCriteria{ |
| | | |
| | | /** 精确 */ |
| | | @Query |
| | | private Long businessExpenseId; |
| | | |
| | | /** 模糊 */ |
| | | @Query(type = Query.Type.INNER_LIKE) |
| | | private String reimbursementContent; |
| | | } |
| 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.business.service.dto; |
| | | |
| | | import lombok.Data; |
| | | import me.zhengjie.base.BaseDTO; |
| | | |
| | | import java.sql.Timestamp; |
| | | import java.io.Serializable; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @website https://eladmin.vip |
| | | * @description / |
| | | * @author 赵士淞 |
| | | * @date 2023-04-12 |
| | | **/ |
| | | @Data |
| | | public class BusinessPlanDto extends BaseDTO implements Serializable { |
| | | |
| | | /** ID */ |
| | | private Long id; |
| | | |
| | | /** 营业地 */ |
| | | private String businessPlace; |
| | | |
| | | /** 营业内容 */ |
| | | private String businessContent; |
| | | |
| | | /** 营业状态 */ |
| | | private String businessStatus; |
| | | |
| | | /** 备注 */ |
| | | private String remarks; |
| | | |
| | | /** 营业计划人员列表 */ |
| | | private List<BusinessPlanPersonnelDto> businessPlanPersonnelDtoList; |
| | | } |
| 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.business.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-04-12 |
| | | **/ |
| | | @Data |
| | | public class BusinessPlanPersonnelDto extends BaseDTO implements Serializable { |
| | | |
| | | /** ID */ |
| | | private Long id; |
| | | |
| | | /** 所属营业计划 */ |
| | | private Long businessPlanId; |
| | | |
| | | /** 所属营业计划内容 */ |
| | | private String businessPlanContent; |
| | | |
| | | /** 所属用户 */ |
| | | private Long userId; |
| | | |
| | | /** 所属用户昵称 */ |
| | | private String userNickName; |
| | | |
| | | /** 营业计划开始日期 */ |
| | | private Timestamp businessPlanStartDate; |
| | | |
| | | /** 营业计划结束日期 */ |
| | | private Timestamp businessPlanEndDate; |
| | | |
| | | /** 备注 */ |
| | | private String remarks; |
| | | } |
| New file |
| | |
| | | /* |
| | | * Copyright 2019-2020 Zheng Jie |
| | | * |
| | | * Licensed under the Apache License, Version 2.0 (the "License"); |
| | | * you may not use this file except in compliance with the License. |
| | | * You may obtain a copy of the License at |
| | | * |
| | | * http://www.apache.org/licenses/LICENSE-2.0 |
| | | * |
| | | * Unless required by applicable law or agreed to in writing, software |
| | | * distributed under the License is distributed on an "AS IS" BASIS, |
| | | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| | | * See the License for the specific language governing permissions and |
| | | * limitations under the License. |
| | | */ |
| | | package me.zhengjie.modules.business.service.dto; |
| | | |
| | | import lombok.Data; |
| | | import java.util.List; |
| | | import me.zhengjie.annotation.Query; |
| | | |
| | | /** |
| | | * @website https://eladmin.vip |
| | | * @author 赵士淞 |
| | | * @date 2023-04-12 |
| | | **/ |
| | | @Data |
| | | public class BusinessPlanPersonnelQueryCriteria{ |
| | | |
| | | /** 精确 */ |
| | | @Query |
| | | private Long businessPlanId; |
| | | |
| | | /** 精确 */ |
| | | @Query |
| | | private Long userId; |
| | | } |
| 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.business.service.dto; |
| | | |
| | | import lombok.Data; |
| | | import java.util.List; |
| | | import me.zhengjie.annotation.Query; |
| | | |
| | | /** |
| | | * @website https://eladmin.vip |
| | | * @author 赵士淞 |
| | | * @date 2023-04-12 |
| | | **/ |
| | | @Data |
| | | public class BusinessPlanQueryCriteria{ |
| | | |
| | | /** 模糊 */ |
| | | @Query(type = Query.Type.INNER_LIKE) |
| | | private String businessPlace; |
| | | |
| | | /** 模糊 */ |
| | | @Query(type = Query.Type.INNER_LIKE) |
| | | private String businessContent; |
| | | |
| | | /** 精确 */ |
| | | @Query |
| | | private String businessStatus; |
| | | } |
| 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.business.service.impl; |
| | | |
| | | import me.zhengjie.modules.business.domain.BusinessExpense; |
| | | import me.zhengjie.modules.business.domain.BusinessExpenseReimbursement; |
| | | import me.zhengjie.modules.business.repository.BusinessExpenseRepository; |
| | | import me.zhengjie.utils.ValidationUtil; |
| | | import me.zhengjie.utils.FileUtil; |
| | | import lombok.RequiredArgsConstructor; |
| | | import me.zhengjie.modules.business.repository.BusinessExpenseReimbursementRepository; |
| | | import me.zhengjie.modules.business.service.BusinessExpenseReimbursementService; |
| | | import me.zhengjie.modules.business.service.dto.BusinessExpenseReimbursementDto; |
| | | import me.zhengjie.modules.business.service.dto.BusinessExpenseReimbursementQueryCriteria; |
| | | import me.zhengjie.modules.business.service.mapstruct.BusinessExpenseReimbursementMapper; |
| | | 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-04-13 |
| | | **/ |
| | | @Service |
| | | @RequiredArgsConstructor |
| | | public class BusinessExpenseReimbursementServiceImpl implements BusinessExpenseReimbursementService { |
| | | |
| | | private final BusinessExpenseReimbursementRepository businessExpenseReimbursementRepository; |
| | | private final BusinessExpenseReimbursementMapper businessExpenseReimbursementMapper; |
| | | private final BusinessExpenseRepository businessExpenseRepository; |
| | | |
| | | @Override |
| | | public Map<String,Object> queryAll(BusinessExpenseReimbursementQueryCriteria criteria, Pageable pageable){ |
| | | Page<BusinessExpenseReimbursement> page = businessExpenseReimbursementRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable); |
| | | // 将实体类转换为DTO(重写) |
| | | Function<BusinessExpenseReimbursement, BusinessExpenseReimbursementDto> func = new Function<BusinessExpenseReimbursement, BusinessExpenseReimbursementDto>(){ |
| | | @Override |
| | | public BusinessExpenseReimbursementDto apply(BusinessExpenseReimbursement t) { |
| | | // 将实体类转换成DTO |
| | | BusinessExpenseReimbursementDto businessExpenseReimbursementDto = businessExpenseReimbursementMapper.toDto(t); |
| | | |
| | | // 获取营业费用 |
| | | BusinessExpense businessExpense = businessExpenseRepository.findById(businessExpenseReimbursementDto.getBusinessExpenseId()).orElseGet(BusinessExpense::new); |
| | | businessExpenseReimbursementDto.setBusinessExpenseType(businessExpense.getExpenseType()); |
| | | |
| | | // 返回处理好的DTO |
| | | return businessExpenseReimbursementDto; |
| | | } |
| | | }; |
| | | return PageUtil.toPage(page.map(func)); |
| | | } |
| | | |
| | | @Override |
| | | public List<BusinessExpenseReimbursementDto> queryAll(BusinessExpenseReimbursementQueryCriteria criteria){ |
| | | return businessExpenseReimbursementMapper.toDto(businessExpenseReimbursementRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder))); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional |
| | | public BusinessExpenseReimbursementDto findById(Long id) { |
| | | BusinessExpenseReimbursement businessExpenseReimbursement = businessExpenseReimbursementRepository.findById(id).orElseGet(BusinessExpenseReimbursement::new); |
| | | ValidationUtil.isNull(businessExpenseReimbursement.getId(),"BusinessExpenseReimbursement","id",id); |
| | | return businessExpenseReimbursementMapper.toDto(businessExpenseReimbursement); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public BusinessExpenseReimbursementDto create(BusinessExpenseReimbursement resources) { |
| | | return businessExpenseReimbursementMapper.toDto(businessExpenseReimbursementRepository.save(resources)); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void update(BusinessExpenseReimbursement resources) { |
| | | BusinessExpenseReimbursement businessExpenseReimbursement = businessExpenseReimbursementRepository.findById(resources.getId()).orElseGet(BusinessExpenseReimbursement::new); |
| | | ValidationUtil.isNull( businessExpenseReimbursement.getId(),"BusinessExpenseReimbursement","id",resources.getId()); |
| | | businessExpenseReimbursement.copy(resources); |
| | | businessExpenseReimbursementRepository.save(businessExpenseReimbursement); |
| | | } |
| | | |
| | | @Override |
| | | public void deleteAll(Long[] ids) { |
| | | for (Long id : ids) { |
| | | businessExpenseReimbursementRepository.deleteById(id); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public void download(List<BusinessExpenseReimbursementDto> all, HttpServletResponse response) throws IOException { |
| | | List<Map<String, Object>> list = new ArrayList<>(); |
| | | for (BusinessExpenseReimbursementDto businessExpenseReimbursement : all) { |
| | | Map<String,Object> map = new LinkedHashMap<>(); |
| | | map.put("所属营业费用", businessExpenseReimbursement.getBusinessExpenseId()); |
| | | map.put("报销内容", businessExpenseReimbursement.getReimbursementContent()); |
| | | map.put("报销金额", businessExpenseReimbursement.getReimbursementAmount()); |
| | | map.put("报销凭证", businessExpenseReimbursement.getReimbursementVoucher()); |
| | | map.put("备注", businessExpenseReimbursement.getRemarks()); |
| | | map.put("创建者", businessExpenseReimbursement.getCreateBy()); |
| | | map.put("创建时间", businessExpenseReimbursement.getCreateTime()); |
| | | map.put("更新者", businessExpenseReimbursement.getUpdateBy()); |
| | | map.put("更新时间", businessExpenseReimbursement.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.business.service.impl; |
| | | |
| | | import com.alibaba.fastjson.JSONArray; |
| | | import lombok.RequiredArgsConstructor; |
| | | import me.zhengjie.modules.api.Api; |
| | | import me.zhengjie.modules.business.service.BusinessExpenseFlowableService; |
| | | import me.zhengjie.modules.business.service.BusinessPlanService; |
| | | import me.zhengjie.modules.business.service.dto.BusinessExpenseDto; |
| | | import me.zhengjie.modules.business.service.dto.BusinessExpenseReimbursementDto; |
| | | import me.zhengjie.modules.business.service.dto.BusinessPlanDto; |
| | | import me.zhengjie.modules.constant.Constant; |
| | | import me.zhengjie.modules.project.service.ProjectService; |
| | | import me.zhengjie.modules.project.service.dto.ProjectDto; |
| | | import me.zhengjie.modules.system.domain.Role; |
| | | import me.zhengjie.modules.system.domain.User; |
| | | import me.zhengjie.modules.system.repository.RoleRepository; |
| | | import me.zhengjie.modules.system.repository.UserRepository; |
| | | import me.zhengjie.utils.ObjectUtil; |
| | | import me.zhengjie.utils.SecurityUtils; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * @website https://eladmin.vip |
| | | * @description 服务实现 |
| | | * @author 赵士淞 |
| | | * @date 2023-04-13 |
| | | **/ |
| | | @Service |
| | | @RequiredArgsConstructor |
| | | public class BusinessExpenseServiceFlowableImpl implements BusinessExpenseFlowableService { |
| | | |
| | | @Value("${flowable.url}") |
| | | private String flowableUrl; |
| | | |
| | | private final Api api; |
| | | private final BusinessPlanService businessPlanService; |
| | | private final ProjectService projectService; |
| | | private final RoleRepository roleRepository; |
| | | private final UserRepository userRepository; |
| | | |
| | | /** |
| | | * 我发起的 |
| | | * @return |
| | | */ |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public Map<String, Object> report() throws Exception { |
| | | // 发起通信 |
| | | Object returnObject = api.post(flowableUrl + "/api/common/report?key=" + "businessExpenseApply" + "&userId=" + SecurityUtils.getCurrentUserId(), new HashMap<>()); |
| | | // 查询处理 |
| | | return queryHandle(returnObject); |
| | | } |
| | | |
| | | /** |
| | | * 待审批的 |
| | | * @return |
| | | */ |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public Map<String, Object> approve() throws Exception { |
| | | // 发起通信 |
| | | Object returnObject = api.post(flowableUrl + "/api/common/approve?key=" + "businessExpenseApply" + "&userId=" + SecurityUtils.getCurrentUserId(), new HashMap<>()); |
| | | // 查询处理 |
| | | return queryHandle(returnObject); |
| | | } |
| | | |
| | | /** |
| | | * 查询处理 |
| | | * @param returnObject |
| | | * @return |
| | | */ |
| | | private Map<String, Object> queryHandle(Object returnObject) { |
| | | // 返回结果 |
| | | Map<String, Object> returnMap = new HashMap<>(); |
| | | // 通信结果转DTO |
| | | List<BusinessExpenseDto> businessExpenseDtoList = ((JSONArray) returnObject).toJavaList(BusinessExpenseDto.class); |
| | | // 循环DTO |
| | | for (BusinessExpenseDto businessExpenseDto : businessExpenseDtoList) { |
| | | // 获取营业计划 |
| | | BusinessPlanDto businessPlanDto = businessPlanService.findById(businessExpenseDto.getBusinessPlanId()); |
| | | businessExpenseDto.setBusinessPlanContent(businessPlanDto.getBusinessContent()); |
| | | // 获取项目 |
| | | if (businessExpenseDto.getProjectId() != null) { |
| | | ProjectDto projectDto = projectService.findById(businessExpenseDto.getProjectId()); |
| | | businessExpenseDto.setProjectName(projectDto.getName()); |
| | | } |
| | | // 报销金额总计 |
| | | BigDecimal amountReimbursementAmount = new BigDecimal(0); |
| | | // 获取营业费用明细 |
| | | List<BusinessExpenseReimbursementDto> businessExpenseReimbursementDtoList = businessExpenseDto.getBusinessExpenseReimbursementDtoList(); |
| | | for (BusinessExpenseReimbursementDto businessExpenseReimbursementDto : businessExpenseReimbursementDtoList) { |
| | | amountReimbursementAmount = amountReimbursementAmount.add(businessExpenseReimbursementDto.getReimbursementAmount()); |
| | | } |
| | | businessExpenseDto.setAmountReimbursementAmount(amountReimbursementAmount); |
| | | } |
| | | // 返回结果 |
| | | returnMap.put("content", businessExpenseDtoList); |
| | | returnMap.put("totalElements", businessExpenseDtoList.size()); |
| | | return returnMap; |
| | | } |
| | | |
| | | /** |
| | | * 创建 |
| | | * @param resources / |
| | | */ |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void create(BusinessExpenseDto resources) throws Exception { |
| | | // 查询指定角色 |
| | | Role role = roleRepository.findByLevel(Constant.ROLE_LEVEL_FINANCE.intValue()); |
| | | // 查询指定角色用户 |
| | | List<User> userList = userRepository.findByRoleId(role.getId()); |
| | | // 审批人字符串 |
| | | String approver = ""; |
| | | // 循环指定角色用户 |
| | | for (int i = 0; i < userList.size(); i ++) { |
| | | if (i == 0) { |
| | | // 审批人字符串 |
| | | approver = userList.get(i).getId().toString(); |
| | | } else { |
| | | // 审批人字符串 |
| | | approver += "," + userList.get(i).getId().toString(); |
| | | } |
| | | } |
| | | // 参数 |
| | | Map<String, Object> params = ObjectUtil.toObjectMap(resources); |
| | | params.put("approver", approver); |
| | | // 发起通信 |
| | | api.post(flowableUrl + "/api/common/run?key=" + "businessExpenseApply" + "&userId=" + SecurityUtils.getCurrentUserId(), params); |
| | | } |
| | | |
| | | /** |
| | | * 同意 |
| | | * @param processInstanceId / |
| | | */ |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void agree(String processInstanceId) throws Exception { |
| | | // 参数 |
| | | Map<String, Object> paramsMap = new HashMap<>(); |
| | | paramsMap.put("approve", "true"); |
| | | // 发起通信 |
| | | api.post(flowableUrl + "/api/common/next?processInstanceId=" + processInstanceId, paramsMap); |
| | | } |
| | | |
| | | /** |
| | | * 拒绝 |
| | | * @param processInstanceId / |
| | | */ |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void reject(String processInstanceId) throws Exception { |
| | | // 参数 |
| | | Map<String, Object> paramsMap = new HashMap<>(); |
| | | paramsMap.put("approve", "false"); |
| | | // 发起通信 |
| | | api.post(flowableUrl + "/api/common/next?processInstanceId=" + processInstanceId, paramsMap); |
| | | } |
| | | } |
| 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.business.service.impl; |
| | | |
| | | import me.zhengjie.modules.business.domain.BusinessExpense; |
| | | import me.zhengjie.modules.business.domain.BusinessExpenseReimbursement; |
| | | import me.zhengjie.modules.business.repository.BusinessExpenseReimbursementRepository; |
| | | import me.zhengjie.modules.business.service.BusinessExpenseReimbursementService; |
| | | import me.zhengjie.modules.business.service.BusinessPlanService; |
| | | import me.zhengjie.modules.business.service.dto.*; |
| | | import me.zhengjie.modules.business.service.mapstruct.BusinessExpenseReimbursementMapper; |
| | | import me.zhengjie.modules.capitalFlow.service.CapitalFlowExpendService; |
| | | import me.zhengjie.modules.constant.Constant; |
| | | import me.zhengjie.modules.project.service.ProjectService; |
| | | import me.zhengjie.modules.project.service.dto.ProjectDto; |
| | | import me.zhengjie.modules.system.domain.DictDetail; |
| | | import me.zhengjie.modules.system.repository.DictDetailRepository; |
| | | import me.zhengjie.utils.ValidationUtil; |
| | | import me.zhengjie.utils.FileUtil; |
| | | import lombok.RequiredArgsConstructor; |
| | | import me.zhengjie.modules.business.repository.BusinessExpenseRepository; |
| | | import me.zhengjie.modules.business.service.BusinessExpenseService; |
| | | import me.zhengjie.modules.business.service.mapstruct.BusinessExpenseMapper; |
| | | 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-04-13 |
| | | **/ |
| | | @Service |
| | | @RequiredArgsConstructor |
| | | public class BusinessExpenseServiceImpl implements BusinessExpenseService { |
| | | |
| | | private final BusinessExpenseRepository businessExpenseRepository; |
| | | private final BusinessExpenseMapper businessExpenseMapper; |
| | | private final BusinessPlanService businessPlanService; |
| | | private final ProjectService projectService; |
| | | private final BusinessExpenseReimbursementRepository businessExpenseReimbursementRepository; |
| | | private final BusinessExpenseReimbursementMapper businessExpenseReimbursementMapper; |
| | | private final CapitalFlowExpendService capitalFlowExpendService; |
| | | private final DictDetailRepository dictDetailRepository; |
| | | private final BusinessExpenseReimbursementService businessExpenseReimbursementService; |
| | | |
| | | @Override |
| | | public Map<String,Object> queryAll(BusinessExpenseQueryCriteria criteria, Pageable pageable){ |
| | | Page<BusinessExpense> page = businessExpenseRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable); |
| | | // 将实体类转换为DTO(重写) |
| | | Function<BusinessExpense, BusinessExpenseDto> func = new Function<BusinessExpense, BusinessExpenseDto>(){ |
| | | @Override |
| | | public BusinessExpenseDto apply(BusinessExpense t) { |
| | | // 将实体类转换成DTO |
| | | BusinessExpenseDto businessExpenseDto = businessExpenseMapper.toDto(t); |
| | | |
| | | // 获取营业计划 |
| | | BusinessPlanDto businessPlanDto = businessPlanService.findById(businessExpenseDto.getBusinessPlanId()); |
| | | businessExpenseDto.setBusinessPlanContent(businessPlanDto.getBusinessContent()); |
| | | // 获取项目 |
| | | if (businessExpenseDto.getProjectId() != null) { |
| | | ProjectDto projectDto = projectService.findById(businessExpenseDto.getProjectId()); |
| | | businessExpenseDto.setProjectName(projectDto.getName()); |
| | | } |
| | | // 获取营业费用明细 |
| | | List<BusinessExpenseReimbursement> businessExpenseReimbursementList = businessExpenseReimbursementRepository.findByBusinessExpenseId(businessExpenseDto.getId()); |
| | | businessExpenseDto.setBusinessExpenseReimbursementDtoList(businessExpenseReimbursementMapper.toDto(businessExpenseReimbursementList)); |
| | | // 获取报销金额总计 |
| | | BigDecimal amountReimbursementAmount = businessExpenseReimbursementRepository.amountReimbursementAmountByBusinessExpenseId(businessExpenseDto.getId()); |
| | | businessExpenseDto.setAmountReimbursementAmount(amountReimbursementAmount); |
| | | |
| | | // 返回处理好的DTO |
| | | return businessExpenseDto; |
| | | } |
| | | }; |
| | | return PageUtil.toPage(page.map(func)); |
| | | } |
| | | |
| | | @Override |
| | | public List<BusinessExpenseDto> queryAll(BusinessExpenseQueryCriteria criteria){ |
| | | return businessExpenseMapper.toDto(businessExpenseRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder))); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional |
| | | public BusinessExpenseDto findById(Long id) { |
| | | BusinessExpense businessExpense = businessExpenseRepository.findById(id).orElseGet(BusinessExpense::new); |
| | | ValidationUtil.isNull(businessExpense.getId(),"BusinessExpense","id",id); |
| | | return businessExpenseMapper.toDto(businessExpense); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public BusinessExpenseDto create(BusinessExpenseDto resources) { |
| | | // 保存营业费用 |
| | | BusinessExpense businessExpense = businessExpenseRepository.save(businessExpenseMapper.toEntity(resources)); |
| | | // 保存相关营业费用明细 |
| | | saveBusinessExpenseReimbursement(resources.getBusinessExpenseReimbursementDtoList(), businessExpense.getId()); |
| | | // 关联新增 |
| | | accountCreate(resources); |
| | | return findById(businessExpense.getId()); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void update(BusinessExpenseDto resources) { |
| | | BusinessExpense businessExpense = businessExpenseRepository.findById(resources.getId()).orElseGet(BusinessExpense::new); |
| | | ValidationUtil.isNull( businessExpense.getId(),"BusinessExpense","id",resources.getId()); |
| | | // 关联删除 |
| | | accountDelete(businessExpense); |
| | | businessExpense.copy(businessExpenseMapper.toEntity(resources)); |
| | | businessExpenseRepository.save(businessExpense); |
| | | // 保存相关营业费用明细 |
| | | saveBusinessExpenseReimbursement(resources.getBusinessExpenseReimbursementDtoList(), businessExpense.getId()); |
| | | // 实体类 转 DTO |
| | | BusinessExpenseDto businessExpenseDto = businessExpenseMapper.toDto(businessExpense); |
| | | businessExpenseDto.setBusinessExpenseReimbursementDtoList(resources.getBusinessExpenseReimbursementDtoList()); |
| | | // 关联新增 |
| | | accountCreate(businessExpenseDto); |
| | | } |
| | | |
| | | /** |
| | | * 保存相关营业费用明细 |
| | | * @param businessExpenseReimbursementDtoList |
| | | * @param businessExpenseId |
| | | */ |
| | | private void saveBusinessExpenseReimbursement(List<BusinessExpenseReimbursementDto> businessExpenseReimbursementDtoList, Long businessExpenseId) { |
| | | // 根据营业费用ID删除营业费用明细 |
| | | businessExpenseReimbursementRepository.deleteByBusinessExpenseId(businessExpenseId); |
| | | // 营业费用明细列表 |
| | | List<BusinessExpenseReimbursement> businessExpenseReimbursementList = businessExpenseReimbursementMapper.toEntity(businessExpenseReimbursementDtoList); |
| | | // 循环营业费用明细列表 |
| | | for (BusinessExpenseReimbursement businessExpenseReimbursement : businessExpenseReimbursementList) { |
| | | // 营业费用明细 |
| | | businessExpenseReimbursement.setBusinessExpenseId(businessExpenseId); |
| | | // 保存营业费用明细 |
| | | businessExpenseReimbursementRepository.save(businessExpenseReimbursement); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public void deleteAll(Long[] ids) { |
| | | for (Long id : ids) { |
| | | BusinessExpense businessExpense = businessExpenseRepository.findById(id).orElseGet(BusinessExpense::new); |
| | | ValidationUtil.isNull( businessExpense.getId(),"BusinessExpense","id",id); |
| | | // 关联删除 |
| | | accountDelete(businessExpense); |
| | | businessExpenseRepository.deleteById(id); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public void download(List<BusinessExpenseDto> all, HttpServletResponse response) throws IOException { |
| | | List<Map<String, Object>> list = new ArrayList<>(); |
| | | for (BusinessExpenseDto businessExpense : all) { |
| | | Map<String,Object> map = new LinkedHashMap<>(); |
| | | map.put("费用类型", businessExpense.getExpenseType()); |
| | | map.put("所属营业计划", businessExpense.getBusinessPlanId()); |
| | | map.put("所属项目", businessExpense.getProjectId()); |
| | | map.put("备注", businessExpense.getRemarks()); |
| | | map.put("创建者", businessExpense.getCreateBy()); |
| | | map.put("创建时间", businessExpense.getCreateTime()); |
| | | map.put("更新者", businessExpense.getUpdateBy()); |
| | | map.put("更新时间", businessExpense.getUpdateTime()); |
| | | list.add(map); |
| | | } |
| | | FileUtil.downloadExcel(list, response); |
| | | } |
| | | |
| | | /** |
| | | * 关联创建 |
| | | * @param resources |
| | | */ |
| | | private void accountCreate(BusinessExpenseDto resources) { |
| | | // 营业计划 |
| | | BusinessPlanDto businessPlanDto = businessPlanService.findById(resources.getBusinessPlanId()); |
| | | // 费用类型 |
| | | DictDetail dictDetail = dictDetailRepository.findByDictNameAndValue(Constant.EXPENSE_TYPE, resources.getExpenseType()); |
| | | // 费用金额 |
| | | BigDecimal amount = new BigDecimal(0); |
| | | for (BusinessExpenseReimbursementDto businessExpenseReimbursementDto : resources.getBusinessExpenseReimbursementDtoList()) { |
| | | amount = amount.add(businessExpenseReimbursementDto.getReimbursementAmount()); |
| | | } |
| | | // 关联创建 |
| | | capitalFlowExpendService.flowableCreate(Constant.ACCOUNT_TYPE_QIYUAN, businessPlanDto.getBusinessContent() + " - " + dictDetail.getLabel(), amount); |
| | | } |
| | | |
| | | /** |
| | | * 关联删除 |
| | | * @param resources |
| | | */ |
| | | private void accountDelete(BusinessExpense resources) { |
| | | // 营业计划 |
| | | BusinessPlanDto businessPlanDto = businessPlanService.findById(resources.getBusinessPlanId()); |
| | | // 费用类型 |
| | | DictDetail dictDetail = dictDetailRepository.findByDictNameAndValue(Constant.EXPENSE_TYPE, resources.getExpenseType()); |
| | | // 费用金额 |
| | | BigDecimal amount = new BigDecimal(0); |
| | | BusinessExpenseReimbursementQueryCriteria businessExpenseReimbursementQueryCriteria = new BusinessExpenseReimbursementQueryCriteria(); |
| | | businessExpenseReimbursementQueryCriteria.setBusinessExpenseId(resources.getId()); |
| | | List<BusinessExpenseReimbursementDto> businessExpenseReimbursementDtoList = businessExpenseReimbursementService.queryAll(businessExpenseReimbursementQueryCriteria); |
| | | for (BusinessExpenseReimbursementDto businessExpenseReimbursementDto : businessExpenseReimbursementDtoList) { |
| | | amount = amount.add(businessExpenseReimbursementDto.getReimbursementAmount()); |
| | | } |
| | | // 关联删除 |
| | | capitalFlowExpendService.flowableDelete(Constant.ACCOUNT_TYPE_QIYUAN, businessPlanDto.getBusinessContent() + " - " + dictDetail.getLabel(), amount); |
| | | } |
| | | } |
| 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.business.service.impl; |
| | | |
| | | import me.zhengjie.modules.business.domain.BusinessPlanPersonnel; |
| | | import me.zhengjie.modules.business.service.BusinessPlanService; |
| | | import me.zhengjie.modules.business.service.dto.BusinessPlanDto; |
| | | import me.zhengjie.modules.system.service.UserService; |
| | | import me.zhengjie.modules.system.service.dto.UserDto; |
| | | import me.zhengjie.utils.ValidationUtil; |
| | | import me.zhengjie.utils.FileUtil; |
| | | import lombok.RequiredArgsConstructor; |
| | | import me.zhengjie.modules.business.repository.BusinessPlanPersonnelRepository; |
| | | import me.zhengjie.modules.business.service.BusinessPlanPersonnelService; |
| | | import me.zhengjie.modules.business.service.dto.BusinessPlanPersonnelDto; |
| | | import me.zhengjie.modules.business.service.dto.BusinessPlanPersonnelQueryCriteria; |
| | | import me.zhengjie.modules.business.service.mapstruct.BusinessPlanPersonnelMapper; |
| | | 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-04-12 |
| | | **/ |
| | | @Service |
| | | @RequiredArgsConstructor |
| | | public class BusinessPlanPersonnelServiceImpl implements BusinessPlanPersonnelService { |
| | | |
| | | private final BusinessPlanPersonnelRepository businessPlanPersonnelRepository; |
| | | private final BusinessPlanPersonnelMapper businessPlanPersonnelMapper; |
| | | private final BusinessPlanService businessPlanService; |
| | | private final UserService userService; |
| | | |
| | | @Override |
| | | public Map<String,Object> queryAll(BusinessPlanPersonnelQueryCriteria criteria, Pageable pageable){ |
| | | Page<BusinessPlanPersonnel> page = businessPlanPersonnelRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable); |
| | | // 将实体类转换为DTO(重写) |
| | | Function<BusinessPlanPersonnel, BusinessPlanPersonnelDto> func = new Function<BusinessPlanPersonnel, BusinessPlanPersonnelDto>(){ |
| | | @Override |
| | | public BusinessPlanPersonnelDto apply(BusinessPlanPersonnel t) { |
| | | // 将实体类转换成DTO |
| | | BusinessPlanPersonnelDto businessPlanPersonnelDto = businessPlanPersonnelMapper.toDto(t); |
| | | |
| | | // 获取营业计划 |
| | | BusinessPlanDto businessPlanDto = businessPlanService.findById(businessPlanPersonnelDto.getBusinessPlanId()); |
| | | businessPlanPersonnelDto.setBusinessPlanContent(businessPlanDto.getBusinessContent()); |
| | | // 获取用户 |
| | | UserDto userDto = userService.findById(businessPlanPersonnelDto.getUserId()); |
| | | businessPlanPersonnelDto.setUserNickName(userDto.getNickName()); |
| | | |
| | | // 返回处理好的DTO |
| | | return businessPlanPersonnelDto; |
| | | } |
| | | }; |
| | | return PageUtil.toPage(page.map(func)); |
| | | } |
| | | |
| | | @Override |
| | | public List<BusinessPlanPersonnelDto> queryAll(BusinessPlanPersonnelQueryCriteria criteria){ |
| | | return businessPlanPersonnelMapper.toDto(businessPlanPersonnelRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder))); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional |
| | | public BusinessPlanPersonnelDto findById(Long id) { |
| | | BusinessPlanPersonnel businessPlanPersonnel = businessPlanPersonnelRepository.findById(id).orElseGet(BusinessPlanPersonnel::new); |
| | | ValidationUtil.isNull(businessPlanPersonnel.getId(),"BusinessPlanPersonnel","id",id); |
| | | return businessPlanPersonnelMapper.toDto(businessPlanPersonnel); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public BusinessPlanPersonnelDto create(BusinessPlanPersonnel resources) { |
| | | return businessPlanPersonnelMapper.toDto(businessPlanPersonnelRepository.save(resources)); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void update(BusinessPlanPersonnel resources) { |
| | | BusinessPlanPersonnel businessPlanPersonnel = businessPlanPersonnelRepository.findById(resources.getId()).orElseGet(BusinessPlanPersonnel::new); |
| | | ValidationUtil.isNull( businessPlanPersonnel.getId(),"BusinessPlanPersonnel","id",resources.getId()); |
| | | businessPlanPersonnel.copy(resources); |
| | | businessPlanPersonnelRepository.save(businessPlanPersonnel); |
| | | } |
| | | |
| | | @Override |
| | | public void deleteAll(Long[] ids) { |
| | | for (Long id : ids) { |
| | | businessPlanPersonnelRepository.deleteById(id); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public void download(List<BusinessPlanPersonnelDto> all, HttpServletResponse response) throws IOException { |
| | | List<Map<String, Object>> list = new ArrayList<>(); |
| | | for (BusinessPlanPersonnelDto businessPlanPersonnel : all) { |
| | | Map<String,Object> map = new LinkedHashMap<>(); |
| | | map.put("所属营业计划", businessPlanPersonnel.getBusinessPlanId()); |
| | | map.put("所属用户", businessPlanPersonnel.getUserId()); |
| | | map.put("营业计划开始日期", businessPlanPersonnel.getBusinessPlanStartDate()); |
| | | map.put("营业计划结束日期", businessPlanPersonnel.getBusinessPlanEndDate()); |
| | | map.put("备注", businessPlanPersonnel.getRemarks()); |
| | | map.put("创建者", businessPlanPersonnel.getCreateBy()); |
| | | map.put("创建时间", businessPlanPersonnel.getCreateTime()); |
| | | map.put("更新者", businessPlanPersonnel.getUpdateBy()); |
| | | map.put("更新时间", businessPlanPersonnel.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.business.service.impl; |
| | | |
| | | import me.zhengjie.modules.business.domain.BusinessPlan; |
| | | import me.zhengjie.modules.business.domain.BusinessPlanPersonnel; |
| | | import me.zhengjie.modules.business.repository.BusinessPlanPersonnelRepository; |
| | | import me.zhengjie.modules.business.service.dto.BusinessPlanPersonnelDto; |
| | | import me.zhengjie.modules.business.service.mapstruct.BusinessPlanPersonnelMapper; |
| | | import me.zhengjie.modules.system.service.UserService; |
| | | import me.zhengjie.modules.system.service.dto.UserDto; |
| | | import me.zhengjie.utils.ValidationUtil; |
| | | import me.zhengjie.utils.FileUtil; |
| | | import lombok.RequiredArgsConstructor; |
| | | import me.zhengjie.modules.business.repository.BusinessPlanRepository; |
| | | import me.zhengjie.modules.business.service.BusinessPlanService; |
| | | import me.zhengjie.modules.business.service.dto.BusinessPlanDto; |
| | | import me.zhengjie.modules.business.service.dto.BusinessPlanQueryCriteria; |
| | | import me.zhengjie.modules.business.service.mapstruct.BusinessPlanMapper; |
| | | 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-04-12 |
| | | **/ |
| | | @Service |
| | | @RequiredArgsConstructor |
| | | public class BusinessPlanServiceImpl implements BusinessPlanService { |
| | | |
| | | private final BusinessPlanRepository businessPlanRepository; |
| | | private final BusinessPlanMapper businessPlanMapper; |
| | | private final BusinessPlanPersonnelRepository businessPlanPersonnelRepository; |
| | | private final BusinessPlanPersonnelMapper businessPlanPersonnelMapper; |
| | | private final UserService userService; |
| | | |
| | | @Override |
| | | public Map<String,Object> queryAll(BusinessPlanQueryCriteria criteria, Pageable pageable){ |
| | | Page<BusinessPlan> page = businessPlanRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable); |
| | | // 将实体类转换为DTO(重写) |
| | | Function<BusinessPlan, BusinessPlanDto> func = new Function<BusinessPlan, BusinessPlanDto>(){ |
| | | @Override |
| | | public BusinessPlanDto apply(BusinessPlan t) { |
| | | // 将实体类转换成DTO |
| | | BusinessPlanDto businessPlanDto = businessPlanMapper.toDto(t); |
| | | |
| | | // 根据营业计划ID查询营业计划人员 |
| | | List<BusinessPlanPersonnelDto> businessPlanPersonnelDtoList = businessPlanPersonnelMapper.toDto(businessPlanPersonnelRepository.findByBusinessPlanId(businessPlanDto.getId())); |
| | | // 循环营业计划人员 |
| | | for (BusinessPlanPersonnelDto businessPlanPersonnelDto : businessPlanPersonnelDtoList) { |
| | | // 获取用户 |
| | | UserDto userDto = userService.findById(businessPlanPersonnelDto.getUserId()); |
| | | businessPlanPersonnelDto.setUserNickName(userDto.getNickName()); |
| | | } |
| | | // DTO |
| | | businessPlanDto.setBusinessPlanPersonnelDtoList(businessPlanPersonnelDtoList); |
| | | |
| | | // 返回处理好的DTO |
| | | return businessPlanDto; |
| | | } |
| | | }; |
| | | return PageUtil.toPage(page.map(func)); |
| | | } |
| | | |
| | | @Override |
| | | public List<BusinessPlanDto> queryAll(BusinessPlanQueryCriteria criteria){ |
| | | return businessPlanMapper.toDto(businessPlanRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder))); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional |
| | | public BusinessPlanDto findById(Long id) { |
| | | BusinessPlan businessPlan = businessPlanRepository.findById(id).orElseGet(BusinessPlan::new); |
| | | ValidationUtil.isNull(businessPlan.getId(),"BusinessPlan","id",id); |
| | | return businessPlanMapper.toDto(businessPlan); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public BusinessPlanDto create(BusinessPlanDto resources) { |
| | | // 保存营业计划 |
| | | BusinessPlan businessPlan = businessPlanRepository.save(businessPlanMapper.toEntity(resources)); |
| | | // 保存相关营业计划人员 |
| | | saveBusinessPlanPersonnel(resources.getBusinessPlanPersonnelDtoList(), businessPlan.getId()); |
| | | return findById(businessPlan.getId()); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void update(BusinessPlanDto resources) { |
| | | BusinessPlan businessPlan = businessPlanRepository.findById(resources.getId()).orElseGet(BusinessPlan::new); |
| | | ValidationUtil.isNull( businessPlan.getId(),"BusinessPlan","id",resources.getId()); |
| | | businessPlan.copy(businessPlanMapper.toEntity(resources)); |
| | | businessPlanRepository.save(businessPlan); |
| | | // 保存相关营业计划人员 |
| | | saveBusinessPlanPersonnel(resources.getBusinessPlanPersonnelDtoList(), businessPlan.getId()); |
| | | } |
| | | |
| | | /** |
| | | * 保存相关营业计划人员 |
| | | * @param businessPlanPersonnelDtoList |
| | | * @param businessPlanId |
| | | */ |
| | | private void saveBusinessPlanPersonnel(List<BusinessPlanPersonnelDto> businessPlanPersonnelDtoList, Long businessPlanId) { |
| | | // 根据营业计划ID删除营业计划人员 |
| | | businessPlanPersonnelRepository.deleteByBusinessPlanId(businessPlanId); |
| | | // 营业计划人员列表 |
| | | List<BusinessPlanPersonnel> businessPlanPersonnelList = businessPlanPersonnelMapper.toEntity(businessPlanPersonnelDtoList); |
| | | // 循环营业计划人员列表 |
| | | for (BusinessPlanPersonnel businessPlanPersonnel : businessPlanPersonnelList) { |
| | | // 营业计划人员 |
| | | businessPlanPersonnel.setBusinessPlanId(businessPlanId); |
| | | // 保存营业计划人员 |
| | | businessPlanPersonnelRepository.save(businessPlanPersonnel); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public void deleteAll(Long[] ids) { |
| | | for (Long id : ids) { |
| | | businessPlanRepository.deleteById(id); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public void download(List<BusinessPlanDto> all, HttpServletResponse response) throws IOException { |
| | | List<Map<String, Object>> list = new ArrayList<>(); |
| | | for (BusinessPlanDto businessPlan : all) { |
| | | Map<String,Object> map = new LinkedHashMap<>(); |
| | | map.put("营业地", businessPlan.getBusinessPlace()); |
| | | map.put("营业内容", businessPlan.getBusinessContent()); |
| | | map.put("营业状态", businessPlan.getBusinessStatus()); |
| | | map.put("备注", businessPlan.getRemarks()); |
| | | map.put("创建者", businessPlan.getCreateBy()); |
| | | map.put("创建时间", businessPlan.getCreateTime()); |
| | | map.put("更新者", businessPlan.getUpdateBy()); |
| | | map.put("更新时间", businessPlan.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.business.service.mapstruct; |
| | | |
| | | import me.zhengjie.base.BaseMapper; |
| | | import me.zhengjie.modules.business.domain.BusinessExpense; |
| | | import me.zhengjie.modules.business.service.dto.BusinessExpenseDto; |
| | | import org.mapstruct.Mapper; |
| | | import org.mapstruct.ReportingPolicy; |
| | | |
| | | /** |
| | | * @website https://eladmin.vip |
| | | * @author 赵士淞 |
| | | * @date 2023-04-13 |
| | | **/ |
| | | @Mapper(componentModel = "spring", unmappedTargetPolicy = ReportingPolicy.IGNORE) |
| | | public interface BusinessExpenseMapper extends BaseMapper<BusinessExpenseDto, BusinessExpense> { |
| | | |
| | | } |
| 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.business.service.mapstruct; |
| | | |
| | | import me.zhengjie.base.BaseMapper; |
| | | import me.zhengjie.modules.business.domain.BusinessExpenseReimbursement; |
| | | import me.zhengjie.modules.business.service.dto.BusinessExpenseReimbursementDto; |
| | | import org.mapstruct.Mapper; |
| | | import org.mapstruct.ReportingPolicy; |
| | | |
| | | /** |
| | | * @website https://eladmin.vip |
| | | * @author 赵士淞 |
| | | * @date 2023-04-13 |
| | | **/ |
| | | @Mapper(componentModel = "spring", unmappedTargetPolicy = ReportingPolicy.IGNORE) |
| | | public interface BusinessExpenseReimbursementMapper extends BaseMapper<BusinessExpenseReimbursementDto, BusinessExpenseReimbursement> { |
| | | |
| | | } |
| 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.business.service.mapstruct; |
| | | |
| | | import me.zhengjie.base.BaseMapper; |
| | | import me.zhengjie.modules.business.domain.BusinessPlan; |
| | | import me.zhengjie.modules.business.service.dto.BusinessPlanDto; |
| | | import org.mapstruct.Mapper; |
| | | import org.mapstruct.ReportingPolicy; |
| | | |
| | | /** |
| | | * @website https://eladmin.vip |
| | | * @author 赵士淞 |
| | | * @date 2023-04-12 |
| | | **/ |
| | | @Mapper(componentModel = "spring", unmappedTargetPolicy = ReportingPolicy.IGNORE) |
| | | public interface BusinessPlanMapper extends BaseMapper<BusinessPlanDto, BusinessPlan> { |
| | | |
| | | } |
| 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.business.service.mapstruct; |
| | | |
| | | import me.zhengjie.base.BaseMapper; |
| | | import me.zhengjie.modules.business.domain.BusinessPlanPersonnel; |
| | | import me.zhengjie.modules.business.service.dto.BusinessPlanPersonnelDto; |
| | | import org.mapstruct.Mapper; |
| | | import org.mapstruct.ReportingPolicy; |
| | | |
| | | /** |
| | | * @website https://eladmin.vip |
| | | * @author 赵士淞 |
| | | * @date 2023-04-12 |
| | | **/ |
| | | @Mapper(componentModel = "spring", unmappedTargetPolicy = ReportingPolicy.IGNORE) |
| | | public interface BusinessPlanPersonnelMapper extends BaseMapper<BusinessPlanPersonnelDto, BusinessPlanPersonnel> { |
| | | |
| | | } |
| 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.capital.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-04-12 |
| | | **/ |
| | | @Entity |
| | | @Data |
| | | @Table(name="capital_account_company") |
| | | public class CapitalAccountCompany extends BaseEntity implements Serializable { |
| | | |
| | | @Id |
| | | @GeneratedValue(strategy = GenerationType.IDENTITY) |
| | | @Column(name = "`id`") |
| | | @ApiModelProperty(value = "ID") |
| | | private Long id; |
| | | |
| | | @Column(name = "`project_distinguish`",nullable = false) |
| | | @NotBlank |
| | | @ApiModelProperty(value = "项目区分") |
| | | private String projectDistinguish; |
| | | |
| | | @Column(name = "`account_type`",nullable = false) |
| | | @NotBlank |
| | | @ApiModelProperty(value = "账户类型") |
| | | private String accountType; |
| | | |
| | | @Column(name = "`account_name`",nullable = false) |
| | | @NotBlank |
| | | @ApiModelProperty(value = "账户名称") |
| | | private String accountName; |
| | | |
| | | @Column(name = "`account_year`",nullable = false) |
| | | @NotNull |
| | | @ApiModelProperty(value = "账户年度") |
| | | private Timestamp accountYear; |
| | | |
| | | @Column(name = "`opening_amount`",nullable = false) |
| | | @NotNull |
| | | @ApiModelProperty(value = "期初金额") |
| | | private BigDecimal openingAmount; |
| | | |
| | | @Column(name = "`warn_amount`",nullable = false) |
| | | @NotNull |
| | | @ApiModelProperty(value = "警戒金额") |
| | | private BigDecimal warnAmount; |
| | | |
| | | @Column(name = "`account_amount`",nullable = false) |
| | | @NotNull |
| | | @ApiModelProperty(value = "账户金额") |
| | | private BigDecimal accountAmount; |
| | | |
| | | @Column(name = "`settlement_status`",nullable = false) |
| | | @NotBlank |
| | | @ApiModelProperty(value = "结算状态") |
| | | private String settlementStatus; |
| | | |
| | | @Column(name = "`remarks`") |
| | | @ApiModelProperty(value = "备注") |
| | | private String remarks; |
| | | |
| | | public void copy(CapitalAccountCompany 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.capital.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-04-12 |
| | | **/ |
| | | @Entity |
| | | @Data |
| | | @Table(name="capital_account_company_set") |
| | | public class CapitalAccountCompanySet extends BaseEntity implements Serializable { |
| | | |
| | | @Id |
| | | @GeneratedValue(strategy = GenerationType.IDENTITY) |
| | | @Column(name = "`id`") |
| | | @ApiModelProperty(value = "ID") |
| | | private Long id; |
| | | |
| | | @Column(name = "`project_distinguish`",nullable = false) |
| | | @NotBlank |
| | | @ApiModelProperty(value = "项目区分") |
| | | private String projectDistinguish; |
| | | |
| | | @Column(name = "`account_type`",nullable = false) |
| | | @NotBlank |
| | | @ApiModelProperty(value = "账户类型") |
| | | private String accountType; |
| | | |
| | | @Column(name = "`account_name`",nullable = false) |
| | | @NotBlank |
| | | @ApiModelProperty(value = "账户名称") |
| | | private String accountName; |
| | | |
| | | @Column(name = "`remarks`") |
| | | @ApiModelProperty(value = "备注") |
| | | private String remarks; |
| | | |
| | | public void copy(CapitalAccountCompanySet 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.capital.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-04-12 |
| | | **/ |
| | | @Entity |
| | | @Data |
| | | @Table(name="capital_account_money") |
| | | public class CapitalAccountMoney extends BaseEntity implements Serializable { |
| | | |
| | | @Id |
| | | @GeneratedValue(strategy = GenerationType.IDENTITY) |
| | | @Column(name = "`id`") |
| | | @ApiModelProperty(value = "ID") |
| | | private Long id; |
| | | |
| | | @Column(name = "`account_name`",nullable = false) |
| | | @NotBlank |
| | | @ApiModelProperty(value = "账户名称") |
| | | private String accountName; |
| | | |
| | | @Column(name = "`account_year`",nullable = false) |
| | | @NotNull |
| | | @ApiModelProperty(value = "账户年度") |
| | | private Timestamp accountYear; |
| | | |
| | | @Column(name = "`opening_amount`",nullable = false) |
| | | @NotNull |
| | | @ApiModelProperty(value = "期初金额") |
| | | private BigDecimal openingAmount; |
| | | |
| | | @Column(name = "`warn_amount`",nullable = false) |
| | | @NotNull |
| | | @ApiModelProperty(value = "警戒金额") |
| | | private BigDecimal warnAmount; |
| | | |
| | | @Column(name = "`account_amount`",nullable = false) |
| | | @NotNull |
| | | @ApiModelProperty(value = "账户金额") |
| | | private BigDecimal accountAmount; |
| | | |
| | | @Column(name = "`settlement_status`",nullable = false) |
| | | @NotBlank |
| | | @ApiModelProperty(value = "结算状态") |
| | | private String settlementStatus; |
| | | |
| | | @Column(name = "`remarks`") |
| | | @ApiModelProperty(value = "备注") |
| | | private String remarks; |
| | | |
| | | public void copy(CapitalAccountMoney 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.capital.repository; |
| | | |
| | | import me.zhengjie.modules.capital.domain.CapitalAccountCompany; |
| | | import org.springframework.data.jpa.repository.JpaRepository; |
| | | import org.springframework.data.jpa.repository.JpaSpecificationExecutor; |
| | | |
| | | import java.sql.Timestamp; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @website https://eladmin.vip |
| | | * @author 赵士淞 |
| | | * @date 2023-04-12 |
| | | **/ |
| | | public interface CapitalAccountCompanyRepository extends JpaRepository<CapitalAccountCompany, Long>, JpaSpecificationExecutor<CapitalAccountCompany> { |
| | | |
| | | /** |
| | | * 根据项目区分、账户类型、账户年度查询 |
| | | * @param projectDistinguish |
| | | * @param accountType |
| | | * @param accountYear |
| | | * @return |
| | | */ |
| | | List<CapitalAccountCompany> findByProjectDistinguishAndAccountTypeAndAccountYear(String projectDistinguish, String accountType, Timestamp accountYear); |
| | | } |
| 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.capital.repository; |
| | | |
| | | import me.zhengjie.modules.capital.domain.CapitalAccountCompanySet; |
| | | 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-04-12 |
| | | **/ |
| | | public interface CapitalAccountCompanySetRepository extends JpaRepository<CapitalAccountCompanySet, Long>, JpaSpecificationExecutor<CapitalAccountCompanySet> { |
| | | |
| | | /** |
| | | * 根据项目区分查询 |
| | | * @param projectDistinguish |
| | | * @return |
| | | */ |
| | | List<CapitalAccountCompanySet> findByProjectDistinguish(String projectDistinguish); |
| | | |
| | | /** |
| | | * 根据账户类型查询 |
| | | * @param accountType |
| | | * @return |
| | | */ |
| | | List<CapitalAccountCompanySet> findByAccountType(String accountType); |
| | | } |
| 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.capital.repository; |
| | | |
| | | import me.zhengjie.modules.capital.domain.CapitalAccountMoney; |
| | | import org.springframework.data.jpa.repository.JpaRepository; |
| | | import org.springframework.data.jpa.repository.JpaSpecificationExecutor; |
| | | |
| | | import java.sql.Timestamp; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @website https://eladmin.vip |
| | | * @author 赵士淞 |
| | | * @date 2023-04-12 |
| | | **/ |
| | | public interface CapitalAccountMoneyRepository extends JpaRepository<CapitalAccountMoney, Long>, JpaSpecificationExecutor<CapitalAccountMoney> { |
| | | |
| | | /** |
| | | * 根据账户年度查询 |
| | | * @param accountYear |
| | | * @return |
| | | */ |
| | | List<CapitalAccountMoney> findByAccountYear(Timestamp accountYear); |
| | | } |
| 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.capital.rest; |
| | | |
| | | import me.zhengjie.annotation.Log; |
| | | import me.zhengjie.modules.capital.domain.CapitalAccountCompany; |
| | | import me.zhengjie.modules.capital.service.CapitalAccountCompanyService; |
| | | import me.zhengjie.modules.capital.service.dto.CapitalAccountCompanyQueryCriteria; |
| | | 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-04-12 |
| | | **/ |
| | | @RestController |
| | | @RequiredArgsConstructor |
| | | @Api(tags = "年度资金账户(公司流)管理") |
| | | @RequestMapping("/api/capitalAccountCompany") |
| | | public class CapitalAccountCompanyController { |
| | | |
| | | private final CapitalAccountCompanyService capitalAccountCompanyService; |
| | | |
| | | @Log("导出数据") |
| | | @ApiOperation("导出数据") |
| | | @GetMapping(value = "/download") |
| | | @PreAuthorize("@el.check('capitalAccountCompany:download')") |
| | | public void exportCapitalAccountCompany(HttpServletResponse response, CapitalAccountCompanyQueryCriteria criteria) throws IOException { |
| | | capitalAccountCompanyService.download(capitalAccountCompanyService.queryAll(criteria), response); |
| | | } |
| | | |
| | | @GetMapping |
| | | @Log("查询年度资金账户(公司流)") |
| | | @ApiOperation("查询年度资金账户(公司流)") |
| | | @PreAuthorize("@el.check('capitalAccountCompany:list')") |
| | | public ResponseEntity<Object> queryCapitalAccountCompany(CapitalAccountCompanyQueryCriteria criteria, Pageable pageable){ |
| | | return new ResponseEntity<>(capitalAccountCompanyService.queryAll(criteria,pageable),HttpStatus.OK); |
| | | } |
| | | |
| | | @GetMapping(value = "/all") |
| | | @Log("查询年度资金账户(公司流)") |
| | | @ApiOperation("查询年度资金账户(公司流)") |
| | | @PreAuthorize("@el.check('capitalAccountCompany:list')") |
| | | public ResponseEntity<Object> queryCapitalAccountCompany(CapitalAccountCompanyQueryCriteria criteria){ |
| | | return new ResponseEntity<>(capitalAccountCompanyService.queryAll(criteria),HttpStatus.OK); |
| | | } |
| | | |
| | | @PostMapping |
| | | @Log("新增年度资金账户(公司流)") |
| | | @ApiOperation("新增年度资金账户(公司流)") |
| | | @PreAuthorize("@el.check('capitalAccountCompany:add')") |
| | | public ResponseEntity<Object> createCapitalAccountCompany(@Validated @RequestBody CapitalAccountCompany resources){ |
| | | return new ResponseEntity<>(capitalAccountCompanyService.create(resources),HttpStatus.CREATED); |
| | | } |
| | | |
| | | @PutMapping |
| | | @Log("修改年度资金账户(公司流)") |
| | | @ApiOperation("修改年度资金账户(公司流)") |
| | | @PreAuthorize("@el.check('capitalAccountCompany:edit')") |
| | | public ResponseEntity<Object> updateCapitalAccountCompany(@Validated @RequestBody CapitalAccountCompany resources){ |
| | | capitalAccountCompanyService.update(resources); |
| | | return new ResponseEntity<>(HttpStatus.NO_CONTENT); |
| | | } |
| | | |
| | | @DeleteMapping |
| | | @Log("删除年度资金账户(公司流)") |
| | | @ApiOperation("删除年度资金账户(公司流)") |
| | | @PreAuthorize("@el.check('capitalAccountCompany:del')") |
| | | public ResponseEntity<Object> deleteCapitalAccountCompany(@RequestBody Long[] ids) { |
| | | capitalAccountCompanyService.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.capital.rest; |
| | | |
| | | import me.zhengjie.annotation.Log; |
| | | import me.zhengjie.modules.capital.domain.CapitalAccountCompanySet; |
| | | import me.zhengjie.modules.capital.service.CapitalAccountCompanySetService; |
| | | import me.zhengjie.modules.capital.service.dto.CapitalAccountCompanySetQueryCriteria; |
| | | 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-04-12 |
| | | **/ |
| | | @RestController |
| | | @RequiredArgsConstructor |
| | | @Api(tags = "年度资金账户(公司流)设定管理") |
| | | @RequestMapping("/api/capitalAccountCompanySet") |
| | | public class CapitalAccountCompanySetController { |
| | | |
| | | private final CapitalAccountCompanySetService capitalAccountCompanySetService; |
| | | |
| | | @Log("导出数据") |
| | | @ApiOperation("导出数据") |
| | | @GetMapping(value = "/download") |
| | | @PreAuthorize("@el.check('capitalAccountCompanySet:download')") |
| | | public void exportCapitalAccountCompanySet(HttpServletResponse response, CapitalAccountCompanySetQueryCriteria criteria) throws IOException { |
| | | capitalAccountCompanySetService.download(capitalAccountCompanySetService.queryAll(criteria), response); |
| | | } |
| | | |
| | | @GetMapping |
| | | @Log("查询年度资金账户(公司流)设定") |
| | | @ApiOperation("查询年度资金账户(公司流)设定") |
| | | @PreAuthorize("@el.check('capitalAccountCompanySet:list')") |
| | | public ResponseEntity<Object> queryCapitalAccountCompanySet(CapitalAccountCompanySetQueryCriteria criteria, Pageable pageable){ |
| | | return new ResponseEntity<>(capitalAccountCompanySetService.queryAll(criteria,pageable),HttpStatus.OK); |
| | | } |
| | | |
| | | @GetMapping(value = "/all") |
| | | @Log("查询年度资金账户(公司流)设定") |
| | | @ApiOperation("查询年度资金账户(公司流)设定") |
| | | @PreAuthorize("@el.check('capitalAccountCompanySet:list')") |
| | | public ResponseEntity<Object> queryCapitalAccountCompanySet(CapitalAccountCompanySetQueryCriteria criteria){ |
| | | return new ResponseEntity<>(capitalAccountCompanySetService.queryAll(criteria),HttpStatus.OK); |
| | | } |
| | | |
| | | @PostMapping |
| | | @Log("新增年度资金账户(公司流)设定") |
| | | @ApiOperation("新增年度资金账户(公司流)设定") |
| | | @PreAuthorize("@el.check('capitalAccountCompanySet:add')") |
| | | public ResponseEntity<Object> createCapitalAccountCompanySet(@Validated @RequestBody CapitalAccountCompanySet resources){ |
| | | return new ResponseEntity<>(capitalAccountCompanySetService.create(resources),HttpStatus.CREATED); |
| | | } |
| | | |
| | | @PutMapping |
| | | @Log("修改年度资金账户(公司流)设定") |
| | | @ApiOperation("修改年度资金账户(公司流)设定") |
| | | @PreAuthorize("@el.check('capitalAccountCompanySet:edit')") |
| | | public ResponseEntity<Object> updateCapitalAccountCompanySet(@Validated @RequestBody CapitalAccountCompanySet resources){ |
| | | capitalAccountCompanySetService.update(resources); |
| | | return new ResponseEntity<>(HttpStatus.NO_CONTENT); |
| | | } |
| | | |
| | | @DeleteMapping |
| | | @Log("删除年度资金账户(公司流)设定") |
| | | @ApiOperation("删除年度资金账户(公司流)设定") |
| | | @PreAuthorize("@el.check('capitalAccountCompanySet:del')") |
| | | public ResponseEntity<Object> deleteCapitalAccountCompanySet(@RequestBody Long[] ids) { |
| | | capitalAccountCompanySetService.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.capital.rest; |
| | | |
| | | import me.zhengjie.annotation.Log; |
| | | import me.zhengjie.modules.capital.domain.CapitalAccountMoney; |
| | | import me.zhengjie.modules.capital.service.CapitalAccountMoneyService; |
| | | import me.zhengjie.modules.capital.service.dto.CapitalAccountMoneyQueryCriteria; |
| | | 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-04-12 |
| | | **/ |
| | | @RestController |
| | | @RequiredArgsConstructor |
| | | @Api(tags = "年度资金账户(现金流)管理") |
| | | @RequestMapping("/api/capitalAccountMoney") |
| | | public class CapitalAccountMoneyController { |
| | | |
| | | private final CapitalAccountMoneyService capitalAccountMoneyService; |
| | | |
| | | @Log("导出数据") |
| | | @ApiOperation("导出数据") |
| | | @GetMapping(value = "/download") |
| | | @PreAuthorize("@el.check('capitalAccountMoney:download')") |
| | | public void exportCapitalAccountMoney(HttpServletResponse response, CapitalAccountMoneyQueryCriteria criteria) throws IOException { |
| | | capitalAccountMoneyService.download(capitalAccountMoneyService.queryAll(criteria), response); |
| | | } |
| | | |
| | | @GetMapping |
| | | @Log("查询年度资金账户(现金流)") |
| | | @ApiOperation("查询年度资金账户(现金流)") |
| | | @PreAuthorize("@el.check('capitalAccountMoney:list')") |
| | | public ResponseEntity<Object> queryCapitalAccountMoney(CapitalAccountMoneyQueryCriteria criteria, Pageable pageable){ |
| | | return new ResponseEntity<>(capitalAccountMoneyService.queryAll(criteria,pageable),HttpStatus.OK); |
| | | } |
| | | |
| | | @GetMapping(value = "/all") |
| | | @Log("查询年度资金账户(现金流)") |
| | | @ApiOperation("查询年度资金账户(现金流)") |
| | | @PreAuthorize("@el.check('capitalAccountMoney:list')") |
| | | public ResponseEntity<Object> queryCapitalAccountMoney(CapitalAccountMoneyQueryCriteria criteria){ |
| | | return new ResponseEntity<>(capitalAccountMoneyService.queryAll(criteria),HttpStatus.OK); |
| | | } |
| | | |
| | | @PostMapping |
| | | @Log("新增年度资金账户(现金流)") |
| | | @ApiOperation("新增年度资金账户(现金流)") |
| | | @PreAuthorize("@el.check('capitalAccountMoney:add')") |
| | | public ResponseEntity<Object> createCapitalAccountMoney(@Validated @RequestBody CapitalAccountMoney resources){ |
| | | return new ResponseEntity<>(capitalAccountMoneyService.create(resources),HttpStatus.CREATED); |
| | | } |
| | | |
| | | @PutMapping |
| | | @Log("修改年度资金账户(现金流)") |
| | | @ApiOperation("修改年度资金账户(现金流)") |
| | | @PreAuthorize("@el.check('capitalAccountMoney:edit')") |
| | | public ResponseEntity<Object> updateCapitalAccountMoney(@Validated @RequestBody CapitalAccountMoney resources){ |
| | | capitalAccountMoneyService.update(resources); |
| | | return new ResponseEntity<>(HttpStatus.NO_CONTENT); |
| | | } |
| | | |
| | | @DeleteMapping |
| | | @Log("删除年度资金账户(现金流)") |
| | | @ApiOperation("删除年度资金账户(现金流)") |
| | | @PreAuthorize("@el.check('capitalAccountMoney:del')") |
| | | public ResponseEntity<Object> deleteCapitalAccountMoney(@RequestBody Long[] ids) { |
| | | capitalAccountMoneyService.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.capital.service; |
| | | |
| | | import me.zhengjie.modules.capital.domain.CapitalAccountCompany; |
| | | import me.zhengjie.modules.capital.service.dto.CapitalAccountCompanyDto; |
| | | import me.zhengjie.modules.capital.service.dto.CapitalAccountCompanyQueryCriteria; |
| | | 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-04-12 |
| | | **/ |
| | | public interface CapitalAccountCompanyService { |
| | | |
| | | /** |
| | | * 查询数据分页 |
| | | * @param criteria 条件 |
| | | * @param pageable 分页参数 |
| | | * @return Map<String,Object> |
| | | */ |
| | | Map<String,Object> queryAll(CapitalAccountCompanyQueryCriteria criteria, Pageable pageable); |
| | | |
| | | /** |
| | | * 查询所有数据不分页 |
| | | * @param criteria 条件参数 |
| | | * @return List<CapitalAccountCompanyDto> |
| | | */ |
| | | List<CapitalAccountCompanyDto> queryAll(CapitalAccountCompanyQueryCriteria criteria); |
| | | |
| | | /** |
| | | * 根据ID查询 |
| | | * @param id ID |
| | | * @return CapitalAccountCompanyDto |
| | | */ |
| | | CapitalAccountCompanyDto findById(Long id); |
| | | |
| | | /** |
| | | * 创建 |
| | | * @param resources / |
| | | * @return CapitalAccountCompanyDto |
| | | */ |
| | | CapitalAccountCompanyDto create(CapitalAccountCompany resources); |
| | | |
| | | /** |
| | | * 编辑 |
| | | * @param resources / |
| | | */ |
| | | void update(CapitalAccountCompany resources); |
| | | |
| | | /** |
| | | * 多选删除 |
| | | * @param ids / |
| | | */ |
| | | void deleteAll(Long[] ids); |
| | | |
| | | /** |
| | | * 导出数据 |
| | | * @param all 待导出的数据 |
| | | * @param response / |
| | | * @throws IOException / |
| | | */ |
| | | void download(List<CapitalAccountCompanyDto> 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.capital.service; |
| | | |
| | | import me.zhengjie.modules.capital.domain.CapitalAccountCompanySet; |
| | | import me.zhengjie.modules.capital.service.dto.CapitalAccountCompanySetDto; |
| | | import me.zhengjie.modules.capital.service.dto.CapitalAccountCompanySetQueryCriteria; |
| | | 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-04-12 |
| | | **/ |
| | | public interface CapitalAccountCompanySetService { |
| | | |
| | | /** |
| | | * 查询数据分页 |
| | | * @param criteria 条件 |
| | | * @param pageable 分页参数 |
| | | * @return Map<String,Object> |
| | | */ |
| | | Map<String,Object> queryAll(CapitalAccountCompanySetQueryCriteria criteria, Pageable pageable); |
| | | |
| | | /** |
| | | * 查询所有数据不分页 |
| | | * @param criteria 条件参数 |
| | | * @return List<CapitalAccountCompanySetDto> |
| | | */ |
| | | List<CapitalAccountCompanySetDto> queryAll(CapitalAccountCompanySetQueryCriteria criteria); |
| | | |
| | | /** |
| | | * 根据ID查询 |
| | | * @param id ID |
| | | * @return CapitalAccountCompanySetDto |
| | | */ |
| | | CapitalAccountCompanySetDto findById(Long id); |
| | | |
| | | /** |
| | | * 创建 |
| | | * @param resources / |
| | | * @return CapitalAccountCompanySetDto |
| | | */ |
| | | CapitalAccountCompanySetDto create(CapitalAccountCompanySet resources); |
| | | |
| | | /** |
| | | * 编辑 |
| | | * @param resources / |
| | | */ |
| | | void update(CapitalAccountCompanySet resources); |
| | | |
| | | /** |
| | | * 多选删除 |
| | | * @param ids / |
| | | */ |
| | | void deleteAll(Long[] ids); |
| | | |
| | | /** |
| | | * 导出数据 |
| | | * @param all 待导出的数据 |
| | | * @param response / |
| | | * @throws IOException / |
| | | */ |
| | | void download(List<CapitalAccountCompanySetDto> 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.capital.service; |
| | | |
| | | import me.zhengjie.modules.capital.domain.CapitalAccountMoney; |
| | | import me.zhengjie.modules.capital.service.dto.CapitalAccountMoneyDto; |
| | | import me.zhengjie.modules.capital.service.dto.CapitalAccountMoneyQueryCriteria; |
| | | 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-04-12 |
| | | **/ |
| | | public interface CapitalAccountMoneyService { |
| | | |
| | | /** |
| | | * 查询数据分页 |
| | | * @param criteria 条件 |
| | | * @param pageable 分页参数 |
| | | * @return Map<String,Object> |
| | | */ |
| | | Map<String,Object> queryAll(CapitalAccountMoneyQueryCriteria criteria, Pageable pageable); |
| | | |
| | | /** |
| | | * 查询所有数据不分页 |
| | | * @param criteria 条件参数 |
| | | * @return List<CapitalAccountMoneyDto> |
| | | */ |
| | | List<CapitalAccountMoneyDto> queryAll(CapitalAccountMoneyQueryCriteria criteria); |
| | | |
| | | /** |
| | | * 根据ID查询 |
| | | * @param id ID |
| | | * @return CapitalAccountMoneyDto |
| | | */ |
| | | CapitalAccountMoneyDto findById(Long id); |
| | | |
| | | /** |
| | | * 创建 |
| | | * @param resources / |
| | | * @return CapitalAccountMoneyDto |
| | | */ |
| | | CapitalAccountMoneyDto create(CapitalAccountMoney resources); |
| | | |
| | | /** |
| | | * 编辑 |
| | | * @param resources / |
| | | */ |
| | | void update(CapitalAccountMoney resources); |
| | | |
| | | /** |
| | | * 多选删除 |
| | | * @param ids / |
| | | */ |
| | | void deleteAll(Long[] ids); |
| | | |
| | | /** |
| | | * 导出数据 |
| | | * @param all 待导出的数据 |
| | | * @param response / |
| | | * @throws IOException / |
| | | */ |
| | | void download(List<CapitalAccountMoneyDto> 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.capital.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-04-12 |
| | | **/ |
| | | @Data |
| | | public class CapitalAccountCompanyDto extends BaseDTO implements Serializable { |
| | | |
| | | /** ID */ |
| | | private Long id; |
| | | |
| | | /** 项目区分 */ |
| | | private String projectDistinguish; |
| | | |
| | | /** 账户类型 */ |
| | | private String accountType; |
| | | |
| | | /** 账户名称 */ |
| | | private String accountName; |
| | | |
| | | /** 账户年度 */ |
| | | private Timestamp accountYear; |
| | | |
| | | /** 期初金额 */ |
| | | private BigDecimal openingAmount; |
| | | |
| | | /** 警戒金额 */ |
| | | private BigDecimal warnAmount; |
| | | |
| | | /** 账户金额 */ |
| | | private BigDecimal accountAmount; |
| | | |
| | | /** 结算状态 */ |
| | | private String settlementStatus; |
| | | |
| | | /** 备注 */ |
| | | private String remarks; |
| | | } |
| New file |
| | |
| | | /* |
| | | * Copyright 2019-2020 Zheng Jie |
| | | * |
| | | * Licensed under the Apache License, Version 2.0 (the "License"); |
| | | * you may not use this file except in compliance with the License. |
| | | * You may obtain a copy of the License at |
| | | * |
| | | * http://www.apache.org/licenses/LICENSE-2.0 |
| | | * |
| | | * Unless required by applicable law or agreed to in writing, software |
| | | * distributed under the License is distributed on an "AS IS" BASIS, |
| | | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| | | * See the License for the specific language governing permissions and |
| | | * limitations under the License. |
| | | */ |
| | | package me.zhengjie.modules.capital.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-04-12 |
| | | **/ |
| | | @Data |
| | | public class CapitalAccountCompanyQueryCriteria{ |
| | | |
| | | /** 精确 */ |
| | | @Query |
| | | private String projectDistinguish; |
| | | |
| | | /** 精确 */ |
| | | @Query |
| | | private String accountType; |
| | | |
| | | /** 模糊 */ |
| | | @Query(type = Query.Type.INNER_LIKE) |
| | | private String accountName; |
| | | |
| | | /** 模糊 */ |
| | | @Query(type = Query.Type.INNER_LIKE) |
| | | private String accountYear; |
| | | |
| | | /** 精确 */ |
| | | @Query |
| | | private String settlementStatus; |
| | | } |
| 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.capital.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-04-12 |
| | | **/ |
| | | @Data |
| | | public class CapitalAccountCompanySetDto extends BaseDTO implements Serializable { |
| | | |
| | | /** ID */ |
| | | private Long id; |
| | | |
| | | /** 项目区分 */ |
| | | private String projectDistinguish; |
| | | |
| | | /** 账户类型 */ |
| | | private String accountType; |
| | | |
| | | /** 账户名称 */ |
| | | private String accountName; |
| | | |
| | | /** 备注 */ |
| | | private String remarks; |
| | | } |
| New file |
| | |
| | | /* |
| | | * Copyright 2019-2020 Zheng Jie |
| | | * |
| | | * Licensed under the Apache License, Version 2.0 (the "License"); |
| | | * you may not use this file except in compliance with the License. |
| | | * You may obtain a copy of the License at |
| | | * |
| | | * http://www.apache.org/licenses/LICENSE-2.0 |
| | | * |
| | | * Unless required by applicable law or agreed to in writing, software |
| | | * distributed under the License is distributed on an "AS IS" BASIS, |
| | | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| | | * See the License for the specific language governing permissions and |
| | | * limitations under the License. |
| | | */ |
| | | package me.zhengjie.modules.capital.service.dto; |
| | | |
| | | import lombok.Data; |
| | | import java.util.List; |
| | | import me.zhengjie.annotation.Query; |
| | | |
| | | /** |
| | | * @website https://eladmin.vip |
| | | * @author 赵士淞 |
| | | * @date 2023-04-12 |
| | | **/ |
| | | @Data |
| | | public class CapitalAccountCompanySetQueryCriteria{ |
| | | |
| | | /** 精确 */ |
| | | @Query |
| | | private String projectDistinguish; |
| | | |
| | | /** 精确 */ |
| | | @Query |
| | | private String accountType; |
| | | |
| | | /** 模糊 */ |
| | | @Query(type = Query.Type.INNER_LIKE) |
| | | private String accountName; |
| | | } |
| 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.capital.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-04-12 |
| | | **/ |
| | | @Data |
| | | public class CapitalAccountMoneyDto extends BaseDTO implements Serializable { |
| | | |
| | | /** ID */ |
| | | private Long id; |
| | | |
| | | /** 账户名称 */ |
| | | private String accountName; |
| | | |
| | | /** 账户年度 */ |
| | | private Timestamp accountYear; |
| | | |
| | | /** 期初金额 */ |
| | | private BigDecimal openingAmount; |
| | | |
| | | /** 警戒金额 */ |
| | | private BigDecimal warnAmount; |
| | | |
| | | /** 账户金额 */ |
| | | private BigDecimal accountAmount; |
| | | |
| | | /** 结算状态 */ |
| | | private String settlementStatus; |
| | | |
| | | /** 备注 */ |
| | | private String remarks; |
| | | } |
| New file |
| | |
| | | /* |
| | | * Copyright 2019-2020 Zheng Jie |
| | | * |
| | | * Licensed under the Apache License, Version 2.0 (the "License"); |
| | | * you may not use this file except in compliance with the License. |
| | | * You may obtain a copy of the License at |
| | | * |
| | | * http://www.apache.org/licenses/LICENSE-2.0 |
| | | * |
| | | * Unless required by applicable law or agreed to in writing, software |
| | | * distributed under the License is distributed on an "AS IS" BASIS, |
| | | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| | | * See the License for the specific language governing permissions and |
| | | * limitations under the License. |
| | | */ |
| | | package me.zhengjie.modules.capital.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-04-12 |
| | | **/ |
| | | @Data |
| | | public class CapitalAccountMoneyQueryCriteria{ |
| | | |
| | | /** 模糊 */ |
| | | @Query(type = Query.Type.INNER_LIKE) |
| | | private String accountName; |
| | | |
| | | /** 模糊 */ |
| | | @Query(type = Query.Type.INNER_LIKE) |
| | | private String accountYear; |
| | | |
| | | /** 精确 */ |
| | | @Query |
| | | private String settlementStatus; |
| | | } |
| 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.capital.service.impl; |
| | | |
| | | import me.zhengjie.exception.BadRequestException; |
| | | import me.zhengjie.modules.capital.domain.CapitalAccountCompany; |
| | | import me.zhengjie.modules.constant.Constant; |
| | | import me.zhengjie.utils.*; |
| | | import lombok.RequiredArgsConstructor; |
| | | import me.zhengjie.modules.capital.repository.CapitalAccountCompanyRepository; |
| | | import me.zhengjie.modules.capital.service.CapitalAccountCompanyService; |
| | | import me.zhengjie.modules.capital.service.dto.CapitalAccountCompanyDto; |
| | | import me.zhengjie.modules.capital.service.dto.CapitalAccountCompanyQueryCriteria; |
| | | import me.zhengjie.modules.capital.service.mapstruct.CapitalAccountCompanyMapper; |
| | | 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.math.BigDecimal; |
| | | import java.util.*; |
| | | import java.io.IOException; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | |
| | | /** |
| | | * @website https://eladmin.vip |
| | | * @description 服务实现 |
| | | * @author 赵士淞 |
| | | * @date 2023-04-12 |
| | | **/ |
| | | @Service |
| | | @RequiredArgsConstructor |
| | | public class CapitalAccountCompanyServiceImpl implements CapitalAccountCompanyService { |
| | | |
| | | private final CapitalAccountCompanyRepository capitalAccountCompanyRepository; |
| | | private final CapitalAccountCompanyMapper capitalAccountCompanyMapper; |
| | | |
| | | @Override |
| | | public Map<String,Object> queryAll(CapitalAccountCompanyQueryCriteria criteria, Pageable pageable){ |
| | | if (criteria.getAccountYear() != null && !"".equals(criteria.getAccountYear())) { |
| | | criteria.setAccountYear(DateUtil.internationalTimeToChinaTime(criteria.getAccountYear()).substring(0,4)); |
| | | } |
| | | Page<CapitalAccountCompany> page = capitalAccountCompanyRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable); |
| | | return PageUtil.toPage(page.map(capitalAccountCompanyMapper::toDto)); |
| | | } |
| | | |
| | | @Override |
| | | public List<CapitalAccountCompanyDto> queryAll(CapitalAccountCompanyQueryCriteria criteria){ |
| | | return capitalAccountCompanyMapper.toDto(capitalAccountCompanyRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder))); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional |
| | | public CapitalAccountCompanyDto findById(Long id) { |
| | | CapitalAccountCompany capitalAccountCompany = capitalAccountCompanyRepository.findById(id).orElseGet(CapitalAccountCompany::new); |
| | | ValidationUtil.isNull(capitalAccountCompany.getId(),"CapitalAccountCompany","id",id); |
| | | return capitalAccountCompanyMapper.toDto(capitalAccountCompany); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public CapitalAccountCompanyDto create(CapitalAccountCompany resources) { |
| | | // 拷贝后校验 |
| | | copyAfterCheck(resources); |
| | | return capitalAccountCompanyMapper.toDto(capitalAccountCompanyRepository.save(resources)); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void update(CapitalAccountCompany resources) { |
| | | CapitalAccountCompany capitalAccountCompany = capitalAccountCompanyRepository.findById(resources.getId()).orElseGet(CapitalAccountCompany::new); |
| | | ValidationUtil.isNull( capitalAccountCompany.getId(),"CapitalAccountCompany","id",resources.getId()); |
| | | // 拷贝前校验 |
| | | copyBeforeCheck(capitalAccountCompany); |
| | | capitalAccountCompany.copy(resources); |
| | | // 拷贝后校验 |
| | | copyAfterCheck(capitalAccountCompany); |
| | | capitalAccountCompanyRepository.save(capitalAccountCompany); |
| | | } |
| | | |
| | | @Override |
| | | public void deleteAll(Long[] ids) { |
| | | for (Long id : ids) { |
| | | capitalAccountCompanyRepository.deleteById(id); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public void download(List<CapitalAccountCompanyDto> all, HttpServletResponse response) throws IOException { |
| | | List<Map<String, Object>> list = new ArrayList<>(); |
| | | for (CapitalAccountCompanyDto capitalAccountCompany : all) { |
| | | Map<String,Object> map = new LinkedHashMap<>(); |
| | | map.put("项目区分", capitalAccountCompany.getProjectDistinguish()); |
| | | map.put("账户类型", capitalAccountCompany.getAccountType()); |
| | | map.put("账户名称", capitalAccountCompany.getAccountName()); |
| | | map.put("账户年度", capitalAccountCompany.getAccountYear()); |
| | | map.put("期初金额", capitalAccountCompany.getOpeningAmount()); |
| | | map.put("警戒金额", capitalAccountCompany.getWarnAmount()); |
| | | map.put("账户金额", capitalAccountCompany.getAccountAmount()); |
| | | map.put("结算状态", capitalAccountCompany.getSettlementStatus()); |
| | | map.put("备注", capitalAccountCompany.getRemarks()); |
| | | map.put("创建者", capitalAccountCompany.getCreateBy()); |
| | | map.put("创建时间", capitalAccountCompany.getCreateTime()); |
| | | map.put("更新者", capitalAccountCompany.getUpdateBy()); |
| | | map.put("更新时间", capitalAccountCompany.getUpdateTime()); |
| | | list.add(map); |
| | | } |
| | | FileUtil.downloadExcel(list, response); |
| | | } |
| | | |
| | | /** |
| | | * 拷贝前校验 |
| | | * @param resources |
| | | */ |
| | | private void copyBeforeCheck(CapitalAccountCompany resources) { |
| | | // 判断结算状态 |
| | | if (Constant.SETTLEMENT_STATUS_SETTLED.equals(resources.getSettlementStatus())) { |
| | | throw new BadRequestException("已结算的公司流账户无法进行修改!"); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 拷贝后校验 |
| | | * @param resources |
| | | */ |
| | | private void copyAfterCheck(CapitalAccountCompany resources) { |
| | | // 根据项目区分、账户类型、账户年度查询 |
| | | List<CapitalAccountCompany> capitalAccountCompanyList = capitalAccountCompanyRepository.findByProjectDistinguishAndAccountTypeAndAccountYear(resources.getProjectDistinguish(), resources.getAccountType(), resources.getAccountYear()); |
| | | // 判断结果集长度 |
| | | if (capitalAccountCompanyList.size() > 1) { |
| | | throw new BadRequestException("每个年度项目区分+账户类型组合公司流账户只能有一个!"); |
| | | } else if (capitalAccountCompanyList.size() == 1) { |
| | | if (resources.getId() == null || capitalAccountCompanyList.get(0).getId().longValue() != resources.getId().longValue()) { |
| | | throw new BadRequestException("每个年度项目区分+账户类型组合公司流账户只能有一个!"); |
| | | } |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 关联年度资金公司流账户 |
| | | * @return |
| | | */ |
| | | public CapitalAccountCompanyDto relevanceCapitalAccountCompany(String accountType) { |
| | | // 当前系统时间 |
| | | Calendar calendar = Calendar.getInstance(); |
| | | // 年度资金账户(公司流)检索类 |
| | | CapitalAccountCompanyQueryCriteria criteria = new CapitalAccountCompanyQueryCriteria(); |
| | | criteria.setAccountType(accountType); |
| | | criteria.setAccountYear(DateUtil.getYear(calendar)); |
| | | // 查询年度资金账户(公司流) |
| | | List<CapitalAccountCompanyDto> capitalAccountCompanyDtoList = capitalAccountCompanyMapper.toDto(capitalAccountCompanyRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder))); |
| | | // 判断年度资金账户(公司流) |
| | | if (capitalAccountCompanyDtoList.size() == 0) { |
| | | throw new BadRequestException("没有找到对应的年度资金公司流账户!"); |
| | | } else if (capitalAccountCompanyDtoList.size() > 1) { |
| | | throw new BadRequestException("找到多条对应的年度资金公司流账户!"); |
| | | } |
| | | return capitalAccountCompanyDtoList.get(0); |
| | | } |
| | | |
| | | /** |
| | | * 关联年度资金公司流账户(增加金额) |
| | | * @param capitalAccountCompanyDto |
| | | * @param amount |
| | | */ |
| | | public void relevanceCapitalAccountCompanyAdd(CapitalAccountCompanyDto capitalAccountCompanyDto, BigDecimal amount) { |
| | | // 账户金额 |
| | | BigDecimal accountAmount = capitalAccountCompanyDto.getAccountAmount(); |
| | | accountAmount = accountAmount.add(amount); |
| | | capitalAccountCompanyDto.setAccountAmount(accountAmount); |
| | | // 保存 |
| | | capitalAccountCompanyRepository.save(capitalAccountCompanyMapper.toEntity(capitalAccountCompanyDto)); |
| | | } |
| | | |
| | | /** |
| | | * 关联年度资金公司流账户(减少金额) |
| | | * @param capitalAccountCompanyDto |
| | | * @param amount |
| | | */ |
| | | public void relevanceCapitalAccountCompanySubtract(CapitalAccountCompanyDto capitalAccountCompanyDto, BigDecimal amount) { |
| | | // 账户金额 |
| | | BigDecimal accountAmount = capitalAccountCompanyDto.getAccountAmount(); |
| | | accountAmount = accountAmount.subtract(amount); |
| | | capitalAccountCompanyDto.setAccountAmount(accountAmount); |
| | | // 保存 |
| | | capitalAccountCompanyRepository.save(capitalAccountCompanyMapper.toEntity(capitalAccountCompanyDto)); |
| | | } |
| | | } |
| 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.capital.service.impl; |
| | | |
| | | import me.zhengjie.exception.BadRequestException; |
| | | import me.zhengjie.modules.capital.domain.CapitalAccountCompanySet; |
| | | import me.zhengjie.utils.ValidationUtil; |
| | | import me.zhengjie.utils.FileUtil; |
| | | import lombok.RequiredArgsConstructor; |
| | | import me.zhengjie.modules.capital.repository.CapitalAccountCompanySetRepository; |
| | | import me.zhengjie.modules.capital.service.CapitalAccountCompanySetService; |
| | | import me.zhengjie.modules.capital.service.dto.CapitalAccountCompanySetDto; |
| | | import me.zhengjie.modules.capital.service.dto.CapitalAccountCompanySetQueryCriteria; |
| | | import me.zhengjie.modules.capital.service.mapstruct.CapitalAccountCompanySetMapper; |
| | | 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-04-12 |
| | | **/ |
| | | @Service |
| | | @RequiredArgsConstructor |
| | | public class CapitalAccountCompanySetServiceImpl implements CapitalAccountCompanySetService { |
| | | |
| | | private final CapitalAccountCompanySetRepository capitalAccountCompanySetRepository; |
| | | private final CapitalAccountCompanySetMapper capitalAccountCompanySetMapper; |
| | | |
| | | @Override |
| | | public Map<String,Object> queryAll(CapitalAccountCompanySetQueryCriteria criteria, Pageable pageable){ |
| | | Page<CapitalAccountCompanySet> page = capitalAccountCompanySetRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable); |
| | | return PageUtil.toPage(page.map(capitalAccountCompanySetMapper::toDto)); |
| | | } |
| | | |
| | | @Override |
| | | public List<CapitalAccountCompanySetDto> queryAll(CapitalAccountCompanySetQueryCriteria criteria){ |
| | | return capitalAccountCompanySetMapper.toDto(capitalAccountCompanySetRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder))); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional |
| | | public CapitalAccountCompanySetDto findById(Long id) { |
| | | CapitalAccountCompanySet capitalAccountCompanySet = capitalAccountCompanySetRepository.findById(id).orElseGet(CapitalAccountCompanySet::new); |
| | | ValidationUtil.isNull(capitalAccountCompanySet.getId(),"CapitalAccountCompanySet","id",id); |
| | | return capitalAccountCompanySetMapper.toDto(capitalAccountCompanySet); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public CapitalAccountCompanySetDto create(CapitalAccountCompanySet resources) { |
| | | // 拷贝后校验 |
| | | copyAfterCheck(resources); |
| | | return capitalAccountCompanySetMapper.toDto(capitalAccountCompanySetRepository.save(resources)); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void update(CapitalAccountCompanySet resources) { |
| | | CapitalAccountCompanySet capitalAccountCompanySet = capitalAccountCompanySetRepository.findById(resources.getId()).orElseGet(CapitalAccountCompanySet::new); |
| | | ValidationUtil.isNull( capitalAccountCompanySet.getId(),"CapitalAccountCompanySet","id",resources.getId()); |
| | | capitalAccountCompanySet.copy(resources); |
| | | // 拷贝后校验 |
| | | copyAfterCheck(capitalAccountCompanySet); |
| | | capitalAccountCompanySetRepository.save(capitalAccountCompanySet); |
| | | } |
| | | |
| | | @Override |
| | | public void deleteAll(Long[] ids) { |
| | | for (Long id : ids) { |
| | | capitalAccountCompanySetRepository.deleteById(id); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public void download(List<CapitalAccountCompanySetDto> all, HttpServletResponse response) throws IOException { |
| | | List<Map<String, Object>> list = new ArrayList<>(); |
| | | for (CapitalAccountCompanySetDto capitalAccountCompanySet : all) { |
| | | Map<String,Object> map = new LinkedHashMap<>(); |
| | | map.put("项目区分", capitalAccountCompanySet.getProjectDistinguish()); |
| | | map.put("账户类型", capitalAccountCompanySet.getAccountType()); |
| | | map.put("账户名称", capitalAccountCompanySet.getAccountName()); |
| | | map.put("备注", capitalAccountCompanySet.getRemarks()); |
| | | map.put("创建者", capitalAccountCompanySet.getCreateBy()); |
| | | map.put("创建时间", capitalAccountCompanySet.getCreateTime()); |
| | | map.put("更新者", capitalAccountCompanySet.getUpdateBy()); |
| | | map.put("更新时间", capitalAccountCompanySet.getUpdateTime()); |
| | | list.add(map); |
| | | } |
| | | FileUtil.downloadExcel(list, response); |
| | | } |
| | | |
| | | /** |
| | | * 拷贝后校验 |
| | | * @param resources |
| | | */ |
| | | private void copyAfterCheck(CapitalAccountCompanySet resources) { |
| | | // 根据项目区分查询 |
| | | List<CapitalAccountCompanySet> projectDistinguishCapitalAccountCompanySetList = capitalAccountCompanySetRepository.findByProjectDistinguish(resources.getProjectDistinguish()); |
| | | // 判断结果集长度 |
| | | if (projectDistinguishCapitalAccountCompanySetList.size() > 1) { |
| | | throw new BadRequestException("每个项目区分只能设置一个账户!"); |
| | | } else if (projectDistinguishCapitalAccountCompanySetList.size() == 1) { |
| | | if (resources.getId() == null || projectDistinguishCapitalAccountCompanySetList.get(0).getId().longValue() != resources.getId().longValue()) { |
| | | throw new BadRequestException("每个项目区分只能设置一个账户!"); |
| | | } |
| | | } |
| | | // 根据账户类型查询 |
| | | List<CapitalAccountCompanySet> accountTypeCapitalAccountCompanySetList = capitalAccountCompanySetRepository.findByAccountType(resources.getAccountType()); |
| | | // 判断结果集长度 |
| | | if (accountTypeCapitalAccountCompanySetList.size() > 1) { |
| | | throw new BadRequestException("每个账户类型只能设置一个账户!"); |
| | | } else if (accountTypeCapitalAccountCompanySetList.size() == 1) { |
| | | if (resources.getId() == null || accountTypeCapitalAccountCompanySetList.get(0).getId().longValue() != resources.getId().longValue()) { |
| | | 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.capital.service.impl; |
| | | |
| | | import me.zhengjie.exception.BadRequestException; |
| | | import me.zhengjie.modules.capital.domain.CapitalAccountMoney; |
| | | import me.zhengjie.modules.constant.Constant; |
| | | import me.zhengjie.utils.*; |
| | | import lombok.RequiredArgsConstructor; |
| | | import me.zhengjie.modules.capital.repository.CapitalAccountMoneyRepository; |
| | | import me.zhengjie.modules.capital.service.CapitalAccountMoneyService; |
| | | import me.zhengjie.modules.capital.service.dto.CapitalAccountMoneyDto; |
| | | import me.zhengjie.modules.capital.service.dto.CapitalAccountMoneyQueryCriteria; |
| | | import me.zhengjie.modules.capital.service.mapstruct.CapitalAccountMoneyMapper; |
| | | 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.math.BigDecimal; |
| | | import java.util.*; |
| | | import java.io.IOException; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | |
| | | /** |
| | | * @website https://eladmin.vip |
| | | * @description 服务实现 |
| | | * @author 赵士淞 |
| | | * @date 2023-04-12 |
| | | **/ |
| | | @Service |
| | | @RequiredArgsConstructor |
| | | public class CapitalAccountMoneyServiceImpl implements CapitalAccountMoneyService { |
| | | |
| | | private final CapitalAccountMoneyRepository capitalAccountMoneyRepository; |
| | | private final CapitalAccountMoneyMapper capitalAccountMoneyMapper; |
| | | |
| | | @Override |
| | | public Map<String,Object> queryAll(CapitalAccountMoneyQueryCriteria criteria, Pageable pageable){ |
| | | if (criteria.getAccountYear() != null && !"".equals(criteria.getAccountYear())) { |
| | | criteria.setAccountYear(DateUtil.internationalTimeToChinaTime(criteria.getAccountYear()).substring(0,4)); |
| | | } |
| | | Page<CapitalAccountMoney> page = capitalAccountMoneyRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable); |
| | | return PageUtil.toPage(page.map(capitalAccountMoneyMapper::toDto)); |
| | | } |
| | | |
| | | @Override |
| | | public List<CapitalAccountMoneyDto> queryAll(CapitalAccountMoneyQueryCriteria criteria){ |
| | | return capitalAccountMoneyMapper.toDto(capitalAccountMoneyRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder))); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional |
| | | public CapitalAccountMoneyDto findById(Long id) { |
| | | CapitalAccountMoney capitalAccountMoney = capitalAccountMoneyRepository.findById(id).orElseGet(CapitalAccountMoney::new); |
| | | ValidationUtil.isNull(capitalAccountMoney.getId(),"CapitalAccountMoney","id",id); |
| | | return capitalAccountMoneyMapper.toDto(capitalAccountMoney); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public CapitalAccountMoneyDto create(CapitalAccountMoney resources) { |
| | | // 拷贝后校验 |
| | | copyAfterCheck(resources); |
| | | return capitalAccountMoneyMapper.toDto(capitalAccountMoneyRepository.save(resources)); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void update(CapitalAccountMoney resources) { |
| | | CapitalAccountMoney capitalAccountMoney = capitalAccountMoneyRepository.findById(resources.getId()).orElseGet(CapitalAccountMoney::new); |
| | | ValidationUtil.isNull( capitalAccountMoney.getId(),"CapitalAccountMoney","id",resources.getId()); |
| | | // 拷贝前校验 |
| | | copyBeforeCheck(capitalAccountMoney); |
| | | capitalAccountMoney.copy(resources); |
| | | // 拷贝后校验 |
| | | copyAfterCheck(capitalAccountMoney); |
| | | capitalAccountMoneyRepository.save(capitalAccountMoney); |
| | | } |
| | | |
| | | @Override |
| | | public void deleteAll(Long[] ids) { |
| | | for (Long id : ids) { |
| | | capitalAccountMoneyRepository.deleteById(id); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public void download(List<CapitalAccountMoneyDto> all, HttpServletResponse response) throws IOException { |
| | | List<Map<String, Object>> list = new ArrayList<>(); |
| | | for (CapitalAccountMoneyDto capitalAccountMoney : all) { |
| | | Map<String,Object> map = new LinkedHashMap<>(); |
| | | map.put("账户名称", capitalAccountMoney.getAccountName()); |
| | | map.put("账户年度", capitalAccountMoney.getAccountYear()); |
| | | map.put("期初金额", capitalAccountMoney.getOpeningAmount()); |
| | | map.put("警戒金额", capitalAccountMoney.getWarnAmount()); |
| | | map.put("账户金额", capitalAccountMoney.getAccountAmount()); |
| | | map.put("结算状态", capitalAccountMoney.getSettlementStatus()); |
| | | map.put("备注", capitalAccountMoney.getRemarks()); |
| | | map.put("创建者", capitalAccountMoney.getCreateBy()); |
| | | map.put("创建时间", capitalAccountMoney.getCreateTime()); |
| | | map.put("更新者", capitalAccountMoney.getUpdateBy()); |
| | | map.put("更新时间", capitalAccountMoney.getUpdateTime()); |
| | | list.add(map); |
| | | } |
| | | FileUtil.downloadExcel(list, response); |
| | | } |
| | | |
| | | /** |
| | | * 拷贝前校验 |
| | | * @param resources |
| | | */ |
| | | private void copyBeforeCheck(CapitalAccountMoney resources) { |
| | | // 判断结算状态 |
| | | if (Constant.SETTLEMENT_STATUS_SETTLED.equals(resources.getSettlementStatus())) { |
| | | throw new BadRequestException("已结算的现金流账户无法进行修改!"); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 拷贝后校验 |
| | | * @param resources |
| | | */ |
| | | private void copyAfterCheck(CapitalAccountMoney resources) { |
| | | // 根据账户年度查询 |
| | | List<CapitalAccountMoney> capitalAccountMoneyList = capitalAccountMoneyRepository.findByAccountYear(resources.getAccountYear()); |
| | | // 判断结果集长度 |
| | | if (capitalAccountMoneyList.size() > 1) { |
| | | throw new BadRequestException("每个年度只能有一个现金流账户!"); |
| | | } else if (capitalAccountMoneyList.size() == 1) { |
| | | if (resources.getId() == null || capitalAccountMoneyList.get(0).getId().longValue() != resources.getId().longValue()) { |
| | | throw new BadRequestException("每个年度只能有一个现金流账户!"); |
| | | } |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 关联年度资金现金流账户 |
| | | * @return |
| | | */ |
| | | public CapitalAccountMoneyDto relevanceCapitalAccountMoney() { |
| | | // 当前系统时间 |
| | | Calendar calendar = Calendar.getInstance(); |
| | | // 年度资金账户(现金流)检索类 |
| | | CapitalAccountMoneyQueryCriteria criteria = new CapitalAccountMoneyQueryCriteria(); |
| | | criteria.setAccountYear(DateUtil.getYear(calendar)); |
| | | // 查询年度资金账户(现金流) |
| | | List<CapitalAccountMoneyDto> capitalAccountMoneyDtoList = capitalAccountMoneyMapper.toDto(capitalAccountMoneyRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder))); |
| | | // 判断年度资金账户(现金流) |
| | | if (capitalAccountMoneyDtoList.size() == 0) { |
| | | throw new BadRequestException("没有找到对应的年度资金现金流账户!"); |
| | | } else if (capitalAccountMoneyDtoList.size() > 1) { |
| | | throw new BadRequestException("找到多条对应的年度资金现金流账户!"); |
| | | } |
| | | return capitalAccountMoneyDtoList.get(0); |
| | | } |
| | | |
| | | /** |
| | | * 关联年度资金现金流账户(增加金额) |
| | | * @param capitalAccountMoneyDto |
| | | * @param amount |
| | | */ |
| | | public void relevanceCapitalAccountMoneyAdd(CapitalAccountMoneyDto capitalAccountMoneyDto, BigDecimal amount) { |
| | | // 账户金额 |
| | | BigDecimal accountAmount = capitalAccountMoneyDto.getAccountAmount(); |
| | | accountAmount = accountAmount.add(amount); |
| | | capitalAccountMoneyDto.setAccountAmount(accountAmount); |
| | | // 保存 |
| | | capitalAccountMoneyRepository.save(capitalAccountMoneyMapper.toEntity(capitalAccountMoneyDto)); |
| | | } |
| | | |
| | | /** |
| | | * 关联年度资金现金流账户(减少金额) |
| | | * @param capitalAccountMoneyDto |
| | | * @param amount |
| | | */ |
| | | public void relevanceCapitalAccountMoneySubtract(CapitalAccountMoneyDto capitalAccountMoneyDto, BigDecimal amount) { |
| | | // 账户金额 |
| | | BigDecimal accountAmount = capitalAccountMoneyDto.getAccountAmount(); |
| | | accountAmount = accountAmount.subtract(amount); |
| | | capitalAccountMoneyDto.setAccountAmount(accountAmount); |
| | | // 保存 |
| | | capitalAccountMoneyRepository.save(capitalAccountMoneyMapper.toEntity(capitalAccountMoneyDto)); |
| | | } |
| | | } |
| 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.capital.service.mapstruct; |
| | | |
| | | import me.zhengjie.base.BaseMapper; |
| | | import me.zhengjie.modules.capital.domain.CapitalAccountCompany; |
| | | import me.zhengjie.modules.capital.service.dto.CapitalAccountCompanyDto; |
| | | import org.mapstruct.Mapper; |
| | | import org.mapstruct.ReportingPolicy; |
| | | |
| | | /** |
| | | * @website https://eladmin.vip |
| | | * @author 赵士淞 |
| | | * @date 2023-04-12 |
| | | **/ |
| | | @Mapper(componentModel = "spring", unmappedTargetPolicy = ReportingPolicy.IGNORE) |
| | | public interface CapitalAccountCompanyMapper extends BaseMapper<CapitalAccountCompanyDto, CapitalAccountCompany> { |
| | | |
| | | } |
| 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.capital.service.mapstruct; |
| | | |
| | | import me.zhengjie.base.BaseMapper; |
| | | import me.zhengjie.modules.capital.domain.CapitalAccountCompanySet; |
| | | import me.zhengjie.modules.capital.service.dto.CapitalAccountCompanySetDto; |
| | | import org.mapstruct.Mapper; |
| | | import org.mapstruct.ReportingPolicy; |
| | | |
| | | /** |
| | | * @website https://eladmin.vip |
| | | * @author 赵士淞 |
| | | * @date 2023-04-12 |
| | | **/ |
| | | @Mapper(componentModel = "spring", unmappedTargetPolicy = ReportingPolicy.IGNORE) |
| | | public interface CapitalAccountCompanySetMapper extends BaseMapper<CapitalAccountCompanySetDto, CapitalAccountCompanySet> { |
| | | |
| | | } |
| 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.capital.service.mapstruct; |
| | | |
| | | import me.zhengjie.base.BaseMapper; |
| | | import me.zhengjie.modules.capital.domain.CapitalAccountMoney; |
| | | import me.zhengjie.modules.capital.service.dto.CapitalAccountMoneyDto; |
| | | import org.mapstruct.Mapper; |
| | | import org.mapstruct.ReportingPolicy; |
| | | |
| | | /** |
| | | * @website https://eladmin.vip |
| | | * @author 赵士淞 |
| | | * @date 2023-04-12 |
| | | **/ |
| | | @Mapper(componentModel = "spring", unmappedTargetPolicy = ReportingPolicy.IGNORE) |
| | | public interface CapitalAccountMoneyMapper extends BaseMapper<CapitalAccountMoneyDto, CapitalAccountMoney> { |
| | | |
| | | } |
| | |
| | | @ApiModelProperty(value = "流水年月") |
| | | private Timestamp flowYearMonth; |
| | | |
| | | @Column(name = "`company_id`",nullable = false) |
| | | @Column(name = "`account_company_id`",nullable = false) |
| | | @NotNull |
| | | @ApiModelProperty(value = "所属公司") |
| | | private Long companyId; |
| | | @ApiModelProperty(value = "年度账户ID") |
| | | private Long accountCompanyId; |
| | | |
| | | @Column(name = "`remarks`") |
| | | @ApiModelProperty(value = "备注") |
| | |
| | | public interface CapitalFlowRepository extends JpaRepository<CapitalFlow, Long>, JpaSpecificationExecutor<CapitalFlow> { |
| | | |
| | | /** |
| | | * 根据日期,公司id查询 |
| | | * 根据日期,年度账号id查询 |
| | | * @param yearMonth |
| | | * @param companyId |
| | | * @param accountCompanyId |
| | | * @return |
| | | */ |
| | | @Query |
| | | CapitalFlow findByFlowYearMonthAndCompanyId(Timestamp yearMonth, Long companyId); |
| | | CapitalFlow findByFlowYearMonthAndAccountCompanyId(Timestamp yearMonth, Long accountCompanyId); |
| | | } |
| | |
| | | import me.zhengjie.modules.capitalFlow.service.dto.CapitalFlowExpendDto; |
| | | import me.zhengjie.modules.capitalFlow.service.dto.CapitalFlowExpendQueryCriteria; |
| | | import org.springframework.data.domain.Pageable; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.util.Map; |
| | | import java.util.List; |
| | | import java.io.IOException; |
| | |
| | | * @throws IOException / |
| | | */ |
| | | void download(List<CapitalFlowExpendDto> all, HttpServletResponse response) throws IOException; |
| | | |
| | | /** |
| | | * 关联创建 |
| | | * @param accountType |
| | | * @param title |
| | | * @param amount |
| | | */ |
| | | void flowableCreate(String accountType, String title, BigDecimal amount); |
| | | |
| | | /** |
| | | * 关联删除 |
| | | * @param accountType |
| | | * @param title |
| | | * @param amount |
| | | */ |
| | | void flowableDelete(String accountType, String title, BigDecimal amount); |
| | | } |
| | |
| | | /** 流水年月 */ |
| | | private Timestamp flowYearMonth; |
| | | |
| | | /** 所属公司 */ |
| | | private Long companyId; |
| | | /** 年度账户ID */ |
| | | private Long accountCompanyId; |
| | | |
| | | /** 备注 */ |
| | | private String remarks; |
| | | |
| | | /** 公司名称 */ |
| | | private String companyName; |
| | | /** 年度账户名称 */ |
| | | private String accountCompanyName; |
| | | |
| | | /** 流水支出 */ |
| | | private List<CapitalFlowExpend> capitalFlowExpends; |
| | |
| | | |
| | | /** 精确 */ |
| | | @Query |
| | | private Long companyId; |
| | | private Long accountCompanyId; |
| | | } |
| | |
| | | */ |
| | | package me.zhengjie.modules.capitalFlow.service.impl; |
| | | |
| | | import me.zhengjie.modules.capital.service.dto.CapitalAccountCompanyDto; |
| | | import me.zhengjie.modules.capital.service.dto.CapitalAccountMoneyDto; |
| | | import me.zhengjie.modules.capital.service.impl.CapitalAccountCompanyServiceImpl; |
| | | import me.zhengjie.modules.capital.service.impl.CapitalAccountMoneyServiceImpl; |
| | | 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 me.zhengjie.utils.*; |
| | | import lombok.RequiredArgsConstructor; |
| | | import me.zhengjie.modules.capitalFlow.repository.CapitalFlowExpendRepository; |
| | | import me.zhengjie.modules.capitalFlow.service.CapitalFlowExpendService; |
| | |
| | | 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.math.BigDecimal; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.*; |
| | | import java.io.IOException; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.util.ArrayList; |
| | | import java.util.LinkedHashMap; |
| | | import java.util.function.Function; |
| | | |
| | | /** |
| | |
| | | private final CapitalFlowExpendRepository capitalFlowExpendRepository; |
| | | private final CapitalFlowExpendMapper capitalFlowExpendMapper; |
| | | private final CapitalFlowServiceImpl capitalFlowServiceImpl; |
| | | private final SysCompanyServiceImpl sysCompanyServiceImpl; |
| | | private final CapitalAccountMoneyServiceImpl capitalAccountMoneyServiceImpl; |
| | | private final CapitalAccountCompanyServiceImpl capitalAccountCompanyServiceImpl; |
| | | |
| | | @Override |
| | | public Map<String,Object> queryAll(CapitalFlowExpendQueryCriteria criteria, Pageable pageable){ |
| | |
| | | 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(); |
| | | // 查询年度账号数据 |
| | | CapitalAccountCompanyDto capitalAccountCompanyDto = capitalAccountCompanyServiceImpl.findById(capitalFlowDto.getAccountCompanyId()); |
| | | return new SimpleDateFormat("yyyy-MM").format(capitalFlowDto.getFlowYearMonth()) + " - " + capitalAccountCompanyDto.getAccountName(); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void flowableCreate(String accountType, String title, BigDecimal amount) { |
| | | // 关联年度资金现金流账户 |
| | | CapitalAccountMoneyDto capitalAccountMoneyDto = capitalAccountMoneyServiceImpl.relevanceCapitalAccountMoney(); |
| | | // 关联年度资金现金流账户(减少金额) |
| | | capitalAccountMoneyServiceImpl.relevanceCapitalAccountMoneySubtract(capitalAccountMoneyDto, amount); |
| | | // 关联年度资金公司流账户 |
| | | CapitalAccountCompanyDto capitalAccountCompanyDto = capitalAccountCompanyServiceImpl.relevanceCapitalAccountCompany(accountType); |
| | | // 关联年度资金公司流账户(减少金额) |
| | | capitalAccountCompanyServiceImpl.relevanceCapitalAccountCompanySubtract(capitalAccountCompanyDto, amount); |
| | | // 关联月度资金公司流账户 |
| | | CapitalFlowDto capitalFlowDto = capitalFlowServiceImpl.relevanceCapitalFlow(capitalAccountCompanyDto.getId()); |
| | | // 关联资金流水支出(增加金额) |
| | | relevanceCapitalFlowExpendAdd(capitalFlowDto.getId(), title, amount); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void flowableDelete(String accountType, String title, BigDecimal amount) { |
| | | // 关联年度资金现金流账户 |
| | | CapitalAccountMoneyDto capitalAccountMoneyDto = capitalAccountMoneyServiceImpl.relevanceCapitalAccountMoney(); |
| | | // 关联年度资金现金流账户(增加金额) |
| | | capitalAccountMoneyServiceImpl.relevanceCapitalAccountMoneyAdd(capitalAccountMoneyDto, amount); |
| | | // 关联年度资金公司流账户 |
| | | CapitalAccountCompanyDto capitalAccountCompanyDto = capitalAccountCompanyServiceImpl.relevanceCapitalAccountCompany(accountType); |
| | | // 关联年度资金公司流账户(增加金额) |
| | | capitalAccountCompanyServiceImpl.relevanceCapitalAccountCompanyAdd(capitalAccountCompanyDto, amount); |
| | | // 关联月度资金公司流账户 |
| | | CapitalFlowDto capitalFlowDto = capitalFlowServiceImpl.relevanceCapitalFlow(capitalAccountCompanyDto.getId()); |
| | | // 关联资金流水支出(减少金额) |
| | | relevanceCapitalFlowExpendSubtract(capitalFlowDto.getId(), title, amount); |
| | | } |
| | | |
| | | /** |
| | | * 关联资金流水支出(增加金额) |
| | | * @param capitalFlowId |
| | | * @param title |
| | | * @param amount |
| | | */ |
| | | public void relevanceCapitalFlowExpendAdd(Long capitalFlowId, String title, BigDecimal amount) { |
| | | // 临时金额 |
| | | BigDecimal tempAmount = new BigDecimal(0); |
| | | tempAmount = tempAmount.add(amount); |
| | | // 流水支出实体类 |
| | | CapitalFlowExpend capitalFlowExpend = new CapitalFlowExpend(); |
| | | capitalFlowExpend.setFlowId(capitalFlowId); |
| | | capitalFlowExpend.setTitle(title); |
| | | capitalFlowExpend.setAmount(tempAmount); |
| | | // 保存 |
| | | capitalFlowExpendRepository.save(capitalFlowExpend); |
| | | } |
| | | |
| | | /** |
| | | * 关联资金流水支出(减少金额) |
| | | * @param capitalFlowId |
| | | * @param title |
| | | * @param amount |
| | | */ |
| | | public void relevanceCapitalFlowExpendSubtract(Long capitalFlowId, String title, BigDecimal amount) { |
| | | // 临时金额 |
| | | BigDecimal tempAmount = new BigDecimal(0); |
| | | tempAmount = tempAmount.subtract(amount); |
| | | // 流水支出实体类 |
| | | CapitalFlowExpend capitalFlowExpend = new CapitalFlowExpend(); |
| | | capitalFlowExpend.setFlowId(capitalFlowId); |
| | | capitalFlowExpend.setTitle(title); |
| | | capitalFlowExpend.setAmount(tempAmount); |
| | | // 保存 |
| | | capitalFlowExpendRepository.save(capitalFlowExpend); |
| | | } |
| | | } |
| | |
| | | */ |
| | | package me.zhengjie.modules.capitalFlow.service.impl; |
| | | |
| | | import me.zhengjie.modules.capital.service.dto.CapitalAccountCompanyDto; |
| | | import me.zhengjie.modules.capital.service.impl.CapitalAccountCompanyServiceImpl; |
| | | import me.zhengjie.modules.capitalFlow.domain.CapitalFlowIncome; |
| | | import me.zhengjie.modules.capitalFlow.service.dto.CapitalFlowDto; |
| | | import me.zhengjie.modules.system.service.dto.SysCompanyDto; |
| | |
| | | private final CapitalFlowIncomeRepository capitalFlowIncomeRepository; |
| | | private final CapitalFlowIncomeMapper capitalFlowIncomeMapper; |
| | | private final CapitalFlowServiceImpl capitalFlowServiceImpl; |
| | | private final SysCompanyServiceImpl sysCompanyServiceImpl; |
| | | private final CapitalAccountCompanyServiceImpl capitalAccountCompanyServiceImpl; |
| | | |
| | | @Override |
| | | public Map<String,Object> queryAll(CapitalFlowIncomeQueryCriteria criteria, Pageable pageable){ |
| | |
| | | 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(); |
| | | // 查询年度账户数据 |
| | | CapitalAccountCompanyDto capitalAccountCompanyDto = capitalAccountCompanyServiceImpl.findById(capitalFlowDto.getAccountCompanyId()); |
| | | return new SimpleDateFormat("yyyy-MM").format(capitalFlowDto.getFlowYearMonth()) + " - " + capitalAccountCompanyDto.getAccountName(); |
| | | } |
| | | } |
| | |
| | | package me.zhengjie.modules.capitalFlow.service.impl; |
| | | |
| | | import me.zhengjie.exception.BadRequestException; |
| | | import me.zhengjie.modules.capital.service.CapitalAccountCompanyService; |
| | | import me.zhengjie.modules.capital.service.dto.CapitalAccountCompanyDto; |
| | | import me.zhengjie.modules.capitalFlow.domain.CapitalFlow; |
| | | import me.zhengjie.modules.capitalFlow.domain.CapitalFlowExpend; |
| | | import me.zhengjie.modules.capitalFlow.domain.CapitalFlowIncome; |
| | | import me.zhengjie.modules.capitalFlow.repository.CapitalFlowExpendRepository; |
| | | import me.zhengjie.modules.capitalFlow.repository.CapitalFlowIncomeRepository; |
| | | import me.zhengjie.modules.quartz.service.impl.CapitalServiceImpl; |
| | | import me.zhengjie.modules.system.service.dto.SysCompanyDto; |
| | | import me.zhengjie.modules.system.service.impl.SysCompanyServiceImpl; |
| | | import me.zhengjie.utils.*; |
| | | import lombok.RequiredArgsConstructor; |
| | | import me.zhengjie.modules.capitalFlow.repository.CapitalFlowRepository; |
| | |
| | | |
| | | private final CapitalFlowRepository capitalFlowRepository; |
| | | private final CapitalFlowMapper capitalFlowMapper; |
| | | private final SysCompanyServiceImpl sysCompanyServiceImpl; |
| | | private final CapitalFlowExpendRepository capitalFlowExpendRepository; |
| | | private final CapitalFlowIncomeRepository capitalFlowIncomeRepository; |
| | | private final CapitalServiceImpl capitalService; |
| | | private final CapitalAccountCompanyService capitalAccountCompanyService; |
| | | |
| | | @Override |
| | | public Map<String,Object> queryAll(CapitalFlowQueryCriteria criteria, Pageable pageable){ |
| | |
| | | public CapitalFlowDto apply(CapitalFlow t) { |
| | | // 将实体类转换成DTO |
| | | CapitalFlowDto capitalFlowDto = capitalFlowMapper.toDto(t); |
| | | // 公司名称 |
| | | capitalFlowDto.setCompanyName(companyName(t)); |
| | | // 年度账户名称 |
| | | capitalFlowDto.setAccountCompanyName(accountCompanyName(t)); |
| | | // 流水支出 |
| | | capitalFlowDto.setCapitalFlowExpends(capitalFlowExpendRepository.findByFlowId(t.getId())); |
| | | // 流水支出金额 |
| | |
| | | // 资金流水 |
| | | CapitalFlowDto capitalFlowDto = capitalFlowDtoList.get(i); |
| | | // DTO赋值 |
| | | capitalFlowDto.setCompanyName(companyName(capitalFlowMapper.toEntity(capitalFlowDto))); |
| | | capitalFlowDto.setAccountCompanyName(accountCompanyName(capitalFlowMapper.toEntity(capitalFlowDto))); |
| | | } |
| | | return capitalFlowDtoList; |
| | | } |
| | |
| | | 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)); |
| | | String accountCompanyName = accountCompanyName(capitalFlowMapper.toEntity(capitalFlow)); |
| | | Map<String,Object> map = new LinkedHashMap<>(); |
| | | map.put("流水年月", capitalFlow.getFlowYearMonth()); |
| | | map.put("所属公司", companyName); |
| | | map.put("所属年度账户", accountCompanyName); |
| | | map.put("备注", capitalFlow.getRemarks()); |
| | | map.put("创建者", capitalFlow.getCreateBy()); |
| | | map.put("创建时间", capitalFlow.getCreateTime()); |
| | |
| | | */ |
| | | @Override |
| | | public void generate(CapitalFlow resources) { |
| | | // 日历类 |
| | | Calendar cal = Calendar.getInstance(); |
| | | cal.add(Calendar.MONTH, -1); |
| | | if(resources.getFlowYearMonth().compareTo(cal.getTime()) > 0){ |
| | | throw new BadRequestException("只能更新上个月的流水记录"); |
| | | } |
| | | // // 日历类 |
| | | // Calendar cal = Calendar.getInstance(); |
| | | // cal.add(Calendar.MONTH, -1); |
| | | // if(resources.getFlowYearMonth().compareTo(cal.getTime()) > 0){ |
| | | // throw new BadRequestException("只能更新上个月的流水记录"); |
| | | // } |
| | | // 格式化日期 |
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); |
| | | // 目标年月 |
| | | String targetYearMonth = sdf.format(resources.getFlowYearMonth().getTime()); |
| | | capitalService.getCapitalInfo(resources.getCompanyId(), targetYearMonth); |
| | | capitalService.getCapitalInfo(resources.getAccountCompanyId(), targetYearMonth); |
| | | } |
| | | |
| | | /** |
| | | * 公司名称 |
| | | * 年度账户名称 |
| | | * @param resources |
| | | * @return |
| | | */ |
| | | private String companyName(CapitalFlow resources) { |
| | | private String accountCompanyName(CapitalFlow resources) { |
| | | // 查询公司数据 |
| | | SysCompanyDto sysCompanyDto = sysCompanyServiceImpl.findById(resources.getCompanyId()); |
| | | return sysCompanyDto.getLabel(); |
| | | CapitalAccountCompanyDto capitalAccountCompanyDto = capitalAccountCompanyService.findById(resources.getAccountCompanyId()); |
| | | return capitalAccountCompanyDto.getAccountName(); |
| | | } |
| | | |
| | | /** |
| | | * 关联月度资金公司流账户 |
| | | * @return |
| | | */ |
| | | public CapitalFlowDto relevanceCapitalFlow(Long accountCompanyId) { |
| | | // 当前系统时间 |
| | | Calendar calendar = Calendar.getInstance(); |
| | | // 资金流水检索类 |
| | | CapitalFlowQueryCriteria criteria = new CapitalFlowQueryCriteria(); |
| | | criteria.setAccountCompanyId(accountCompanyId); |
| | | criteria.setFlowYearMonth(DateUtil.getYearMonth(calendar)); |
| | | // 查询资金流水 |
| | | List<CapitalFlowDto> capitalFlowDtoList = capitalFlowMapper.toDto(capitalFlowRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder)));; |
| | | // 判断资金流水 |
| | | if (capitalFlowDtoList.size() == 0) { |
| | | throw new BadRequestException("没有找到对应的月度资金公司流账户!"); |
| | | } else if (capitalFlowDtoList.size() > 1) { |
| | | throw new BadRequestException("找到多条对应的月度资金公司流账户!"); |
| | | } |
| | | return capitalFlowDtoList.get(0); |
| | | } |
| | | } |
| | |
| | | public static final Long ROLE_LEVEL_LEADER = 4L; |
| | | // 角色级别:普通员工 |
| | | public static final Long ROLE_LEVEL_ORDINARY = 5L; |
| | | // 角色级别:设备管理员 |
| | | public static final Long ROLE_LEVEL_DEVICE = 6L; |
| | | // 角色级别:财务管理员 |
| | | public static final Long ROLE_LEVEL_FINANCE = 7L; |
| | | |
| | | // 日期类型 |
| | | public static final String DATE_TYPE = "date_type"; |
| | |
| | | public static final String ASSET_FLOW_EXPEND_L = "流动资产支出"; |
| | | public static final String CONTRACT_EXPENSES = "合同费用支出"; |
| | | public static final String CONTRACT_EXPENSES_S = "合同费用收入"; |
| | | |
| | | // 账户类型 |
| | | public static final String ACCOUNT_TYPE = "account_type"; |
| | | // 账户类型:起源 |
| | | public static final String ACCOUNT_TYPE_QIYUAN = "account_type_qiyuan"; |
| | | // 账户类型:以恒 |
| | | public static final String ACCOUNT_TYPE_YIHENG = "account_type_yiheng"; |
| | | // 账户类型:咨询 |
| | | public static final String ACCOUNT_TYPE_ZIXUN = "account_type_zixun"; |
| | | // 账户类型:恒臻 |
| | | public static final String ACCOUNT_TYPE_HENGZHEN = "account_type_hengzhen"; |
| | | |
| | | // 费用类型 |
| | | public static final String EXPENSE_TYPE = "expense_type"; |
| | | // 费用类型:差旅补助 |
| | | public static final String EXPENSE_TYPE_TRAVEL_SUBSIDIES = "expense_type_travel_subsidies"; |
| | | // 费用类型:客户关系 |
| | | public static final String EXPENSE_TYPE_CUSTOMER_RELATIONSHIP = "expense_type_customer_relationship"; |
| | | } |
| | |
| | | @Query(propName = "id", type = Query.Type.IN) |
| | | private List<Long> idInList; |
| | | |
| | | /** 精确 */ |
| | | @Query(type = Query.Type.NOT_EQUAL, propName = "projectStatus") |
| | | private String projectStatusNotEqual; |
| | | |
| | | private Long taskUserId; |
| | | |
| | | private String targetYear; |
| | |
| | | } |
| | | // 项目检索条件 |
| | | criteria.setIdInList(partakeProjectIds); |
| | | criteria.setProjectStatusNotEqual(Constant.PROJECT_STATUS_COMPLETED); |
| | | return projectMapper.toDto(projectRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder))); |
| | | } |
| | | |
| | |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import me.zhengjie.modules.assetManagement.domain.AssetManagement; |
| | | import me.zhengjie.modules.assetManagement.repository.AssetManagementRepository; |
| | | import me.zhengjie.modules.capital.domain.CapitalAccountCompany; |
| | | import me.zhengjie.modules.capital.repository.CapitalAccountCompanyRepository; |
| | | import me.zhengjie.modules.capitalFlow.domain.CapitalFlow; |
| | | import me.zhengjie.modules.capitalFlow.domain.CapitalFlowExpend; |
| | | import me.zhengjie.modules.capitalFlow.domain.CapitalFlowIncome; |
| | |
| | | @RequiredArgsConstructor |
| | | public class CapitalServiceImpl{ |
| | | |
| | | private final SysCompanyRepository sysCompanyRepository; |
| | | private final CapitalAccountCompanyRepository capitalAccountCompanyRepository; |
| | | private final UserService userService; |
| | | private final SalaryRepository salaryRepository; |
| | | private final AssetManagementRepository assetManagementRepository; |
| | |
| | | |
| | | /** |
| | | * 向资金流水和流水指出添加数据 |
| | | * @param companyId |
| | | * @param accountCompanyId |
| | | * @param targetYearMonth |
| | | */ |
| | | public void getCapitalInfo(Long companyId, String targetYearMonth){ |
| | | // 判断公司Id是否为空 |
| | | if(companyId != null){ |
| | | // 单个公司流水 |
| | | singleCompanyFlow(companyId, targetYearMonth); |
| | | public void getCapitalInfo(Long accountCompanyId, String targetYearMonth){ |
| | | // 判断年度账号Id是否为空 |
| | | if(accountCompanyId != null){ |
| | | // 单个年度账号流水 |
| | | singleAccountCompanyFlow(accountCompanyId, targetYearMonth); |
| | | }else{ |
| | | // 查询所有公司 |
| | | List<SysCompany> companyList = sysCompanyRepository.findAll(); |
| | | for(int i = 0; i < companyList.size(); i++){ |
| | | // 查询所有年度账号 |
| | | List<CapitalAccountCompany> capitalAccountCompanyList = capitalAccountCompanyRepository.findAll(); |
| | | for(int i = 0; i < capitalAccountCompanyList.size(); i++){ |
| | | try { |
| | | // 单个公司流水 |
| | | singleCompanyFlow(companyList.get(i).getId(), targetYearMonth); |
| | | // 单个年度账号流水 |
| | | singleAccountCompanyFlow(capitalAccountCompanyList.get(i).getId(), targetYearMonth); |
| | | }catch (Exception e){ |
| | | // 跳过本次循环 |
| | | continue; |
| | |
| | | } |
| | | |
| | | /** |
| | | * 单个公司流水 |
| | | * @param companyId |
| | | * 单个年度账号流水 |
| | | * @param accountCompanyId |
| | | * @param targetYearMonth |
| | | */ |
| | | public void singleCompanyFlow(Long companyId, String targetYearMonth){ |
| | | public void singleAccountCompanyFlow(Long accountCompanyId, String targetYearMonth){ |
| | | // 日历类 |
| | | Calendar cal = Calendar.getInstance(); |
| | | // 设置年份 |
| | |
| | | cal.set(Calendar.MILLISECOND, 0); |
| | | |
| | | // 查询资金流水 |
| | | CapitalFlow capitalFlow = capitalFlowRepository.findByFlowYearMonthAndCompanyId(new Timestamp(cal.getTime().getTime()), companyId); |
| | | CapitalFlow capitalFlow = capitalFlowRepository.findByFlowYearMonthAndAccountCompanyId(new Timestamp(cal.getTime().getTime()), accountCompanyId); |
| | | // 判断是否为空 |
| | | if(ObjectUtils.isEmpty(capitalFlow)){ |
| | | capitalFlow = new CapitalFlow(); |
| | | } |
| | | capitalFlow.setFlowYearMonth(new Timestamp(cal.getTime().getTime())); |
| | | capitalFlow.setCompanyId(companyId); |
| | | capitalFlow.setAccountCompanyId(accountCompanyId); |
| | | // 资金流水管理添加 |
| | | capitalFlowRepository.save(capitalFlow); |
| | | |
| | |
| | | capitalFlowIncomeRepository.delete(capitalFlowIncomes.get(i)); |
| | | } |
| | | |
| | | // 工资支出总金额 |
| | | Double totalWageExpenditure = 0.0; |
| | | // 用户检索类 |
| | | UserQueryCriteria userQueryCriteria = new UserQueryCriteria(); |
| | | userQueryCriteria.setEnabled(true); |
| | | // 获取用户列表 |
| | | List<UserDto> userDtoList = userService.queryAll(userQueryCriteria); |
| | | for(int i = 0; i < userDtoList.size(); i++){ |
| | | // 判断员工是否属于当前公司 |
| | | if(userDtoList.get(i).getCompanyId().equals(companyId)){ |
| | | // 根据日期和员工查询工资条 |
| | | List<Salary> salaryList = salaryRepository.findByUserIdAndSalaryYearMonth(userDtoList.get(i).getId(), new Timestamp(cal.getTime().getTime())); |
| | | for(int i1 = 0; i1 < salaryList.size(); i1++){ |
| | | totalWageExpenditure = totalWageExpenditure + Double.valueOf(salaryList.get(i1).getPreTaxAmount().toString()); |
| | | } |
| | | } |
| | | } |
| | | // 工资支出总金额不为0的话就往流水支出管理添加数据 |
| | | if(!totalWageExpenditure.equals(0.0)){ |
| | | // 调用方法添加 |
| | | saveCapitalFlowExpend(capitalFlow.getId(),totalWageExpenditure, Constant.DAILY_PAYROLL_EXPEND); |
| | | } |
| | | // // 工资支出总金额 |
| | | // Double totalWageExpenditure = 0.0; |
| | | // // 用户检索类 |
| | | // UserQueryCriteria userQueryCriteria = new UserQueryCriteria(); |
| | | // userQueryCriteria.setEnabled(true); |
| | | // // 获取用户列表 |
| | | // List<UserDto> userDtoList = userService.queryAll(userQueryCriteria); |
| | | // for(int i = 0; i < userDtoList.size(); i++){ |
| | | // // 判断员工是否属于当前公司 |
| | | // if(userDtoList.get(i).getCompanyId().equals(companyId)){ |
| | | // // 根据日期和员工查询工资条 |
| | | // List<Salary> salaryList = salaryRepository.findByUserIdAndSalaryYearMonth(userDtoList.get(i).getId(), new Timestamp(cal.getTime().getTime())); |
| | | // for(int i1 = 0; i1 < salaryList.size(); i1++){ |
| | | // totalWageExpenditure = totalWageExpenditure + Double.valueOf(salaryList.get(i1).getPreTaxAmount().toString()); |
| | | // } |
| | | // } |
| | | // } |
| | | // // 工资支出总金额不为0的话就往流水支出管理添加数据 |
| | | // if(!totalWageExpenditure.equals(0.0)){ |
| | | // // 调用方法添加 |
| | | // saveCapitalFlowExpend(capitalFlow.getId(),totalWageExpenditure, Constant.DAILY_PAYROLL_EXPEND); |
| | | // } |
| | | |
| | | |
| | | // 资产支出总金额(固定) |
| | | Double totalAssetsExpenditureFixed = 0.0; |
| | | // 根据日期和公司查询固定资产 |
| | | List<AssetManagement> assetManagementList = assetManagementRepository.findByDateAndCompany(targetYearMonth.substring(0,7), companyId, Constant.ACCET_TYPE_FIXED); |
| | | for(int i = 0; i < assetManagementList.size(); i++){ |
| | | totalAssetsExpenditureFixed = totalAssetsExpenditureFixed + Double.valueOf(assetManagementList.get(i).getBuyMoney().toString()); |
| | | } |
| | | // 固定资产支出总金额不为0的话就往流水支出管理添加数据 |
| | | if(!totalAssetsExpenditureFixed.equals(0.0)){ |
| | | // 调用方法添加 |
| | | saveCapitalFlowExpend(capitalFlow.getId(),totalAssetsExpenditureFixed, Constant.ASSET_FLOW_EXPEND_G); |
| | | } |
| | | // // 资产支出总金额(固定) |
| | | // Double totalAssetsExpenditureFixed = 0.0; |
| | | // // 根据日期和公司查询固定资产 |
| | | // List<AssetManagement> assetManagementList = assetManagementRepository.findByDateAndCompany(targetYearMonth.substring(0,7), companyId, Constant.ACCET_TYPE_FIXED); |
| | | // for(int i = 0; i < assetManagementList.size(); i++){ |
| | | // totalAssetsExpenditureFixed = totalAssetsExpenditureFixed + Double.valueOf(assetManagementList.get(i).getBuyMoney().toString()); |
| | | // } |
| | | // // 固定资产支出总金额不为0的话就往流水支出管理添加数据 |
| | | // if(!totalAssetsExpenditureFixed.equals(0.0)){ |
| | | // // 调用方法添加 |
| | | // saveCapitalFlowExpend(capitalFlow.getId(),totalAssetsExpenditureFixed, Constant.ASSET_FLOW_EXPEND_G); |
| | | // } |
| | | |
| | | // 资产支出总金额(流动) |
| | | Double totalAssetsExpenditureFlow = 0.0; |
| | | // 根据日期和公司查询流动资产 |
| | | List<AssetManagement> assetManagementLists = assetManagementRepository.findByDateAndCompany(targetYearMonth.substring(0,7), companyId, Constant.ACCET_TYPE_FLOW); |
| | | for(int i = 0; i < assetManagementLists.size(); i++){ |
| | | totalAssetsExpenditureFlow = totalAssetsExpenditureFlow + Double.valueOf(assetManagementLists.get(i).getBuyMoney().toString()); |
| | | } |
| | | // 流动资产支出总金额不为0的话就往流水支出管理添加数据 |
| | | if(!totalAssetsExpenditureFlow.equals(0.0)){ |
| | | // 调用方法添加 |
| | | saveCapitalFlowExpend(capitalFlow.getId(),totalAssetsExpenditureFlow, Constant.ASSET_FLOW_EXPEND_L); |
| | | } |
| | | // // 资产支出总金额(流动) |
| | | // Double totalAssetsExpenditureFlow = 0.0; |
| | | // // 根据日期和公司查询流动资产 |
| | | // List<AssetManagement> assetManagementLists = assetManagementRepository.findByDateAndCompany(targetYearMonth.substring(0,7), companyId, Constant.ACCET_TYPE_FLOW); |
| | | // for(int i = 0; i < assetManagementLists.size(); i++){ |
| | | // totalAssetsExpenditureFlow = totalAssetsExpenditureFlow + Double.valueOf(assetManagementLists.get(i).getBuyMoney().toString()); |
| | | // } |
| | | // // 流动资产支出总金额不为0的话就往流水支出管理添加数据 |
| | | // if(!totalAssetsExpenditureFlow.equals(0.0)){ |
| | | // // 调用方法添加 |
| | | // saveCapitalFlowExpend(capitalFlow.getId(),totalAssetsExpenditureFlow, Constant.ASSET_FLOW_EXPEND_L); |
| | | // } |
| | | |
| | | // 合同支出总金额 |
| | | Double contractExpenditure = 0.0; |
| | | // 根据日期和公司查询合同付款 |
| | | List<ContractPayment> contractPayments = contractPaymentRepository.findByDateAndCompany(targetYearMonth.substring(0,7), companyId, Constant.CONTRACR_EXPENDITURE); |
| | | for(int i = 0; i < contractPayments.size(); i++){ |
| | | contractExpenditure = contractExpenditure + Double.valueOf(contractPayments.get(i).getPaymentAmount().toString()); |
| | | } |
| | | // 合同支出总金额不为0的话就往流水支出管理添加数据 |
| | | if(!contractExpenditure.equals(0.0)){ |
| | | // 调用方法添加 |
| | | saveCapitalFlowExpend(capitalFlow.getId(),contractExpenditure, Constant.CONTRACT_EXPENSES); |
| | | } |
| | | // // 合同支出总金额 |
| | | // Double contractExpenditure = 0.0; |
| | | // // 根据日期和公司查询合同付款 |
| | | // List<ContractPayment> contractPayments = contractPaymentRepository.findByDateAndCompany(targetYearMonth.substring(0,7), companyId, Constant.CONTRACR_EXPENDITURE); |
| | | // for(int i = 0; i < contractPayments.size(); i++){ |
| | | // contractExpenditure = contractExpenditure + Double.valueOf(contractPayments.get(i).getPaymentAmount().toString()); |
| | | // } |
| | | // // 合同支出总金额不为0的话就往流水支出管理添加数据 |
| | | // if(!contractExpenditure.equals(0.0)){ |
| | | // // 调用方法添加 |
| | | // saveCapitalFlowExpend(capitalFlow.getId(),contractExpenditure, Constant.CONTRACT_EXPENSES); |
| | | // } |
| | | |
| | | // 合同收入总金额 |
| | | Double contractRevenue = 0.0; |
| | | // 根据日期和公司查询合同收入 |
| | | List<ContractPayment> contractPaymentList = contractPaymentRepository.findByDateAndCompany(targetYearMonth.substring(0,7), companyId, Constant.CONTRACR_REVENUE); |
| | | for(int i = 0; i < contractPaymentList.size(); i++){ |
| | | contractRevenue = contractRevenue + Double.valueOf(contractPaymentList.get(i).getPaymentAmount().toString()); |
| | | } |
| | | // 合同收入总金额不为0就往流水收入管理添加数据 |
| | | if(!contractRevenue.equals(0.0)){ |
| | | CapitalFlowIncome capitalFlowIncome = new CapitalFlowIncome(); |
| | | capitalFlowIncome.setFlowId(capitalFlow.getId()); |
| | | capitalFlowIncome.setAmount(new BigDecimal(contractRevenue)); |
| | | capitalFlowIncome.setTitle(Constant.CONTRACT_EXPENSES_S); |
| | | capitalFlowIncomeRepository.save(capitalFlowIncome); |
| | | } |
| | | // // 合同收入总金额 |
| | | // Double contractRevenue = 0.0; |
| | | // // 根据日期和公司查询合同收入 |
| | | // List<ContractPayment> contractPaymentList = contractPaymentRepository.findByDateAndCompany(targetYearMonth.substring(0,7), companyId, Constant.CONTRACR_REVENUE); |
| | | // for(int i = 0; i < contractPaymentList.size(); i++){ |
| | | // contractRevenue = contractRevenue + Double.valueOf(contractPaymentList.get(i).getPaymentAmount().toString()); |
| | | // } |
| | | // // 合同收入总金额不为0就往流水收入管理添加数据 |
| | | // if(!contractRevenue.equals(0.0)){ |
| | | // CapitalFlowIncome capitalFlowIncome = new CapitalFlowIncome(); |
| | | // capitalFlowIncome.setFlowId(capitalFlow.getId()); |
| | | // capitalFlowIncome.setAmount(new BigDecimal(contractRevenue)); |
| | | // capitalFlowIncome.setTitle(Constant.CONTRACT_EXPENSES_S); |
| | | // capitalFlowIncomeRepository.save(capitalFlowIncome); |
| | | // } |
| | | } |
| | | |
| | | |
| New file |
| | |
| | | package me.zhengjie.modules.quartz.task; |
| | | |
| | | import lombok.RequiredArgsConstructor; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import me.zhengjie.modules.capital.domain.CapitalAccountCompany; |
| | | import me.zhengjie.modules.capital.domain.CapitalAccountMoney; |
| | | import me.zhengjie.modules.capital.service.CapitalAccountCompanyService; |
| | | import me.zhengjie.modules.capital.service.CapitalAccountCompanySetService; |
| | | import me.zhengjie.modules.capital.service.CapitalAccountMoneyService; |
| | | import me.zhengjie.modules.capital.service.dto.CapitalAccountCompanySetDto; |
| | | import me.zhengjie.modules.capital.service.dto.CapitalAccountCompanySetQueryCriteria; |
| | | import me.zhengjie.modules.constant.Constant; |
| | | import me.zhengjie.modules.quartz.utils.DateTimeUtil; |
| | | import org.springframework.scheduling.annotation.Async; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.util.Calendar; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * 资金管理定时任务 |
| | | */ |
| | | @Slf4j |
| | | @Service |
| | | @RequiredArgsConstructor |
| | | @Async |
| | | public class CapitalTask { |
| | | |
| | | private final CapitalAccountMoneyService capitalAccountMoneyService; |
| | | private final CapitalAccountCompanyService capitalAccountCompanyService; |
| | | private final CapitalAccountCompanySetService capitalAccountCompanySetService; |
| | | |
| | | // 年度资金账户(现金流)创建 |
| | | public void accountMoneyCreate() { |
| | | // 日期类 |
| | | Calendar calendar = Calendar.getInstance(); |
| | | calendar.set(Calendar.MONTH, 0); |
| | | calendar.set(Calendar.DATE, 1); |
| | | calendar.set(Calendar.HOUR, 0); |
| | | calendar.set(Calendar.MINUTE, 0); |
| | | calendar.set(Calendar.SECOND, 0); |
| | | calendar.set(Calendar.MILLISECOND, 0); |
| | | // 年度资金账户(现金流)实体类 |
| | | CapitalAccountMoney resources = new CapitalAccountMoney(); |
| | | resources.setAccountName(calendar.get(Calendar.YEAR) + "年度现金池"); |
| | | resources.setAccountYear(DateTimeUtil.getTimestamp(calendar.getTime())); |
| | | resources.setOpeningAmount(new BigDecimal(0)); |
| | | resources.setWarnAmount(new BigDecimal(0)); |
| | | resources.setAccountAmount(new BigDecimal(0)); |
| | | resources.setSettlementStatus(Constant.SETTLEMENT_STATUS_UNSETTLED); |
| | | // 创建年度资金账户(现金流) |
| | | capitalAccountMoneyService.create(resources); |
| | | } |
| | | |
| | | // 年度资金账户(公司流)创建 |
| | | public void accountCompanyCreate() { |
| | | // 日期类 |
| | | Calendar calendar = Calendar.getInstance(); |
| | | calendar.set(Calendar.MONTH, 0); |
| | | calendar.set(Calendar.DATE, 1); |
| | | calendar.set(Calendar.HOUR, 0); |
| | | calendar.set(Calendar.MINUTE, 0); |
| | | calendar.set(Calendar.SECOND, 0); |
| | | calendar.set(Calendar.MILLISECOND, 0); |
| | | // 获取年度资金账户(公司流)设定 |
| | | List<CapitalAccountCompanySetDto> capitalAccountCompanySetDtoList = capitalAccountCompanySetService.queryAll(new CapitalAccountCompanySetQueryCriteria()); |
| | | // 循环年度资金账户(公司流)设定 |
| | | for (CapitalAccountCompanySetDto capitalAccountCompanySetDto : capitalAccountCompanySetDtoList) { |
| | | // 年度资金账户(公司流)实体类 |
| | | CapitalAccountCompany resources = new CapitalAccountCompany(); |
| | | resources.setProjectDistinguish(capitalAccountCompanySetDto.getProjectDistinguish()); |
| | | resources.setAccountType(capitalAccountCompanySetDto.getAccountType()); |
| | | resources.setAccountName(calendar.get(Calendar.YEAR) + "年度" + capitalAccountCompanySetDto.getAccountName()); |
| | | resources.setAccountYear(DateTimeUtil.getTimestamp(calendar.getTime())); |
| | | resources.setOpeningAmount(new BigDecimal(0)); |
| | | resources.setWarnAmount(new BigDecimal(0)); |
| | | resources.setAccountAmount(new BigDecimal(0)); |
| | | resources.setSettlementStatus(Constant.SETTLEMENT_STATUS_UNSETTLED); |
| | | // 创建年度资金账户(公司流) |
| | | capitalAccountCompanyService.create(resources); |
| | | } |
| | | } |
| | | } |
| | |
| | | @ApiModelProperty(value = "开启提醒(提醒时间)") |
| | | private Timestamp openingTime; |
| | | |
| | | @Column(name = "`business_plan_id`",nullable = false) |
| | | @NotNull |
| | | @ApiModelProperty(value = "营业计划ID") |
| | | private Long businessPlanId; |
| | | |
| | | @Column(name = "`place`",nullable = false) |
| | | @NotBlank |
| | | @ApiModelProperty(value = "地点") |
| | | private String place; |
| | | |
| | | @Column(name = "`introducer`") |
| | | @ApiModelProperty(value = "介绍人") |
| | | private String introducer; |
| | | |
| | | @Column(name = "`remarks`") |
| | | @ApiModelProperty(value = "备注") |
| | | private String remarks; |
| | |
| | | Role findByName(String name); |
| | | |
| | | /** |
| | | * 根据等级查询 |
| | | * @param level / |
| | | * @return / |
| | | */ |
| | | Role findByLevel(Integer level); |
| | | |
| | | /** |
| | | * 删除多个角色 |
| | | * @param ids / |
| | | */ |
| | |
| | | /** 开启提醒(提醒时间) */ |
| | | private Timestamp openingTime; |
| | | |
| | | /** 营业计划ID */ |
| | | private Long businessPlanId; |
| | | |
| | | /** 地点 */ |
| | | private String place; |
| | | |
| | | /** 介绍人 */ |
| | | private String introducer; |
| | | |
| | | /** 备注 */ |
| | | private String remarks; |
| | | |
| | | /** 营业计划内容 */ |
| | | private String businessPlanContent; |
| | | } |
| | |
| | | //分类 |
| | | @Query(type = Query.Type.INNER_LIKE, propName = "classification") |
| | | private String classification; |
| | | |
| | | // 营业计划ID |
| | | @Query(propName = "businessPlanId") |
| | | private Long businessPlanId; |
| | | |
| | | // 地点 |
| | | @Query(type = Query.Type.INNER_LIKE, propName = "place") |
| | | private String place; |
| | | } |
| | |
| | | */ |
| | | package me.zhengjie.modules.system.service.impl; |
| | | |
| | | import me.zhengjie.modules.business.service.BusinessPlanService; |
| | | import me.zhengjie.modules.business.service.dto.BusinessPlanDto; |
| | | import me.zhengjie.modules.constant.Constant; |
| | | import me.zhengjie.modules.quartz.service.OpaiDingTalkService; |
| | | import me.zhengjie.modules.system.domain.CustomerResources; |
| | |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.*; |
| | | import java.io.IOException; |
| | | import java.util.function.Function; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | |
| | | /** |
| | |
| | | private final UserRepository userRepository; |
| | | private final OpaiDingTalkService opaiDingTalkService; |
| | | private final CustomerResourcesUserRepository customerResourcesUserRepository; |
| | | private final BusinessPlanService businessPlanService; |
| | | |
| | | @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)); |
| | | // 将实体类转换为DTO(重写) |
| | | Function<CustomerResources, CustomerResourcesDto> func = new Function<CustomerResources, CustomerResourcesDto>(){ |
| | | @Override |
| | | public CustomerResourcesDto apply(CustomerResources t) { |
| | | // 将实体类转换成DTO |
| | | CustomerResourcesDto customerResourcesDto = customerResourcesMapper.toDto(t); |
| | | |
| | | // 获取营业计划 |
| | | BusinessPlanDto businessPlanDto = businessPlanService.findById(customerResourcesDto.getBusinessPlanId()); |
| | | customerResourcesDto.setBusinessPlanContent(businessPlanDto.getBusinessContent()); |
| | | |
| | | // 返回处理好的DTO |
| | | return customerResourcesDto; |
| | | } |
| | | }; |
| | | return PageUtil.toPage(page.map(func)); |
| | | } |
| | | |
| | | @Override |
| | |
| | | if (roleRepository.findByName(resources.getName()) != null) { |
| | | throw new EntityExistException(Role.class, "username", resources.getName()); |
| | | } |
| | | if (roleRepository.findByLevel(resources.getLevel()) != null) { |
| | | throw new EntityExistException(Role.class, "level", resources.getLevel().toString()); |
| | | } |
| | | roleRepository.save(resources); |
| | | } |
| | | |
| | |
| | | ValidationUtil.isNull(role.getId(), "Role", "id", resources.getId()); |
| | | |
| | | Role role1 = roleRepository.findByName(resources.getName()); |
| | | |
| | | Role role2 = roleRepository.findByLevel(resources.getLevel()); |
| | | if (role1 != null && !role1.getId().equals(role.getId())) { |
| | | throw new EntityExistException(Role.class, "username", resources.getName()); |
| | | } |
| | | if (role2 != null && !role2.getId().equals(role.getId())) { |
| | | throw new EntityExistException(Role.class, "level", resources.getLevel().toString()); |
| | | } |
| | | role.setName(resources.getName()); |
| | | role.setDescription(resources.getDescription()); |
| | | role.setDataScope(resources.getDataScope()); |
| | |
| | | /** 任务工作量单位 */ |
| | | private String taskWorkloadUnit; |
| | | |
| | | /** 任务绩效类型 */ |
| | | private String taskPerformanceType; |
| | | |
| | | /** 用户昵称 */ |
| | | private String userNickName; |
| | | |
| | |
| | | taskUserDto.setTaskName(task.getName()); |
| | | // 任务工作量单位 |
| | | taskUserDto.setTaskWorkloadUnit(task.getPlanWorkloadUnit()); |
| | | // 任务绩效类型 |
| | | taskUserDto.setTaskPerformanceType(task.getPerformanceType()); |
| | | // 根据用户ID查询用户信息 |
| | | User user = userRepository.findById(taskUserDto.getUserId()).orElseGet(User::new); |
| | | ValidationUtil.isNull(user.getId(),"User","id",taskUserDto.getUserId()); |
| | |
| | | // 日历类 |
| | | return cal; |
| | | } |
| | | |
| | | /** |
| | | * 获取年 |
| | | * @param dayCal |
| | | * @return |
| | | */ |
| | | public static String getYear(Calendar dayCal) { |
| | | // 格式化日期 |
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyy"); |
| | | return sdf.format(dayCal.getTime()); |
| | | } |
| | | |
| | | /** |
| | | * 获取年月 |
| | | * @param dayCal |
| | | * @return |
| | | */ |
| | | public static String getYearMonth(Calendar dayCal) { |
| | | // 格式化日期 |
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM"); |
| | | return sdf.format(dayCal.getTime()); |
| | | } |
| | | } |
| | |
| | | wall: |
| | | config: |
| | | multi-statement-allow: true |
| | | # 配置消息队列 |
| | | rabbitmq: |
| | | host: 114.116.101.63 |
| | | port: 31444 |
| | | username: admin |
| | | password: 7658757a@ |
| | | # 虚拟host 可以不设置,使用server默认host |
| | | virtual-host: / |
| | | |
| | | # 登录相关配置 |
| | | login: |
| | |
| | | # 文件大小 /M |
| | | maxSize: 100 |
| | | avatarMaxSize: 5 |
| | | |
| | | # Flowable |
| | | flowable: |
| | | url: http://localhost:8888 |
| | |
| | | wall: |
| | | config: |
| | | multi-statement-allow: true |
| | | # 配置消息队列 |
| | | rabbitmq: |
| | | host: 114.116.101.63 |
| | | port: 31444 |
| | | username: admin |
| | | password: 7658757a@ |
| | | # 虚拟host 可以不设置,使用server默认host |
| | | virtual-host: / |
| | | |
| | | # 登录相关配置 |
| | | login: |
| | |
| | | # 文件大小 /M |
| | | maxSize: 100 |
| | | avatarMaxSize: 5 |
| | | |
| | | # Flowable |
| | | flowable: |
| | | url: http://localhost:8888 |
| New file |
| | |
| | | import request from '@/utils/request' |
| | | |
| | | export function getAll(params) { |
| | | return request({ |
| | | url: 'api/businessExpense/all', |
| | | method: 'get', |
| | | params |
| | | }) |
| | | } |
| | | |
| | | export function add(data) { |
| | | return request({ |
| | | url: 'api/businessExpense', |
| | | method: 'post', |
| | | data |
| | | }) |
| | | } |
| | | |
| | | export function del(ids) { |
| | | return request({ |
| | | url: 'api/businessExpense/', |
| | | method: 'delete', |
| | | data: ids |
| | | }) |
| | | } |
| | | |
| | | export function edit(data) { |
| | | return request({ |
| | | url: 'api/businessExpense', |
| | | method: 'put', |
| | | data |
| | | }) |
| | | } |
| | | |
| | | export default { getAll, add, edit, del } |
| New file |
| | |
| | | import request from '@/utils/request' |
| | | |
| | | export function add(data) { |
| | | return request({ |
| | | url: 'api/businessExpenseFlowable', |
| | | method: 'post', |
| | | data |
| | | }) |
| | | } |
| | | |
| | | export function agree(processInstanceId) { |
| | | return request({ |
| | | url: 'api/businessExpenseFlowable/agree', |
| | | method: 'post', |
| | | data: processInstanceId |
| | | }) |
| | | } |
| | | |
| | | export function reject(processInstanceId) { |
| | | return request({ |
| | | url: 'api/businessExpenseFlowable/reject', |
| | | method: 'post', |
| | | data: processInstanceId |
| | | }) |
| | | } |
| | | |
| | | export default { add, agree, reject } |
| New file |
| | |
| | | import request from '@/utils/request' |
| | | |
| | | export function getAll(params) { |
| | | return request({ |
| | | url: 'api/businessExpenseReimbursement/all', |
| | | method: 'get', |
| | | params |
| | | }) |
| | | } |
| | | |
| | | export function add(data) { |
| | | return request({ |
| | | url: 'api/businessExpenseReimbursement', |
| | | method: 'post', |
| | | data |
| | | }) |
| | | } |
| | | |
| | | export function del(ids) { |
| | | return request({ |
| | | url: 'api/businessExpenseReimbursement/', |
| | | method: 'delete', |
| | | data: ids |
| | | }) |
| | | } |
| | | |
| | | export function edit(data) { |
| | | return request({ |
| | | url: 'api/businessExpenseReimbursement', |
| | | method: 'put', |
| | | data |
| | | }) |
| | | } |
| | | |
| | | export default { getAll, add, edit, del } |
| New file |
| | |
| | | import request from '@/utils/request' |
| | | |
| | | export function getAll(params) { |
| | | return request({ |
| | | url: 'api/businessPlan/all', |
| | | method: 'get', |
| | | params |
| | | }) |
| | | } |
| | | |
| | | export function add(data) { |
| | | return request({ |
| | | url: 'api/businessPlan', |
| | | method: 'post', |
| | | data |
| | | }) |
| | | } |
| | | |
| | | export function del(ids) { |
| | | return request({ |
| | | url: 'api/businessPlan/', |
| | | method: 'delete', |
| | | data: ids |
| | | }) |
| | | } |
| | | |
| | | export function edit(data) { |
| | | return request({ |
| | | url: 'api/businessPlan', |
| | | method: 'put', |
| | | data |
| | | }) |
| | | } |
| | | |
| | | export default { getAll, add, edit, del } |
| New file |
| | |
| | | import request from '@/utils/request' |
| | | |
| | | export function getAll(params) { |
| | | return request({ |
| | | url: 'api/businessPlanPersonnel/all', |
| | | method: 'get', |
| | | params |
| | | }) |
| | | } |
| | | |
| | | export function add(data) { |
| | | return request({ |
| | | url: 'api/businessPlanPersonnel', |
| | | method: 'post', |
| | | data |
| | | }) |
| | | } |
| | | |
| | | export function del(ids) { |
| | | return request({ |
| | | url: 'api/businessPlanPersonnel/', |
| | | method: 'delete', |
| | | data: ids |
| | | }) |
| | | } |
| | | |
| | | export function edit(data) { |
| | | return request({ |
| | | url: 'api/businessPlanPersonnel', |
| | | method: 'put', |
| | | data |
| | | }) |
| | | } |
| | | |
| | | export default { getAll, add, edit, del } |
| New file |
| | |
| | | import request from '@/utils/request' |
| | | |
| | | export function getAll(params) { |
| | | return request({ |
| | | url: 'api/capitalAccountCompany/all', |
| | | method: 'get', |
| | | params |
| | | }) |
| | | } |
| | | |
| | | export function add(data) { |
| | | return request({ |
| | | url: 'api/capitalAccountCompany', |
| | | method: 'post', |
| | | data |
| | | }) |
| | | } |
| | | |
| | | export function del(ids) { |
| | | return request({ |
| | | url: 'api/capitalAccountCompany/', |
| | | method: 'delete', |
| | | data: ids |
| | | }) |
| | | } |
| | | |
| | | export function edit(data) { |
| | | return request({ |
| | | url: 'api/capitalAccountCompany', |
| | | method: 'put', |
| | | data |
| | | }) |
| | | } |
| | | |
| | | export default { getAll, add, edit, del } |
| New file |
| | |
| | | import request from '@/utils/request' |
| | | |
| | | export function getAll(params) { |
| | | return request({ |
| | | url: 'api/capitalAccountCompanySet/all', |
| | | method: 'get', |
| | | params |
| | | }) |
| | | } |
| | | |
| | | export function add(data) { |
| | | return request({ |
| | | url: 'api/capitalAccountCompanySet', |
| | | method: 'post', |
| | | data |
| | | }) |
| | | } |
| | | |
| | | export function del(ids) { |
| | | return request({ |
| | | url: 'api/capitalAccountCompanySet/', |
| | | method: 'delete', |
| | | data: ids |
| | | }) |
| | | } |
| | | |
| | | export function edit(data) { |
| | | return request({ |
| | | url: 'api/capitalAccountCompanySet', |
| | | method: 'put', |
| | | data |
| | | }) |
| | | } |
| | | |
| | | export default { getAll, add, edit, del } |
| New file |
| | |
| | | import request from '@/utils/request' |
| | | |
| | | export function getAll(params) { |
| | | return request({ |
| | | url: 'api/capitalAccountMoney/all', |
| | | method: 'get', |
| | | params |
| | | }) |
| | | } |
| | | |
| | | export function add(data) { |
| | | return request({ |
| | | url: 'api/capitalAccountMoney', |
| | | method: 'post', |
| | | data |
| | | }) |
| | | } |
| | | |
| | | export function del(ids) { |
| | | return request({ |
| | | url: 'api/capitalAccountMoney/', |
| | | method: 'delete', |
| | | data: ids |
| | | }) |
| | | } |
| | | |
| | | export function edit(data) { |
| | | return request({ |
| | | url: 'api/capitalAccountMoney', |
| | | method: 'put', |
| | | data |
| | | }) |
| | | } |
| | | |
| | | export default { getAll, add, edit, del } |
| | |
| | | // 合同费用类型:合同收入 |
| | | export const CONTRACR_REVENUE = 'contract_revenue' |
| | | |
| | | // 账户类型 |
| | | export const ACCOUNT_TYPE = 'account_type' |
| | | // 账户类型:起源 |
| | | export const ACCOUNT_TYPE_QIYUAN = 'account_type_qiyuan' |
| | | // 账户类型:以恒 |
| | | export const ACCOUNT_TYPE_YIHENG = 'account_type_yiheng' |
| | | // 账户类型:咨询 |
| | | export const ACCOUNT_TYPE_ZIXUN = 'account_type_zixun' |
| | | // 账户类型:恒臻 |
| | | export const ACCOUNT_TYPE_HENGZHEN = 'account_type_hengzhen' |
| | | |
| | | // 营业状态 |
| | | export const BUSINESS_STATUS = 'business_status' |
| | | |
| | | // 费用类型 |
| | | export const EXPENSE_TYPE = 'expense_type' |
| | | |
| | | export default { |
| | | ROLE_LEVEL_SUPER, |
| | | ROLE_LEVEL_GENERAL, |
| | |
| | | CONTRACT_STATUS_IS_OVER, |
| | | CONTRACR_TYPE_COST, |
| | | CONTRACR_EXPENDITURE, |
| | | CONTRACR_REVENUE |
| | | CONTRACR_REVENUE, |
| | | ACCOUNT_TYPE, |
| | | ACCOUNT_TYPE_QIYUAN, |
| | | ACCOUNT_TYPE_YIHENG, |
| | | ACCOUNT_TYPE_ZIXUN, |
| | | ACCOUNT_TYPE_HENGZHEN, |
| | | BUSINESS_STATUS, |
| | | EXPENSE_TYPE |
| | | } |
| New file |
| | |
| | | <template> |
| | | <div class="app-container"> |
| | | <!--工具栏--> |
| | | <div class="head-container"> |
| | | <div v-if="crud.props.searchToggle"> |
| | | <!-- 搜索 --> |
| | | <el-select v-model="query.expenseType" clearable placeholder="费用类型" style="width: 185px;" class="filter-item" @keyup.enter.native="crud.toQuery"> |
| | | <el-option |
| | | v-for="item in dict[expenseType]" |
| | | :key="item.id" |
| | | :label="item.label" |
| | | :value="item.value" |
| | | /> |
| | | </el-select> |
| | | <el-select v-model="query.businessPlanId" clearable placeholder="所属营业计划" style="width: 185px;" class="filter-item" @keyup.enter.native="crud.toQuery"> |
| | | <el-option |
| | | v-for="item in businessPlanList" |
| | | :key="item.id" |
| | | :label="item.businessContent" |
| | | :value="item.id" |
| | | /> |
| | | </el-select> |
| | | <el-select v-model="query.projectId" clearable placeholder="所属项目" style="width: 185px;" class="filter-item" @keyup.enter.native="crud.toQuery"> |
| | | <el-option |
| | | v-for="item in projectList" |
| | | :key="item.id" |
| | | :label="item.name" |
| | | :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="600px"> |
| | | <el-form ref="form" :model="form" :rules="rules" size="small" label-width="110px"> |
| | | <el-form-item label="费用类型" prop="expenseType"> |
| | | <el-select v-model="form.expenseType" placeholder="请选择" filterable clearable style="width: 440px;"> |
| | | <el-option |
| | | v-for="item in dict[expenseType]" |
| | | :key="item.id" |
| | | :label="item.label" |
| | | :value="item.value" |
| | | /> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="所属营业计划" prop="businessPlanId"> |
| | | <el-select v-model="form.businessPlanId" placeholder="请选择" filterable clearable style="width: 440px;"> |
| | | <el-option |
| | | v-for="item in businessPlanList" |
| | | :key="item.id" |
| | | :label="item.businessContent" |
| | | :value="item.id" |
| | | /> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="所属项目"> |
| | | <el-select v-model="form.projectId" placeholder="请选择" filterable clearable style="width: 440px;"> |
| | | <el-option |
| | | v-for="item in projectList" |
| | | :key="item.id" |
| | | :label="item.name" |
| | | :value="item.id" |
| | | /> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-button size="mini" type="primary" icon="el-icon-plus" style="position: relative; left: 464px;" @click="reimbursementAdd()" /> |
| | | <el-table ref="table" :data="form.businessExpenseReimbursementDtoList" size="small" style="width: 100%;"> |
| | | <el-table-column :show-overflow-tooltip="true" prop="reimbursementContent" label="报销内容" /> |
| | | <el-table-column :show-overflow-tooltip="true" prop="reimbursementAmount" label="报销金额"> |
| | | <template slot-scope="scope"> |
| | | {{ crud.toMoney(scope.row.reimbursementAmount) }} |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column :show-overflow-tooltip="true" prop="reimbursementVoucher" label="报销凭证"> |
| | | <template slot-scope="scope"> |
| | | <el-image |
| | | :src="scope.row.reimbursementVoucher != null && scope.row.reimbursementVoucher !== '' ? baseApi + scope.row.reimbursementVoucher.split(',')[0] : ''" |
| | | :preview-src-list="scope.row.reimbursementVoucher != null && scope.row.reimbursementVoucher !== '' ? scope.row.reimbursementVoucher.split(',').map(item => { return baseApi + item }) : []" |
| | | style="width: 100px;" |
| | | > |
| | | <div slot="placeholder" class="image-slot"> |
| | | 加载中... |
| | | </div> |
| | | <div slot="error" class="image-slot"> |
| | | 暂无图片 |
| | | </div> |
| | | </el-image> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column label="操作" width="150px" align="center"> |
| | | <template slot-scope="scope"> |
| | | <el-button size="mini" type="primary" icon="el-icon-edit" @click="reimbursementEdit(scope.row)" /> |
| | | <el-button size="mini" type="danger" icon="el-icon-delete" @click="reimbursementDelete(scope.row)" /> |
| | | </template> |
| | | </el-table-column> |
| | | </el-table> |
| | | <el-form-item label="备注" style="margin-top: 20px;"> |
| | | <el-input v-model="form.remarks" :rows="3" type="textarea" style="width: 440px;" /> |
| | | </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"> |
| | | <el-table :data="props.row.businessExpenseReimbursementDtoList" style="margin: 10px 20px 10px 105px; width: calc(100% - 20px - 105px);"> |
| | | <el-table-column :show-overflow-tooltip="true" prop="reimbursementContent" label="报销内容" /> |
| | | <el-table-column :show-overflow-tooltip="true" prop="reimbursementAmount" label="报销金额"> |
| | | <template slot-scope="scope"> |
| | | {{ crud.toMoney(scope.row.reimbursementAmount) }} |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column :show-overflow-tooltip="true" prop="reimbursementVoucher" label="报销凭证"> |
| | | <template slot-scope="scope"> |
| | | <el-image |
| | | :src="scope.row.reimbursementVoucher != null && scope.row.reimbursementVoucher !== '' ? baseApi + scope.row.reimbursementVoucher.split(',')[0] : ''" |
| | | :preview-src-list="scope.row.reimbursementVoucher != null && scope.row.reimbursementVoucher !== '' ? scope.row.reimbursementVoucher.split(',').map(item => { return baseApi + item }) : []" |
| | | style="width: 100px;" |
| | | > |
| | | <div slot="placeholder" class="image-slot"> |
| | | 加载中... |
| | | </div> |
| | | <div slot="error" class="image-slot"> |
| | | 暂无图片 |
| | | </div> |
| | | </el-image> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column :show-overflow-tooltip="true" prop="remarks" label="备注" /> |
| | | </el-table> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="expenseType" label="费用类型"> |
| | | <template slot-scope="scope"> |
| | | {{ dict.label[expenseType][scope.row.expenseType] }} |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="businessPlanContent" label="所属营业计划" /> |
| | | <el-table-column prop="projectName" label="所属项目" /> |
| | | <el-table-column prop="amountReimbursementAmount" label="报销总金额"> |
| | | <template slot-scope="scope"> |
| | | {{ crud.toMoney(scope.row.amountReimbursementAmount) }} |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="remarks" label="备注" /> |
| | | <el-table-column prop="createTime" label="创建时间" /> |
| | | <el-table-column v-if="checkPer(['admin','businessExpense:edit','businessExpense:del'])" label="操作" width="150px" align="center"> |
| | | <template slot-scope="scope"> |
| | | <udOperation |
| | | :data="scope.row" |
| | | :permission="permission" |
| | | /> |
| | | </template> |
| | | </el-table-column> |
| | | </el-table> |
| | | <!--分页组件--> |
| | | <pagination /> |
| | | <!--表单组件--> |
| | | <el-dialog :close-on-click-modal="false" :before-close="reimbursementCancel" :visible.sync="reimbursementStatus" :title="reimbursementTitle" width="600px"> |
| | | <el-form ref="reimbursementForm" :model="reimbursementForm" :rules="reimbursementRules" size="small" label-width="140px"> |
| | | <el-form-item label="报销内容" prop="reimbursementContent"> |
| | | <el-input v-model="reimbursementForm.reimbursementContent" style="width: 340px;" /> |
| | | </el-form-item> |
| | | <el-form-item label="报销金额" prop="reimbursementAmount"> |
| | | <money-input :key="random" v-model="reimbursementForm.reimbursementAmount" :width="340" /> |
| | | </el-form-item> |
| | | <el-form-item label="报销凭证"> |
| | | <image-upload ref="imageUpload" :key="random" :image-url="reimbursementForm.reimbursementVoucher == null || reimbursementForm.reimbursementVoucher === '' ? null : reimbursementForm.reimbursementVoucher" :limit="3" @imageInfo="getImageInfo" /> |
| | | </el-form-item> |
| | | <el-form-item label="备注"> |
| | | <el-input v-model="reimbursementForm.remarks" :rows="3" type="textarea" style="width: 340px;" /> |
| | | </el-form-item> |
| | | </el-form> |
| | | <div slot="footer" class="dialog-footer"> |
| | | <el-button type="text" @click="reimbursementCancel">取消</el-button> |
| | | <el-button :loading="reimbursementLoading" type="primary" @click="reimbursementSubmit('reimbursementForm')">确认</el-button> |
| | | </div> |
| | | </el-dialog> |
| | | </div> |
| | | </div> |
| | | </template> |
| | | |
| | | <script> |
| | | import crudBusinessExpense from '@/api/business/expense' |
| | | 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 crudBusinessPlan from '@/api/business/plan' |
| | | import crudProject from '@/api/project/project' |
| | | import moneyInput from '../../assembly/moneyInput/index.vue' |
| | | import imageUpload from '../../assembly/imageUpload/index.vue' |
| | | import { mapGetters } from 'vuex' |
| | | |
| | | const defaultForm = { id: null, expenseType: null, businessPlanId: null, projectId: null, remarks: null, createBy: null, createTime: null, updateBy: null, updateTime: null, businessExpenseReimbursementDtoList: [] } |
| | | export default { |
| | | name: 'BusinessExpense', |
| | | components: { pagination, crudOperation, rrOperation, udOperation, moneyInput, imageUpload }, |
| | | mixins: [presenter(), header(), form(defaultForm), crud()], |
| | | dicts: [constant.EXPENSE_TYPE], |
| | | cruds() { |
| | | return CRUD({ title: '营业费用', url: 'api/businessExpense', idField: 'id', sort: 'id,desc', crudMethod: { ...crudBusinessExpense }}) |
| | | }, |
| | | data() { |
| | | // 验证报销金额 |
| | | var checkReimbursementAmount = (rule, value, callback) => { |
| | | if (value !== null) { |
| | | if (isNaN(Number(value))) { |
| | | callback(new Error('报销金额必须是数字')) |
| | | } else { |
| | | if (value <= 0) { |
| | | callback(new Error('报销金额必须大于0')) |
| | | } else if (value >= 10000000) { |
| | | callback(new Error('报销金额必须小于1千万')) |
| | | } else { |
| | | callback() |
| | | } |
| | | } |
| | | } else { |
| | | callback(new Error('报销金额不能为空')) |
| | | } |
| | | } |
| | | return { |
| | | permission: { |
| | | add: ['admin', 'businessExpense:add'], |
| | | edit: ['admin', 'businessExpense:edit'], |
| | | del: ['admin', 'businessExpense:del'], |
| | | download: ['admin', 'businessExpense:download'] |
| | | }, |
| | | rules: { |
| | | expenseType: [ |
| | | { required: true, message: '费用类型不能为空', trigger: 'change' } |
| | | ], |
| | | businessPlanId: [ |
| | | { required: true, message: '所属营业计划不能为空', trigger: 'change' } |
| | | ] |
| | | }, |
| | | queryTypeOptions: [ |
| | | { key: 'expenseType', display_name: '费用类型' }, |
| | | { key: 'businessPlanId', display_name: '所属营业计划' }, |
| | | { key: 'projectId', display_name: '所属项目' } |
| | | ], |
| | | // 字典:费用类型 |
| | | expenseType: constant.EXPENSE_TYPE, |
| | | // 随机数 |
| | | random: 0, |
| | | // 营业计划列表 |
| | | businessPlanList: [], |
| | | // 项目列表 |
| | | projectList: [], |
| | | // 营业费用明细弹窗状态 |
| | | reimbursementStatus: false, |
| | | // 营业费用明细弹窗标题 |
| | | reimbursementTitle: '营业费用明细', |
| | | // 营业费用明细弹窗表单 |
| | | reimbursementForm: {}, |
| | | // 营业费用明细弹窗验证 |
| | | reimbursementRules: { |
| | | businessExpenseId: [ |
| | | { required: true, message: '所属营业费用不能为空', trigger: 'change' } |
| | | ], |
| | | reimbursementContent: [ |
| | | { required: true, message: '报销内容不能为空', trigger: 'blur' }, |
| | | { min: 2, max: 20, message: '长度在 2 到 20 个字符', trigger: 'blur' } |
| | | ], |
| | | reimbursementAmount: [ |
| | | { required: true, validator: checkReimbursementAmount, trigger: 'blur' } |
| | | ] |
| | | }, |
| | | // 营业费用明细弹窗操作 |
| | | reimbursementExecute: {}, |
| | | // 营业费用明细弹窗加载 |
| | | reimbursementLoading: false |
| | | } |
| | | }, |
| | | computed: { |
| | | ...mapGetters([ |
| | | 'baseApi' |
| | | ]) |
| | | }, |
| | | methods: { |
| | | // 钩子:在获取表格数据之前执行,false 则代表不获取数据 |
| | | [CRUD.HOOK.beforeRefresh]() { |
| | | // 获取营业计划 |
| | | this.getBusinessPlan() |
| | | // 获取项目 |
| | | this.getProject() |
| | | return true |
| | | }, |
| | | // 获取营业计划 |
| | | getBusinessPlan() { |
| | | // 获取营业计划 |
| | | crudBusinessPlan.getAll().then(res => { |
| | | // 营业计划列表 |
| | | this.businessPlanList = res |
| | | }) |
| | | }, |
| | | // 获取项目 |
| | | getProject() { |
| | | // 获取项目 |
| | | crudProject.getAll().then(res => { |
| | | // 项目列表 |
| | | this.projectList = res |
| | | }) |
| | | }, |
| | | // 营业费用明细弹窗新增 |
| | | reimbursementAdd() { |
| | | // 指针重定义 |
| | | const _this = this |
| | | // 营业费用明细弹窗表单 |
| | | this.reimbursementForm = {} |
| | | // 营业费用明细弹窗状态 |
| | | this.reimbursementStatus = true |
| | | // 营业费用明细弹窗操作 |
| | | this.reimbursementExecute = {} |
| | | // 表单清空 |
| | | setTimeout(function() { |
| | | _this.$refs['reimbursementForm'].clearValidate() |
| | | }, 3) |
| | | // 随机数 |
| | | this.random = Math.random() |
| | | }, |
| | | // 营业费用明细弹窗修改 |
| | | reimbursementEdit(data) { |
| | | // 营业费用明细弹窗表单 |
| | | this.reimbursementForm = JSON.parse(JSON.stringify(data)) |
| | | // 营业费用明细弹窗状态 |
| | | this.reimbursementStatus = true |
| | | // 营业费用明细弹窗操作 |
| | | this.reimbursementExecute = JSON.parse(JSON.stringify(data)) |
| | | // 随机数 |
| | | this.random = Math.random() |
| | | }, |
| | | // 营业费用明细弹窗删除 |
| | | reimbursementDelete(data) { |
| | | // 筛选费用明细人员 |
| | | const reimbursementInfo = this.crud.form.businessExpenseReimbursementDtoList.filter(function(item) { |
| | | return item.reimbursementContent === data.reimbursementContent && item.reimbursementAmount === data.reimbursementAmount |
| | | }) |
| | | // 获取下标 |
| | | const subscript = this.crud.form.businessExpenseReimbursementDtoList.indexOf(reimbursementInfo[0]) |
| | | // 营业费用明细移除元素 |
| | | this.crud.form.businessExpenseReimbursementDtoList.splice(subscript, 1) |
| | | }, |
| | | // 营业费用明细弹窗关闭 |
| | | reimbursementCancel() { |
| | | // 营业费用明细弹窗状态 |
| | | this.reimbursementStatus = false |
| | | }, |
| | | // 营业费用明细弹窗提交 |
| | | reimbursementSubmit(formName) { |
| | | this.$refs[formName].validate((valid) => { |
| | | if (valid) { |
| | | // 通过“this.$refs.imageUpload”找到子页面,“submit”是子页面的方法。 |
| | | this.$refs.imageUpload.submit() |
| | | } else { |
| | | return false |
| | | } |
| | | }) |
| | | }, |
| | | // 获取图片信息 |
| | | getImageInfo(info) { |
| | | // 判断返回数据 |
| | | if (info.length === 0) { |
| | | // 表单图片路径赋值 |
| | | this.reimbursementForm.reimbursementVoucher = null |
| | | // 表单提交 |
| | | this.reimbursementSubmitCU() |
| | | // 终止 |
| | | return |
| | | } |
| | | // 循环返回数据 |
| | | for (let i = 0; i < info.length; i++) { |
| | | // 判断循环下标 |
| | | if (i === 0) { |
| | | // 表单图片路径赋值 |
| | | this.reimbursementForm.reimbursementVoucher = 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 { |
| | | // 表单图片路径赋值 |
| | | this.reimbursementForm.reimbursementVoucher += 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) { |
| | | // 表单提交 |
| | | this.reimbursementSubmitCU() |
| | | } |
| | | } |
| | | }, |
| | | // 表单提交 |
| | | reimbursementSubmitCU() { |
| | | // 判断营业费用明细弹窗操作 |
| | | if (this.reimbursementExecute.reimbursementContent !== undefined) { |
| | | // 营业费用明细弹编辑 |
| | | // 指针重定义 |
| | | const _this = this |
| | | // 筛选营业费用明细弹 |
| | | const reimbursementInfo = this.crud.form.businessExpenseReimbursementDtoList.filter(function(item) { |
| | | return item.reimbursementContent === _this.reimbursementExecute.reimbursementContent && item.reimbursementAmount === _this.reimbursementExecute.reimbursementAmount |
| | | }) |
| | | // 营业费用明细弹更新 |
| | | reimbursementInfo[0].reimbursementContent = this.reimbursementForm.reimbursementContent |
| | | reimbursementInfo[0].reimbursementAmount = this.reimbursementForm.reimbursementAmount |
| | | reimbursementInfo[0].reimbursementVoucher = this.reimbursementForm.reimbursementVoucher |
| | | reimbursementInfo[0].remarks = this.reimbursementForm.remarks |
| | | } else { |
| | | // 营业费用明细新增 |
| | | this.crud.form.businessExpenseReimbursementDtoList.push(this.reimbursementForm) |
| | | } |
| | | // 营业费用明细弹窗关闭 |
| | | this.reimbursementCancel() |
| | | } |
| | | } |
| | | } |
| | | </script> |
| | | |
| | | <style scoped> |
| | | |
| | | </style> |
| New file |
| | |
| | | <template> |
| | | <div class="app-container"> |
| | | <!--工具栏--> |
| | | <div class="head-container"> |
| | | <!--表格渲染--> |
| | | <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"> |
| | | <el-table :data="props.row.businessExpenseReimbursementDtoList" style="margin: 10px 20px 10px 105px; width: calc(100% - 20px - 105px);"> |
| | | <el-table-column :show-overflow-tooltip="true" prop="reimbursementContent" label="报销内容" /> |
| | | <el-table-column :show-overflow-tooltip="true" prop="reimbursementAmount" label="报销金额"> |
| | | <template slot-scope="scope"> |
| | | {{ crud.toMoney(scope.row.reimbursementAmount) }} |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column :show-overflow-tooltip="true" prop="reimbursementVoucher" label="报销凭证"> |
| | | <template slot-scope="scope"> |
| | | <el-image |
| | | :src="scope.row.reimbursementVoucher != null && scope.row.reimbursementVoucher !== '' ? baseApi + scope.row.reimbursementVoucher.split(',')[0] : ''" |
| | | :preview-src-list="scope.row.reimbursementVoucher != null && scope.row.reimbursementVoucher !== '' ? scope.row.reimbursementVoucher.split(',').map(item => { return baseApi + item }) : []" |
| | | style="width: 100px;" |
| | | > |
| | | <div slot="placeholder" class="image-slot"> |
| | | 加载中... |
| | | </div> |
| | | <div slot="error" class="image-slot"> |
| | | 暂无图片 |
| | | </div> |
| | | </el-image> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column :show-overflow-tooltip="true" prop="remarks" label="备注" /> |
| | | </el-table> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="expenseType" label="费用类型"> |
| | | <template slot-scope="scope"> |
| | | {{ dict.label[expenseType][scope.row.expenseType] }} |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="businessPlanContent" label="所属营业计划" /> |
| | | <el-table-column prop="projectName" label="所属项目" /> |
| | | <el-table-column prop="amountReimbursementAmount" label="报销总金额"> |
| | | <template slot-scope="scope"> |
| | | {{ crud.toMoney(scope.row.amountReimbursementAmount) }} |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="remarks" label="备注" /> |
| | | <el-table-column prop="createTime" label="创建时间" /> |
| | | <el-table-column v-if="checkPer(['admin','businessExpenseFlowable:agree','businessExpenseFlowable:reject'])" label="操作" width="150px" align="center"> |
| | | <template slot-scope="scope"> |
| | | <el-popover |
| | | :ref="`agree_${scope.row.processInstanceId}`" |
| | | v-permission="permission.agree" |
| | | width="200" |
| | | placement="top" |
| | | > |
| | | <p>您确定同意这条申请吗?</p> |
| | | <div style="text-align: right; margin: 0"> |
| | | <el-button size="mini" type="text" @click="canelAgree(scope.row)">取消</el-button> |
| | | <el-button size="mini" type="primary" :loading="agreeLoading" @click="toAgree(scope.row)">确定</el-button> |
| | | </div> |
| | | <el-button slot="reference" size="mini" type="success" icon="el-icon-check" /> |
| | | </el-popover> |
| | | <el-popover |
| | | :ref="`reject_${scope.row.processInstanceId}`" |
| | | v-permission="permission.reject" |
| | | width="200" |
| | | placement="top" |
| | | > |
| | | <p>您确定拒绝这条申请吗?</p> |
| | | <div style="text-align: right; margin: 0"> |
| | | <el-button size="mini" type="text" @click="canelReject(scope.row)">取消</el-button> |
| | | <el-button size="mini" type="primary" :loading="rejectLoading" @click="toReject(scope.row)">确定</el-button> |
| | | </div> |
| | | <el-button slot="reference" size="mini" type="danger" icon="el-icon-close" /> |
| | | </el-popover> |
| | | </template> |
| | | </el-table-column> |
| | | </el-table> |
| | | <!--分页组件--> |
| | | <pagination /> |
| | | </div> |
| | | </div> |
| | | </template> |
| | | |
| | | <script> |
| | | import crudBusinessExpenseFlowable from '@/api/business/expenseFlowable' |
| | | import CRUD, { presenter, header, crud } from '@crud/crud' |
| | | import pagination from '@crud/Pagination' |
| | | import constant from '../../../utils/constant' |
| | | import { mapGetters } from 'vuex' |
| | | |
| | | export default { |
| | | name: 'BusinessExpenseFlowableApprove', |
| | | components: { pagination }, |
| | | mixins: [presenter(), header(), crud()], |
| | | dicts: [constant.EXPENSE_TYPE], |
| | | cruds() { |
| | | return CRUD({ title: '营业费用审批', url: 'api/businessExpenseFlowable/approve', idField: 'id', sort: 'id,desc', crudMethod: { ...crudBusinessExpenseFlowable }}) |
| | | }, |
| | | data() { |
| | | return { |
| | | permission: { |
| | | agree: ['admin', 'businessExpenseFlowable:agree'], |
| | | reject: ['admin', 'businessExpenseFlowable:reject'] |
| | | }, |
| | | // 字典:费用类型 |
| | | expenseType: constant.EXPENSE_TYPE, |
| | | // 同意按钮加载状态 |
| | | agreeLoading: false, |
| | | // 拒绝按钮加载状态 |
| | | rejectLoading: false |
| | | } |
| | | }, |
| | | computed: { |
| | | ...mapGetters([ |
| | | 'baseApi' |
| | | ]) |
| | | }, |
| | | methods: { |
| | | // 钩子:在获取表格数据之前执行,false 则代表不获取数据 |
| | | [CRUD.HOOK.beforeRefresh]() { |
| | | return true |
| | | }, |
| | | // 同意 |
| | | toAgree(data) { |
| | | // 同意按钮加载状态 |
| | | this.agreeLoading = true |
| | | // 同意 |
| | | crudBusinessExpenseFlowable.agree(data.processInstanceId).then(res => { |
| | | // 关闭弹出框 |
| | | this.$refs[`agree_${data.processInstanceId}`].showPopper = false |
| | | // 查询 |
| | | this.crud.toQuery() |
| | | }).finally(() => { |
| | | // 同意按钮加载状态 |
| | | this.agreeLoading = false |
| | | }) |
| | | }, |
| | | canelAgree(data) { |
| | | // 关闭弹出框 |
| | | this.$refs[`agree_${data.processInstanceId}`].showPopper = false |
| | | }, |
| | | // 拒接 |
| | | toReject(data) { |
| | | // 拒绝按钮加载状态 |
| | | this.rejectLoading = true |
| | | // 拒绝 |
| | | crudBusinessExpenseFlowable.reject(data.processInstanceId).then(res => { |
| | | // 关闭弹出框 |
| | | this.$refs[`reject_${data.processInstanceId}`].showPopper = false |
| | | // 查询 |
| | | this.crud.toQuery() |
| | | }).finally(() => { |
| | | // 拒绝按钮加载状态 |
| | | this.rejectLoading = false |
| | | }) |
| | | }, |
| | | canelReject(data) { |
| | | // 关闭弹出框 |
| | | this.$refs[`reject_${data.processInstanceId}`].showPopper = false |
| | | } |
| | | } |
| | | } |
| | | </script> |
| | | |
| | | <style scoped> |
| | | |
| | | </style> |
| New file |
| | |
| | | <template> |
| | | <div class="app-container"> |
| | | <!--工具栏--> |
| | | <div class="head-container"> |
| | | <!--如果想在工具栏加入更多按钮,可以使用插槽方式, 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="600px"> |
| | | <el-form ref="form" :model="form" :rules="rules" size="small" label-width="110px"> |
| | | <el-form-item label="费用类型" prop="expenseType"> |
| | | <el-select v-model="form.expenseType" placeholder="请选择" filterable clearable style="width: 440px;"> |
| | | <el-option |
| | | v-for="item in dict[expenseType]" |
| | | :key="item.id" |
| | | :label="item.label" |
| | | :value="item.value" |
| | | /> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="所属营业计划" prop="businessPlanId"> |
| | | <el-select v-model="form.businessPlanId" placeholder="请选择" filterable clearable style="width: 440px;"> |
| | | <el-option |
| | | v-for="item in businessPlanList" |
| | | :key="item.id" |
| | | :label="item.businessContent" |
| | | :value="item.id" |
| | | /> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="所属项目"> |
| | | <el-select v-model="form.projectId" placeholder="请选择" filterable clearable style="width: 440px;"> |
| | | <el-option |
| | | v-for="item in projectList" |
| | | :key="item.id" |
| | | :label="item.name" |
| | | :value="item.id" |
| | | /> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-button size="mini" type="primary" icon="el-icon-plus" style="position: relative; left: 464px;" @click="reimbursementAdd()" /> |
| | | <el-table ref="table" :data="form.businessExpenseReimbursementDtoList" size="small" style="width: 100%;"> |
| | | <el-table-column :show-overflow-tooltip="true" prop="reimbursementContent" label="报销内容" /> |
| | | <el-table-column :show-overflow-tooltip="true" prop="reimbursementAmount" label="报销金额"> |
| | | <template slot-scope="scope"> |
| | | {{ crud.toMoney(scope.row.reimbursementAmount) }} |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column :show-overflow-tooltip="true" prop="reimbursementVoucher" label="报销凭证"> |
| | | <template slot-scope="scope"> |
| | | <el-image |
| | | :src="scope.row.reimbursementVoucher != null && scope.row.reimbursementVoucher !== '' ? baseApi + scope.row.reimbursementVoucher.split(',')[0] : ''" |
| | | :preview-src-list="scope.row.reimbursementVoucher != null && scope.row.reimbursementVoucher !== '' ? scope.row.reimbursementVoucher.split(',').map(item => { return baseApi + item }) : []" |
| | | style="width: 100px;" |
| | | > |
| | | <div slot="placeholder" class="image-slot"> |
| | | 加载中... |
| | | </div> |
| | | <div slot="error" class="image-slot"> |
| | | 暂无图片 |
| | | </div> |
| | | </el-image> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column label="操作" width="150px" align="center"> |
| | | <template slot-scope="scope"> |
| | | <el-button size="mini" type="primary" icon="el-icon-edit" @click="reimbursementEdit(scope.row)" /> |
| | | <el-button size="mini" type="danger" icon="el-icon-delete" @click="reimbursementDelete(scope.row)" /> |
| | | </template> |
| | | </el-table-column> |
| | | </el-table> |
| | | <el-form-item label="备注" style="margin-top: 20px;"> |
| | | <el-input v-model="form.remarks" :rows="3" type="textarea" style="width: 440px;" /> |
| | | </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"> |
| | | <el-table :data="props.row.businessExpenseReimbursementDtoList" style="margin: 10px 20px 10px 105px; width: calc(100% - 20px - 105px);"> |
| | | <el-table-column :show-overflow-tooltip="true" prop="reimbursementContent" label="报销内容" /> |
| | | <el-table-column :show-overflow-tooltip="true" prop="reimbursementAmount" label="报销金额"> |
| | | <template slot-scope="scope"> |
| | | {{ crud.toMoney(scope.row.reimbursementAmount) }} |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column :show-overflow-tooltip="true" prop="reimbursementVoucher" label="报销凭证"> |
| | | <template slot-scope="scope"> |
| | | <el-image |
| | | :src="scope.row.reimbursementVoucher != null && scope.row.reimbursementVoucher !== '' ? baseApi + scope.row.reimbursementVoucher.split(',')[0] : ''" |
| | | :preview-src-list="scope.row.reimbursementVoucher != null && scope.row.reimbursementVoucher !== '' ? scope.row.reimbursementVoucher.split(',').map(item => { return baseApi + item }) : []" |
| | | style="width: 100px;" |
| | | > |
| | | <div slot="placeholder" class="image-slot"> |
| | | 加载中... |
| | | </div> |
| | | <div slot="error" class="image-slot"> |
| | | 暂无图片 |
| | | </div> |
| | | </el-image> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column :show-overflow-tooltip="true" prop="remarks" label="备注" /> |
| | | </el-table> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="expenseType" label="费用类型"> |
| | | <template slot-scope="scope"> |
| | | {{ dict.label[expenseType][scope.row.expenseType] }} |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="businessPlanContent" label="所属营业计划" /> |
| | | <el-table-column prop="projectName" label="所属项目" /> |
| | | <el-table-column prop="amountReimbursementAmount" label="报销总金额"> |
| | | <template slot-scope="scope"> |
| | | {{ crud.toMoney(scope.row.amountReimbursementAmount) }} |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="remarks" label="备注" /> |
| | | <el-table-column prop="createTime" label="审批状态"> |
| | | <template slot-scope="scope"> |
| | | {{ scope.row.approve == 'true' ? '同意' : scope.row.approve == 'false' ? '拒绝' : '审核中' }} |
| | | </template> |
| | | </el-table-column> |
| | | </el-table> |
| | | <!--分页组件--> |
| | | <pagination /> |
| | | <!--表单组件--> |
| | | <el-dialog :close-on-click-modal="false" :before-close="reimbursementCancel" :visible.sync="reimbursementStatus" :title="reimbursementTitle" width="600px"> |
| | | <el-form ref="reimbursementForm" :model="reimbursementForm" :rules="reimbursementRules" size="small" label-width="140px"> |
| | | <el-form-item label="报销内容" prop="reimbursementContent"> |
| | | <el-input v-model="reimbursementForm.reimbursementContent" style="width: 340px;" /> |
| | | </el-form-item> |
| | | <el-form-item label="报销金额" prop="reimbursementAmount"> |
| | | <money-input :key="random" v-model="reimbursementForm.reimbursementAmount" :width="340" /> |
| | | </el-form-item> |
| | | <el-form-item label="报销凭证"> |
| | | <image-upload ref="imageUpload" :key="random" :image-url="reimbursementForm.reimbursementVoucher == null || reimbursementForm.reimbursementVoucher === '' ? null : reimbursementForm.reimbursementVoucher" :limit="3" @imageInfo="getImageInfo" /> |
| | | </el-form-item> |
| | | <el-form-item label="备注"> |
| | | <el-input v-model="reimbursementForm.remarks" :rows="3" type="textarea" style="width: 340px;" /> |
| | | </el-form-item> |
| | | </el-form> |
| | | <div slot="footer" class="dialog-footer"> |
| | | <el-button type="text" @click="reimbursementCancel">取消</el-button> |
| | | <el-button :loading="reimbursementLoading" type="primary" @click="reimbursementSubmit('reimbursementForm')">确认</el-button> |
| | | </div> |
| | | </el-dialog> |
| | | </div> |
| | | </div> |
| | | </template> |
| | | |
| | | <script> |
| | | import crudBusinessExpenseFlowable from '@/api/business/expenseFlowable' |
| | | import CRUD, { presenter, header, form, crud } from '@crud/crud' |
| | | import crudOperation from '@crud/CRUD.operation' |
| | | import pagination from '@crud/Pagination' |
| | | import constant from '../../../utils/constant' |
| | | import crudBusinessPlan from '@/api/business/plan' |
| | | import crudProject from '@/api/project/project' |
| | | import moneyInput from '../../assembly/moneyInput/index.vue' |
| | | import imageUpload from '../../assembly/imageUpload/index.vue' |
| | | import { mapGetters } from 'vuex' |
| | | |
| | | const defaultForm = { id: null, expenseType: null, businessPlanId: null, projectId: null, remarks: null, createBy: null, createTime: null, updateBy: null, updateTime: null, businessExpenseReimbursementDtoList: [] } |
| | | export default { |
| | | name: 'BusinessExpenseFlowableReport', |
| | | components: { pagination, crudOperation, moneyInput, imageUpload }, |
| | | mixins: [presenter(), header(), form(defaultForm), crud()], |
| | | dicts: [constant.EXPENSE_TYPE], |
| | | cruds() { |
| | | return CRUD({ title: '营业费用', url: 'api/businessExpenseFlowable/report', idField: 'id', sort: 'id,desc', crudMethod: { ...crudBusinessExpenseFlowable }}) |
| | | }, |
| | | data() { |
| | | // 验证报销金额 |
| | | var checkReimbursementAmount = (rule, value, callback) => { |
| | | if (value !== null) { |
| | | if (isNaN(Number(value))) { |
| | | callback(new Error('报销金额必须是数字')) |
| | | } else { |
| | | if (value <= 0) { |
| | | callback(new Error('报销金额必须大于0')) |
| | | } else if (value >= 10000000) { |
| | | callback(new Error('报销金额必须小于1千万')) |
| | | } else { |
| | | callback() |
| | | } |
| | | } |
| | | } else { |
| | | callback(new Error('报销金额不能为空')) |
| | | } |
| | | } |
| | | return { |
| | | permission: { |
| | | add: ['admin', 'businessExpenseFlowable:add'], |
| | | edit: ['admin', 'businessExpenseFlowable:edit'], |
| | | del: ['admin', 'businessExpenseFlowable:del'], |
| | | download: ['admin', 'businessExpenseFlowable:download'] |
| | | }, |
| | | rules: { |
| | | expenseType: [ |
| | | { required: true, message: '费用类型不能为空', trigger: 'change' } |
| | | ], |
| | | businessPlanId: [ |
| | | { required: true, message: '所属营业计划不能为空', trigger: 'change' } |
| | | ] |
| | | }, |
| | | // 字典:费用类型 |
| | | expenseType: constant.EXPENSE_TYPE, |
| | | // 随机数 |
| | | random: 0, |
| | | // 营业计划列表 |
| | | businessPlanList: [], |
| | | // 项目列表 |
| | | projectList: [], |
| | | // 营业费用明细弹窗状态 |
| | | reimbursementStatus: false, |
| | | // 营业费用明细弹窗标题 |
| | | reimbursementTitle: '营业费用明细', |
| | | // 营业费用明细弹窗表单 |
| | | reimbursementForm: {}, |
| | | // 营业费用明细弹窗验证 |
| | | reimbursementRules: { |
| | | businessExpenseId: [ |
| | | { required: true, message: '所属营业费用不能为空', trigger: 'change' } |
| | | ], |
| | | reimbursementContent: [ |
| | | { required: true, message: '报销内容不能为空', trigger: 'blur' }, |
| | | { min: 2, max: 20, message: '长度在 2 到 20 个字符', trigger: 'blur' } |
| | | ], |
| | | reimbursementAmount: [ |
| | | { required: true, validator: checkReimbursementAmount, trigger: 'blur' } |
| | | ] |
| | | }, |
| | | // 营业费用明细弹窗操作 |
| | | reimbursementExecute: {}, |
| | | // 营业费用明细弹窗加载 |
| | | reimbursementLoading: false |
| | | } |
| | | }, |
| | | computed: { |
| | | ...mapGetters([ |
| | | 'baseApi' |
| | | ]) |
| | | }, |
| | | created() { |
| | | this.crud.optShow = { |
| | | add: true, |
| | | edit: false, |
| | | del: false, |
| | | download: false |
| | | } |
| | | }, |
| | | methods: { |
| | | // 钩子:在获取表格数据之前执行,false 则代表不获取数据 |
| | | [CRUD.HOOK.beforeRefresh]() { |
| | | // 获取营业计划 |
| | | this.getBusinessPlan() |
| | | // 获取项目 |
| | | this.getProject() |
| | | return true |
| | | }, |
| | | // 获取营业计划 |
| | | getBusinessPlan() { |
| | | // 获取营业计划 |
| | | crudBusinessPlan.getAll().then(res => { |
| | | // 营业计划列表 |
| | | this.businessPlanList = res |
| | | }) |
| | | }, |
| | | // 获取项目 |
| | | getProject() { |
| | | // 获取项目 |
| | | crudProject.getAll().then(res => { |
| | | // 项目列表 |
| | | this.projectList = res |
| | | }) |
| | | }, |
| | | // 营业费用明细弹窗新增 |
| | | reimbursementAdd() { |
| | | // 指针重定义 |
| | | const _this = this |
| | | // 营业费用明细弹窗表单 |
| | | this.reimbursementForm = {} |
| | | // 营业费用明细弹窗状态 |
| | | this.reimbursementStatus = true |
| | | // 营业费用明细弹窗操作 |
| | | this.reimbursementExecute = {} |
| | | // 表单清空 |
| | | setTimeout(function() { |
| | | _this.$refs['reimbursementForm'].clearValidate() |
| | | }, 3) |
| | | // 随机数 |
| | | this.random = Math.random() |
| | | }, |
| | | // 营业费用明细弹窗修改 |
| | | reimbursementEdit(data) { |
| | | // 营业费用明细弹窗表单 |
| | | this.reimbursementForm = JSON.parse(JSON.stringify(data)) |
| | | // 营业费用明细弹窗状态 |
| | | this.reimbursementStatus = true |
| | | // 营业费用明细弹窗操作 |
| | | this.reimbursementExecute = JSON.parse(JSON.stringify(data)) |
| | | // 随机数 |
| | | this.random = Math.random() |
| | | }, |
| | | // 营业费用明细弹窗删除 |
| | | reimbursementDelete(data) { |
| | | // 筛选费用明细人员 |
| | | const reimbursementInfo = this.crud.form.businessExpenseReimbursementDtoList.filter(function(item) { |
| | | return item.reimbursementContent === data.reimbursementContent && item.reimbursementAmount === data.reimbursementAmount |
| | | }) |
| | | // 获取下标 |
| | | const subscript = this.crud.form.businessExpenseReimbursementDtoList.indexOf(reimbursementInfo[0]) |
| | | // 营业费用明细移除元素 |
| | | this.crud.form.businessExpenseReimbursementDtoList.splice(subscript, 1) |
| | | }, |
| | | // 营业费用明细弹窗关闭 |
| | | reimbursementCancel() { |
| | | // 营业费用明细弹窗状态 |
| | | this.reimbursementStatus = false |
| | | }, |
| | | // 营业费用明细弹窗提交 |
| | | reimbursementSubmit(formName) { |
| | | this.$refs[formName].validate((valid) => { |
| | | if (valid) { |
| | | // 通过“this.$refs.imageUpload”找到子页面,“submit”是子页面的方法。 |
| | | this.$refs.imageUpload.submit() |
| | | } else { |
| | | return false |
| | | } |
| | | }) |
| | | }, |
| | | // 获取图片信息 |
| | | getImageInfo(info) { |
| | | // 判断返回数据 |
| | | if (info.length === 0) { |
| | | // 表单图片路径赋值 |
| | | this.reimbursementForm.reimbursementVoucher = null |
| | | // 表单提交 |
| | | this.reimbursementSubmitCU() |
| | | // 终止 |
| | | return |
| | | } |
| | | // 循环返回数据 |
| | | for (let i = 0; i < info.length; i++) { |
| | | // 判断循环下标 |
| | | if (i === 0) { |
| | | // 表单图片路径赋值 |
| | | this.reimbursementForm.reimbursementVoucher = 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 { |
| | | // 表单图片路径赋值 |
| | | this.reimbursementForm.reimbursementVoucher += 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) { |
| | | // 表单提交 |
| | | this.reimbursementSubmitCU() |
| | | } |
| | | } |
| | | }, |
| | | // 表单提交 |
| | | reimbursementSubmitCU() { |
| | | // 判断营业费用明细弹窗操作 |
| | | if (this.reimbursementExecute.reimbursementContent !== undefined) { |
| | | // 营业费用明细弹编辑 |
| | | // 指针重定义 |
| | | const _this = this |
| | | // 筛选营业费用明细弹 |
| | | const reimbursementInfo = this.crud.form.businessExpenseReimbursementDtoList.filter(function(item) { |
| | | return item.reimbursementContent === _this.reimbursementExecute.reimbursementContent && item.reimbursementAmount === _this.reimbursementExecute.reimbursementAmount |
| | | }) |
| | | // 营业费用明细弹更新 |
| | | reimbursementInfo[0].reimbursementContent = this.reimbursementForm.reimbursementContent |
| | | reimbursementInfo[0].reimbursementAmount = this.reimbursementForm.reimbursementAmount |
| | | reimbursementInfo[0].reimbursementVoucher = this.reimbursementForm.reimbursementVoucher |
| | | reimbursementInfo[0].remarks = this.reimbursementForm.remarks |
| | | } else { |
| | | // 营业费用明细新增 |
| | | this.crud.form.businessExpenseReimbursementDtoList.push(this.reimbursementForm) |
| | | } |
| | | // 营业费用明细弹窗关闭 |
| | | this.reimbursementCancel() |
| | | } |
| | | } |
| | | } |
| | | </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.businessExpenseId" clearable placeholder="所属营业费用" style="width: 185px;" class="filter-item" @keyup.enter.native="crud.toQuery"> |
| | | <el-option |
| | | v-for="item in businessExpenseList" |
| | | :key="item.id" |
| | | :label="dict.label[expenseType][item.expenseType]" |
| | | :value="item.id" |
| | | /> |
| | | </el-select> |
| | | <el-input v-model="query.reimbursementContent" 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="110px"> |
| | | <el-form-item label="所属营业费用" prop="businessExpenseId"> |
| | | <el-select v-model="form.businessExpenseId" placeholder="请选择" filterable clearable style="width: 340px;"> |
| | | <el-option |
| | | v-for="item in businessExpenseList" |
| | | :key="item.id" |
| | | :label="dict.label[expenseType][item.expenseType]" |
| | | :value="item.id" |
| | | /> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="报销内容" prop="reimbursementContent"> |
| | | <el-input v-model="form.reimbursementContent" style="width: 340px;" /> |
| | | </el-form-item> |
| | | <el-form-item label="报销金额" prop="reimbursementAmount"> |
| | | <money-input :key="random" v-model="form.reimbursementAmount" :width="340" /> |
| | | </el-form-item> |
| | | <el-form-item label="报销凭证"> |
| | | <image-upload ref="imageUpload" :key="random" :image-url="form.reimbursementVoucher == null || form.reimbursementVoucher === '' ? null : form.reimbursementVoucher" :limit="3" @imageInfo="getImageInfo" /> |
| | | </el-form-item> |
| | | <el-form-item label="备注"> |
| | | <el-input v-model="form.remarks" :rows="3" type="textarea" style="width: 340px;" /> |
| | | </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="businessExpenseId" label="所属营业费用"> |
| | | <template slot-scope="scope"> |
| | | {{ dict.label[expenseType][scope.row.businessExpenseType] }} |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column :show-overflow-tooltip="true" prop="reimbursementContent" label="报销内容" /> |
| | | <el-table-column :show-overflow-tooltip="true" prop="reimbursementAmount" label="报销金额"> |
| | | <template slot-scope="scope"> |
| | | {{ crud.toMoney(scope.row.reimbursementAmount) }} |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column :show-overflow-tooltip="true" prop="reimbursementVoucher" label="报销凭证"> |
| | | <template slot-scope="scope"> |
| | | <el-image |
| | | :src="scope.row.reimbursementVoucher != null && scope.row.reimbursementVoucher !== '' ? baseApi + scope.row.reimbursementVoucher.split(',')[0] : ''" |
| | | :preview-src-list="scope.row.reimbursementVoucher != null && scope.row.reimbursementVoucher !== '' ? scope.row.reimbursementVoucher.split(',').map(item => { return baseApi + item }) : []" |
| | | style="width: 100px;" |
| | | > |
| | | <div slot="placeholder" class="image-slot"> |
| | | 加载中... |
| | | </div> |
| | | <div slot="error" class="image-slot"> |
| | | 暂无图片 |
| | | </div> |
| | | </el-image> |
| | | </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','businessExpenseReimbursement:edit','businessExpenseReimbursement: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 crudBusinessExpenseReimbursement from '@/api/business/expenseReimbursement' |
| | | 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 crudBusinessExpense from '@/api/business/expense' |
| | | import moneyInput from '../../assembly/moneyInput/index.vue' |
| | | import imageUpload from '../../assembly/imageUpload/index.vue' |
| | | import { mapGetters } from 'vuex' |
| | | |
| | | const defaultForm = { id: null, businessExpenseId: null, reimbursementContent: null, reimbursementAmount: null, reimbursementVoucher: null, remarks: null, createBy: null, createTime: null, updateBy: null, updateTime: null } |
| | | export default { |
| | | name: 'BusinessExpenseReimbursement', |
| | | components: { pagination, crudOperation, rrOperation, udOperation, moneyInput, imageUpload }, |
| | | mixins: [presenter(), header(), form(defaultForm), crud()], |
| | | dicts: [constant.EXPENSE_TYPE], |
| | | cruds() { |
| | | return CRUD({ title: '营业费用明细', url: 'api/businessExpenseReimbursement', idField: 'id', sort: 'id,desc', crudMethod: { ...crudBusinessExpenseReimbursement }}) |
| | | }, |
| | | data() { |
| | | return { |
| | | permission: { |
| | | add: ['admin', 'businessExpenseReimbursement:add'], |
| | | edit: ['admin', 'businessExpenseReimbursement:edit'], |
| | | del: ['admin', 'businessExpenseReimbursement:del'], |
| | | download: ['admin', 'businessExpenseReimbursement:download'] |
| | | }, |
| | | rules: { |
| | | businessExpenseId: [ |
| | | { required: true, message: '所属营业费用不能为空', trigger: 'change' } |
| | | ], |
| | | reimbursementContent: [ |
| | | { required: true, message: '报销内容不能为空', trigger: 'blur' }, |
| | | { min: 2, max: 20, message: '长度在 2 到 20 个字符', trigger: 'blur' } |
| | | ], |
| | | reimbursementAmount: [ |
| | | { required: true, message: '报销金额不能为空', trigger: 'blur' } |
| | | ] |
| | | }, |
| | | queryTypeOptions: [ |
| | | { key: 'businessExpenseId', display_name: '所属营业费用' }, |
| | | { key: 'reimbursementContent', display_name: '报销内容' } |
| | | ], |
| | | // 字典:费用类型 |
| | | expenseType: constant.EXPENSE_TYPE, |
| | | // 随机数 |
| | | random: 0, |
| | | // 营业费用列表 |
| | | businessExpenseList: [] |
| | | } |
| | | }, |
| | | computed: { |
| | | ...mapGetters([ |
| | | 'baseApi' |
| | | ]) |
| | | }, |
| | | methods: { |
| | | // 钩子:在获取表格数据之前执行,false 则代表不获取数据 |
| | | [CRUD.HOOK.beforeRefresh]() { |
| | | // 获取营业费用 |
| | | this.getBusinessExpense() |
| | | return true |
| | | }, |
| | | // 获取营业费用 |
| | | getBusinessExpense() { |
| | | // 获取营业费用 |
| | | crudBusinessExpense.getAll().then(res => { |
| | | // 营业费用列表 |
| | | this.businessExpenseList = res |
| | | }) |
| | | }, |
| | | // 新增与编辑前做的操作 |
| | | [CRUD.HOOK.beforeToCU]() { |
| | | // 随机数 |
| | | this.random = Math.random() |
| | | }, |
| | | // 表单提交 |
| | | submitCU() { |
| | | // 通过“this.$refs.imageUpload”找到子页面,“submit”是子页面的方法。 |
| | | this.$refs.imageUpload.submit() |
| | | }, |
| | | // 获取图片信息 |
| | | getImageInfo(info) { |
| | | // 判断返回数据 |
| | | if (info.length === 0) { |
| | | // 表单图片路径赋值 |
| | | this.crud.form.reimbursementVoucher = null |
| | | // 表单提交 |
| | | this.crud.submitCU() |
| | | // 终止 |
| | | return |
| | | } |
| | | // 循环返回数据 |
| | | for (let i = 0; i < info.length; i++) { |
| | | // 判断循环下标 |
| | | if (i === 0) { |
| | | // 表单图片路径赋值 |
| | | this.crud.form.reimbursementVoucher = 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 { |
| | | // 表单图片路径赋值 |
| | | this.crud.form.reimbursementVoucher += 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) { |
| | | // 表单提交 |
| | | this.crud.submitCU() |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | </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.businessPlace" clearable placeholder="营业地" style="width: 185px;" class="filter-item" @keyup.enter.native="crud.toQuery" /> |
| | | <el-input v-model="query.businessContent" clearable placeholder="营业内容" style="width: 185px;" class="filter-item" @keyup.enter.native="crud.toQuery" /> |
| | | <el-select v-model="query.businessStatus" filterable clearable placeholder="营业状态" style="width: 185px;" class="filter-item" @keyup.enter.native="crud.toQuery"> |
| | | <el-option |
| | | v-for="item in dict[businessStatus]" |
| | | :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="600px"> |
| | | <el-form ref="form" :model="form" :rules="rules" size="small" label-width="80px"> |
| | | <el-form-item label="营业地" prop="businessPlace"> |
| | | <el-input v-model="form.businessPlace" style="width: 470px;" /> |
| | | </el-form-item> |
| | | <el-form-item label="营业内容" prop="businessContent"> |
| | | <el-input v-model="form.businessContent" :rows="3" type="textarea" style="width: 470px;" /> |
| | | </el-form-item> |
| | | <el-form-item label="营业状态" prop="businessStatus"> |
| | | <el-select v-model="form.businessStatus" filterable placeholder="请选择" style="width: 470px;"> |
| | | <el-option |
| | | v-for="item in dict[businessStatus]" |
| | | :key="item.id" |
| | | :label="item.label" |
| | | :value="item.value" |
| | | /> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-button size="mini" type="primary" icon="el-icon-plus" style="position: relative; left: 464px;" @click="personnelAdd()" /> |
| | | <el-table ref="table" :data="form.businessPlanPersonnelDtoList" size="small" style="width: 100%;"> |
| | | <el-table-column :show-overflow-tooltip="true" prop="userNickName" label="所属用户" /> |
| | | <el-table-column :show-overflow-tooltip="true" prop="businessPlanStartDate" label="营业计划开始日期"> |
| | | <template slot-scope="scope"> |
| | | {{ crud.toDate(scope.row.businessPlanStartDate) }} |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column :show-overflow-tooltip="true" prop="businessPlanEndDate" label="营业计划结束日期"> |
| | | <template slot-scope="scope"> |
| | | {{ crud.toDate(scope.row.businessPlanEndDate) }} |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column label="操作" width="150px" align="center"> |
| | | <template slot-scope="scope"> |
| | | <el-button size="mini" type="primary" icon="el-icon-edit" @click="personnelEdit(scope.row)" /> |
| | | <el-button size="mini" type="danger" icon="el-icon-delete" @click="personnelDelete(scope.row)" /> |
| | | </template> |
| | | </el-table-column> |
| | | </el-table> |
| | | <el-form-item label="备注" style="margin-top: 20px;"> |
| | | <el-input v-model="form.remarks" :rows="3" type="textarea" style="width: 470px;" /> |
| | | </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"> |
| | | <el-table :data="props.row.businessPlanPersonnelDtoList" style="margin: 10px 20px 10px 105px; width: calc(100% - 20px - 105px);"> |
| | | <el-table-column :show-overflow-tooltip="true" prop="userNickName" label="所属用户" /> |
| | | <el-table-column :show-overflow-tooltip="true" prop="businessPlanStartDate" label="营业计划开始日期"> |
| | | <template slot-scope="scope"> |
| | | {{ crud.toDate(scope.row.businessPlanStartDate) }} |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column :show-overflow-tooltip="true" prop="businessPlanEndDate" label="营业计划结束日期"> |
| | | <template slot-scope="scope"> |
| | | {{ crud.toDate(scope.row.businessPlanEndDate) }} |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column :show-overflow-tooltip="true" prop="remarks" label="备注" /> |
| | | </el-table> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column :show-overflow-tooltip="true" prop="businessPlace" label="营业地" /> |
| | | <el-table-column :show-overflow-tooltip="true" prop="businessContent" label="营业内容" /> |
| | | <el-table-column :show-overflow-tooltip="true" prop="businessStatus" label="营业状态"> |
| | | <template slot-scope="scope"> |
| | | <el-tag>{{ dict.label[businessStatus][scope.row.businessStatus] }}</el-tag> |
| | | </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','businessPlan:edit','businessPlan:del'])" label="操作" width="150px" align="center"> |
| | | <template slot-scope="scope"> |
| | | <udOperation |
| | | :data="scope.row" |
| | | :permission="permission" |
| | | /> |
| | | </template> |
| | | </el-table-column> |
| | | </el-table> |
| | | <!--分页组件--> |
| | | <pagination /> |
| | | <!--表单组件--> |
| | | <el-dialog :close-on-click-modal="false" :before-close="personnelCancel" :visible.sync="personnelStatus" :title="personnelTitle" width="600px"> |
| | | <el-form ref="personnelForm" :model="personnelForm" :rules="personnelRules" size="small" label-width="140px"> |
| | | <el-form-item label="所属用户" prop="userId"> |
| | | <el-select v-model="personnelForm.userId" placeholder="请选择" filterable clearable style="width: 410px;" @change="personnelFormUserIdChange"> |
| | | <el-option |
| | | v-for="item in userList" |
| | | :key="item.id" |
| | | :label="item.nickName" |
| | | :value="item.id" |
| | | /> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="营业计划开始日期" prop="businessPlanStartDate"> |
| | | <el-date-picker v-model="personnelForm.businessPlanStartDate" type="date" style="width: 410px;" /> |
| | | </el-form-item> |
| | | <el-form-item label="营业计划结束日期" prop="businessPlanEndDate"> |
| | | <el-date-picker v-model="personnelForm.businessPlanEndDate" type="date" style="width: 410px;" /> |
| | | </el-form-item> |
| | | <el-form-item label="备注"> |
| | | <el-input v-model="personnelForm.remarks" :rows="3" type="textarea" style="width: 410px;" /> |
| | | </el-form-item> |
| | | </el-form> |
| | | <div slot="footer" class="dialog-footer"> |
| | | <el-button type="text" @click="personnelCancel">取消</el-button> |
| | | <el-button :loading="personnelLoading" type="primary" @click="personnelSubmit('personnelForm')">确认</el-button> |
| | | </div> |
| | | </el-dialog> |
| | | </div> |
| | | </div> |
| | | </template> |
| | | |
| | | <script> |
| | | import crudBusinessPlan from '@/api/business/plan' |
| | | 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 crudUser from '@/api/system/user' |
| | | |
| | | const defaultForm = { id: null, businessPlace: null, businessContent: null, businessStatus: null, remarks: null, createBy: null, createTime: null, updateBy: null, updateTime: null, businessPlanPersonnelDtoList: [] } |
| | | export default { |
| | | name: 'BusinessPlan', |
| | | components: { pagination, crudOperation, rrOperation, udOperation }, |
| | | mixins: [presenter(), header(), form(defaultForm), crud()], |
| | | dicts: [constant.BUSINESS_STATUS], |
| | | cruds() { |
| | | return CRUD({ title: '营业计划', url: 'api/businessPlan', idField: 'id', sort: 'id,desc', crudMethod: { ...crudBusinessPlan }}) |
| | | }, |
| | | data() { |
| | | return { |
| | | permission: { |
| | | add: ['admin', 'businessPlan:add'], |
| | | edit: ['admin', 'businessPlan:edit'], |
| | | del: ['admin', 'businessPlan:del'], |
| | | download: ['admin', 'businessPlan:download'] |
| | | }, |
| | | rules: { |
| | | businessPlace: [ |
| | | { required: true, message: '营业地不能为空', trigger: 'blur' }, |
| | | { min: 2, max: 100, message: '长度在 2 到 100 个字符', trigger: 'blur' } |
| | | ], |
| | | businessContent: [ |
| | | { required: true, message: '营业内容不能为空', trigger: 'blur' } |
| | | ], |
| | | businessStatus: [ |
| | | { required: true, message: '营业状态不能为空', trigger: 'change' } |
| | | ] |
| | | }, |
| | | queryTypeOptions: [ |
| | | { key: 'businessPlace', display_name: '营业地' }, |
| | | { key: 'businessContent', display_name: '营业内容' }, |
| | | { key: 'businessStatus', display_name: '营业状态' } |
| | | ], |
| | | // 字典:营业状态 |
| | | businessStatus: constant.BUSINESS_STATUS, |
| | | // 营业计划人员弹窗状态 |
| | | personnelStatus: false, |
| | | // 营业计划人员弹窗标题 |
| | | personnelTitle: '营业计划人员', |
| | | // 营业计划人员弹窗表单 |
| | | personnelForm: {}, |
| | | // 营业计划人员弹窗验证 |
| | | personnelRules: { |
| | | businessPlanId: [ |
| | | { required: true, message: '所属营业计划不能为空', trigger: 'change' } |
| | | ], |
| | | userId: [ |
| | | { required: true, message: '所属用户不能为空', trigger: 'change' } |
| | | ], |
| | | businessPlanStartDate: [ |
| | | { required: true, message: '营业计划开始日期不能为空', trigger: 'change' } |
| | | ], |
| | | businessPlanEndDate: [ |
| | | { required: true, message: '营业计划结束日期不能为空', trigger: 'change' } |
| | | ] |
| | | }, |
| | | // 营业计划人员弹窗操作 |
| | | personnelExecute: {}, |
| | | // 营业计划人员弹窗加载 |
| | | personnelLoading: false, |
| | | // 用户列表 |
| | | userList: [] |
| | | } |
| | | }, |
| | | methods: { |
| | | // 钩子:在获取表格数据之前执行,false 则代表不获取数据 |
| | | [CRUD.HOOK.beforeRefresh]() { |
| | | // 获取用户 |
| | | this.getUser() |
| | | return true |
| | | }, |
| | | // 获取用户 |
| | | getUser() { |
| | | // 获取用户 |
| | | crudUser.getAll().then(res => { |
| | | // 用户列表 |
| | | this.userList = res |
| | | }) |
| | | }, |
| | | // 营业计划人员弹窗用户ID变更 |
| | | personnelFormUserIdChange() { |
| | | // 指针重定义 |
| | | const _this = this |
| | | // 筛选用户列表 |
| | | const personnelInfo = this.userList.filter(function(item) { |
| | | return item.id === _this.personnelForm.userId |
| | | }) |
| | | // 营业计划人员弹窗表单 |
| | | this.personnelForm.userNickName = personnelInfo[0].nickName |
| | | }, |
| | | // 营业计划人员弹窗新增 |
| | | personnelAdd() { |
| | | // 指针重定义 |
| | | const _this = this |
| | | // 营业计划人员弹窗表单 |
| | | this.personnelForm = {} |
| | | // 营业计划人员弹窗状态 |
| | | this.personnelStatus = true |
| | | // 营业计划人员弹窗操作 |
| | | this.personnelExecute = {} |
| | | // 表单清空 |
| | | setTimeout(function() { |
| | | _this.$refs['personnelForm'].clearValidate() |
| | | }, 3) |
| | | }, |
| | | // 营业计划人员弹窗修改 |
| | | personnelEdit(data) { |
| | | // 营业计划人员弹窗表单 |
| | | this.personnelForm = JSON.parse(JSON.stringify(data)) |
| | | // 营业计划人员弹窗状态 |
| | | this.personnelStatus = true |
| | | // 营业计划人员弹窗操作 |
| | | this.personnelExecute = JSON.parse(JSON.stringify(data)) |
| | | }, |
| | | // 营业计划人员弹窗删除 |
| | | personnelDelete(data) { |
| | | // 指针重定义 |
| | | const _this = this |
| | | // 筛选营业计划人员 |
| | | const personnelInfo = this.crud.form.businessPlanPersonnelDtoList.filter(function(item) { |
| | | return item.userId === data.userId && _this.crud.toDate(item.businessPlanStartDate) === _this.crud.toDate(data.businessPlanStartDate) && _this.crud.toDate(item.businessPlanEndDate) === _this.crud.toDate(data.businessPlanEndDate) |
| | | }) |
| | | // 获取下标 |
| | | const subscript = this.crud.form.businessPlanPersonnelDtoList.indexOf(personnelInfo[0]) |
| | | // 营业计划人员移除元素 |
| | | this.crud.form.businessPlanPersonnelDtoList.splice(subscript, 1) |
| | | }, |
| | | // 营业计划人员弹窗关闭 |
| | | personnelCancel() { |
| | | // 营业计划人员弹窗状态 |
| | | this.personnelStatus = false |
| | | }, |
| | | // 营业计划人员弹窗提交 |
| | | personnelSubmit(formName) { |
| | | this.$refs[formName].validate((valid) => { |
| | | if (valid) { |
| | | // 判断营业计划人员弹窗操作 |
| | | if (this.personnelExecute.userId !== undefined) { |
| | | // 营业计划人员弹编辑 |
| | | // 指针重定义 |
| | | const _this = this |
| | | // 筛选营业计划人员弹 |
| | | const personnelInfo = this.crud.form.businessPlanPersonnelDtoList.filter(function(item) { |
| | | return item.userId === _this.personnelExecute.userId && _this.crud.toDate(item.businessPlanStartDate) === _this.crud.toDate(_this.personnelExecute.businessPlanStartDate) && _this.crud.toDate(item.businessPlanEndDate) === _this.crud.toDate(_this.personnelExecute.businessPlanEndDate) |
| | | }) |
| | | // 营业计划人员弹更新 |
| | | personnelInfo[0].userId = this.personnelForm.userId |
| | | personnelInfo[0].userNickName = this.personnelForm.userNickName |
| | | personnelInfo[0].businessPlanStartDate = this.personnelForm.businessPlanStartDate |
| | | personnelInfo[0].businessPlanEndDate = this.personnelForm.businessPlanEndDate |
| | | personnelInfo[0].remarks = this.personnelForm.remarks |
| | | } else { |
| | | // 营业计划人员新增 |
| | | this.crud.form.businessPlanPersonnelDtoList.push(this.personnelForm) |
| | | } |
| | | // 营业计划人员弹窗关闭 |
| | | this.personnelCancel() |
| | | } else { |
| | | return false |
| | | } |
| | | }) |
| | | } |
| | | } |
| | | } |
| | | </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.businessPlanId" clearable placeholder="所属营业计划" style="width: 185px;" class="filter-item" @keyup.enter.native="crud.toQuery"> |
| | | <el-option |
| | | v-for="item in businessPlanList" |
| | | :key="item.id" |
| | | :label="item.businessContent" |
| | | :value="item.id" |
| | | /> |
| | | </el-select> |
| | | <el-select v-model="query.userId" clearable placeholder="所属用户" style="width: 185px;" class="filter-item" @keyup.enter.native="crud.toQuery"> |
| | | <el-option |
| | | v-for="item in userList" |
| | | :key="item.id" |
| | | :label="item.nickName" |
| | | :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="600px"> |
| | | <el-form ref="form" :model="form" :rules="rules" size="small" label-width="140px"> |
| | | <el-form-item label="所属营业计划" prop="businessPlanId"> |
| | | <el-select v-model="form.businessPlanId" placeholder="请选择" filterable clearable style="width: 410px;"> |
| | | <el-option |
| | | v-for="item in businessPlanList" |
| | | :key="item.id" |
| | | :label="item.businessContent" |
| | | :value="item.id" |
| | | /> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="所属用户" prop="userId"> |
| | | <el-select v-model="form.userId" placeholder="请选择" filterable clearable style="width: 410px;"> |
| | | <el-option |
| | | v-for="item in userList" |
| | | :key="item.id" |
| | | :label="item.nickName" |
| | | :value="item.id" |
| | | /> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="营业计划开始日期" prop="businessPlanStartDate"> |
| | | <el-date-picker v-model="form.businessPlanStartDate" type="date" style="width: 410px;" /> |
| | | </el-form-item> |
| | | <el-form-item label="营业计划结束日期" prop="businessPlanEndDate"> |
| | | <el-date-picker v-model="form.businessPlanEndDate" type="date" style="width: 410px;" /> |
| | | </el-form-item> |
| | | <el-form-item label="备注"> |
| | | <el-input v-model="form.remarks" :rows="3" type="textarea" style="width: 410px;" /> |
| | | </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="businessPlanContent" label="所属营业计划" /> |
| | | <el-table-column :show-overflow-tooltip="true" prop="userNickName" label="所属用户" /> |
| | | <el-table-column :show-overflow-tooltip="true" prop="businessPlanStartDate" label="营业计划开始日期"> |
| | | <template slot-scope="scope"> |
| | | {{ crud.toDate(scope.row.businessPlanStartDate) }} |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column :show-overflow-tooltip="true" prop="businessPlanEndDate" label="营业计划结束日期"> |
| | | <template slot-scope="scope"> |
| | | {{ crud.toDate(scope.row.businessPlanEndDate) }} |
| | | </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','businessPlanPersonnel:edit','businessPlanPersonnel: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 crudBusinessPlanPersonnel from '@/api/business/planPersonnel' |
| | | 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 crudBusinessPlan from '@/api/business/plan' |
| | | import crudUser from '@/api/system/user' |
| | | |
| | | const defaultForm = { id: null, businessPlanId: null, userId: null, businessPlanStartDate: null, businessPlanEndDate: null, remarks: null, createBy: null, createTime: null, updateBy: null, updateTime: null } |
| | | export default { |
| | | name: 'BusinessPlanPersonnel', |
| | | components: { pagination, crudOperation, rrOperation, udOperation }, |
| | | mixins: [presenter(), header(), form(defaultForm), crud()], |
| | | cruds() { |
| | | return CRUD({ title: '营业计划人员', url: 'api/businessPlanPersonnel', idField: 'id', sort: 'id,desc', crudMethod: { ...crudBusinessPlanPersonnel }}) |
| | | }, |
| | | data() { |
| | | return { |
| | | permission: { |
| | | add: ['admin', 'businessPlanPersonnel:add'], |
| | | edit: ['admin', 'businessPlanPersonnel:edit'], |
| | | del: ['admin', 'businessPlanPersonnel:del'], |
| | | download: ['admin', 'businessPlanPersonnel:download'] |
| | | }, |
| | | rules: { |
| | | businessPlanId: [ |
| | | { required: true, message: '所属营业计划不能为空', trigger: 'change' } |
| | | ], |
| | | userId: [ |
| | | { required: true, message: '所属用户不能为空', trigger: 'change' } |
| | | ], |
| | | businessPlanStartDate: [ |
| | | { required: true, message: '营业计划开始日期不能为空', trigger: 'change' } |
| | | ], |
| | | businessPlanEndDate: [ |
| | | { required: true, message: '营业计划结束日期不能为空', trigger: 'change' } |
| | | ] |
| | | }, |
| | | queryTypeOptions: [ |
| | | { key: 'businessPlanId', display_name: '所属营业计划' }, |
| | | { key: 'userId', display_name: '所属用户' } |
| | | ], |
| | | // 营业计划列表 |
| | | businessPlanList: [], |
| | | // 用户列表 |
| | | userList: [] |
| | | } |
| | | }, |
| | | methods: { |
| | | // 钩子:在获取表格数据之前执行,false 则代表不获取数据 |
| | | [CRUD.HOOK.beforeRefresh]() { |
| | | // 获取营业计划 |
| | | this.getBusinessPlan() |
| | | // 获取用户 |
| | | this.getUser() |
| | | return true |
| | | }, |
| | | // 获取营业计划 |
| | | getBusinessPlan() { |
| | | // 获取营业计划 |
| | | crudBusinessPlan.getAll().then(res => { |
| | | // 营业计划列表 |
| | | this.businessPlanList = res |
| | | }) |
| | | }, |
| | | // 获取用户 |
| | | getUser() { |
| | | // 获取用户 |
| | | crudUser.getAll().then(res => { |
| | | // 用户列表 |
| | | this.userList = res |
| | | }) |
| | | } |
| | | } |
| | | } |
| | | </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.projectDistinguish" filterable clearable placeholder="项目区分" style="width: 185px;" class="filter-item" @keyup.enter.native="crud.toQuery"> |
| | | <el-option |
| | | v-for="item in dict[projectDistinguish]" |
| | | :key="item.id" |
| | | :label="item.label" |
| | | :value="item.value" |
| | | /> |
| | | </el-select> |
| | | <el-select v-model="query.accountType" filterable clearable placeholder="账户类型" style="width: 185px;" class="filter-item" @keyup.enter.native="crud.toQuery"> |
| | | <el-option |
| | | v-for="item in dict[accountType]" |
| | | :key="item.id" |
| | | :label="item.label" |
| | | :value="item.value" |
| | | /> |
| | | </el-select> |
| | | <el-input v-model="query.accountName" clearable placeholder="账户名称" style="width: 185px;" class="filter-item" @keyup.enter.native="crud.toQuery" /> |
| | | <el-date-picker v-model="query.accountYear" type="year" clearable placeholder="账户年度" style="width: 185px;" class="filter-item" @keyup.enter.native="crud.toQuery" /> |
| | | <el-select v-model="query.settlementStatus" filterable clearable placeholder="结算状态" style="width: 185px;" class="filter-item" @keyup.enter.native="crud.toQuery"> |
| | | <el-option |
| | | v-for="item in dict[settlementStatus]" |
| | | :key="item.id" |
| | | :label="item.label" |
| | | :value="item.value" |
| | | /> |
| | | </el-select> |
| | | <rrOperation :crud="crud" /> |
| | | </div> |
| | | <!--如果想在工具栏加入更多按钮,可以使用插槽方式, slot = 'left' or 'right'--> |
| | | <crudOperation :permission="permission"> |
| | | <el-button |
| | | slot="right" |
| | | v-permission="permission.set" |
| | | class="filter-item" |
| | | size="mini" |
| | | type="info" |
| | | icon="el-icon-setting" |
| | | @click="toSet" |
| | | > |
| | | 设定 |
| | | </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="projectDistinguish"> |
| | | <el-select v-model="form.projectDistinguish" filterable placeholder="请选择" style="width: 370px;" :disabled="formDisabled" @change="projectDistinguishChange"> |
| | | <el-option |
| | | v-for="item in dict[projectDistinguish]" |
| | | :key="item.id" |
| | | :label="item.label" |
| | | :value="item.value" |
| | | /> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="账户类型" prop="accountType"> |
| | | <el-select v-model="form.accountType" filterable placeholder="请选择" style="width: 370px;" disabled> |
| | | <el-option |
| | | v-for="item in dict[accountType]" |
| | | :key="item.id" |
| | | :label="item.label" |
| | | :value="item.value" |
| | | /> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="账户名称" prop="accountName"> |
| | | <el-input v-model="form.accountName" style="width: 370px;" :disabled="formDisabled" /> |
| | | </el-form-item> |
| | | <el-form-item label="账户年度" prop="accountYear"> |
| | | <el-date-picker v-model="form.accountYear" type="year" style="width: 370px;" :disabled="formDisabled" /> |
| | | </el-form-item> |
| | | <el-form-item label="期初金额" prop="openingAmount"> |
| | | <money-input :key="random" v-model="form.openingAmount" :width="370" :disabled="formDisabled" /> |
| | | </el-form-item> |
| | | <el-form-item label="警戒金额" prop="warnAmount"> |
| | | <money-input :key="random" v-model="form.warnAmount" :width="370" :disabled="formDisabled" /> |
| | | </el-form-item> |
| | | <el-form-item label="账户金额" prop="accountAmount"> |
| | | <money-input :key="random" v-model="form.accountAmount" :width="370" :disabled="formDisabled" /> |
| | | </el-form-item> |
| | | <el-form-item label="结算状态" prop="settlementStatus"> |
| | | <el-select v-model="form.settlementStatus" filterable placeholder="请选择" style="width: 370px;" :disabled="formDisabled"> |
| | | <el-option |
| | | v-for="item in dict[settlementStatus]" |
| | | :key="item.id" |
| | | :label="item.label" |
| | | :value="item.value" |
| | | /> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="备注"> |
| | | <el-input v-model="form.remarks" :rows="3" type="textarea" style="width: 370px;" :disabled="formDisabled" /> |
| | | </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="projectDistinguish" label="项目区分"> |
| | | <template slot-scope="scope"> |
| | | <el-tag>{{ dict.label[projectDistinguish][scope.row.projectDistinguish] }}</el-tag> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column :show-overflow-tooltip="true" prop="accountType" label="账户类型"> |
| | | <template slot-scope="scope"> |
| | | <el-tag>{{ dict.label[accountType][scope.row.accountType] }}</el-tag> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column :show-overflow-tooltip="true" prop="accountName" label="账户名称"> |
| | | <template slot-scope="scope"> |
| | | <span :style="{color: (scope.row.accountAmount <= scope.row.warnAmount ? 'red' : '')}">{{ scope.row.accountName }}</span> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column :show-overflow-tooltip="true" prop="accountYear" label="账户年度"> |
| | | <template slot-scope="scope"> |
| | | {{ crud.toYear(scope.row.accountYear) }} |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column :show-overflow-tooltip="true" prop="openingAmount" label="期初金额"> |
| | | <template slot-scope="scope"> |
| | | {{ crud.toMoney(scope.row.openingAmount) }} |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column :show-overflow-tooltip="true" prop="warnAmount" label="警戒金额"> |
| | | <template slot-scope="scope"> |
| | | {{ crud.toMoney(scope.row.warnAmount) }} |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column :show-overflow-tooltip="true" prop="accountAmount" label="账户金额"> |
| | | <template slot-scope="scope"> |
| | | <span :style="{color: (scope.row.accountAmount <= scope.row.warnAmount ? 'red' : '')}">{{ crud.toMoney(scope.row.accountAmount) }}</span> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column :show-overflow-tooltip="true" prop="settlementStatus" label="结算状态"> |
| | | <template slot-scope="scope"> |
| | | {{ dict.label.settlement_status[scope.row.settlementStatus] }} |
| | | </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','capitalAccountCompany:edit','capitalAccountCompany: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 crudCapitalAccountCompany from '@/api/capital/accountCompany' |
| | | 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' |
| | | import crudCapitalAccountCompanySet from '@/api/capital/accountCompanySet' |
| | | |
| | | const defaultForm = { id: null, projectDistinguish: null, accountType: null, accountName: null, accountYear: null, openingAmount: null, warnAmount: null, accountAmount: null, settlementStatus: constant.SETTLEMENT_STATUS_UNSETTLED, remarks: null, createBy: null, createTime: null, updateBy: null, updateTime: null } |
| | | export default { |
| | | name: 'CapitalAccountCompany', |
| | | components: { pagination, crudOperation, rrOperation, udOperation, moneyInput }, |
| | | mixins: [presenter(), header(), form(defaultForm), crud()], |
| | | dicts: [constant.PROJECT_DISTINGUISH, constant.ACCOUNT_TYPE, constant.SETTLEMENT_STATUS], |
| | | cruds() { |
| | | return CRUD({ title: '年度资金账户(公司流)', url: 'api/capitalAccountCompany', idField: 'id', sort: 'id,desc', crudMethod: { ...crudCapitalAccountCompany }}) |
| | | }, |
| | | data() { |
| | | // 金额(亿内)验证 |
| | | var amountValidate = (rule, value, callback) => { |
| | | if (value != null && value !== '' && (isNaN(value) || Number(value) < 0 || Number(value) > 100000000)) { |
| | | callback(new Error('请输入 一亿 以内的正整数或两位小数')) |
| | | } else { |
| | | callback() |
| | | } |
| | | } |
| | | return { |
| | | permission: { |
| | | add: ['admin', 'capitalAccountCompany:add'], |
| | | edit: ['admin', 'capitalAccountCompany:edit'], |
| | | del: ['admin', 'capitalAccountCompany:del'], |
| | | download: ['admin', 'capitalAccountCompany:download'], |
| | | set: ['admin', 'capitalAccountCompany:set'] |
| | | }, |
| | | rules: { |
| | | projectDistinguish: [ |
| | | { required: true, message: '项目区分不能为空', trigger: 'change' } |
| | | ], |
| | | accountType: [ |
| | | { required: true, message: '账户类型不能为空', trigger: 'change' } |
| | | ], |
| | | accountName: [ |
| | | { required: true, message: '账户名称不能为空', trigger: 'blur' }, |
| | | { min: 2, max: 20, message: '长度在 2 到 20 个字符', trigger: 'blur' } |
| | | ], |
| | | accountYear: [ |
| | | { required: true, message: '账户年度不能为空', trigger: 'change' } |
| | | ], |
| | | openingAmount: [ |
| | | { required: true, message: '期初金额不能为空', trigger: 'blur' }, |
| | | { validator: amountValidate, trigger: 'blur' } |
| | | ], |
| | | warnAmount: [ |
| | | { required: true, message: '警戒金额不能为空', trigger: 'blur' }, |
| | | { validator: amountValidate, trigger: 'blur' } |
| | | ], |
| | | accountAmount: [ |
| | | { required: true, message: '账户金额不能为空', trigger: 'blur' }, |
| | | { validator: amountValidate, trigger: 'blur' } |
| | | ], |
| | | settlementStatus: [ |
| | | { required: true, message: '结算状态不能为空', trigger: 'change' } |
| | | ] |
| | | }, |
| | | queryTypeOptions: [ |
| | | { key: 'projectDistinguish', display_name: '项目区分' }, |
| | | { key: 'accountType', display_name: '账户类型' }, |
| | | { key: 'accountName', display_name: '账户名称' }, |
| | | { key: 'accountYear', display_name: '账户年度' }, |
| | | { key: 'settlementStatus', display_name: '结算状态' } |
| | | ], |
| | | // 字典:项目区分 |
| | | projectDistinguish: constant.PROJECT_DISTINGUISH, |
| | | // 字典:账户类型 |
| | | accountType: constant.ACCOUNT_TYPE, |
| | | // 字典:结算状态 |
| | | settlementStatus: constant.SETTLEMENT_STATUS, |
| | | // 随机数 |
| | | random: 0, |
| | | // 表单禁用 |
| | | formDisabled: false |
| | | } |
| | | }, |
| | | methods: { |
| | | // 钩子:在获取表格数据之前执行,false 则代表不获取数据 |
| | | [CRUD.HOOK.beforeRefresh]() { |
| | | return true |
| | | }, |
| | | // 钩子: 开始 "新建/编辑" - 之前 |
| | | [CRUD.HOOK.beforeToCU]() { |
| | | // 判断结算状态 |
| | | if (this.crud.form.settlementStatus === constant.SETTLEMENT_STATUS_SETTLED) { |
| | | // 表单禁用 |
| | | this.formDisabled = true |
| | | } else { |
| | | // 表单禁用 |
| | | this.formDisabled = false |
| | | } |
| | | // 随机数 |
| | | this.random = Math.random() |
| | | }, |
| | | // 项目区分变更 |
| | | projectDistinguishChange() { |
| | | // 获取年度资金账户(公司流) |
| | | crudCapitalAccountCompanySet.getAll({ projectDistinguish: this.crud.form.projectDistinguish }).then(res => { |
| | | // 判断结果集数量 |
| | | if (res.length > 1) { |
| | | // 消息提示 |
| | | this.crud.notify('查到多个相同项目区分账户设定,请联系管理员处理!', CRUD.NOTIFICATION_TYPE.WARNING) |
| | | } else if (res.length === 1) { |
| | | // 账户类型 |
| | | this.crud.form.accountType = res[0].accountType |
| | | } else { |
| | | // 账户类型 |
| | | this.crud.form.accountType = null |
| | | } |
| | | }) |
| | | }, |
| | | // 去设定 |
| | | toSet() { |
| | | // 跳转页面 |
| | | this.$router.push({ path: '/capital/accountCompanySet' }) |
| | | } |
| | | } |
| | | } |
| | | </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.projectDistinguish" filterable clearable placeholder="项目区分" style="width: 185px;" class="filter-item" @keyup.enter.native="crud.toQuery"> |
| | | <el-option |
| | | v-for="item in dict[projectDistinguish]" |
| | | :key="item.id" |
| | | :label="item.label" |
| | | :value="item.value" |
| | | /> |
| | | </el-select> |
| | | <el-select v-model="query.accountType" filterable clearable placeholder="账户类型" style="width: 185px;" class="filter-item" @keyup.enter.native="crud.toQuery"> |
| | | <el-option |
| | | v-for="item in dict[accountType]" |
| | | :key="item.id" |
| | | :label="item.label" |
| | | :value="item.value" |
| | | /> |
| | | </el-select> |
| | | <el-input v-model="query.accountName" 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="projectDistinguish"> |
| | | <el-select v-model="form.projectDistinguish" filterable placeholder="请选择" style="width: 370px;"> |
| | | <el-option |
| | | v-for="item in dict[projectDistinguish]" |
| | | :key="item.id" |
| | | :label="item.label" |
| | | :value="item.value" |
| | | /> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="账户类型" prop="accountType"> |
| | | <el-select v-model="form.accountType" filterable placeholder="请选择" style="width: 370px;"> |
| | | <el-option |
| | | v-for="item in dict[accountType]" |
| | | :key="item.id" |
| | | :label="item.label" |
| | | :value="item.value" |
| | | /> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="账户名称" prop="accountName"> |
| | | <el-input v-model="form.accountName" style="width: 370px;" /> |
| | | </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="projectDistinguish" label="项目区分"> |
| | | <template slot-scope="scope"> |
| | | <el-tag>{{ dict.label[projectDistinguish][scope.row.projectDistinguish] }}</el-tag> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column :show-overflow-tooltip="true" prop="accountType" label="账户类型"> |
| | | <template slot-scope="scope"> |
| | | {{ dict.label[accountType][scope.row.accountType] }} |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column :show-overflow-tooltip="true" prop="accountName" label="账户名称" /> |
| | | <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','capitalAccountCompanySet:edit','capitalAccountCompanySet: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 crudCapitalAccountCompanySet from '@/api/capital/accountCompanySet' |
| | | 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' |
| | | |
| | | const defaultForm = { id: null, projectDistinguish: null, accountType: null, accountName: null, remarks: null, createBy: null, createTime: null, updateBy: null, updateTime: null } |
| | | export default { |
| | | name: 'CapitalAccountCompanySet', |
| | | components: { pagination, crudOperation, rrOperation, udOperation }, |
| | | mixins: [presenter(), header(), form(defaultForm), crud()], |
| | | dicts: [constant.PROJECT_DISTINGUISH, constant.ACCOUNT_TYPE], |
| | | cruds() { |
| | | return CRUD({ title: '年度资金账户(公司流)设定', url: 'api/capitalAccountCompanySet', idField: 'id', sort: 'id,desc', crudMethod: { ...crudCapitalAccountCompanySet }}) |
| | | }, |
| | | data() { |
| | | return { |
| | | permission: { |
| | | add: ['admin', 'capitalAccountCompanySet:add'], |
| | | edit: ['admin', 'capitalAccountCompanySet:edit'], |
| | | del: ['admin', 'capitalAccountCompanySet:del'], |
| | | download: ['admin', 'capitalAccountCompanySet:download'] |
| | | }, |
| | | rules: { |
| | | projectDistinguish: [ |
| | | { required: true, message: '项目区分不能为空', trigger: 'change' } |
| | | ], |
| | | accountType: [ |
| | | { required: true, message: '账户类型不能为空', trigger: 'change' } |
| | | ], |
| | | accountName: [ |
| | | { required: true, message: '账户名称不能为空', trigger: 'blur' }, |
| | | { min: 2, max: 20, message: '长度在 2 到 20 个字符', trigger: 'blur' } |
| | | ] |
| | | }, |
| | | queryTypeOptions: [ |
| | | { key: 'projectDistinguish', display_name: '项目区分' }, |
| | | { key: 'accountType', display_name: '账户类型' }, |
| | | { key: 'accountName', display_name: '账户名称' } |
| | | ], |
| | | // 字典:项目区分 |
| | | projectDistinguish: constant.PROJECT_DISTINGUISH, |
| | | // 字典:账户类型 |
| | | accountType: constant.ACCOUNT_TYPE |
| | | } |
| | | }, |
| | | methods: { |
| | | // 钩子:在获取表格数据之前执行,false 则代表不获取数据 |
| | | [CRUD.HOOK.beforeRefresh]() { |
| | | 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.accountName" clearable placeholder="账户名称" style="width: 185px;" class="filter-item" @keyup.enter.native="crud.toQuery" /> |
| | | <el-date-picker v-model="query.accountYear" type="year" clearable placeholder="账户年度" style="width: 185px;" class="filter-item" @keyup.enter.native="crud.toQuery" /> |
| | | <el-select v-model="query.settlementStatus" filterable clearable placeholder="结算状态" style="width: 185px;" class="filter-item" @keyup.enter.native="crud.toQuery"> |
| | | <el-option |
| | | v-for="item in dict[settlementStatus]" |
| | | :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="accountName"> |
| | | <el-input v-model="form.accountName" style="width: 370px;" :disabled="formDisabled" /> |
| | | </el-form-item> |
| | | <el-form-item label="账户年度" prop="accountYear"> |
| | | <el-date-picker v-model="form.accountYear" type="year" style="width: 370px;" :disabled="formDisabled" /> |
| | | </el-form-item> |
| | | <el-form-item label="期初金额" prop="openingAmount"> |
| | | <money-input :key="random" v-model="form.openingAmount" :width="370" :disabled="formDisabled" /> |
| | | </el-form-item> |
| | | <el-form-item label="警戒金额" prop="warnAmount"> |
| | | <money-input :key="random" v-model="form.warnAmount" :width="370" :disabled="formDisabled" /> |
| | | </el-form-item> |
| | | <el-form-item label="账户金额" prop="accountAmount"> |
| | | <money-input :key="random" v-model="form.accountAmount" :width="370" :disabled="formDisabled" /> |
| | | </el-form-item> |
| | | <el-form-item label="结算状态" prop="settlementStatus"> |
| | | <el-select v-model="form.settlementStatus" filterable placeholder="请选择" style="width: 370px;" :disabled="formDisabled"> |
| | | <el-option |
| | | v-for="item in dict[settlementStatus]" |
| | | :key="item.id" |
| | | :label="item.label" |
| | | :value="item.value" |
| | | /> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="备注"> |
| | | <el-input v-model="form.remarks" :rows="3" type="textarea" style="width: 370px;" :disabled="formDisabled" /> |
| | | </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="accountName" label="账户名称"> |
| | | <template slot-scope="scope"> |
| | | <span :style="{color: (scope.row.accountAmount <= scope.row.warnAmount ? 'red' : '')}">{{ scope.row.accountName }}</span> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column :show-overflow-tooltip="true" prop="accountYear" label="账户年度"> |
| | | <template slot-scope="scope"> |
| | | {{ crud.toYear(scope.row.accountYear) }} |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column :show-overflow-tooltip="true" prop="openingAmount" label="期初金额"> |
| | | <template slot-scope="scope"> |
| | | {{ crud.toMoney(scope.row.openingAmount) }} |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column :show-overflow-tooltip="true" prop="warnAmount" label="警戒金额"> |
| | | <template slot-scope="scope"> |
| | | {{ crud.toMoney(scope.row.warnAmount) }} |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column :show-overflow-tooltip="true" prop="accountAmount" label="账户金额"> |
| | | <template slot-scope="scope"> |
| | | <span :style="{color: (scope.row.accountAmount <= scope.row.warnAmount ? 'red' : '')}">{{ crud.toMoney(scope.row.accountAmount) }}</span> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column :show-overflow-tooltip="true" prop="settlementStatus" label="结算状态"> |
| | | <template slot-scope="scope"> |
| | | <el-tag>{{ dict.label[settlementStatus][scope.row.settlementStatus] }}</el-tag> |
| | | </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','capitalAccountMoney:edit','capitalAccountMoney: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 crudCapitalAccountMoney from '@/api/capital/accountMoney' |
| | | 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, accountName: null, accountYear: null, openingAmount: null, warnAmount: null, accountAmount: null, settlementStatus: constant.SETTLEMENT_STATUS_UNSETTLED, remarks: null, createBy: null, createTime: null, updateBy: null, updateTime: null } |
| | | export default { |
| | | name: 'CapitalAccountMoney', |
| | | components: { pagination, crudOperation, rrOperation, udOperation, moneyInput }, |
| | | mixins: [presenter(), header(), form(defaultForm), crud()], |
| | | dicts: [constant.SETTLEMENT_STATUS], |
| | | cruds() { |
| | | return CRUD({ title: '年度资金账户(现金流)', url: 'api/capitalAccountMoney', idField: 'id', sort: 'id,desc', crudMethod: { ...crudCapitalAccountMoney }}) |
| | | }, |
| | | data() { |
| | | // 金额(亿内)验证 |
| | | var amountValidate = (rule, value, callback) => { |
| | | if (value != null && value !== '' && (isNaN(value) || Number(value) < 0 || Number(value) > 100000000)) { |
| | | callback(new Error('请输入 一亿 以内的正整数或两位小数')) |
| | | } else { |
| | | callback() |
| | | } |
| | | } |
| | | return { |
| | | permission: { |
| | | add: ['admin', 'capitalAccountMoney:add'], |
| | | edit: ['admin', 'capitalAccountMoney:edit'], |
| | | del: ['admin', 'capitalAccountMoney:del'], |
| | | download: ['admin', 'capitalAccountMoney:download'] |
| | | }, |
| | | rules: { |
| | | accountName: [ |
| | | { required: true, message: '账户名称不能为空', trigger: 'blur' }, |
| | | { min: 2, max: 20, message: '长度在 2 到 20 个字符', trigger: 'blur' } |
| | | ], |
| | | accountYear: [ |
| | | { required: true, message: '账户年度不能为空', trigger: 'change' } |
| | | ], |
| | | openingAmount: [ |
| | | { required: true, message: '期初金额不能为空', trigger: 'blur' }, |
| | | { validator: amountValidate, trigger: 'blur' } |
| | | ], |
| | | warnAmount: [ |
| | | { required: true, message: '警戒金额不能为空', trigger: 'blur' }, |
| | | { validator: amountValidate, trigger: 'blur' } |
| | | ], |
| | | accountAmount: [ |
| | | { required: true, message: '账户金额不能为空', trigger: 'blur' }, |
| | | { validator: amountValidate, trigger: 'blur' } |
| | | ], |
| | | settlementStatus: [ |
| | | { required: true, message: '结算状态不能为空', trigger: 'change' } |
| | | ] |
| | | }, |
| | | queryTypeOptions: [ |
| | | { key: 'accountName', display_name: '账户名称' }, |
| | | { key: 'accountYear', display_name: '账户年度' }, |
| | | { key: 'settlementStatus', display_name: '结算状态' } |
| | | ], |
| | | // 字典:结算状态 |
| | | settlementStatus: constant.SETTLEMENT_STATUS, |
| | | // 随机数 |
| | | random: 0, |
| | | // 表单禁用 |
| | | formDisabled: false |
| | | } |
| | | }, |
| | | methods: { |
| | | // 钩子:在获取表格数据之前执行,false 则代表不获取数据 |
| | | [CRUD.HOOK.beforeRefresh]() { |
| | | return true |
| | | }, |
| | | // 钩子: 开始 "新建/编辑" - 之前 |
| | | [CRUD.HOOK.beforeToCU]() { |
| | | // 判断结算状态 |
| | | if (this.crud.form.settlementStatus === constant.SETTLEMENT_STATUS_SETTLED) { |
| | | // 表单禁用 |
| | | this.formDisabled = true |
| | | } else { |
| | | // 表单禁用 |
| | | this.formDisabled = false |
| | | } |
| | | // 随机数 |
| | | this.random = Math.random() |
| | | } |
| | | } |
| | | } |
| | | </script> |
| | | |
| | | <style scoped> |
| | | |
| | | </style> |
| | |
| | | <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-select v-model="query.accountCompanyId" filterable clearable placeholder="所属年度账号" style="width: 185px;" class="filter-item" @keyup.enter.native="crud.toQuery"> |
| | | <el-option |
| | | v-for="item in companyList" |
| | | v-for="item in accountCompanyList" |
| | | :key="item.id" |
| | | :label="item.label" |
| | | :label="item.accountName" |
| | | :value="item.id" |
| | | /> |
| | | </el-select> |
| | |
| | | </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 ref="form" :model="form" :rules="rules" size="small" label-width="110px"> |
| | | <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-date-picker v-model="form.flowYearMonth" type="month" style="width: 340px;" 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-form-item label="所属年度账号" prop="accountCompanyId"> |
| | | <el-select v-model="form.accountCompanyId" filterable clearable placeholder="请选择" style="width: 340px;"> |
| | | <el-option |
| | | v-for="item in companyList" |
| | | v-for="item in accountCompanyList" |
| | | :key="item.id" |
| | | :label="item.label" |
| | | :label="item.accountName" |
| | | :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-input v-model="form.remarks" :rows="3" type="textarea" style="width: 340px;" /> |
| | | </el-form-item> |
| | | </el-form> |
| | | <div slot="footer" class="dialog-footer"> |
| | |
| | | {{ crud.toMonth(scope.row.flowYearMonth) }} |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="companyName" label="所属公司"> |
| | | <el-table-column prop="accountCompanyName" label="所属年度账号"> |
| | | <template slot-scope="scope"> |
| | | <el-tag>{{ scope.row.companyName }}</el-tag> |
| | | <el-tag>{{ scope.row.accountCompanyName }}</el-tag> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="capitalFlowExpendsAmount" label="支出总金额"> |
| | |
| | | placeholder="请选择" |
| | | /> |
| | | </el-form-item> |
| | | <el-form-item label="所属公司" prop="companyId"> |
| | | <el-select v-model="generateForm.companyId" filterable clearable placeholder="请选择" style="width: 370px;"> |
| | | <el-form-item label="所属年度账号" prop="accountCompanyId"> |
| | | <el-select v-model="generateForm.accountCompanyId" filterable clearable placeholder="请选择" style="width: 370px;"> |
| | | <el-option |
| | | v-for="item in companyList" |
| | | v-for="item in accountCompanyList" |
| | | :key="item.id" |
| | | :label="item.label" |
| | | :label="item.accountName" |
| | | :value="item.id" |
| | | /> |
| | | </el-select> |
| | |
| | | import crudOperation from '@crud/CRUD.operation' |
| | | import udOperation from '@crud/UD.operation' |
| | | import pagination from '@crud/Pagination' |
| | | import crudSysCompany from '@/api/system/sysCompany' |
| | | import crudCapitalAccountCompany from '@/api/capital/accountCompany' |
| | | |
| | | const defaultForm = { id: null, flowYearMonth: null, companyId: null, remarks: null, createBy: null, createTime: null, updateBy: null, updateTime: null } |
| | | const defaultForm = { id: null, flowYearMonth: null, accountCompanyId: null, remarks: null, createBy: null, createTime: null, updateBy: null, updateTime: null } |
| | | export default { |
| | | name: 'CapitalFlow', |
| | | components: { pagination, crudOperation, rrOperation, udOperation }, |
| | |
| | | flowYearMonth: [ |
| | | { required: true, message: '流水年月不能为空', trigger: 'change' } |
| | | ], |
| | | companyId: [ |
| | | accountCompanyId: [ |
| | | { required: true, message: '所属公司不能为空', trigger: 'change' } |
| | | ] |
| | | }, |
| | | queryTypeOptions: [ |
| | | { key: 'flowYearMonth', display_name: '流水年月' }, |
| | | { key: 'companyId', display_name: '所属公司' } |
| | | { key: 'accountCompanyId', display_name: '所属公司' } |
| | | ], |
| | | // 公司列表 |
| | | companyList: [], |
| | | // 年度账号列表 |
| | | accountCompanyList: [], |
| | | // 生成表单状态 |
| | | generateStatus: false, |
| | | // 生成表单加载 |
| | | generateLoading: false, |
| | | // 生成表单数据 |
| | | generateForm: { flowYearMonth: null, companyId: null }, |
| | | generateForm: { flowYearMonth: null, accountCompanyId: null }, |
| | | // 生成表单验证 |
| | | generateRules: { |
| | | flowYearMonth: [ |
| | |
| | | methods: { |
| | | // 钩子:在获取表格数据之前执行,false 则代表不获取数据 |
| | | [CRUD.HOOK.beforeRefresh]() { |
| | | // 获取公司数据 |
| | | this.getCompanyList() |
| | | // 获取年度账号数据 |
| | | this.getAccountCompanyList() |
| | | return true |
| | | }, |
| | | // 获取公司数据 |
| | | getCompanyList() { |
| | | // 获取公司数据 |
| | | crudSysCompany.getAll().then(res => { |
| | | // 公司列表 |
| | | this.companyList = res |
| | | // 获取年度账号数据 |
| | | getAccountCompanyList() { |
| | | // 获取年度账号数据 |
| | | crudCapitalAccountCompany.getAll().then(res => { |
| | | // 年度账号列表 |
| | | this.accountCompanyList = res |
| | | }) |
| | | }, |
| | | // 生成表单打开 |
| | |
| | | <el-option |
| | | v-for="item in capitalFlowList" |
| | | :key="item.id" |
| | | :label="item.flowYearMonth.substring(0,7) + ' - ' + item.companyName" |
| | | :label="item.flowYearMonth.substring(0,7) + ' - ' + item.accountCompanyName" |
| | | :value="item.id" |
| | | /> |
| | | </el-select> |
| | |
| | | <el-option |
| | | v-for="item in capitalFlowList" |
| | | :key="item.id" |
| | | :label="item.flowYearMonth.substring(0,7) + ' - ' + item.companyName" |
| | | :label="item.flowYearMonth.substring(0,7) + ' - ' + item.accountCompanyName" |
| | | :value="item.id" |
| | | /> |
| | | </el-select> |
| | |
| | | <el-option |
| | | v-for="item in capitalFlowList" |
| | | :key="item.id" |
| | | :label="item.flowYearMonth.substring(0,7) + ' - ' + item.companyName" |
| | | :label="item.flowYearMonth.substring(0,7) + ' - ' + item.accountCompanyName" |
| | | :value="item.id" |
| | | /> |
| | | </el-select> |
| | |
| | | <el-option |
| | | v-for="item in capitalFlowList" |
| | | :key="item.id" |
| | | :label="item.flowYearMonth.substring(0,7) + ' - ' + item.companyName" |
| | | :label="item.flowYearMonth.substring(0,7) + ' - ' + item.accountCompanyName" |
| | | :value="item.id" |
| | | /> |
| | | </el-select> |
| | |
| | | <!--工具栏--> |
| | | <div class="head-container"> |
| | | <div> |
| | | <!-- 搜索 --> |
| | | <el-select v-model="query.businessPlanId" clearable placeholder="所属营业计划" style="width: 185px;" class="filter-item" @keyup.enter.native="crud.toQuery"> |
| | | <el-option |
| | | v-for="item in businessPlanList" |
| | | :key="item.id" |
| | | :label="item.businessContent" |
| | | :value="item.id" |
| | | /> |
| | | </el-select> |
| | | <el-input |
| | | v-model="query.title" |
| | | clearable |
| | | size="small" |
| | | placeholder="标题" |
| | | 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-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" |
| | |
| | | :value="item.classification" |
| | | /> |
| | | </el-select> |
| | | <el-input v-model="query.place" clearable placeholder="商机地点" style="width: 185px;" 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="80px"> |
| | | <el-form-item label="标题" prop="title"> |
| | | <el-input v-model="form.title" style="width: 370px;" /> |
| | | <el-form ref="form" :model="form" :rules="rules" size="small" label-width="110px"> |
| | | <el-form-item label="所属营业计划" prop="businessPlanId"> |
| | | <el-select v-model="form.businessPlanId" placeholder="请选择" filterable clearable style="width: 340px;"> |
| | | <el-option |
| | | v-for="item in businessPlanList" |
| | | :key="item.id" |
| | | :label="item.businessContent" |
| | | :value="item.id" |
| | | /> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="分类" prop="classification"> |
| | | <el-form-item label="商机标题" prop="title"> |
| | | <el-input v-model="form.title" style="width: 340px;" /> |
| | | </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;" |
| | | style="width: 340px;" |
| | | @select="handleSubmit" |
| | | /> |
| | | </el-form-item> |
| | | <el-form-item label="商机地点" prop="place"> |
| | | <el-input v-model="form.place" style="width: 340px;" /> |
| | | </el-form-item> |
| | | <el-form-item label="商机介绍人"> |
| | | <el-input v-model="form.introducer" style="width: 340px;" /> |
| | | </el-form-item> |
| | | <el-form-item label="记录时间" prop="recordTime"> |
| | | <el-date-picker |
| | | v-model="form.recordTime" |
| | | type="datetime" |
| | | placeholder="选择日期时间" |
| | | style="width: 370px;" |
| | | style="width: 340px;" |
| | | 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-input v-model="form.recordContent" type="textarea" rows="3" style="width: 340px;" /> |
| | | </el-form-item> |
| | | <el-form-item label="是否提醒" prop="remind"> |
| | | <el-select v-model="form.remind" clearable style="width: 370px;" @change="remindChange()"> |
| | | <el-select v-model="form.remind" clearable style="width: 340px;" @change="remindChange()"> |
| | | <el-option |
| | | v-for="item in dict[dictResourceType]" |
| | | :key="item.value" |
| | |
| | | /> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item v-if="form.remind === dictResourcesTypeRemind" label="选择类型" prop="resource"> |
| | | <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="稍后提醒" /> |
| | |
| | | v-model="form.openingTime" |
| | | type="datetime" |
| | | placeholder="选择日期时间" |
| | | style="width: 370px;" |
| | | style="width: 340px;" |
| | | 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-select v-model="form.remindPeople" filterable multiple placeholder="请选择人员" style="width: 340px;" @change="change"> |
| | | <el-option |
| | | v-for="(item, index) in users" |
| | | :key="index" |
| | |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="备注"> |
| | | <el-input v-model="form.remarks" type="textarea" rows="3" style="width: 370px;" /> |
| | | <el-input v-model="form.remarks" type="textarea" rows="3" style="width: 340px;" /> |
| | | </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="title" label="标题" show-overflow-tooltip> |
| | | <el-table-column prop="businessPlanContent" label="所属营业计划" show-overflow-tooltip /> |
| | | <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="classification" label="商机分类" show-overflow-tooltip /> |
| | | <el-table-column prop="place" label="商机地点" show-overflow-tooltip /> |
| | | <el-table-column prop="introducer" 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> |
| | |
| | | import udOperation from '@crud/UD.operation' |
| | | import pagination from '@crud/Pagination' |
| | | import constant from '@/utils/constant' |
| | | import crudBusinessPlan from '@/api/business/plan' |
| | | |
| | | 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 } |
| | | const defaultForm = { id: null, title: null, classification: null, recordTime: null, recordContent: null, openingTime: null, businessPlanId: null, place: null, introducer: 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 }, |
| | |
| | | // 数据字典 |
| | | dicts: [constant.RESOURCES_TYPE], |
| | | cruds() { |
| | | return CRUD({ title: '客户资源管理', url: 'api/customerResources', idField: 'id', sort: 'id,desc', crudMethod: { ...crudCustomerResources }}) |
| | | return CRUD({ title: '营业商机', url: 'api/customerResources', idField: 'id', sort: 'id,desc', crudMethod: { ...crudCustomerResources }}) |
| | | }, |
| | | data() { |
| | | return { |
| | |
| | | download: ['admin', 'customerResources:download'] |
| | | }, |
| | | rules: { |
| | | businessPlanId: [ |
| | | { required: true, message: '所属营业计划不能为空', trigger: 'change' } |
| | | ], |
| | | title: [ |
| | | { required: true, message: '标题不能为空', trigger: 'blur' } |
| | | { required: true, message: '商机标题不能为空', trigger: 'blur' }, |
| | | { min: 2, max: 20, message: '长度在 2 到 20 个字符', trigger: 'blur' } |
| | | ], |
| | | classification: [ |
| | | { required: true, message: '分类不能为空', trigger: 'change' } |
| | | { required: true, message: '商机分类不能为空', trigger: 'blur' }, |
| | | { min: 2, max: 20, message: '长度在 2 到 20 个字符', trigger: 'blur' } |
| | | ], |
| | | place: [ |
| | | { required: true, message: '商机地点不能为空', trigger: 'blur' }, |
| | | { min: 2, max: 100, message: '长度在 2 到 100 个字符', trigger: 'blur' } |
| | | ], |
| | | introducer: [ |
| | | { min: 2, max: 20, message: '长度在 2 到 20 个字符', trigger: 'blur' } |
| | | ], |
| | | recordTime: [ |
| | | { required: true, message: '记录时间不能为空', trigger: 'blur' } |
| | | { required: true, message: '记录时间不能为空', trigger: 'change' } |
| | | ], |
| | | remind: [ |
| | | { required: true, message: '提醒不能为空', trigger: 'change' } |
| | | { required: true, message: '是否提醒不能为空', trigger: 'change' } |
| | | ], |
| | | resource: [ |
| | | { required: true, message: '类型不能为空', trigger: 'change' } |
| | | { required: true, message: '提醒类型不能为空', trigger: 'change' } |
| | | ], |
| | | openingTime: [ |
| | | { required: true, message: '提醒时间不能为空', trigger: 'blur' } |
| | | { required: true, message: '提醒时间不能为空', trigger: 'change' } |
| | | ], |
| | | remindPeople: [ |
| | | { required: true, message: '提醒人不能为空', trigger: 'change' } |
| | |
| | | classifications: [], |
| | | restaurants: [], |
| | | state: '', |
| | | timeout: null } |
| | | timeout: null, |
| | | // 营业计划列表 |
| | | businessPlanList: [] |
| | | } |
| | | }, |
| | | methods: { |
| | | // 钩子:在获取表格数据之前执行,false 则代表不获取数据 |
| | |
| | | crudCustomerResources.getAll().then(res => { |
| | | this.classifications = res |
| | | }) |
| | | // 获取营业计划 |
| | | crudBusinessPlan.getAll().then(res => { |
| | | // 营业计划列表 |
| | | this.businessPlanList = res |
| | | }) |
| | | return true |
| | | }, |
| | | // 钩子:编辑之前 |
| | |
| | | <el-form-item label="任务工作量单位" prop="taskWorkloadUnit"> |
| | | {{ dict.label[standardWorkloadUnit][form.taskWorkloadUnit] }} |
| | | </el-form-item> |
| | | <el-form-item label="任务绩效类型" prop="taskPerformanceType"> |
| | | {{ dict.label[performanceType][form.taskPerformanceType] }} |
| | | </el-form-item> |
| | | <el-form-item label="强制更新" tool-tip prop="enable1"> |
| | | <el-tooltip content="不增减工作量的场合调整工时的话,需要选择此项。(有疑问请联系管理员,不要随便选。。。)" effect="dark" placement="bottom"> |
| | | <el-switch v-model="form.enable1" /> |
| | |
| | | <el-tag v-if="scope.row.taskWorkloadUnit != null && scope.row.taskWorkloadUnit != ''">{{ dict.label[standardWorkloadUnit][scope.row.taskWorkloadUnit] }}</el-tag> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column :show-overflow-tooltip="true" prop="taskPerformanceType" label="任务绩效类型" width="110"> |
| | | <template slot-scope="scope"> |
| | | <el-tag v-if="scope.row.taskPerformanceType != null && scope.row.taskPerformanceType != ''">{{ dict.label[performanceType][scope.row.taskPerformanceType] }}</el-tag> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column :show-overflow-tooltip="true" prop="taskProgress" label="任务进度" width="80"> |
| | | <template slot-scope="scope"> |
| | | {{ scope.row.taskProgress }}% |
| | |
| | | name: 'TaskUser', |
| | | components: { pagination, crudOperation, rrOperation, udOperation, DateRangePicker }, |
| | | mixins: [presenter(), header(), form(defaultForm), crud()], |
| | | dicts: [constant.TASK_STATUS, constant.STANDARD_WORKLOAD_UNIT], |
| | | dicts: [constant.TASK_STATUS, constant.STANDARD_WORKLOAD_UNIT, constant.PERFORMANCE_TYPE], |
| | | cruds() { |
| | | return CRUD({ title: '任务分配', url: 'api/taskUser', idField: 'id', sort: 'taskStartDate,desc', crudMethod: { ...crudTaskUser }}) |
| | | }, |
| | |
| | | taskStatus: constant.TASK_STATUS, |
| | | // 字典:标准工作量单位 |
| | | standardWorkloadUnit: constant.STANDARD_WORKLOAD_UNIT, |
| | | // 字典:绩效对象 |
| | | performanceType: constant.PERFORMANCE_TYPE, |
| | | // 字典:批准状态-未承认 |
| | | approveStatusUnrecognized: constant.APPROVE_STATUS_UNRECOGNIZED, |
| | | // 角色级别:超级管理员 |
| | |
| | | [CRUD.HOOK.beforeToAdd]() { |
| | | // 表单赋值 |
| | | this.form.taskWorkloadUnit = null |
| | | this.form.taskPerformanceType = null |
| | | // 表单任务列表 |
| | | this.formTasks = [] |
| | | }, |
| | |
| | | this.form.taskStartDate = this.formTasks[i].planStartTime |
| | | this.form.taskEndDate = this.formTasks[i].planEndTime |
| | | this.form.taskWorkloadUnit = this.formTasks[i].planWorkloadUnit |
| | | this.form.taskPerformanceType = this.formTasks[i].performanceType |
| | | break |
| | | } |
| | | // 判断循环是否结束 |
| | |
| | | this.form.taskStartDate = null |
| | | this.form.taskEndDate = null |
| | | this.form.taskWorkloadUnit = null |
| | | this.form.taskPerformanceType = null |
| | | } |
| | | } |
| | | // 判断是否是否是新增 |