Browse Source

1. 结算bug调整

wuhp 2 years ago
parent
commit
9515a6def3

+ 4 - 0
src/main/java/com/ydtech/modules/fnc/entity/SettlementDocumentaryFeesEntity.java

@@ -153,6 +153,10 @@ public class SettlementDocumentaryFeesEntity implements Serializable {
     @TableField("completion_status")
     private String completionStatus;
 
+    @ApiModelProperty("开票号")
+    @TableField("invoice_id")
+    private String invoicId;
+
 
     @ApiModelProperty("图片路径")
     @TableField(exist = false)

+ 51 - 23
src/main/java/com/ydtech/modules/fnc/service/impl/InsPlyIncomeServiceImpl.java

@@ -28,6 +28,7 @@ import com.ydtech.modules.fnc.vo.SettlementDocumentaryFeesVo;
 import com.ydtech.modules.ins.model.vo.res.*;
 import com.ydtech.modules.inv.model.dto.*;
 import com.ydtech.modules.inv.utils.EasyExcelUtils;
+import com.ydtech.modules.inv.utils.LocalDateTimeUtils;
 import com.ydtech.modules.order.entity.BasePageResult;
 import com.ydtech.modules.order.entity.InsOrders;
 import com.ydtech.modules.order.entity.api.dajia.response.NVHLODR1001Response;
@@ -69,7 +70,9 @@ import java.nio.file.Path;
 import java.nio.file.Paths;
 import java.time.LocalDate;
 import java.time.LocalDateTime;
+import java.time.LocalTime;
 import java.time.YearMonth;
+import java.time.format.DateTimeFormatter;
 import java.util.*;
 
 /**
@@ -1254,7 +1257,7 @@ handlingProportion,
             BigDecimal noNoTaxPremium = insPlyIncomeVo.getNoPremium();// 非车手续费  按照思路  非车不含税保费* 非车手续费比例  =非车手续费
             if (jqNoTaxPremium != null && insPlyIncomeVo.getJqSuperviseCostsProportion() != null && insPlyIncomeVo.getJqSuperviseCostsProportion().compareTo(BigDecimal.ZERO) != 0) {
 
-                insPlyIncome.setJqSuperviseCostsPremiums(getBigDecimal(syNoTaxPremium, insPlyIncomeVo.getJqSuperviseCostsProportion()));
+                insPlyIncome.setJqSuperviseCostsPremiums(getBigDecimal(jqNoTaxPremium, insPlyIncomeVo.getJqSuperviseCostsProportion()));
                 insPlyIncome.setJqSuperviseCostsProportion(insPlyIncomeVo.getJqSuperviseCostsProportion());
 
             }
@@ -1354,16 +1357,49 @@ handlingProportion,
         Long id = new SnowFlakeUtil().nextId();
         InsPlyIncome insPlyIncome = new InsPlyIncome();
         insPlyIncomeVo.setOrderno(id.toString());
+        String signdateStr = insPlyIncomeVo.getSignDate();
+        LocalDateTime localDateTime = this.LocalDatePareLocalDateTime(signdateStr);
+        insPlyIncomeVo.setSignDate(null);
         BeanUtils.copyProperties(insPlyIncomeVo, insPlyIncome);
         insPlyIncome.setUserId(BaseController.getUser().getId());
         insPlyIncome.setDocumentaryFeesStatus("0");
         insPlyIncome.setHandlingFeesStatus("0");
         insPlyIncome.setIsNotCar(insPlyIncomeVo.getIsNotCar());   // 是否是非车
         insPlyIncome.setIsNotDocumentary(insPlyIncomeVo.getIsNotDocumentary());  //是否是跟单
+        insPlyIncome.setSignDate(localDateTime);
+        insPlyIncome.setDeptId(BaseController.getUser().getDeptId());
 
+        insPlyIncome.setCreateTime(LocalDate.now());
+        insPlyIncome.setOtherFeerate(this.calculateTotal(insPlyIncomeVo.getJqOtherCostsProportion(),insPlyIncomeVo.getSyOtherCostsProportion(),insPlyIncomeVo.getNoOtherCostsProportion()));
+        insPlyIncome.setCommissionFeerate(this.calculateTotal(insPlyIncomeVo.getJqSuperviseCostsProportion(),insPlyIncomeVo.getSySuperviseCostsProportion(),insPlyIncomeVo.getNoSuperviseCostsProportion()));
+
+        if (insPlyIncome.getJqPremium() != null && insPlyIncome.getJqPremium().compareTo(BigDecimal.ZERO) != 0 && insPlyIncome.getJqSuperviseCostsProportion() != null && insPlyIncome.getJqSuperviseCostsProportion().compareTo(BigDecimal.ZERO) != 0) {
+            insPlyIncome.setJqSuperviseCostsPremiums(getBigDecimal(insPlyIncome.getJqPremium(), insPlyIncomeVo.getJqSuperviseCostsProportion()));
+        }
+        if (insPlyIncome.getSyPremium() != null && insPlyIncome.getSyPremium().compareTo(BigDecimal.ZERO) != 0 && insPlyIncome.getSySuperviseCostsProportion() != null && insPlyIncome.getSySuperviseCostsProportion().compareTo(BigDecimal.ZERO) != 0) {
+            insPlyIncome.setSySuperviseCostsPremiums(getBigDecimal(insPlyIncome.getSyPremium(), insPlyIncomeVo.getSySuperviseCostsProportion()));
+        }
+        if (insPlyIncome.getNoPremium() != null && insPlyIncome.getNoPremium().compareTo(BigDecimal.ZERO) != 0 && insPlyIncome.getNoSuperviseCostsProportion() != null && insPlyIncome.getNoSuperviseCostsProportion().compareTo(BigDecimal.ZERO) != 0) {
+            insPlyIncome.setNoSuperviseCostsPremiums(getBigDecimal(insPlyIncome.getNoPremium(), insPlyIncomeVo.getNoSuperviseCostsProportion()));
+        }
+        if (insPlyIncome.getJqPremium() != null && insPlyIncome.getJqPremium().compareTo(BigDecimal.ZERO) != 0 && insPlyIncome.getJqOtherCostsProportion() != null && insPlyIncome.getJqOtherCostsProportion().compareTo(BigDecimal.ZERO) != 0) {
+            insPlyIncome.setJqOtherCostsPremium(getBigDecimal(insPlyIncome.getJqPremium(), insPlyIncomeVo.getJqOtherCostsProportion()));
+        }
+        if (insPlyIncome.getSyPremium() != null && insPlyIncome.getSyPremium().compareTo(BigDecimal.ZERO) != 0 && insPlyIncome.getSyOtherCostsProportion() != null && insPlyIncome.getSyOtherCostsProportion().compareTo(BigDecimal.ZERO) != 0) {
+            insPlyIncome.setSyOtherCostsPremium(getBigDecimal(insPlyIncome.getSyPremium(), insPlyIncomeVo.getSyOtherCostsProportion()));
+        }
+        if (insPlyIncome.getNoPremium() != null && insPlyIncome.getNoPremium().compareTo(BigDecimal.ZERO) != 0 && insPlyIncome.getNoOtherCostsProportion() != null && insPlyIncome.getNoOtherCostsProportion().compareTo(BigDecimal.ZERO) != 0) {
+            insPlyIncome.setNoOtherCostsPremium(getBigDecimal(insPlyIncome.getNoPremium(), insPlyIncomeVo.getNoOtherCostsProportion()));
+        }
+        insPlyIncome.setAllFeeValue(this.calculateTotal(insPlyIncome.getCommissionFeevalue(),insPlyIncome.getOtherFeevalue(),null));
+
+        String partnerCompaniesId = insPlyIncome.getPartnerCompaniesId();
+        insPlyIncome.setPartnerCompaniesId(partnerCompaniesId);
+        EsmInsCompany esmInsCompany = EsmInsCompanyService.getById(partnerCompaniesId);
+        String name = esmInsCompany.getNamesimple();   //合作名称
+        insPlyIncome.setPartnerCompaniesName(name);
         HashMap<String, Object> params = new HashMap<>();
-        params.put("companyId", insPlyIncomeVo.getCompanyId());
-        params.put("partnerCompaniesId", insPlyIncomeVo.getPartnerCompaniesId());
+        params.put("agreeId",insPlyIncomeVo.getAgreeId());
 
         PtlAgreement ptlAgreement = ptlAgreementService.selectAgreeId(params);
         if (ObjectUtils.isEmpty(ptlAgreement)) {
@@ -1375,28 +1411,20 @@ handlingProportion,
         insPlyIncomeVo.setCrudStatus("1");
         this.saveLog(insPlyIncomeVo);   //添加日志
 
-//        HashMap<String, Object> params = new HashMap<>();
-//
-//        if(StringUtils.isNotEmpty(insPlyIncomeVo.getIsNotCar())){
-//            params.put("isNotCar",insPlyIncomeVo.getIsNotCar());
-//        }
-//        params.put("isOther","1");
-//        if(StringUtils.isNotEmpty(insPlyIncomeVo.getYear())){
-//            params.put("year",insPlyIncomeVo.getYear());
-//        }
-//        if(StringUtils.isNotEmpty(insPlyIncomeVo.getCompanyId())){
-//            params.put("companyId",insPlyIncomeVo.getCompanyId());
-//        }
-//
-//        List<InsPlyIncome> list= this.baseMapper.NonSettlementQuery(params);
-//        if(!CollectionUtils.isEmpty(list)){
-//            for (InsPlyIncome item :list){
-//                return HttpResult.ok(item.getIds());
-//            }
-//        }
         return HttpResult.ok();
     }
 
+    private LocalDateTime LocalDatePareLocalDateTime(String signdateStr) {
+        DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
+
+        // 将字符串解析为LocalDate
+        LocalDate signdate = LocalDate.parse(signdateStr, formatter);
+        // 创建一个 LocalTime 对象表示中午12点
+        LocalTime noon = LocalTime.of(12, 0);
+        // 使用 LocalDate 和 LocalTime 来创建 LocalDateTime
+        return  LocalDateTime.of(signdate, noon);
+    }
+
     /**
      *   删除id  已开票或者已结算都不可以进行 删除
      *    因为跟单没有关联表 也无法关联到开票表所以只能按照 条件去查询判断 保司机构 id
@@ -1519,7 +1547,7 @@ handlingProportion,
 
         String id = insPlyIncomeVo.getId();   //  开票id
         SettlementDocumentaryFeesEntity settlementDocumentaryFeesServiceById = settlementDocumentaryFeesService.getById(id);  //
-        BigDecimal allAmount = settlementDocumentaryFeesServiceById.getTotalAmount();
+        BigDecimal allAmount = settlementDocumentaryFeesServiceById.getSettlementAmount();
 
 
         HashMap<String, Object> params = new HashMap<>();

+ 7 - 3
src/main/java/com/ydtech/modules/fnc/vo/InsPlyIncomeVo.java

@@ -50,9 +50,8 @@ public class InsPlyIncomeVo implements Serializable {
     private LocalDate endDate;
 
 
-//    @ApiModelProperty(value = "签单日期")
-//    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
-//    private LocalDate signdate;
+    @ApiModelProperty(value = "签单日期")
+    private String signDate;
 
     @ApiModelProperty(value = "创建日期")
     @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss ", timezone = "GMT+8")
@@ -254,6 +253,9 @@ public class InsPlyIncomeVo implements Serializable {
     @ApiModelProperty("非车跟单比例")
     private BigDecimal noOtherCostsProportion;
 
+    @ApiModelProperty("车船税")
+    private BigDecimal taxamount;
+
 
     @ApiModelProperty("被保人名称")
     private String insuredName;
@@ -354,6 +356,8 @@ public class InsPlyIncomeVo implements Serializable {
 
     @ApiModelProperty(value = "年度结束")
     private String yearEnd;
+    @ApiModelProperty(value = "协议id")
+    private String agreeId;
 
 
 

+ 3 - 0
src/main/resources/mapper/modules/protocol/PtlAgreementMapper.xml

@@ -132,6 +132,9 @@
             <if test="partnerCompaniesId  !=null  and   partnerCompaniesId  !=''" >
                   and   a.partner_companies_id =#{partnerCompaniesId}
             </if>
+          <if test="agreeId  !=null  and   agreeId  !=''" >
+                  and   a.id =#{agreeId}
+            </if>
         </where>
         limit  1
     </select>