|
@@ -114,35 +114,39 @@ public class TopNuoMplatformLogServiceImpl extends ServiceImpl<TopNuoMplatformLo
|
|
|
add.setCreateTime(DateUtils.getNowTime());
|
|
|
add.setUpdateTime(DateUtils.getNowTime());
|
|
|
if(this.save(add)){
|
|
|
- Long id = add.getId();
|
|
|
- Map<String,String> params = new HashMap<>();
|
|
|
- params.put("content",bo.getContent());
|
|
|
- String result = nuonuoService.openMplatform(params);
|
|
|
- TopNuoMplatformLog update = new TopNuoMplatformLog();
|
|
|
- update.setId(id);
|
|
|
- update.setResult(result);
|
|
|
-; JSONObject jsonObject = (JSONObject) JSONObject.parse(result);
|
|
|
- String code = String.valueOf(jsonObject.get("code"));
|
|
|
- String describe = String.valueOf(jsonObject.get("describe"));
|
|
|
- update.setResultCode(code);
|
|
|
- Map<String,String> rs = new HashMap<>();
|
|
|
- if("E0000".equals(code)){
|
|
|
- JSONObject resultObject = jsonObject.getJSONObject("result");
|
|
|
- String invoiceSerialNum = String.valueOf(resultObject.get("invoiceSerialNum"));
|
|
|
- update.setInvoiceSerialNum(invoiceSerialNum);
|
|
|
- update.setStatus(1);
|
|
|
- rs.put("invoiceSerialNum",invoiceSerialNum);
|
|
|
- update.setUpdateTime(DateUtils.getNowTime());
|
|
|
- updateById(update);
|
|
|
+ try{
|
|
|
+ Long id = add.getId();
|
|
|
+ Map<String,String> params = new HashMap<>();
|
|
|
+ params.put("content",bo.getContent());
|
|
|
+ String result = nuonuoService.openMplatform(params);
|
|
|
+ TopNuoMplatformLog update = new TopNuoMplatformLog();
|
|
|
+ update.setId(id);
|
|
|
+ update.setResult(result);
|
|
|
+ ; JSONObject jsonObject = (JSONObject) JSONObject.parse(result);
|
|
|
+ String code = String.valueOf(jsonObject.get("code"));
|
|
|
+ String describe = String.valueOf(jsonObject.get("describe"));
|
|
|
+ update.setResultCode(code);
|
|
|
+ Map<String,String> rs = new HashMap<>();
|
|
|
+ if("E0000".equals(code)){
|
|
|
+ JSONObject resultObject = jsonObject.getJSONObject("result");
|
|
|
+ String invoiceSerialNum = String.valueOf(resultObject.get("invoiceSerialNum"));
|
|
|
+ update.setInvoiceSerialNum(invoiceSerialNum);
|
|
|
+ update.setStatus(1);
|
|
|
+ rs.put("invoiceSerialNum",invoiceSerialNum);
|
|
|
+ update.setUpdateTime(DateUtils.getNowTime());
|
|
|
+ updateById(update);
|
|
|
|
|
|
- rs.put("code",code);
|
|
|
- rs.put("describe",describe);
|
|
|
- return rs;
|
|
|
- }else{
|
|
|
- update.setStatus(-1);
|
|
|
- update.setUpdateTime(DateUtils.getNowTime());
|
|
|
- updateById(update);
|
|
|
- throw new CustomException(result);
|
|
|
+ rs.put("code",code);
|
|
|
+ rs.put("describe",describe);
|
|
|
+ return rs;
|
|
|
+ }else{
|
|
|
+ update.setStatus(-1);
|
|
|
+ update.setUpdateTime(DateUtils.getNowTime());
|
|
|
+ updateById(update);
|
|
|
+ throw new CustomException(result);
|
|
|
+ }
|
|
|
+ }catch (Exception e){
|
|
|
+ throw new CustomException("开票失败");
|
|
|
}
|
|
|
}
|
|
|
throw new CustomException("新增失败");
|