This commit is contained in:
parent
acedf4175b
commit
0723988a25
|
@ -18,6 +18,9 @@ import com.hzya.frame.basedao.service.impl.BaseService;
|
|||
import org.springframework.beans.factory.annotation.Value;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
public class NuoNuoServiceImpl extends BaseService<NuoNuoEntity, String> implements INuoNuoService {
|
||||
|
@ -59,8 +62,17 @@ public class NuoNuoServiceImpl extends BaseService<NuoNuoEntity, String> impleme
|
|||
return BaseResult.getSuccessMessageEntity("发票类型为SJ,不传诺税通");
|
||||
}
|
||||
//组装发送数据
|
||||
JSONObject sendData = getSendData(mainData,detailArray);
|
||||
JSONObject sendData = null;
|
||||
try {
|
||||
sendData = getSendData(mainData,detailArray);
|
||||
} catch (ParseException e) {
|
||||
e.printStackTrace();
|
||||
return BaseResult.getFailureMessageEntity("推送诺诺发票失败:组装数据失败");
|
||||
|
||||
}
|
||||
//发送数据
|
||||
logger.error("推送诺诺发票推送:"+sendData.toJSONString());
|
||||
|
||||
String tokenResult = HttpRequest.post(url).
|
||||
header("appId", "800051").
|
||||
header("apiCode", "8000510012").
|
||||
|
@ -86,7 +98,7 @@ public class NuoNuoServiceImpl extends BaseService<NuoNuoEntity, String> impleme
|
|||
* @param detailArray
|
||||
* @return com.alibaba.fastjson.JSONObject
|
||||
**/
|
||||
private JSONObject getSendData(JSONObject mainData, JSONArray detailArray) {
|
||||
private JSONObject getSendData(JSONObject mainData, JSONArray detailArray) throws ParseException {
|
||||
JSONObject sendData = new JSONObject();
|
||||
sendData.put("buyerName",mainData.getString("field0092"));//购方名称
|
||||
sendData.put("buyerTaxnum",mainData.getString("field0146"));//购方税号
|
||||
|
@ -112,8 +124,14 @@ public class NuoNuoServiceImpl extends BaseService<NuoNuoEntity, String> impleme
|
|||
sendData.put("checkBlue",0);//开具红票时是否校验蓝票 0.校验蓝票是否存在诺税通 1.不校验蓝票是否存在诺税通但校验可冲红金额 2.不校验蓝票是否存在诺税通且不校验可冲红金额
|
||||
JSONArray sendArray = new JSONArray();
|
||||
|
||||
boolean flag = false;
|
||||
String field0177 = null;
|
||||
if(detailArray != null && detailArray.size() > 0){
|
||||
for (int i = 0; i < detailArray.size(); i++) {
|
||||
if(detailArray.getJSONObject(i).getString("field0166") != null && "经营租赁".equals(detailArray.getJSONObject(i).getString("field0166"))){
|
||||
flag = true;
|
||||
field0177 = detailArray.getJSONObject(i).getString("field0177");
|
||||
}
|
||||
JSONObject detail = new JSONObject();
|
||||
detail.put("detailIndex",detailArray.getJSONObject(i).getString("field0147"));//明细序号数电票明细行必须从1开始编号
|
||||
detail.put("detailType",0);//明细行性质:0,正常行;1,折扣行;2,被折扣行
|
||||
|
@ -144,6 +162,28 @@ public class NuoNuoServiceImpl extends BaseService<NuoNuoEntity, String> impleme
|
|||
}
|
||||
}
|
||||
sendData.put("detail",sendArray);
|
||||
if(flag){
|
||||
sendData.put("specificFactor",mainData.getString("field0187"));//不动产租赁发票
|
||||
JSONArray realPropertyRentInfoList = new JSONArray();
|
||||
JSONObject detail = new JSONObject();
|
||||
detail.put("realPropertyAddress",mainData.getString("field0182"));//不动产地址
|
||||
detail.put("detailAddress",mainData.getString("field0180"));//不动产详细地址
|
||||
detail.put("realPropertyCertificate",field0177);//规格型号/不动产权证
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
||||
SimpleDateFormat inputFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
Date date = inputFormat.parse(mainData.getString("field0183"));
|
||||
detail.put("rentStartDate",sdf.format(date));//租赁期起期,停车费业务支持yyyy-MM-dd HH:mm格式
|
||||
Date date1 = inputFormat.parse(mainData.getString("field0184"));
|
||||
detail.put("rentEndDate",sdf.format(date1));//租赁期止期支持yyyy-MM-dd HH:mm格式
|
||||
if(mainData.getString("field0185") != null && "1".equals(mainData.getString("field0185"))){
|
||||
detail.put("crossCityFlag",1);//跨地市标志
|
||||
}else {
|
||||
detail.put("crossCityFlag",0);//跨地市标志
|
||||
}
|
||||
detail.put("unit",mainData.getString("field0186"));//面积单位(默认平方米)
|
||||
realPropertyRentInfoList.add(detail);
|
||||
sendData.put("realPropertyRentInfoList",realPropertyRentInfoList);//不动产租赁发票
|
||||
}
|
||||
return sendData;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -21,7 +21,10 @@ import org.springframework.boot.test.context.SpringBootTest;
|
|||
import org.springframework.test.context.junit4.SpringRunner;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
@ -32,12 +35,21 @@ import java.util.Map;
|
|||
* @Author llg
|
||||
* Date 2023/7/16 8:18 上午
|
||||
*/
|
||||
@RunWith(SpringRunner.class)
|
||||
@SpringBootTest(classes = {WebappApplication.class})
|
||||
//@RunWith(SpringRunner.class)
|
||||
//@SpringBootTest(classes = {WebappApplication.class})
|
||||
public class temButtom {
|
||||
|
||||
//@Test
|
||||
@Test
|
||||
public void test01() {
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
||||
SimpleDateFormat inputFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
Date date = null;
|
||||
try {
|
||||
date = inputFormat.parse("2025-07-01 17:30:19");
|
||||
} catch (ParseException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
String asd = sdf.format(date);
|
||||
String a = AESUtil.encrypt("hzya@1314");
|
||||
System.out.println(a);
|
||||
String b = AESUtil.decrypt("62e4295b615a30dbf3b8ee96f41c820b");
|
||||
|
|
|
@ -76,7 +76,7 @@ public class NuoNuoCallbackServiceImpl implements INuoNuoCallbackService {
|
|||
String pdfUrl = jsonObject.getString("pdfUrl");//发票pdf地址
|
||||
String imageUrl = jsonObject.getString("imageUrl");//发票jpg地址
|
||||
String invoiceTime = jsonObject.getString("invoiceTime");//开票日期
|
||||
String invoiceCode = jsonObject.getString("invoiceCode");//发票代码
|
||||
String invoiceCode = jsonObject.getString("allElectronicInvoiceNumber");//发票代码
|
||||
String invoiceNumber = jsonObject.getString("invoiceNumber");//发票号码
|
||||
String orderNo = jsonObject.getString("orderNo");//订单编号
|
||||
logger.error("诺诺发票回调接口1:"+invoiceTime);
|
||||
|
|
Loading…
Reference in New Issue