Browse Source

财务确认

jihs 4 năm trước cách đây
mục cha
commit
ff7924a9aa

+ 25 - 0
src/main/java/org/jeecg/common/dto/payment/FinanceListEditReqDTO.java

@@ -0,0 +1,25 @@
+package org.jeecg.common.dto.payment;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.math.BigDecimal;
+
+@Data
+@ApiModel("id")
+public class FinanceListEditReqDTO {
+    @ApiModelProperty("主表id")
+    private String id;
+    @ApiModelProperty("子表id")
+    private String contentId;
+    @ApiModelProperty("状态: 0.未确认 1.确认")
+    private String status;
+    @ApiModelProperty("收款金额")
+    private BigDecimal coPrvice;
+    @ApiModelProperty("项目档案--里程碑")
+    private String proArchivesMilestone;
+
+    public FinanceListEditReqDTO() {
+    }
+}

+ 14 - 0
src/main/java/org/jeecg/common/dto/payment/FinanceListReqDTO.java

@@ -0,0 +1,14 @@
+package org.jeecg.common.dto.payment;
+
+import io.swagger.annotations.ApiModel;
+import lombok.Data;
+
+@ApiModel("财务确认请求参数")
+@Data
+public class FinanceListReqDTO {
+    private String billCode;
+    private String pkOrg;
+
+    public FinanceListReqDTO() {
+    }
+}

+ 60 - 0
src/main/java/org/jeecg/common/dto/payment/FinanceListRespDTO.java

@@ -0,0 +1,60 @@
+package org.jeecg.common.dto.payment;
+
+import com.baomidou.mybatisplus.annotation.TableField;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import javax.validation.constraints.NotEmpty;
+import java.math.BigDecimal;
+
+@Data
+@ApiModel("财务确认列表响应数据")
+public class FinanceListRespDTO {
+    @ApiModelProperty("id")
+    private String id;
+    @ApiModelProperty("单据编号")
+    private String billcode;
+    @ApiModelProperty("1.收款单 2.付款单")
+    @NotEmpty(message = "参数type不能为空")
+    private String type;
+    @ApiModelProperty("项目id")
+    private String proId;
+    @ApiModelProperty("项目名称")
+    private String proName;
+    @ApiModelProperty("项目编码")
+    private String proCode;
+    @ApiModelProperty("客户档案id")
+    private String cusId;
+    @ApiModelProperty("客户档案编码")
+    private String cusCode;
+    @ApiModelProperty("客户档案名称")
+    private String cusName;
+    @ApiModelProperty("总额")
+    private BigDecimal totalPrice;
+    @ApiModelProperty("子表id")
+    private String contentId;
+    @ApiModelProperty("收款单id")
+    private String slipId;
+    @ApiModelProperty("项目档案--里程碑id")
+    private String proArchivesId;
+    @ApiModelProperty("项目档案--里程碑")
+    private String proArchivesMilestone;
+    @ApiModelProperty("项目档案-里程碑信息子表id")
+    private String coArchivesId;
+    @ApiModelProperty("收付款条线档案名称")
+    private String coArchivesName;
+    @ApiModelProperty("收款金额")
+    private BigDecimal coPrvice;
+    @ApiModelProperty("说明")
+    @TableField("`explain`")
+    private String explain;
+    @ApiModelProperty("采购发票id")
+    private String invoiceId;
+    @ApiModelProperty("对应发票(采购发票)")
+    private String invoice;
+    @ApiModelProperty("状态: 0.未确认 1.确认 ")
+    private String status;
+
+    public FinanceListRespDTO() {
+    }
+}

+ 33 - 1
src/main/java/org/jeecg/modules/payment/controller/ManagerPaymentAndReceiptSlipController.java

@@ -5,9 +5,9 @@ import javax.validation.Valid;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiImplicitParam;
 import io.swagger.annotations.ApiImplicitParams;
-import io.swagger.annotations.ApiModelProperty;
 import io.swagger.annotations.ApiOperation;
 import org.jeecg.common.api.vo.Result;
+import org.jeecg.common.dto.payment.FinanceListEditReqDTO;
 import org.jeecg.common.dto.payment.ProjectArchiveReqDTO;
 import org.jeecg.common.dto.payment.ProjectArchiveRespDTO;
 import org.jeecg.common.dto.payment.SlieReqDTO;
@@ -15,6 +15,8 @@ import org.jeecg.common.dto.payment.SlipAddReqDTO;
 import org.jeecg.common.dto.payment.SlipPriceReqDTO;
 import org.jeecg.common.dto.payment.SlipPriceRespDTO;
 import org.jeecg.common.dto.payment.SlipRespDTO;
+import org.jeecg.common.dto.payment.FinanceListReqDTO;
+import org.jeecg.common.dto.payment.FinanceListRespDTO;
 import org.jeecg.common.exception.JeecgBootException;
 import org.jeecg.common.system.query.QueryGenerator;
 import org.jeecg.modules.payment.entity.ManagerPaymentAndReceiptSlip;
@@ -213,4 +215,34 @@ public class ManagerPaymentAndReceiptSlipController {
 		result.setSuccess(true);
 		return result;
 	}
+
+
+	@ApiOperation(value = "财务收款确认列表", notes = "财务收款确认列表")
+	@ApiImplicitParams({
+			@ApiImplicitParam(name="billCode", value="单据号",required=true, dataType="String"),
+			@ApiImplicitParam(name="pkOrg", value="组织",required=true, dataType="String"),
+	})
+	@GetMapping(value = "/getFinanceList")
+	public Result<List<FinanceListRespDTO>> getFinanceList(FinanceListReqDTO reqDTO) {
+		Result<List<FinanceListRespDTO>> result = new Result<List<FinanceListRespDTO>>();
+		List<FinanceListRespDTO> list  = managerPaymentAndReceiptSlipService.getFinanceList(reqDTO);
+		result.setResult(list);
+		result.setSuccess(true);
+		return result;
+	}
+
+	@ApiOperation(value = "修改财务收款确认列表", notes = "修改财务收款确认列表")
+	@ApiImplicitParams({
+			@ApiImplicitParam(name="billCode", value="单据号",required=true, dataType="String"),
+			@ApiImplicitParam(name="pkOrg", value="组织",required=true, dataType="String"),
+	})
+	@PutMapping(value = "/editFinanceList")
+	public Result<FinanceListRespDTO> editFinanceList(@RequestBody FinanceListEditReqDTO reqDTO) {
+		Result<FinanceListRespDTO> result = new Result<FinanceListRespDTO>();
+		managerPaymentAndReceiptSlipService.editFinanceList(reqDTO);
+		result.success("修改成功!");
+		return result;
+	}
+
+
 }

+ 12 - 1
src/main/java/org/jeecg/modules/payment/entity/ManagePaymentAndReceiptContent.java

@@ -12,6 +12,7 @@ import io.swagger.annotations.ApiModelProperty;
 import io.swagger.models.auth.In;
 import lombok.Data;
 import com.fasterxml.jackson.annotation.JsonFormat;
+import org.jeecg.common.dto.payment.FinanceListEditReqDTO;
 import org.jeecg.common.dto.payment.SlipContentAddReqDTO;
 import org.springframework.format.annotation.DateTimeFormat;
 
@@ -46,6 +47,8 @@ public class ManagePaymentAndReceiptContent implements Serializable {
     private String invoiceId;
     @ApiModelProperty("对应发票(采购发票)")
     private String invoice;
+    @ApiModelProperty("状态: 0.未确认 1.确认 ")
+    private String status;
     @ApiModelProperty("创建时间")
     @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
     @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@@ -68,7 +71,7 @@ public class ManagePaymentAndReceiptContent implements Serializable {
     public ManagePaymentAndReceiptContent() {
     }
 
-    public ManagePaymentAndReceiptContent(SlipContentAddReqDTO reqDTO ) {
+    public ManagePaymentAndReceiptContent(SlipContentAddReqDTO reqDTO) {
         this.id = reqDTO.getId();
         this.slipId = reqDTO.getSlipId();
         this.proArchivesId = reqDTO.getProArchivesId();
@@ -81,6 +84,14 @@ public class ManagePaymentAndReceiptContent implements Serializable {
         this.delFlag = "0";
         this.pkOrg = reqDTO.getPkOrg();
         this.invoiceId = reqDTO.getInvoiceId();
+        this.status = "0";
+    }
+
+
+    public ManagePaymentAndReceiptContent(FinanceListEditReqDTO reqDTO) {
+        this.id = reqDTO.getContentId();
+        this.coPrvice = reqDTO.getCoPrvice();
+        this.status = reqDTO.getStatus();
     }
 
     public ManagePaymentAndReceiptContent(String delFlag ) {

+ 7 - 0
src/main/java/org/jeecg/modules/payment/mapper/ManagerPaymentAndReceiptSlipMapper.java

@@ -5,6 +5,8 @@ import java.util.List;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import org.apache.ibatis.annotations.Param;
 import org.jeecg.common.dto.archives.ExpensePriceReqDTO;
+import org.jeecg.common.dto.payment.FinanceListReqDTO;
+import org.jeecg.common.dto.payment.FinanceListRespDTO;
 import org.jeecg.common.dto.payment.SlipAllListDTO;
 import org.jeecg.common.dto.payment.SlipPriceReqDTO;
 import org.jeecg.common.dto.payment.SlipPriceRespDTO;
@@ -27,4 +29,9 @@ public interface ManagerPaymentAndReceiptSlipMapper extends BaseMapper<ManagerPa
     List<SlipAllListDTO> getAll(@Param("ew") QueryWrapper<ManagerPaymentAndReceiptSlip> queryWrapper);
 
     List<SlipPriceRespDTO> getSlipPrice(SlipPriceReqDTO reqDTO);
+
+    /**
+     * @desc 财务收款确认列表
+     */
+    List<FinanceListRespDTO> getFinanceList(FinanceListReqDTO reqDTO);
 }

+ 38 - 0
src/main/java/org/jeecg/modules/payment/mapper/xml/ManagerPaymentAndReceiptSlipMapper.xml

@@ -47,4 +47,42 @@
             WHERE a.del_flag = '0' AND b.del_flag = '0'
             AND a.pro_id =#{proId} and b.pro_archives_id = #{mileId} AND b.co_archives_id = #{businessId} AND a.type = #{type}
       </select>
+
+    <select id="getFinanceList" resultType="org.jeecg.common.dto.payment.FinanceListRespDTO">
+          SELECT
+                a.id,
+                a.billcode,
+                a.type,
+                a.pro_id,
+                a.pro_name,
+                a.pro_code,
+                a.cus_id,
+                a.cus_code,
+                a.cus_name,
+                a.total_price,
+                a.pk_org,
+                b.id 'contentId',
+                b.slip_id,
+                b.pro_archives_id,
+                b.pro_archives_milestone,
+                b.co_archives_id,
+                b.co_archives_name,
+                b.co_prvice,
+                b.explain,
+                b.invoice_id,
+                b.invoice,
+                b.status
+            FROM
+                manager_payment_and_receipt_slip AS a
+            JOIN manage_payment_and_receipt_content AS b
+            ON a.id = b.slip_id
+            WHERE a.del_flag = '0' AND b.del_flag = '0'
+            <if test = "billCode != null and billCode != ''">
+               AND a.billcode = #{billCode}
+            </if>
+            <if test = "pkOrg != null and pkOrg != ''">
+                AND a.pk_org = #{pkOrg}
+            </if>
+      </select>
+
 </mapper>

+ 0 - 1
src/main/java/org/jeecg/modules/payment/service/ManagePaymentAndReceiptContentService.java

@@ -10,5 +10,4 @@ import com.baomidou.mybatisplus.extension.service.IService;
  * @version: V1.0
  */
 public interface ManagePaymentAndReceiptContentService extends IService<ManagePaymentAndReceiptContent> {
-
 }

+ 12 - 0
src/main/java/org/jeecg/modules/payment/service/ManagerPaymentAndReceiptSlipService.java

@@ -2,6 +2,7 @@ package org.jeecg.modules.payment.service;
 
 import org.jeecg.common.dto.archives.ExpensePriceReqDTO;
 import org.jeecg.common.dto.archives.ExpensePriceRespDTO;
+import org.jeecg.common.dto.payment.FinanceListEditReqDTO;
 import org.jeecg.common.dto.payment.ProjectArchiveReqDTO;
 import org.jeecg.common.dto.payment.ProjectArchiveRespDTO;
 import org.jeecg.common.dto.payment.SlipAddReqDTO;
@@ -9,6 +10,8 @@ import org.jeecg.common.dto.payment.SlipAllListDTO;
 import org.jeecg.common.dto.payment.SlipPriceReqDTO;
 import org.jeecg.common.dto.payment.SlipPriceRespDTO;
 import org.jeecg.common.dto.payment.SlipRespDTO;
+import org.jeecg.common.dto.payment.FinanceListReqDTO;
+import org.jeecg.common.dto.payment.FinanceListRespDTO;
 import org.jeecg.modules.payment.entity.ManagerPaymentAndReceiptSlip;
 import com.baomidou.mybatisplus.extension.service.IService;
 import java.util.List;
@@ -50,4 +53,13 @@ public interface ManagerPaymentAndReceiptSlipService extends IService<ManagerPay
     List<SlipAllListDTO> getAll(ManagerPaymentAndReceiptSlip managerPaymentAndReceiptSlip);
 
     List<SlipPriceRespDTO> getSlipPrice(SlipPriceReqDTO reqDTO);
+
+    /**
+     * @desc 财务收款确认列表(一一对应)
+     */
+    List<FinanceListRespDTO> getFinanceList(FinanceListReqDTO reqDTO);
+    /**
+     * @desc 修改财务收款确认状态
+     */
+    void editFinanceList(FinanceListEditReqDTO reqDTO);
 }

+ 61 - 2
src/main/java/org/jeecg/modules/payment/service/impl/ManagerPaymentAndReceiptSlipServiceImpl.java

@@ -6,6 +6,9 @@ import com.google.common.collect.Lists;
 import org.apache.commons.lang.StringUtils;
 import org.jeecg.common.dto.archives.ExpensePriceReqDTO;
 import org.jeecg.common.dto.archives.ExpensePriceRespDTO;
+import org.jeecg.common.dto.payment.FinanceListEditReqDTO;
+import org.jeecg.common.dto.payment.FinanceListReqDTO;
+import org.jeecg.common.dto.payment.FinanceListRespDTO;
 import org.jeecg.common.dto.payment.ProjectArchiveReqDTO;
 import org.jeecg.common.dto.payment.ProjectArchiveRespDTO;
 import org.jeecg.common.dto.payment.SlipAddReqDTO;
@@ -167,6 +170,62 @@ public class ManagerPaymentAndReceiptSlipServiceImpl extends ServiceImpl<Manager
         return managerPaymentAndReceiptSlipMapper.getSlipPrice(reqDTO);
     }
 
+    /**
+     * @desc 财务收款确认列表
+     */
+    @Override
+    public List<FinanceListRespDTO> getFinanceList(FinanceListReqDTO reqDTO) {
+        return managerPaymentAndReceiptSlipMapper.getFinanceList(reqDTO);
+    }
+
+    /**
+     * @desc 修改财务收款确认列表
+     */
+    @Override
+    public void editFinanceList(FinanceListEditReqDTO reqDTO) {
+        //修改总金额
+        ManagerPaymentAndReceiptSlip managerPaymentAndReceiptSlip = managerPaymentAndReceiptSlipMapper.selectById(reqDTO.getId());
+        ManagePaymentAndReceiptContent  managePaymentAndReceiptContent = managePaymentAndReceiptContentService.getById(reqDTO.getContentId());
+        BigDecimal totalPrice =  managerPaymentAndReceiptSlip.getTotalPrice().subtract(managePaymentAndReceiptContent.getCoPrvice()).add(reqDTO.getCoPrvice());
+        managerPaymentAndReceiptSlip.setTotalPrice(totalPrice);
+        managerPaymentAndReceiptSlipMapper.updateById(managerPaymentAndReceiptSlip);
+
+         // 修改子表
+        ManagePaymentAndReceiptContent content = new ManagePaymentAndReceiptContent(reqDTO);
+        managePaymentAndReceiptContentService.updateById(content);
+
+        //获取项目档案里程碑数据
+        List<ProjectManageArchivesAndBusiness> businesses = projectManageArchivesAndBusinessService.list(new LambdaQueryWrapper<ProjectManageArchivesAndBusiness>()
+                .eq(ProjectManageArchivesAndBusiness::getDelFlag, "0").in(ProjectManageArchivesAndBusiness::getPlanType, new String[]{"2","4"}));
+        Map<String, List<ProjectManageArchivesAndBusiness>> businessMap = businesses.stream().collect(Collectors.groupingBy(t -> t.getId()));
+        List<ProjectManageArchivesAndBusiness> archivesAndBusinesses = businessMap.get(managePaymentAndReceiptContent.getCoArchivesId());
+        if(!CollectionUtils.isEmpty(archivesAndBusinesses)){
+            for(ProjectManageArchivesAndBusiness business : archivesAndBusinesses){
+                if(business.getMilestone1().equals(reqDTO.getProArchivesMilestone())){
+                    business.setDesc1(reqDTO.getCoPrvice().toPlainString());
+                    projectManageArchivesAndBusinessService.updateById(business);
+                }
+                if(business.getMilestone2().equals(reqDTO.getProArchivesMilestone())){
+                    business.setDesc2(reqDTO.getCoPrvice().toPlainString());
+                    projectManageArchivesAndBusinessService.updateById(business);
+                }
+                if(business.getMilestone3().equals(reqDTO.getProArchivesMilestone())){
+                    business.setDesc3(reqDTO.getCoPrvice().toPlainString());
+                    projectManageArchivesAndBusinessService.updateById(business);
+                }
+                if(business.getMilestone4().equals(reqDTO.getProArchivesMilestone())){
+                    business.setDesc4(reqDTO.getCoPrvice().toPlainString());
+                    projectManageArchivesAndBusinessService.updateById(business);
+                }
+                if(business.getMilestone5().equals(reqDTO.getProArchivesMilestone())){
+                    business.setDesc5(reqDTO.getCoPrvice().toPlainString());
+                    projectManageArchivesAndBusinessService.updateById(business);
+                }
+
+            }
+        }
+    }
+
 
 
     /**
@@ -196,7 +255,7 @@ public class ManagerPaymentAndReceiptSlipServiceImpl extends ServiceImpl<Manager
         managePaymentAndReceiptContentService.update(new ManagePaymentAndReceiptContent("1"), queryWrapper);
 
         //删除回写金额(暂不使用)
-//        deleteReWriterProArchvicePrice(contents);
+        deleteReWriterProArchvicePrice(contents);
     }
 
 
@@ -261,7 +320,7 @@ public class ManagerPaymentAndReceiptSlipServiceImpl extends ServiceImpl<Manager
             list.add(content);
 
             //回写项目档案里程碑信息表的金额 (暂不使用)
-//            reWriterProArchvicePrice(reqDTO, businessMap);
+            reWriterProArchvicePrice(reqDTO, businessMap);
 
         }
         managePaymentAndReceiptContentService.saveBatch(list);