java110
2023-05-18 e46395d507a9eb1d4534c61184b4d60dbd75f888
service-fee/src/main/java/com/java110/fee/cmd/fee/DeleteFeeCmd.java
@@ -7,10 +7,13 @@
import com.java110.core.event.cmd.CmdEvent;
import com.java110.dto.fee.FeeDetailDto;
import com.java110.dto.fee.FeeDto;
import com.java110.fee.feeMonth.IPayFeeMonth;
import com.java110.intf.community.IRoomInnerServiceSMO;
import com.java110.intf.fee.IFeeDetailInnerServiceSMO;
import com.java110.intf.fee.IFeeInnerServiceSMO;
import com.java110.intf.fee.IPayFeeDetailV1InnerServiceSMO;
import com.java110.intf.fee.IPayFeeV1InnerServiceSMO;
import com.java110.po.fee.PayFeeDetailPo;
import com.java110.po.fee.PayFeePo;
import com.java110.utils.cache.MappingCache;
import com.java110.utils.exception.CmdException;
@@ -33,7 +36,13 @@
    private IPayFeeV1InnerServiceSMO payFeeV1InnerServiceSMOImpl;
    @Autowired
    private IPayFeeDetailV1InnerServiceSMO payFeeDetailV1InnerServiceSMOImpl;
    @Autowired
    private IFeeDetailInnerServiceSMO feeDetailInnerServiceSMOImpl;
    @Autowired
    private IPayFeeMonth payFeeMonthImpl;
    @Override
    public void validate(CmdEvent event, ICmdDataFlowContext context, JSONObject reqJson) throws CmdException {
@@ -49,9 +58,6 @@
        Assert.listOnlyOne(feeDtos, "未查询到费用信息 或查询到多条" + reqJson);
//        if ("T".equals(feeDtos.get(0).getIsDefault())) {
//            throw new IllegalArgumentException("当前费用为默认费用不能做删除");
//        }
        String feeValidate = MappingCache.getValue("DELETE_FEE_VALIDATE");
        if ("ON".equals(feeValidate)) {
@@ -82,5 +88,17 @@
        if (flag < 1) {
            throw new IllegalArgumentException("删除失败");
        }
        PayFeeDetailPo payFeeDetailPo = BeanConvertUtil.covertBean(businessUnit, PayFeeDetailPo.class);
        List<FeeDetailDto> feeDetailDtos = feeDetailInnerServiceSMOImpl.queryFeeDetails(BeanConvertUtil.covertBean(payFeeDetailPo, FeeDetailDto.class));
        if(feeDetailDtos != null && feeDetailDtos.size() > 0) {
            int flag2 = payFeeDetailV1InnerServiceSMOImpl.deletePayFeeDetailNew(payFeeDetailPo);
            if (flag2 < 1) {
                throw new IllegalArgumentException("删除失败");
            }
        }
        //todo 离散的月
        payFeeMonthImpl.deleteFeeMonth(payFeePo.getFeeId(),payFeePo.getCommunityId());
    }
}