Commit 6565ce69 authored by 徐州's avatar 徐州

修改部分问题

parent 90ffb15d
...@@ -132,31 +132,31 @@ ...@@ -132,31 +132,31 @@
<div id="page1" class='only_for_print pagestyle' style='width:210mm;height:140mm;position:relative;'> <div id="page1" class='only_for_print pagestyle' style='width:210mm;height:140mm;position:relative;'>
<img class='screen-only' src="${ctx}/images/img/cw.jpg" style="position:absolute;width:100%;height:100%"/> <img class='screen-only' src="${ctx}/images/img/cw.jpg" style="position:absolute;width:100%;height:100%"/>
<div id='f1' draggable='true' <div id='f1' draggable='true'
class='f1'>缴款人全称 class='f1'>${fstzsXm.jkr}
</div> </div>
<div id='f2' draggable='true' <div id='f2' draggable='true'
class='f2'>缴款人账号 class='f2'>${fstzsXm.zhanghao}
</div> </div>
<div id='f3' draggable='true' <div id='f3' draggable='true'
class='f3'>缴款人开户银行 class='f3'>${fstzsXm.khh}
</div> </div>
<div id='f4' draggable='true' <div id='f4' draggable='true'
class='f4'>合计金额小写 class='f4'>${fstzsXm.yjje}
</div> </div>
<div id='f5' draggable='true' <div id='f5' draggable='true'
class='f5'>合计金额大写 class='f5'>${fstzsXm.yjjedx}
</div> </div>
<div id='f6' draggable='true' <div id='f6' draggable='true'
class='f6'>备注 class='f6'>${fstzsXm.beizhu}
</div> </div>
<div id='f7' draggable='true' <div id='f7' draggable='true'
class='f7'>项目编码 class='f7'>${fstzsXm.slbh}
</div> </div>
<div id='f8' draggable='true' <div id='f8' draggable='true'
class='f8'>数量 class='f8'>${fstzsXm.yjmj}
</div> </div>
<div id='f9' draggable='true' <div id='f9' draggable='true'
class='f9'>金额 class='f9'>${fstzsXm.yjje}
</div> </div>
</div> </div>
......
...@@ -57,8 +57,9 @@ ...@@ -57,8 +57,9 @@
{field:'jkr',title:'缴款人',width:100}, {field:'jkr',title:'缴款人',width:100},
{field:'yjje',title:'金额',width:100}, {field:'yjje',title:'金额',width:100},
{field:'pjdm',title:'票据代码',width:100}, {field:'pjdm',title:'票据代码',width:100},
{field:'jksh',title:'缴款书号',width:100}, {field:'dzph',title:'票据号码',width:100,formatter: function (value, row, index){
{field:'dzph',title:'相关电子票号',width:100}, return "<a href='" + row.pjUrl + "'>" + value + "<b></b></a>"
}},
{field:'isKp',title:'开票状态',width:100,formatter: function (value, row, index){ {field:'isKp',title:'开票状态',width:100,formatter: function (value, row, index){
if (value == 0) return "未开票"; if (value == 0) return "未开票";
return "已开票"; return "已开票";
......
...@@ -21,10 +21,15 @@ public class Fstzs extends BaseModel { ...@@ -21,10 +21,15 @@ public class Fstzs extends BaseModel {
private FstzsXm fstzsXm; private FstzsXm fstzsXm;
/** /**
* 非税系统流水号 * 激活的流水号
*/ */
private String lsh; private String lsh;
/**
* 开票的流水号
*/
private String kpLsh;
/** /**
* 非税通知书状态 * 非税通知书状态
* 0:默认,不显示在列表 * 0:默认,不显示在列表
...@@ -95,6 +100,10 @@ public class Fstzs extends BaseModel { ...@@ -95,6 +100,10 @@ public class Fstzs extends BaseModel {
* 电子票号 * 电子票号
*/ */
private String dzph; private String dzph;
/**
* 票据的url
*/
private String pjUrl;
/** /**
* 是否开票 * 是否开票
...@@ -353,4 +362,19 @@ public class Fstzs extends BaseModel { ...@@ -353,4 +362,19 @@ public class Fstzs extends BaseModel {
this.kpJbr = kpJbr; this.kpJbr = kpJbr;
} }
public String getKpLsh() {
return kpLsh;
}
public void setKpLsh(String kpLsh) {
this.kpLsh = kpLsh;
}
public String getPjUrl() {
return pjUrl;
}
public void setPjUrl(String pjUrl) {
this.pjUrl = pjUrl;
}
} }
...@@ -10,6 +10,7 @@ import com.jshx.fstzs.entity.FstzsXm; ...@@ -10,6 +10,7 @@ import com.jshx.fstzs.entity.FstzsXm;
import com.jshx.fstzs.fsutil.bean.*; import com.jshx.fstzs.fsutil.bean.*;
import com.jshx.fstzs.service.FstzsService; import com.jshx.fstzs.service.FstzsService;
import com.jshx.http.HttpclientUtil; import com.jshx.http.HttpclientUtil;
import org.apache.commons.lang3.AnnotationUtils;
import java.io.UnsupportedEncodingException; import java.io.UnsupportedEncodingException;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
...@@ -53,7 +54,7 @@ public class FsRequest { ...@@ -53,7 +54,7 @@ public class FsRequest {
* *
* @param fstzs 非税缴费对象 * @param fstzs 非税缴费对象
*/ */
public static KjjksResp jihuo(Fstzs fstzs) { public static FsResult<KjjksResp> jihuo(Fstzs fstzs) {
Map<String,Object> map = new HashMap<>(); Map<String,Object> map = new HashMap<>();
map.put("serial_number", fstzs.getLsh());//流水号 map.put("serial_number", fstzs.getLsh());//流水号
map.put("place_code",getProp("fs-kpdbm"));//开票点编码 map.put("place_code",getProp("fs-kpdbm"));//开票点编码
...@@ -88,10 +89,13 @@ public class FsRequest { ...@@ -88,10 +89,13 @@ public class FsRequest {
String request = request("paybook.e.issue.do", map); String request = request("paybook.e.issue.do", map);
FsResp<KjjksResp> resp = new Gson().fromJson(request, new TypeToken<FsResp<KjjksResp>>() { FsResp<KjjksResp> resp = new Gson().fromJson(request, new TypeToken<FsResp<KjjksResp>>() {
}.getType()); }.getType());
return resp.message; if(resp.errorMessage != null) {
return FsResult.fail(resp.errorMessage.errorMsg);
}
return new FsResult<>(resp.message);
} catch (Exception e) { } catch (Exception e) {
System.out.println("激活请求异常!!"); System.out.println("激活请求异常!!");
return null; return FsResult.fail("激活请求异常!!" + e.getMessage());
} }
...@@ -101,13 +105,16 @@ public class FsRequest { ...@@ -101,13 +105,16 @@ public class FsRequest {
* 作废电子缴款书 * 作废电子缴款书
* @param fstzs * @param fstzs
*/ */
public static boolean zuofei(Fstzs fstzs) { public static FsResult<Boolean> zuofei(Fstzs fstzs) {
Map<String,Object> map = new HashMap<>(); Map<String,Object> map = new HashMap<>();
map.put("pay_code",fstzs.getJkm()); map.put("pay_code",fstzs.getJkm());
String request = request("paybook.e.invalidate.do", map); String request = request("paybook.e.invalidate.do", map);
FsResp<CaozuoResp> resp = new Gson().fromJson(request, new TypeToken<FsResp<CaozuoResp>>() { FsResp<CaozuoResp> resp = new Gson().fromJson(request, new TypeToken<FsResp<CaozuoResp>>() {
}.getType()); }.getType());
return resp.message != null && "0000".equals(resp.message.succCode); if(resp.message != null && "0000".equals(resp.message.succCode)) {
return new FsResult<>(true);
}
return new FsResult(resp.errorMessage.errorMsg);
} }
/** /**
...@@ -129,7 +136,14 @@ public class FsRequest { ...@@ -129,7 +136,14 @@ public class FsRequest {
} }
} }
public static boolean kaipiao(Fstzs fstzs,String jbr) { /**
* 先开票,开票只返回状态
* 开完之后再调用查询接口
* @param fstzs
* @param jbr
* @return
*/
public static FsResult<KpResp> kaipiao(Fstzs fstzs,String jbr) {
//1,stock.billno.get 获取电子票号 //1,stock.billno.get 获取电子票号
Map<String,Object> mapPh = new HashMap<>(); Map<String,Object> mapPh = new HashMap<>();
mapPh.put("place_code",getProp("fs-kpdbm"));//开票点编码 mapPh.put("place_code",getProp("fs-kpdbm"));//开票点编码
...@@ -138,11 +152,12 @@ public class FsRequest { ...@@ -138,11 +152,12 @@ public class FsRequest {
FsResp<KaipiaoResp> respPh = new Gson().fromJson(requestPh, new TypeToken<FsResp<KaipiaoResp>>() { FsResp<KaipiaoResp> respPh = new Gson().fromJson(requestPh, new TypeToken<FsResp<KaipiaoResp>>() {
}.getType()); }.getType());
//2,通过电子票号 开票 //2,通过电子票号 开票
if(respPh.message == null) { if(respPh.errorMessage != null) {
return false; return FsResult.fail(respPh.errorMessage.errorMsg);
} }
Map<String,Object> map = new HashMap<>(); Map<String,Object> map = new HashMap<>();
map.put("serial_number",System.currentTimeMillis() + "");//业务流水号,不能重复 String kpLsh = System.currentTimeMillis() + "";
map.put("serial_number",kpLsh);//业务流水号,不能重复
map.put("place_code",getProp("fs-kpdbm"));//开票点编码 map.put("place_code",getProp("fs-kpdbm"));//开票点编码
map.put("bill_batch_code",getProp("fs-pjdm"));//电子票据代码 map.put("bill_batch_code",getProp("fs-pjdm"));//电子票据代码
map.put("bill_no",respPh.message.billNo);//电子票据代码 map.put("bill_no",respPh.message.billNo);//电子票据代码
...@@ -181,14 +196,38 @@ public class FsRequest { ...@@ -181,14 +196,38 @@ public class FsRequest {
String request = request("invoice.e.issue.withsign.do", map); String request = request("invoice.e.issue.withsign.do", map);
FsResp<CaozuoResp> resp = new Gson().fromJson(request, new TypeToken<FsResp<CaozuoResp>>() { FsResp<CaozuoResp> resp = new Gson().fromJson(request, new TypeToken<FsResp<CaozuoResp>>() {
}.getType()); }.getType());
return resp.message != null && "0000".equals(resp.message.succCode); if(resp.errorMessage != null) {
return FsResult.fail(resp.errorMessage.errorMsg);
}
if(resp.message != null && "0000".equals(resp.message.succCode)) {
KpResp kpResp = kaipiaoCx(kpLsh);
kpResp.lsh = kpLsh;
return new FsResult<>(kpResp);
}
return FsResult.fail("操作错误!" + new Gson().toJson(resp));
} catch (UnsupportedEncodingException e) { } catch (UnsupportedEncodingException e) {
e.printStackTrace(); e.printStackTrace();
return false; return FsResult.fail("操作异常" + e.getMessage());
} }
} }
/**
* 查询开票信息
* @param kpLsh
* @return
*/
private static KpResp kaipiaoCx(String kpLsh) {
String method = "invoice.jiangsu.get";
Map<String,Object> map = new HashMap<>();
map.put("serial_number",kpLsh);
String request = request(method, map);
FsResp<KpResp> resp = new Gson().fromJson(request,new TypeToken<FsResp<KpResp>>() {
}.getType());
return resp.message;
}
public static void main(String[] args) { public static void main(String[] args) {
String xml = "niasd{{pjdm}}12131"; String xml = "niasd{{pjdm}}12131";
......
package com.jshx.fstzs.fsutil.bean;
public class FsResult<T> {
public FsResult() {
}
public FsResult(T data) {
this.success = true;
this.data = data;
}
/**
* 是否成功
*/
public boolean success;
/**
* 失败的提示
*/
public String msg;
/**
* 成功返回的提示
*/
public T data;
public static FsResult fail(String msg) {
FsResult result = new FsResult();
result.success = false;
result.msg = msg;
return result;
}
}
package com.jshx.fstzs.fsutil.bean;
import com.google.gson.annotations.SerializedName;
public class KpResp {
/**
* 开票日期:YYYY-MM-DD
*/
public String date;
/**
* 票据种类名称
*/
@SerializedName("bill_name")
public String billName;
/**
* 票据代码
*/
@SerializedName("bill_batch_code")
public String billBatchCode;
/**
* 票据号码
*/
@SerializedName("bill_no")
public String billNo;
/**
* 创建时间:时间格式精确到毫秒yyyyMMddHHmmssSSS
*/
@SerializedName("create_time")
public String create_time;
/**
* 状态:1正常,4已冲红
*/
public int state;
/**
* 电子票获取地址,来自省厅地址
*/
public String url;
/**
* 流水号
*/
public String lsh;
}
...@@ -9,7 +9,9 @@ import com.jshx.core.json.CodeJsonValueProcessor; ...@@ -9,7 +9,9 @@ import com.jshx.core.json.CodeJsonValueProcessor;
import com.jshx.core.json.DateJsonValueProcessor; import com.jshx.core.json.DateJsonValueProcessor;
import com.jshx.fstzs.entity.Fstzs; import com.jshx.fstzs.entity.Fstzs;
import com.jshx.fstzs.entity.FstzsXm; import com.jshx.fstzs.entity.FstzsXm;
import com.jshx.fstzs.fsutil.bean.FsResult;
import com.jshx.fstzs.fsutil.bean.KjjksResp; import com.jshx.fstzs.fsutil.bean.KjjksResp;
import com.jshx.fstzs.fsutil.bean.KpResp;
import com.jshx.fstzs.service.FstzsService; import com.jshx.fstzs.service.FstzsService;
import com.jshx.fstzs.service.FstzsXmService; import com.jshx.fstzs.service.FstzsXmService;
import com.jshx.fstzs.fsutil.FsRequest; import com.jshx.fstzs.fsutil.FsRequest;
...@@ -371,12 +373,12 @@ public class FstzsAction extends BaseAction { ...@@ -371,12 +373,12 @@ public class FstzsAction extends BaseAction {
f.setLsh(System.currentTimeMillis() + "");//生成流水号 f.setLsh(System.currentTimeMillis() + "");//生成流水号
f.setFstzsXm(xm); f.setFstzsXm(xm);
f.setJksJbr(this.getLoginUser().getDisplayName()); f.setJksJbr(this.getLoginUser().getDisplayName());
KjjksResp resp = FsRequest.jihuo(f); FsResult<KjjksResp> resp = FsRequest.jihuo(f);
if(resp != null) {//成功 if(resp.success) {//成功
f.setStatus(1); f.setStatus(1);
f.setJkm(resp.payCode); f.setJkm(resp.data.payCode);
f.setJhTime(System.currentTimeMillis() + ""); f.setJhTime(System.currentTimeMillis() + "");
f.setBzrq(resp.createTime); f.setBzrq(resp.data.createTime);
} else {//失败 } else {//失败
f.setStatus(4);//生成缴费码失败 f.setStatus(4);//生成缴费码失败
} }
...@@ -417,10 +419,9 @@ public class FstzsAction extends BaseAction { ...@@ -417,10 +419,9 @@ public class FstzsAction extends BaseAction {
if(result) { if(result) {
list.stream().forEach(i-> { list.stream().forEach(i-> {
// 需要调用财政系统,作废接口 // 需要调用财政系统,作废接口
boolean r = true;
if(i.getStatus() != 2) {//已作废的不再重复作废 if(i.getStatus() != 2) {//已作废的不再重复作废
r = FsRequest.zuofei(i); FsResult<Boolean> zuofei = FsRequest.zuofei(i);
if(r) { if(zuofei.success) {
i.setStatus(2);//已作废 i.setStatus(2);//已作废
fstzsService.update(i); fstzsService.update(i);
} }
...@@ -452,15 +453,19 @@ public class FstzsAction extends BaseAction { ...@@ -452,15 +453,19 @@ public class FstzsAction extends BaseAction {
FstzsXm xm = fstzsXmService.getBySlbh(fstzs.getSlbh()); FstzsXm xm = fstzsXmService.getBySlbh(fstzs.getSlbh());
String jbr = this.getLoginUser().getDisplayName(); String jbr = this.getLoginUser().getDisplayName();
fstzs.setFstzsXm(xm); fstzs.setFstzsXm(xm);
boolean success = FsRequest.kaipiao(fstzs,jbr); FsResult<KpResp> kaipiao = FsRequest.kaipiao(fstzs, jbr);
if(success) { if(kaipiao.success) {
fstzs.setIsKp(1); fstzs.setIsKp(1);
fstzs.setKpJbr(jbr); fstzs.setKpJbr(jbr);
fstzs.setKpTime(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date())); fstzs.setKpLsh(kaipiao.data.lsh);
fstzs.setKpTime(kaipiao.data.date);
fstzs.setDzph(kaipiao.data.billNo);
fstzs.setPjdm(kaipiao.data.billBatchCode);
fstzs.setPjUrl(kaipiao.data.url);
fstzsService.update(fstzs); fstzsService.update(fstzs);
} else { } else {
result = false; result = false;
message = "开票失败"; message = kaipiao.msg;
} }
this.getResponse().getWriter().println("{\"result\":"+result+",\"message\":\"" + message + "!"+"\"}"); this.getResponse().getWriter().println("{\"result\":"+result+",\"message\":\"" + message + "!"+"\"}");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment