|
@@ -1,12 +1,14 @@
|
|
|
package com.ydtech.modules.fnc.service.impl;
|
|
package com.ydtech.modules.fnc.service.impl;
|
|
|
|
|
|
|
|
import cn.dev33.satoken.stp.StpUtil;
|
|
import cn.dev33.satoken.stp.StpUtil;
|
|
|
|
|
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
import com.github.pagehelper.PageHelper;
|
|
import com.github.pagehelper.PageHelper;
|
|
|
import com.github.pagehelper.PageInfo;
|
|
import com.github.pagehelper.PageInfo;
|
|
|
import com.ydtech.core.page.HttpResult;
|
|
import com.ydtech.core.page.HttpResult;
|
|
|
import com.ydtech.modules.fnc.dao.InsPlyIncomeMapper;
|
|
import com.ydtech.modules.fnc.dao.InsPlyIncomeMapper;
|
|
|
import com.ydtech.modules.fnc.dao.InsPlySettleDetailMapper;
|
|
import com.ydtech.modules.fnc.dao.InsPlySettleDetailMapper;
|
|
|
|
|
+import com.ydtech.modules.fnc.dao.InsPlySettleHxMapper;
|
|
|
import com.ydtech.modules.fnc.entity.InsPlyIncome;
|
|
import com.ydtech.modules.fnc.entity.InsPlyIncome;
|
|
|
import com.ydtech.modules.fnc.entity.InsPlySettle;
|
|
import com.ydtech.modules.fnc.entity.InsPlySettle;
|
|
|
import com.ydtech.modules.fnc.dao.InsPlySettleMapper;
|
|
import com.ydtech.modules.fnc.dao.InsPlySettleMapper;
|
|
@@ -25,6 +27,7 @@ import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
|
|
import java.math.BigDecimal;
|
|
import java.math.BigDecimal;
|
|
|
|
|
+import java.sql.Wrapper;
|
|
|
import java.time.LocalDate;
|
|
import java.time.LocalDate;
|
|
|
import java.time.LocalDateTime;
|
|
import java.time.LocalDateTime;
|
|
|
import java.time.YearMonth;
|
|
import java.time.YearMonth;
|
|
@@ -46,7 +49,8 @@ public class InsPlySettleServiceImpl extends ServiceImpl<InsPlySettleMapper, Ins
|
|
|
private InsPlySettleDetailMapper insPlySettleDetailMapper;
|
|
private InsPlySettleDetailMapper insPlySettleDetailMapper;
|
|
|
@Autowired
|
|
@Autowired
|
|
|
private InsPlyIncomeMapper insPlyIncomeMapper;
|
|
private InsPlyIncomeMapper insPlyIncomeMapper;
|
|
|
-
|
|
|
|
|
|
|
+ @Autowired
|
|
|
|
|
+ private InsPlySettleHxMapper insPlySettleHxMapper;
|
|
|
@Override
|
|
@Override
|
|
|
@Transactional
|
|
@Transactional
|
|
|
public HttpResult generateSettleAndDetail(List<InsPlyIncome> plyList) {
|
|
public HttpResult generateSettleAndDetail(List<InsPlyIncome> plyList) {
|
|
@@ -73,7 +77,7 @@ public class InsPlySettleServiceImpl extends ServiceImpl<InsPlySettleMapper, Ins
|
|
|
insPlySettleDetail.setCreateTime(LocalDateTime.now());
|
|
insPlySettleDetail.setCreateTime(LocalDateTime.now());
|
|
|
insPlySettleDetailMapper.insert(insPlySettleDetail);
|
|
insPlySettleDetailMapper.insert(insPlySettleDetail);
|
|
|
//修改ins_ply_income
|
|
//修改ins_ply_income
|
|
|
- insPlyIncome.setDoingFeeValue(insPlyIncome.getAllFeeValue());
|
|
|
|
|
|
|
+ insPlyIncome.setFinalFeeValue(insPlyIncome.getAllFeeValue());
|
|
|
insPlyIncomeMapper.updateById(insPlyIncome);
|
|
insPlyIncomeMapper.updateById(insPlyIncome);
|
|
|
|
|
|
|
|
commissionFeevalue=commissionFeevalue.add(insPlyIncome.getCommissionFeevalue());
|
|
commissionFeevalue=commissionFeevalue.add(insPlyIncome.getCommissionFeevalue());
|
|
@@ -134,7 +138,31 @@ public class InsPlySettleServiceImpl extends ServiceImpl<InsPlySettleMapper, Ins
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
@Override
|
|
@Override
|
|
|
- public HttpResult enterSettle(InsPlySettleHx insPlySettle) {
|
|
|
|
|
- return null;
|
|
|
|
|
|
|
+ public HttpResult hxSettle(InsPlySettleHx insPlySettleHx) {
|
|
|
|
|
+
|
|
|
|
|
+ //必填校验
|
|
|
|
|
+ if(StringUtils.isNullOrEmpty(insPlySettleHx.getSettleno())
|
|
|
|
|
+ ||StringUtils.isNullOrEmpty(insPlySettleHx.getFeeType())
|
|
|
|
|
+ ||StringUtils.isNullOrEmpty(insPlySettleHx.getCheckno())
|
|
|
|
|
+ ||StringUtils.isNullOrEmpty(insPlySettleHx.getAmount())){
|
|
|
|
|
+ return HttpResult.error("结算单号、费用类型、核销金额、发票号不能为空");
|
|
|
|
|
+ }
|
|
|
|
|
+ //核销金额不能超总费用
|
|
|
|
|
+ InsPlySettle insPlySettle=this.baseMapper.selectBySettleno(insPlySettleHx.getSettleno());
|
|
|
|
|
+ if(insPlySettle.getHxamount().add(insPlySettleHx.getAmount()).compareTo(insPlySettle.getAllFeeValue())>0){
|
|
|
|
|
+ return HttpResult.error("核销金额已超过总费用,请修改");
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ insPlySettleHx.setOperator(StpUtil.getLoginId().toString());
|
|
|
|
|
+ insPlySettleHx.setCreateTime(LocalDateTime.now());
|
|
|
|
|
+ insPlySettleHxMapper.insert(insPlySettleHx);
|
|
|
|
|
+ return HttpResult.ok("核销成功");
|
|
|
|
|
+ }
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public HttpResult queryHxDetail(String settleno) {
|
|
|
|
|
+ LambdaQueryWrapper<InsPlySettleHx> queryWrapper=new LambdaQueryWrapper();
|
|
|
|
|
+ queryWrapper.eq(InsPlySettleHx::getSettleno,settleno);
|
|
|
|
|
+ List<InsPlySettleHx> list=insPlySettleHxMapper.selectList(queryWrapper);
|
|
|
|
|
+ return HttpResult.ok(list);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|