ky 6 years ago
parent 895f7623c2
commit 8a52f89485

@ -40,10 +40,10 @@ public class CountController {
@ApiImplicitParam(name = "fourMoney", value = "第四季度开票金额", dataType = "string", paramType = "query"),
})
public Result VATCount(String companyType,String invoiceType,String specialInvoiceType,double oneMoney,double twoMoney,double threeMoney,double fourMoney) {
BigDecimal oneBigDecimal = null;
BigDecimal twoBigDecimal = null;
BigDecimal threeBigDecimal = null;
BigDecimal fourBigDecimal = null;
JSONObject oneBigDecimal = null;
JSONObject twoBigDecimal = null;
JSONObject threeBigDecimal = null;
JSONObject fourBigDecimal = null;
JSONObject jsonObject = new JSONObject();
try {
oneBigDecimal = countService.VATCount(companyType,invoiceType,specialInvoiceType,oneMoney);

@ -1,5 +1,6 @@
package com.gszc.service;
import com.alibaba.fastjson.JSONObject;
import org.springframework.stereotype.Service;
import java.math.BigDecimal;
@ -7,37 +8,43 @@ import java.math.BigDecimal;
@Service
public class CountService {
public BigDecimal VATCount(String companyType,String invoiceType,String specialInvoiceType,double money) throws Exception{
public JSONObject VATCount(String companyType,String invoiceType,String specialInvoiceType,double money) throws Exception{
double result = 0;
JSONObject result = new JSONObject();
if(companyType.equals("1")){//有限公司
result = VATCountDetail(invoiceType, money, result, specialInvoiceType);
result = VATCountDetail(invoiceType, money, specialInvoiceType);
}else if(companyType.equals("2")){//个独、合伙企业
result = VATCountDetail(invoiceType, money, result, specialInvoiceType);
result = VATCountDetail(invoiceType, money, specialInvoiceType);
} else {
throw new Exception("公司类型不正确");
}
BigDecimal b = new BigDecimal(result);
return b.setScale(2, BigDecimal.ROUND_HALF_UP);
return result;
}
private double VATCountDetail(String invoiceType,double money,double result,String specialInvoiceType) throws Exception{
private JSONObject VATCountDetail(String invoiceType,double money,String specialInvoiceType) throws Exception{
JSONObject jsonObject = new JSONObject();
double result = 0;
if(invoiceType.equals("1")){//普票类型
result = money/1.03*0.03;
jsonObject.put("rate",3);
}else if(invoiceType.equals("2")){//专票类型
if(specialInvoiceType.equals("1")){
result = money/1.06*0.06;
jsonObject.put("rate",6);
}else if(specialInvoiceType.equals("2")){
result = money/1.13*0.13;
jsonObject.put("rate",13);
}else {
throw new Exception("专票类型不正确");
}
}else {
throw new Exception("发票类型不正确");
}
return result;
BigDecimal b = new BigDecimal(result);
BigDecimal keep = b.setScale(2, BigDecimal.ROUND_HALF_UP);
jsonObject.put("money",keep);
return jsonObject;
}
public BigDecimal PITCount(String type,String produceType,double money) throws Exception{

@ -124,8 +124,7 @@ public class MiniAppService {
return jsonObject;
}
public MiniUser decryptPhoneNumber(String userId, String signature,
String rawData, String encryptedData, String iv) {
public MiniUser decryptPhoneNumber(String userId,String encryptedData ,String ivStr,String signature,String rawData) {
//todo sessionKeyId 查出 sessionKey
String sessionKey = getSessionKey(userId);
@ -136,7 +135,7 @@ public class MiniAppService {
// }
// 解密
WxMaPhoneNumberInfo phoneNoInfo = wxService.getUserService().getPhoneNoInfo(sessionKey, encryptedData, iv);
WxMaPhoneNumberInfo phoneNoInfo = wxService.getUserService().getPhoneNoInfo(sessionKey, encryptedData, ivStr);
//区号
String countryCode = phoneNoInfo.getCountryCode();

Loading…
Cancel
Save