|
|
@@ -135,6 +135,10 @@ public class VendApamountServiceImpl extends CommonBaseServiceImpl<VendApamountM
|
|
|
vendApamount.setVa_leftamount(vendApamount.getVa_beginapamount()-vendApamount.getVa_beginprepayamount()+vendApamount.getVa_payamount()-vendApamount.getVa_preamount());
|
|
|
|
|
|
if(vendApamount.getId() == 0){
|
|
|
+ VendApamount oldVendApamount = getMapper().getVendApamountByVendCodeAndCurrency(vendApamount.getVa_vendcode(), BaseContextHolder.getCompanyId(), vendApamount.getVa_currency(),0L);
|
|
|
+ if(!ObjectUtils.isEmpty(oldVendApamount)){
|
|
|
+ vendApamount.setId(oldVendApamount.getId());
|
|
|
+ }
|
|
|
//新增
|
|
|
vendApamount.setCompanyId(BaseContextHolder.getCompanyId());
|
|
|
vendApamount.setCreatorId(BaseContextHolder.getUserId());
|
|
|
@@ -153,8 +157,11 @@ public class VendApamountServiceImpl extends CommonBaseServiceImpl<VendApamountM
|
|
|
calendar.setTime(date);
|
|
|
calendar.set(Calendar.DAY_OF_MONTH,1);//设置为1号,当前日期既为本月第一天
|
|
|
vendApamount.setVa_begindate(calendar.getTime());
|
|
|
-
|
|
|
- getMapper().insertSelective(vendApamount);
|
|
|
+ if(!ObjectUtils.isEmpty(oldVendApamount)){
|
|
|
+ getMapper().updateByPrimaryKeySelective(vendApamount);
|
|
|
+ }else{
|
|
|
+ getMapper().insertSelective(vendApamount);
|
|
|
+ }
|
|
|
//记录LOG
|
|
|
docBaseDTO = generateMsgObj(vendApamount.getId());
|
|
|
messageLogService.save(docBaseDTO);
|
|
|
@@ -224,7 +231,7 @@ public class VendApamountServiceImpl extends CommonBaseServiceImpl<VendApamountM
|
|
|
throw new BizException(BizExceptionCode.BIZ_NOCURRENCY_SAVE);
|
|
|
}
|
|
|
VendApamount oldVendApamount = getMapper().getVendApamountByVendCodeAndCurrency(vendCode, BaseContextHolder.getCompanyId(), currency,id);
|
|
|
- if (!ObjectUtils.isEmpty(oldVendApamount)){
|
|
|
+ if (!ObjectUtils.isEmpty(oldVendApamount)&& !ObjectUtils.isEmpty(oldVendApamount.getVa_begindate())){
|
|
|
return true;
|
|
|
}
|
|
|
return false;
|