|
|
|
@ -4,18 +4,18 @@ import cn.hutool.core.collection.CollUtil;
|
|
|
|
|
import cn.hutool.core.util.StrUtil;
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
|
|
import com.glxp.api.dao.inout.IoCodeRelMapper;
|
|
|
|
|
import com.github.pagehelper.PageHelper;
|
|
|
|
|
import com.glxp.api.dao.inout.IoOrderDetailCodeDao;
|
|
|
|
|
import com.glxp.api.dao.inout.IoOrderInvoiceMapper;
|
|
|
|
|
import com.glxp.api.entity.inout.IoCodeRelEntity;
|
|
|
|
|
import com.glxp.api.entity.inout.IoOrderDetailCodeEntity;
|
|
|
|
|
import com.glxp.api.entity.inout.IoOrderInvoiceEntity;
|
|
|
|
|
import com.glxp.api.req.inout.IoOrderInvoiceRequest;
|
|
|
|
|
import com.glxp.api.res.inout.IoOrderInvoiceResponse;
|
|
|
|
|
import com.glxp.api.res.inout.IoOrderResponse;
|
|
|
|
|
import org.apache.regexp.RE;
|
|
|
|
|
import org.springframework.beans.BeanUtils;
|
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
|
|
|
|
import com.glxp.api.service.inout.IoOrderInvoiceService;
|
|
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
|
@ -25,24 +25,22 @@ import java.util.List;
|
|
|
|
|
|
|
|
|
|
@Service
|
|
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
|
|
public class IoOrderInvoiceServiceImpl extends ServiceImpl<IoOrderInvoiceMapper, IoOrderInvoiceEntity> implements IoOrderInvoiceService {
|
|
|
|
|
public class IoOrderInvoiceService extends ServiceImpl<IoOrderInvoiceMapper, IoOrderInvoiceEntity> {
|
|
|
|
|
@Resource
|
|
|
|
|
IoOrderInvoiceMapper ioOrderInvoiceMapper;
|
|
|
|
|
@Resource
|
|
|
|
|
IoOrderDetailCodeDao orderDetailCodeDao;
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
|
|
|
|
public List<IoOrderInvoiceEntity> findByBillNo(String orderIdFk) {
|
|
|
|
|
return ioOrderInvoiceMapper.selectList(new QueryWrapper<IoOrderInvoiceEntity>().eq("orderIdFk", orderIdFk));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public boolean deleteByInvId(String id) {
|
|
|
|
|
return this.ioOrderInvoiceMapper.deleteById(id) > 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public boolean updateByInvId(IoOrderInvoiceRequest ioOrderInvoiceRequest) {
|
|
|
|
|
IoOrderInvoiceEntity ioOrderInvoiceEntity = new IoOrderInvoiceEntity();
|
|
|
|
|
BeanUtils.copyProperties(ioOrderInvoiceRequest, ioOrderInvoiceEntity);
|
|
|
|
@ -50,32 +48,20 @@ public class IoOrderInvoiceServiceImpl extends ServiceImpl<IoOrderInvoiceMapper,
|
|
|
|
|
return this.ioOrderInvoiceMapper.updateById(ioOrderInvoiceEntity) > 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public boolean insertInvoice(IoOrderInvoiceEntity ioOrderInvoiceEntity) {
|
|
|
|
|
return ioOrderInvoiceMapper.insert(ioOrderInvoiceEntity) > 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public List<IoOrderInvoiceEntity> selectOrderInvoice(IoOrderInvoiceRequest ioOrderInvoiceRequest) {
|
|
|
|
|
return ioOrderInvoiceMapper.selectOrderInvoice(ioOrderInvoiceRequest);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public boolean updateRegStatus(IoOrderDetailCodeEntity orderDetailCodeEntity) {
|
|
|
|
|
IoOrderInvoiceRequest orderInvoiceRequest = new IoOrderInvoiceRequest();
|
|
|
|
|
orderInvoiceRequest.setBatchNo(orderDetailCodeEntity.getBatchNo());
|
|
|
|
|
orderInvoiceRequest.setBindRlFk(orderDetailCodeEntity.getBindRlFk() + "");
|
|
|
|
|
List<IoOrderInvoiceEntity> orderInvoiceEntities = selectOrderInvoice(orderInvoiceRequest);
|
|
|
|
|
if (CollUtil.isNotEmpty(orderInvoiceEntities)) {
|
|
|
|
|
// BigDecimal amount = new BigDecimal(0.00);
|
|
|
|
|
// for (IoOrderInvoiceEntity orderInvoiceEntity : orderInvoiceEntities) {
|
|
|
|
|
// amount = amount.add(new BigDecimal(orderInvoiceEntity.getPrice()));
|
|
|
|
|
// }
|
|
|
|
|
// if (amount.compareTo(orderDetailCodeEntity.getPrice()) == 0) {
|
|
|
|
|
// orderDetailCodeEntity.setRegStatus(true);
|
|
|
|
|
// } else {
|
|
|
|
|
// orderDetailCodeEntity.setRegStatus(false);
|
|
|
|
|
// }
|
|
|
|
|
orderDetailCodeEntity.setRegStatus(true);
|
|
|
|
|
} else {
|
|
|
|
|
orderDetailCodeEntity.setRegStatus(false);
|
|
|
|
@ -84,7 +70,6 @@ public class IoOrderInvoiceServiceImpl extends ServiceImpl<IoOrderInvoiceMapper,
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public IoOrderResponse findRegStausByBillNo(IoOrderResponse orderResponse) {
|
|
|
|
|
List<IoOrderInvoiceEntity> orderInvoiceEntities = ioOrderInvoiceMapper.selectList(new QueryWrapper<IoOrderInvoiceEntity>().eq("orderIdFk", orderResponse.getBillNo()));
|
|
|
|
|
List<IoOrderDetailCodeEntity> orderDetailCodeEntities = orderDetailCodeDao.selectList(new QueryWrapper<IoOrderDetailCodeEntity>().eq("orderIdFk", orderResponse.getBillNo()));
|
|
|
|
@ -113,15 +98,33 @@ public class IoOrderInvoiceServiceImpl extends ServiceImpl<IoOrderInvoiceMapper,
|
|
|
|
|
}
|
|
|
|
|
if (orderDetailCodeEntities.size() == isAll)
|
|
|
|
|
orderResponse.setInvoiceStatus(2);//已全部登记
|
|
|
|
|
else if(isAll >0){
|
|
|
|
|
else if (isAll > 0) {
|
|
|
|
|
orderResponse.setInvoiceStatus(1);//未全部登记
|
|
|
|
|
}
|
|
|
|
|
return orderResponse;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public boolean findRegStausByProduct(String billNo) {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public List<IoOrderInvoiceResponse> filterGroupBy(IoOrderInvoiceRequest orderInvoiceRequest) {
|
|
|
|
|
if (orderInvoiceRequest.getPage() != null) {
|
|
|
|
|
int offset = (orderInvoiceRequest.getPage() - 1) * orderInvoiceRequest.getLimit();
|
|
|
|
|
PageHelper.offsetPage(offset, orderInvoiceRequest.getLimit());
|
|
|
|
|
}
|
|
|
|
|
return ioOrderInvoiceMapper.filterGroupBy(orderInvoiceRequest);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public List<IoOrderResponse> filterByInvoiceCode(IoOrderInvoiceRequest orderInvoiceRequest) {
|
|
|
|
|
if (orderInvoiceRequest.getPage() != null) {
|
|
|
|
|
int offset = (orderInvoiceRequest.getPage() - 1) * orderInvoiceRequest.getLimit();
|
|
|
|
|
PageHelper.offsetPage(offset, orderInvoiceRequest.getLimit());
|
|
|
|
|
}
|
|
|
|
|
return ioOrderInvoiceMapper.filterByInvoiceCode(orderInvoiceRequest);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|