cardno字段更新为string
diff --git a/config/application-devel-pg.properties b/config/application-devel-pg.properties
index 4d6e081..cced0a5 100644
--- a/config/application-devel-pg.properties
+++ b/config/application-devel-pg.properties
@@ -21,4 +21,7 @@
# timeout seconds
jwt.expiration=3600
auth.password.bcrypt.seed=
-spring.jackson.serialization.fail-on-empty-beans=false
\ No newline at end of file
+spring.jackson.serialization.fail-on-empty-beans=false
+
+
+payapi.url=https://yy.dlsmk.cn/payapi
\ No newline at end of file
diff --git a/src/main/java/com/supwisdom/dlpay/api/service/PayApiService.java b/src/main/java/com/supwisdom/dlpay/api/service/PayApiService.java
new file mode 100644
index 0000000..9f032ad
--- /dev/null
+++ b/src/main/java/com/supwisdom/dlpay/api/service/PayApiService.java
@@ -0,0 +1,12 @@
+package com.supwisdom.dlpay.api.service;
+
+import com.supwisdom.dlpay.api.bean.CitizenCardPayfinishParam;
+import com.supwisdom.dlpay.api.bean.CitizenCardPayinitParam;
+import com.supwisdom.dlpay.api.bean.CitizenPayResponse;
+
+public interface PayApiService {
+ CitizenPayResponse citizencardPayinit(CitizenCardPayinitParam param);
+
+ CitizenPayResponse citizencardPayFinish( CitizenCardPayfinishParam param);
+
+}
diff --git a/src/main/java/com/supwisdom/dlpay/api/service/impl/PayApiServiceImpl.java b/src/main/java/com/supwisdom/dlpay/api/service/impl/PayApiServiceImpl.java
new file mode 100644
index 0000000..9493580
--- /dev/null
+++ b/src/main/java/com/supwisdom/dlpay/api/service/impl/PayApiServiceImpl.java
@@ -0,0 +1,33 @@
+package com.supwisdom.dlpay.api.service.impl;
+
+import com.google.gson.Gson;
+import com.supwisdom.dlpay.api.bean.CitizenCardPayfinishParam;
+import com.supwisdom.dlpay.api.bean.CitizenCardPayinitParam;
+import com.supwisdom.dlpay.api.bean.CitizenPayResponse;
+import com.supwisdom.dlpay.api.service.PayApiService;
+import net.minidev.json.JSONObject;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.stereotype.Service;
+import org.springframework.web.client.RestTemplate;
+import sun.net.www.http.HttpClient;
+
+@Service
+public class PayApiServiceImpl implements PayApiService {
+
+ @Value("${payapi.url}")
+ private String payapiurl;
+
+
+ @Override
+ public CitizenPayResponse citizencardPayinit(CitizenCardPayinitParam param) {
+ // String gsonString = new Gson().toJson(param);
+ RestTemplate client=new RestTemplate();
+ client.postForEntity(payapiurl+"/api/consume/citizencard/payinit")
+ return null;
+ }
+
+ @Override
+ public CitizenPayResponse citizencardPayFinish(CitizenCardPayfinishParam param) {
+ return null;
+ }
+}
diff --git a/src/main/java/com/supwisdom/dlpay/api/service/impl/PosPayServiceImpl.java b/src/main/java/com/supwisdom/dlpay/api/service/impl/PosPayServiceImpl.java
index 7ba3c1f..9ffa4a5 100644
--- a/src/main/java/com/supwisdom/dlpay/api/service/impl/PosPayServiceImpl.java
+++ b/src/main/java/com/supwisdom/dlpay/api/service/impl/PosPayServiceImpl.java
@@ -1,6 +1,7 @@
package com.supwisdom.dlpay.api.service.impl;
import com.supwisdom.dlpay.api.bean.*;
+import com.supwisdom.dlpay.api.service.PayApiService;
import com.supwisdom.dlpay.api.service.PosPayService;
import com.supwisdom.dlpay.framework.dao.BusinessparaDao;
import com.supwisdom.dlpay.framework.domain.TBusinesspara;
@@ -49,6 +50,8 @@
private ShopSettlementService shopSettlementService;
@Autowired
private BusinessparaDao businessparaDao;
+ @Autowired
+ private PayApiService payApiService;
@@ -135,22 +138,7 @@
@Override
public PosPayInitResp doPayInit(PosPayInitReq req) {
PosPayInitResp resp = new PosPayInitResp();
- /*if (!clientSessionService.checkRequestSign(req)) {
- resp.setRetcode(ErrorCode.ERRIF_SIGN_ERROR);
- resp.setRetmsg("签名验证失败");
- return resp;
- }
- TTerm tTerm = systemUtilService.getTermBytermid(Integer.valueOf(req.getTerm_id()));
- if (null == tTerm) {
- resp.setRetcode(ErrorCode.ERRIF_POS_NOTLOGIN);
- resp.setRetmsg("终端未签到");
- return resp;
- }
- if (tTerm.getChecknum().intValue() != req.getChecknum()) {
- resp.setRetcode(ErrorCode.ERRIF_CHECKNUM_ERROR);
- resp.setRetmsg("验证码错误");
- return resp;
- }*/
+
TDevice tDevice = deviceService.getDeviceByDevphyid(req.getDevphyid());
if (tDevice == null) {
resp.setRetcode(ErrorCode.ERRIF_POS_NOREG);
@@ -171,43 +159,9 @@
resp.setRetmsg("卡对应客户不存在");
return resp;
}
+ Double managefee=0.0;
- /* if (!cardService.canDeposit(tCard)) {
- resp.setRetcode(ErrorCode.ERRIF_CARD_STATUSEXCEPT);
- resp.setRetmsg(cardService.getReason());
- return resp;
- }
- if (req.getCardbefbal() < req.getAmount()) {
- resp.setRetcode(ErrorCode.ERRIF_CARDBAL_SHORTAGE);
- resp.setRetmsg("卡余额不足");
- return resp;
- }
- //判断账户余额
- YKTAccount yktAccount = customerService.getYKTAccountByAccno(tCard.getAccno());
- if (null == yktAccount) {
- resp.setRetcode(ErrorCode.ERRIF_CARDACC_EXCEPT);
- resp.setRetmsg(cardService.getReason());
- return resp;
- }
- if (yktAccount.getBalance() < 0) {
- resp.setRetcode(ErrorCode.ERRIF_CARDACC_SHORTAGE);
- resp.setRetmsg("账户余额不足");
- return resp;
- }
- //检查商户
- TShop tShop = shopAccService.getTShopById(req.getShopid());
- if (tShop == null) {
- resp.setRetcode(ErrorCode.ERRIF_SHOP_NOTEXIST);
- resp.setRetmsg("设备绑定的商户不存在");
- return resp;
- }
- if (StringUtil.checkEmpty(tShop.getAccno())) {
- resp.setRetcode(ErrorCode.ERRIF_SHOP_ACC_EXCEPT);
- resp.setRetmsg("商户账号不存在");
- return resp;
- }*/
-
TTransDtl tTransdtl = new TTransDtl();
tTransdtl.setAccdate(req.getTermdate());
tTransdtl.setTermid(tDevice.getId());
@@ -250,7 +204,20 @@
tTransdtl.setCustname("");
}
- transDtlService.saveTransdtl(tTransdtl);
+ TTransDtl dtl=transDtlService.saveTransdtl(tTransdtl);
+
+ CitizenCardPayinitParam param=new CitizenCardPayinitParam();
+ param.setBillno(dtl.getBillno());
+ param.setShopaccno(dtl.getShopid());
+ param.setTransdate(dtl.getTransdate());
+ param.setTranstime(dtl.getTranstime());
+ param.setCardNo(dtl.getCardno());
+ param.setAmount(0);
+ CitizenPayResponse response=payApiService.citizencardPayinit(param);
+ if (response.getRetcode()!=0){
+ dtl.setStatus(RestaurantConstant.STATUS_TRANSDTL_FAIL);
+ }
+
resp.setBillno(tTransdtl.getBillno());
resp.setRetcode(ErrorCode.ERRIF_OK);
resp.setAnonymous(false);
diff --git a/src/main/java/com/supwisdom/dlpay/framework/dao/ShopSettlementDao.java b/src/main/java/com/supwisdom/dlpay/framework/dao/ShopSettlementDao.java
index c763deb..d1abdb0 100644
--- a/src/main/java/com/supwisdom/dlpay/framework/dao/ShopSettlementDao.java
+++ b/src/main/java/com/supwisdom/dlpay/framework/dao/ShopSettlementDao.java
@@ -9,7 +9,7 @@
@Repository
public interface ShopSettlementDao extends JpaRepository<TShopSettlement, String> {
- int countByShopid(Integer shopid);
+ int countByShopid(String shopid);
- List<TShopSettlement> findByShopid(Integer shopid);
+ List<TShopSettlement> findByShopid(String shopid);
}
diff --git a/src/main/java/com/supwisdom/dlpay/framework/domain/TShopSettlement.java b/src/main/java/com/supwisdom/dlpay/framework/domain/TShopSettlement.java
index e84e91a..a7bab95 100644
--- a/src/main/java/com/supwisdom/dlpay/framework/domain/TShopSettlement.java
+++ b/src/main/java/com/supwisdom/dlpay/framework/domain/TShopSettlement.java
@@ -10,8 +10,8 @@
@Column(name="SHOPSettlementno",unique = true, nullable = false, length = 9)
private String shopsettlementno;
- @Column(name="SHOPID", precision = 9)
- private Integer shopid;
+ @Column(name="SHOPID", precision = 15,unique = true)
+ private String shopid;
@Column(name="SHOPNAME", length = 200)
private String shopname;
@@ -28,11 +28,11 @@
this.shopsettlementno = SHOPSettlementno;
}
- public Integer getShopid() {
+ public String getShopid() {
return shopid;
}
- public void setShopid(Integer shopid) {
+ public void setShopid(String shopid) {
this.shopid = shopid;
}
diff --git a/src/main/java/com/supwisdom/dlpay/restaurant/controller/TransDtlController.java b/src/main/java/com/supwisdom/dlpay/restaurant/controller/TransDtlController.java
index fefff9d..f3eb105 100644
--- a/src/main/java/com/supwisdom/dlpay/restaurant/controller/TransDtlController.java
+++ b/src/main/java/com/supwisdom/dlpay/restaurant/controller/TransDtlController.java
@@ -32,7 +32,7 @@
@RequestMapping("/index")
public String indexView(ModelMap model) {
List<TShopSettlement> lst = shopSettlementService.getAllShopSettlement();
- Map<Integer, String> map = new HashMap<>();
+ Map<String, String> map = new HashMap<>();
for (TShopSettlement shop : lst) {
map.put(shop.getShopid(), shop.getShopname());
}
diff --git a/src/main/java/com/supwisdom/dlpay/restaurant/controller/TransDtlRevertController.java b/src/main/java/com/supwisdom/dlpay/restaurant/controller/TransDtlRevertController.java
index bace525..3ae9a10 100644
--- a/src/main/java/com/supwisdom/dlpay/restaurant/controller/TransDtlRevertController.java
+++ b/src/main/java/com/supwisdom/dlpay/restaurant/controller/TransDtlRevertController.java
@@ -37,7 +37,7 @@
@RequestMapping("/index")
public String indexView(ModelMap model) {
List<TShopSettlement> lst = shopSettlementService.getAllShopSettlement();
- Map<Integer, String> map = new HashMap<>();
+ Map<String, String> map = new HashMap<>();
for (TShopSettlement shop : lst) {
map.put(shop.getShopid(), shop.getShopname());
}
diff --git a/src/main/java/com/supwisdom/dlpay/restaurant/domain/TDevice.java b/src/main/java/com/supwisdom/dlpay/restaurant/domain/TDevice.java
index 007da23..63d2ef4 100644
--- a/src/main/java/com/supwisdom/dlpay/restaurant/domain/TDevice.java
+++ b/src/main/java/com/supwisdom/dlpay/restaurant/domain/TDevice.java
@@ -9,7 +9,7 @@
private Integer id;
private String devicename;
private String devphyid;
- private Integer shopid;
+ private String shopid;
private String factoryid;
private Integer state;
private String operid;
@@ -71,12 +71,12 @@
this.runstatus = runstatus;
}
- @Column(name = "shopid", length = 10)
- public Integer getShopid() {
+ @Column(name = "shopid", length = 15)
+ public String getShopid() {
return shopid;
}
- public void setShopid(Integer shopid) {
+ public void setShopid(String shopid) {
this.shopid = shopid;
}
@Column(name = "factoryid", length = 10)
diff --git a/src/main/java/com/supwisdom/dlpay/restaurant/domain/TOfflineTransDtl.java b/src/main/java/com/supwisdom/dlpay/restaurant/domain/TOfflineTransDtl.java
index 88cd4eb..a0f6a33 100644
--- a/src/main/java/com/supwisdom/dlpay/restaurant/domain/TOfflineTransDtl.java
+++ b/src/main/java/com/supwisdom/dlpay/restaurant/domain/TOfflineTransDtl.java
@@ -22,7 +22,7 @@
private String status;
private Integer revflag;
private String transtype;
- private Integer shopid;
+ private String shopid;
private String attr1;
private String revbillno;
private Integer custtype;
@@ -151,12 +151,12 @@
}
- @Column(name = "shopid", length = 9)
- public Integer getShopid() {
+ @Column(name = "shopid", length = 15)
+ public String getShopid() {
return shopid;
}
- public void setShopid(Integer shopid) {
+ public void setShopid(String shopid) {
this.shopid = shopid;
}
diff --git a/src/main/java/com/supwisdom/dlpay/restaurant/domain/TShopDevice.java b/src/main/java/com/supwisdom/dlpay/restaurant/domain/TShopDevice.java
index 06ea652..798a573 100644
--- a/src/main/java/com/supwisdom/dlpay/restaurant/domain/TShopDevice.java
+++ b/src/main/java/com/supwisdom/dlpay/restaurant/domain/TShopDevice.java
@@ -10,7 +10,7 @@
public class TShopDevice {
private Integer deviceid;
- private Integer shopid;
+ private String shopid;
private String operid;
@Id
@@ -23,12 +23,12 @@
this.deviceid = deviceid;
}
- @Column(name = "SHOPID", nullable = false, length = 10)
- public Integer getShopid() {
+ @Column(name = "SHOPID", nullable = false, length = 15)
+ public String getShopid() {
return shopid;
}
- public void setShopid(Integer shopid) {
+ public void setShopid(String shopid) {
this.shopid = shopid;
}
diff --git a/src/main/java/com/supwisdom/dlpay/restaurant/domain/TTransDtl.java b/src/main/java/com/supwisdom/dlpay/restaurant/domain/TTransDtl.java
index 1bce8e6..4f0dbdd 100644
--- a/src/main/java/com/supwisdom/dlpay/restaurant/domain/TTransDtl.java
+++ b/src/main/java/com/supwisdom/dlpay/restaurant/domain/TTransDtl.java
@@ -24,7 +24,7 @@
private String status;
private Integer revflag;
private String transtype;
- private Integer shopid;
+ private String shopid;
private String attr1;
private String revbillno;
private String transmode;
@@ -159,12 +159,12 @@
}
- @Column(name = "shopid", length = 9)
- public Integer getShopid() {
+ @Column(name = "shopid", length = 15)
+ public String getShopid() {
return shopid;
}
- public void setShopid(Integer shopid) {
+ public void setShopid(String shopid) {
this.shopid = shopid;
}
diff --git a/src/main/java/com/supwisdom/dlpay/restaurant/service/ShopSettlementService.java b/src/main/java/com/supwisdom/dlpay/restaurant/service/ShopSettlementService.java
index 046c8b8..7360907 100644
--- a/src/main/java/com/supwisdom/dlpay/restaurant/service/ShopSettlementService.java
+++ b/src/main/java/com/supwisdom/dlpay/restaurant/service/ShopSettlementService.java
@@ -13,7 +13,7 @@
@Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class,readOnly = true)
- List<TShopSettlement> getShopByShopid(Integer shopid);
+ List<TShopSettlement> getShopByShopid(String shopid);
}
diff --git a/src/main/java/com/supwisdom/dlpay/restaurant/service/impl/DeviceServiceImpl.java b/src/main/java/com/supwisdom/dlpay/restaurant/service/impl/DeviceServiceImpl.java
index 64d3080..9a4685d 100644
--- a/src/main/java/com/supwisdom/dlpay/restaurant/service/impl/DeviceServiceImpl.java
+++ b/src/main/java/com/supwisdom/dlpay/restaurant/service/impl/DeviceServiceImpl.java
@@ -143,6 +143,7 @@
}
String operid=OperUtil.getCurrentOperid();
device.setOperid(operid);
+ device.setDevicename(device.getDevphyid());
/* TDevice d = deviceDao.save(device);
TShopDevice shopDevice = new TShopDevice();
@@ -236,7 +237,7 @@
} else if (deviceDao.countByDevphyid((String) data[i][0]) >0) {
msg = msg + "第" + i + "行,设备已存在。<br/>";
failCnt+=1;
- } else if (shopSettlementDao.countByShopid(Integer.parseInt((String) data[i][2]))==0){
+ } else if (shopSettlementDao.countByShopid((String) data[i][2])==0){
msg = msg + "第" + i + "行,商户不存在。<br/>";
failCnt+=1;
}
@@ -245,7 +246,7 @@
d.setDevicename((String) data[i][0]);
d.setDevphyid((String) data[i][0]);
d.setFactoryid((String) data[i][1]);
- d.setShopid(Integer.parseInt((String) data[i][2]));
+ d.setShopid((String) data[i][2]);
sList.add(d);
}
}
diff --git a/src/main/java/com/supwisdom/dlpay/restaurant/service/impl/ShopSettlementServiceImpl.java b/src/main/java/com/supwisdom/dlpay/restaurant/service/impl/ShopSettlementServiceImpl.java
index a5ff9d1..c4195b3 100644
--- a/src/main/java/com/supwisdom/dlpay/restaurant/service/impl/ShopSettlementServiceImpl.java
+++ b/src/main/java/com/supwisdom/dlpay/restaurant/service/impl/ShopSettlementServiceImpl.java
@@ -29,7 +29,7 @@
}
@Override
- public List<TShopSettlement> getShopByShopid(Integer shopid) {
+ public List<TShopSettlement> getShopByShopid(String shopid) {
return shopSettlementDao.findByShopid(shopid);
}
}
diff --git a/src/main/java/com/supwisdom/dlpay/restaurant/service/impl/TransDtlServiceImpl.java b/src/main/java/com/supwisdom/dlpay/restaurant/service/impl/TransDtlServiceImpl.java
index 6e2d20c..4a280d0 100644
--- a/src/main/java/com/supwisdom/dlpay/restaurant/service/impl/TransDtlServiceImpl.java
+++ b/src/main/java/com/supwisdom/dlpay/restaurant/service/impl/TransDtlServiceImpl.java
@@ -112,7 +112,7 @@
System.out.println("---init here---");
info0=new String[cnt][titles0.length];
List<TShopSettlement> shop=shopSettlementDao.findAll();
- Map<Integer,String > shopmap=new HashMap<>();
+ Map<String,String > shopmap=new HashMap<>();
for(TShopSettlement s:shop){
shopmap.put(s.getShopid(),s.getShopname());
}
diff --git a/src/main/java/com/supwisdom/dlpay/restaurant/util/RestaurantConstant.java b/src/main/java/com/supwisdom/dlpay/restaurant/util/RestaurantConstant.java
index 932fb67..142202b 100644
--- a/src/main/java/com/supwisdom/dlpay/restaurant/util/RestaurantConstant.java
+++ b/src/main/java/com/supwisdom/dlpay/restaurant/util/RestaurantConstant.java
@@ -7,7 +7,7 @@
public static final String STATUS_DISCOUNTRULE_REJECT = "reject"; //驳回
public static final String STATUS_TRANSDTL_INIT = "init"; //初始化
- public static final String STATUS_TRANSDTL_WAIT = "wait"; //提交中
+ public static final String STATUS_TRANSDTL_WAIT = "wip"; //提交中
public static final String STATUS_TRANSDTL_SUCCESS = "suc"; //已入账
public static final String STATUS_TRANSDTL_FAIL = "fail"; //取消
diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties
index 5d108ac..94e4bc6 100644
--- a/src/main/resources/application.properties
+++ b/src/main/resources/application.properties
@@ -27,3 +27,5 @@
spring.servlet.multipart.max-file-size=10MB
spring.servlet.multipart.max-request-size=100MB
+payapi.url=https://yy.dlsmk.cn/payapi
+