|
|
|
@ -11,6 +11,7 @@ import com.gszc.entity.InvoiceHeader;
|
|
|
|
|
import com.gszc.mapper.CustomMapper;
|
|
|
|
|
import com.gszc.mapper.InvoiceHeaderMapper;
|
|
|
|
|
import com.gszc.mapper.InvoiceMapper;
|
|
|
|
|
import com.gszc.service.CountService;
|
|
|
|
|
import com.gszc.service.IInvoiceService;
|
|
|
|
|
import com.gszc.util.KdniaoTrackQueryAPI;
|
|
|
|
|
import com.gszc.util.Uuid8Utils;
|
|
|
|
@ -19,6 +20,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
|
|
|
|
import java.math.BigDecimal;
|
|
|
|
|
import java.time.LocalDateTime;
|
|
|
|
|
import java.util.ArrayList;
|
|
|
|
|
import java.util.Date;
|
|
|
|
@ -49,12 +51,26 @@ public class InvoiceServiceImpl extends ServiceImpl<InvoiceMapper, Invoice> impl
|
|
|
|
|
@Autowired
|
|
|
|
|
CustomMapper customMapper;
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
CountService countService;
|
|
|
|
|
|
|
|
|
|
public void addInvoice(Invoice invoice){
|
|
|
|
|
String id = Uuid8Utils.generateShortUUID();
|
|
|
|
|
invoice.setId(id);
|
|
|
|
|
invoice.setStatusCode("disable");
|
|
|
|
|
invoice.setCreateDate(new Date());
|
|
|
|
|
invoice.setModifyDate(new Date());
|
|
|
|
|
BigDecimal money = invoice.getMoney();
|
|
|
|
|
String customId = invoice.getCustomId();
|
|
|
|
|
Custom custom = customMapper.selectById(customId);
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
JSONObject jsonObject = countService.VATCount("4", "1", ""+custom.getRegisterType(), money.doubleValue());
|
|
|
|
|
BigDecimal money1 = jsonObject.getBigDecimal("money");
|
|
|
|
|
invoice.setTaxMoney(money1.toString());
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
e.printStackTrace();
|
|
|
|
|
}
|
|
|
|
|
invoiceMapper.insert(invoice);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -90,6 +106,9 @@ public class InvoiceServiceImpl extends ServiceImpl<InvoiceMapper, Invoice> impl
|
|
|
|
|
public JSONObject invoiceDetail(String invoiceId){
|
|
|
|
|
JSONObject jsonObject = new JSONObject();
|
|
|
|
|
Invoice invoice = invoiceMapper.selectById(invoiceId);
|
|
|
|
|
String customId = invoice.getCustomId();
|
|
|
|
|
Custom custom = customMapper.selectById(customId);
|
|
|
|
|
invoice.setCustomName(custom.getCompanyName());
|
|
|
|
|
InvoiceHeader invoiceHeader = invoiceHeaderMapper.selectById(invoice.getInvoiceHeaderId());
|
|
|
|
|
jsonObject.put("invoice",invoice);
|
|
|
|
|
jsonObject.put("invoiceHeader",invoiceHeader);
|
|
|
|
|