主要任务:添加数据同步任务,导入功能调整以及添加systemParam表数据和类,修改Tcard属性status为normal和closed以及添加transtatus属性做到和核心平台一直
diff --git a/build.gradle b/build.gradle
index aa986f5..e2bb75d 100644
--- a/build.gradle
+++ b/build.gradle
@@ -79,7 +79,7 @@
implementation group: 'com.sun.jersey', name: 'jersey-client', version: '1.19'
implementation group: 'javax.servlet', name: 'jstl', version: '1.2'
implementation group: 'taglibs', name: 'standard', version: '1.1.2'
- implementation group: 'commons-codec', name: 'commons-codec', version: '1.6'
+ implementation group: 'commons-codec', name: 'commons-codec', version: '1.13'
implementation files('libs/ojdbc6.jar')
implementation 'cn.afterturn:easypoi-web:3.0.3'
@@ -89,8 +89,10 @@
annotationProcessor "org.springframework.boot:spring-boot-configuration-processor"
+ annotationProcessor 'org.projectlombok:lombok:1.18.8'
+ compileOnly 'org.projectlombok:lombok:1.18.8'
- compile 'com.supwisdom:payapi-sdk:b5eceda'
+ compile 'com.supwisdom:payapi-sdk:ae0b0e2'
testImplementation 'org.springframework.boot:spring-boot-starter-test'
testImplementation 'io.rest-assured:rest-assured:3.3.0'
diff --git a/config/application-devel-pg.properties b/config/application-devel-pg.properties
index a3d120b..56d209a 100644
--- a/config/application-devel-pg.properties
+++ b/config/application-devel-pg.properties
@@ -22,4 +22,12 @@
spring.jackson.serialization.fail-on-empty-beans=false
server.port=8099
+# payapi.url=https://yy.dlsmk.cn/payapi/
+# payapi.appid=300003
+# payapi.secret=b32309b244904e1789b055eb1da51db1
+
payapi.url=http://172.28.43.3:8099/payapi
+payapi.appid=200001
+payapi.secret=dc1d26c0d43e442588092c8d45c21bce
+
+
diff --git a/src/main/java/com/supwisdom/dlpay/doorlist/bean/CustomerListBean.java b/src/main/java/com/supwisdom/dlpay/doorlist/bean/CustomerListBean.java
index 44e9387..cdaeb2e 100644
--- a/src/main/java/com/supwisdom/dlpay/doorlist/bean/CustomerListBean.java
+++ b/src/main/java/com/supwisdom/dlpay/doorlist/bean/CustomerListBean.java
@@ -7,22 +7,22 @@
public class CustomerListBean implements Serializable {
@Excel(name = "姓名")
private String custname;
- @Excel(name="市民卡号")
+ @Excel(name="市民卡号(必填)")
private String cardno;
@Excel(name = "银行卡号")
private String bankcardno;
- @Excel(name = "物理卡号")
+ /*//@Excel(name = "物理卡号")
private String cardphyid;
- @Excel(name = "性别")
+ //@Excel(name = "性别")
private String sex;
- @Excel(name = "电子邮箱")
+ //@Excel(name = "电子邮箱")
private String email;
- @Excel(name = "手机")
+ //@Excel(name = "手机")
private String mobile;
- @Excel(name = "地址")
+ //@Excel(name = "地址")
private String addr;
- @Excel(name = "注销日期")
- private String closedate;
+ //@Excel(name = "注销日期")
+ private String closedate;*/
@Excel(name = "备注")
private String remarks;
@@ -51,7 +51,7 @@
this.bankcardno = bankcardno;
}
- public String getCardphyid() {
+ /*public String getCardphyid() {
return cardphyid;
}
@@ -97,7 +97,7 @@
public void setClosedate(String closedate) {
this.closedate = closedate;
- }
+ }*/
public String getRemarks() {
return remarks;
diff --git a/src/main/java/com/supwisdom/dlpay/doorlist/controller/DoorlistMgrController.java b/src/main/java/com/supwisdom/dlpay/doorlist/controller/DoorlistMgrController.java
index 81fa14a..382d024 100644
--- a/src/main/java/com/supwisdom/dlpay/doorlist/controller/DoorlistMgrController.java
+++ b/src/main/java/com/supwisdom/dlpay/doorlist/controller/DoorlistMgrController.java
@@ -8,6 +8,8 @@
import cn.afterturn.easypoi.excel.entity.enmus.ExcelType;
import cn.afterturn.easypoi.excel.entity.params.ExcelExportEntity;
import cn.afterturn.easypoi.view.PoiBaseView;
+import com.supwisdom.dlpay.api.bean.QueryUserParam;
+import com.supwisdom.dlpay.api.bean.UserInforResponse;
import com.supwisdom.dlpay.doorlist.bean.*;
import com.supwisdom.dlpay.doorlist.service.DoorlistMgrService;
import com.supwisdom.dlpay.framework.domain.TOperator;
@@ -23,8 +25,13 @@
import com.supwisdom.dlpay.ncmgr.domain.TNcAllottimeId;
import com.supwisdom.dlpay.ncmgr.domain.TNcCardlist;
import com.supwisdom.dlpay.ncmgr.service.NcService;
+import com.supwisdom.dlpay.paysdk.ApiLoginHelper;
+import com.supwisdom.dlpay.paysdk.proxy.ApiLoginProxy;
+import com.supwisdom.dlpay.paysdk.proxy.UserProxy;
+import com.supwisdom.dlpay.system.bean.PayApiConfig;
import com.supwisdom.dlpay.system.domain.TDictionaryId;
import com.supwisdom.dlpay.system.domain.TRegion;
+import com.supwisdom.dlpay.system.domain.TSystemParam;
import com.supwisdom.dlpay.system.page.Pagination;
import com.supwisdom.dlpay.system.service.SystemService;
import com.supwisdom.dlpay.util.RedisUtil;
@@ -32,6 +39,8 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.cloud.openfeign.EnableFeignClients;
+import org.springframework.context.annotation.ComponentScan;
import org.springframework.security.core.annotation.AuthenticationPrincipal;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
@@ -47,8 +56,14 @@
@Controller
@RequestMapping("/doorlistMgr")
+@EnableFeignClients(basePackages = "com.supwisdom.dlpay.paysdk")
+@ComponentScan(basePackages = {"com.supwisdom.dlpay.paysdk"})
public class DoorlistMgrController {
+ private static final String impcustomeFirstFlag = "IMPCUSTOME_FIRST_FLAG";
+
+ private static final String impcustomeFirstTime = "IMPCUSTOME_FIRST_TIME";
+
protected static Logger logger = LoggerFactory.getLogger(DoorlistMgrController.class);
@Autowired
@@ -275,14 +290,14 @@
* 1. 设置列信息:name:列标题 key: 列属性
*/
entity.add(new ExcelExportEntity("姓名", "custname"));
- entity.add(new ExcelExportEntity("市民卡号", "cardno"));
+ entity.add(new ExcelExportEntity("市民卡号(必填)", "cardno"));
entity.add(new ExcelExportEntity("银行卡号", "bankcarno"));
- entity.add(new ExcelExportEntity("物理卡号","cardphyid"));
- entity.add(new ExcelExportEntity("性别", "sex"));
- entity.add(new ExcelExportEntity("电子邮箱", "email"));
- entity.add(new ExcelExportEntity("手机", "mobile"));
- entity.add(new ExcelExportEntity("地址", "addr"));
- entity.add(new ExcelExportEntity("注销日期", "closedate"));
+// entity.add(new ExcelExportEntity("物理卡号()","cardphyid"));
+// entity.add(new ExcelExportEntity("性别", "sex"));
+// entity.add(new ExcelExportEntity("电子邮箱", "email"));
+// entity.add(new ExcelExportEntity("手机", "mobile"));
+// entity.add(new ExcelExportEntity("地址", "addr"));
+// entity.add(new ExcelExportEntity("注销日期", "closedate"));
entity.add(new ExcelExportEntity("备注", "remarks"));
List<Map> personList = new ArrayList<Map>();
@@ -334,8 +349,19 @@
return map;
}
+ @Autowired
+ private PayApiConfig payApiConfig;
+
+ @Autowired
+ private ApiLoginProxy apiLoginProxy;
+
+ @Autowired
+ private UserProxy userProxy;
+
private Map impCardList(String fpath,String operid,Map map) {
+
+ String firstTime = "";
ImportParams params = new ImportParams();
params.setTitleRows(0);
List<CustomerListBean> doorList = ExcelImportUtil.importExcel(new File(fpath), CustomerListBean.class, params);
@@ -347,9 +373,15 @@
return map;
}
try {
+ String appid = payApiConfig.getAppid();
+ String secret = payApiConfig.getSecret();
+ ApiLoginHelper helper = new ApiLoginHelper(apiLoginProxy);
+ helper.login(appid, secret);
+
String now = DateUtil.getNow();
List<TNcCardlist> tmpNcCardList = new ArrayList<TNcCardlist>();
List<TCard> tmpCardList = new ArrayList<TCard>();
+ List<CustomerListBean> tCustomerNoExistInfos = new ArrayList<CustomerListBean>();
int tmpi = 0;
int succCnt = 0;
int errCnt = 0;
@@ -357,46 +389,75 @@
for (CustomerListBean list : doorList) {
String cardno = list.getCardno();
- String bankcardno = list.getBankcardno();
+ //String bankcardno = list.getBankcardno();
- if (StringUtil.isEmpty(cardno)||StringUtil.isEmpty(bankcardno)){
+ if (StringUtil.isEmpty(cardno)){
errCnt++;
+ tCustomerNoExistInfos.add(list);
continue;
}
+ //从核心平台验证此卡号用户是否存在
+ QueryUserParam queryUserParam = new QueryUserParam();
+ queryUserParam.setCitizencardno(cardno);
+ UserInforResponse response = userProxy.querybycardno(queryUserParam);
+ if (response.getRetcode() != 0){
+ errCnt++;
+ tCustomerNoExistInfos.add(list);
+ continue;
+ }
+
succCnt++;
tmpi++;
- TCustomer customer = webInterfaceService.findCustomerByNo(cardno, bankcardno);
+ TCustomer customer = webInterfaceService.findCustomerById(response.getUserid());
if (customer != null) {//此用户已存在
TCard card = webInterfaceService.findCardByCustid(customer.getCustid());
- customer.setStatus("1");
- customer.setCustname(list.getCustname());
- customer.setSex(list.getSex());
- customer.setEmail(list.getEmail());
- customer.setMobile(list.getMobile());
- customer.setAddr(list.getAddr());
- customer.setClosedate(list.getClosedate());
+
+ customer.setStatus(customer.getStatus());
+ customer.setCustname(response.getName());
+// customer.setSex(list.getSex());
+// customer.setEmail(list.getEmail());
+// customer.setMobile(list.getMobile());
+// customer.setAddr(list.getAddr());
+ customer.setClosedate(response.getExpiredate());
customer.setLastsavedtime(now);
customer.setAddoperid(operid);
customer.setRemark(list.getRemarks());
webInterfaceService.saveCustomer(customer);
- card.setCardphyid(list.getCardphyid());
- card.setExpiredate(list.getClosedate());
- card.setStatus("1");
- card.setCardverno(Integer.parseInt(card.getCardverno())+1+"");
- card.setLastsavedtime(now);
- webInterfaceService.saveCard(card);
+ //一个用户可能会有多个卡,补办新卡新增一条信息
+ if (card!=null) {
+ card.setCardphyid(response.getCardphyid());
+ card.setExpiredate(response.getExpiredate());
+ card.setStatus(response.getStatus());
+ card.setTranstatus(response.getTransstatus());
+ card.setCardverno(Integer.parseInt(card.getCardverno()) + 1 + "");
+ card.setLastsavedtime(now);
+ webInterfaceService.saveCard(card);
+ }else {
+ TCard cardTmp = new TCard();
+ cardTmp.setCardno(list.getCardno());
+ cardTmp.setBankcardno(response.getBankcardno());
+ cardTmp.setCustid(response.getUserid());
+ cardTmp.setCardphyid(response.getCardphyid());
+ cardTmp.setExpiredate(response.getExpiredate());
+ cardTmp.setStatus(response.getStatus());
+ cardTmp.setTranstatus(response.getTransstatus());
+ cardTmp.setCardverno("1");
+ cardTmp.setLastsavedtime(now);
+ webInterfaceService.saveCard(cardTmp);
+ }
}else {
TCustomer customerTmp = new TCustomer();
+ customerTmp.setCustid(response.getUserid());
customerTmp.setStatus("1");
- customerTmp.setCustname(list.getCustname());
- customerTmp.setSex(list.getSex());
- customerTmp.setEmail(list.getEmail());
- customerTmp.setMobile(list.getMobile());
- customerTmp.setAddr(list.getAddr());
+ customerTmp.setCustname(response.getName());
+// customerTmp.setSex(list.getSex());
+// customerTmp.setEmail(list.getEmail());
+// customerTmp.setMobile(list.getMobile());
+// customerTmp.setAddr(list.getAddr());
customerTmp.setOpendate(now.substring(0, 7));
- customerTmp.setClosedate(list.getClosedate());
+ customerTmp.setClosedate(response.getExpiredate());
customerTmp.setLastsavedtime(now);
customerTmp.setAddoperid(operid);
customerTmp.setRemark(list.getRemarks());
@@ -404,17 +465,15 @@
TCard cardTmp = new TCard();
cardTmp.setCardno(list.getCardno());
+ cardTmp.setBankcardno(response.getBankcardno());
cardTmp.setCustid(customerTmp.getCustid());
- cardTmp.setCardphyid(list.getCardphyid());
- cardTmp.setExpiredate(list.getClosedate());
- cardTmp.setStatus("1");
- cardTmp.setLossflag("0");
- cardTmp.setLossdate("");
- cardTmp.setRenewflag("0");
- cardTmp.setFrozeflag("0");
+ cardTmp.setCardphyid(response.getCardphyid());
+ cardTmp.setExpiredate(response.getExpiredate());
+ cardTmp.setStatus(response.getStatus());
+ cardTmp.setTranstatus(response.getTransstatus());
cardTmp.setCardverno("1");
cardTmp.setLastsavedtime(now);
- cardTmp.setBankcardno(list.getBankcardno());
+ //cardTmp.setBankcardno(response.getBankcardno());
webInterfaceService.saveCard(cardTmp);
}
}
@@ -423,9 +482,17 @@
logger.info("名单导入消耗时间: " + (endTime - startTime) + "ms");
flag=1;
+ //判断是否为第一次名单导入
+ TSystemParam param = systemService.getSystemParamByKey(impcustomeFirstFlag);
+ if ("0".equals(param.getParamValue())){
+ systemService.updateSystemParamValueByKey(impcustomeFirstFlag, "1");
+ systemService.updateSystemParamValueByKey(impcustomeFirstTime, now);//保存第一次名单导入时间
+ }
+
map.put("imp_totCnt",totCnt);
map.put("imp_succCnt",succCnt);
map.put("imp_errCnt",errCnt);
+ map.put("tCustomerNoExistInfos", tCustomerNoExistInfos);
}catch (Exception ex){
logger.error("名单导入失败--"+ex.getMessage());
flag=-2;
@@ -989,6 +1056,12 @@
return map;
}
+ /**
+ * 删除设备名单
+ * @param tNcCardlistDeleteInfos
+ * @param operUser
+ * @return
+ */
@ResponseBody
@RequestMapping(value = "/saveDoorDeleteCardlist", method = {RequestMethod.POST})
public Map saveDoorDeleteCardlist(
diff --git a/src/main/java/com/supwisdom/dlpay/doorlist/service/DoorlistMgrService.java b/src/main/java/com/supwisdom/dlpay/doorlist/service/DoorlistMgrService.java
index fd7af24..ce0fda5 100644
--- a/src/main/java/com/supwisdom/dlpay/doorlist/service/DoorlistMgrService.java
+++ b/src/main/java/com/supwisdom/dlpay/doorlist/service/DoorlistMgrService.java
@@ -43,4 +43,10 @@
//修改设备人员名单
@Transactional(propagation = Propagation.REQUIRED,rollbackFor = {Exception.class})
public boolean updateNcCardlist(TNcCardlist bean);
+
+ //根据市民卡号和卡状态进行数据同步
+ @Transactional(propagation = Propagation.REQUIRED,rollbackFor = {Exception.class})
+ public void syncNcCardlistByCardnoAndStatus(String cardno,String status,String tranStatus);
+
+
}
diff --git a/src/main/java/com/supwisdom/dlpay/doorlist/service/impl/DoorlistMgrServiceImpl.java b/src/main/java/com/supwisdom/dlpay/doorlist/service/impl/DoorlistMgrServiceImpl.java
index 207f817..d6b774f 100644
--- a/src/main/java/com/supwisdom/dlpay/doorlist/service/impl/DoorlistMgrServiceImpl.java
+++ b/src/main/java/com/supwisdom/dlpay/doorlist/service/impl/DoorlistMgrServiceImpl.java
@@ -1,6 +1,7 @@
package com.supwisdom.dlpay.doorlist.service.impl;
import com.supwisdom.dlpay.doorlist.service.DoorlistMgrService;
+import com.supwisdom.dlpay.framework.util.DateUtil;
import com.supwisdom.dlpay.ncmgr.dao.NcAllottimeDao;
import com.supwisdom.dlpay.ncmgr.dao.NcCardListDao;
import com.supwisdom.dlpay.ncmgr.domain.TNcAllottime;
@@ -75,4 +76,29 @@
public boolean updateNcCardlist(TNcCardlist bean) {
return ncCardListDao.updateNcCardlist(bean);
}
+
+ @Override
+ public void syncNcCardlistByCardnoAndStatus(String cardno, String status, String tranStatus) {
+ String now = DateUtil.getNow();
+ TNcCardlist cardlist = ncCardListDao.getNcCardlistByCardno(cardno);
+ //1.判断此卡是否被下发
+ if (cardlist==null){
+ return;
+ }
+ //2.判断下发状态,如果不一致则重新下发到设备
+ String flagTmp = "D";
+ if (status.equals("normal") && tranStatus.equals("normal")){
+ flagTmp="A";
+ }
+ if (cardlist.getOperflag().equals(flagTmp)){
+ return;
+ }
+ cardlist.setOperflag(flagTmp);
+ cardlist.setRectime(now);
+ cardlist.setVersion(cardlist.getVersion()+1);
+ cardlist.setSyncflag("N");
+ cardlist.setSynctime("");
+ ncCardListDao.updateNcCardlist(cardlist);
+
+ }
}
diff --git a/src/main/java/com/supwisdom/dlpay/mainservice/dao/CardDao.java b/src/main/java/com/supwisdom/dlpay/mainservice/dao/CardDao.java
index 48896f5..972160b 100644
--- a/src/main/java/com/supwisdom/dlpay/mainservice/dao/CardDao.java
+++ b/src/main/java/com/supwisdom/dlpay/mainservice/dao/CardDao.java
@@ -7,4 +7,8 @@
public TCard findCardByCustid(String custid);
public boolean saveCard(TCard bean);
+
+ public TCard findCardByCardno(String cardno);
+
+ public boolean updateCard(TCard bean);
}
diff --git a/src/main/java/com/supwisdom/dlpay/mainservice/dao/CustomerDao.java b/src/main/java/com/supwisdom/dlpay/mainservice/dao/CustomerDao.java
index eab430d..2952d71 100644
--- a/src/main/java/com/supwisdom/dlpay/mainservice/dao/CustomerDao.java
+++ b/src/main/java/com/supwisdom/dlpay/mainservice/dao/CustomerDao.java
@@ -7,7 +7,9 @@
public interface CustomerDao {
- public TCustomer findCustomerByNo(String cardno, String bankcardno);
+ public TCustomer findCustomerByNo(String cardno);
+
+ public TCustomer findCustomerById(String custid);
public boolean saveCustomer(TCustomer bean);
diff --git a/src/main/java/com/supwisdom/dlpay/mainservice/dao/impl/CardDaoImpl.java b/src/main/java/com/supwisdom/dlpay/mainservice/dao/impl/CardDaoImpl.java
index 2e71868..05a0c98 100644
--- a/src/main/java/com/supwisdom/dlpay/mainservice/dao/impl/CardDaoImpl.java
+++ b/src/main/java/com/supwisdom/dlpay/mainservice/dao/impl/CardDaoImpl.java
@@ -18,7 +18,7 @@
@Transactional
@Override
public TCard findCardByCustid(String custid) {
- String sql = "select bean from TCard bean where bean.custid = :custid";
+ String sql = "select bean from TCard bean where bean.custid = :custid ";
TypedQuery<TCard> query = entityManager.createQuery(sql, TCard.class);
query.setParameter("custid", custid);
List<TCard> list = query.getResultList();
@@ -40,4 +40,30 @@
}
return flag;
}
+
+ @Transactional
+ @Override
+ public TCard findCardByCardno(String cardno) {
+ String sql = "select bean from TCard bean where bean.cardno = :cardno ";
+ TypedQuery<TCard> query = entityManager.createQuery(sql, TCard.class);
+ query.setParameter("cardno", cardno);
+ List<TCard> list = query.getResultList();
+ if (list!=null && list.size()>0){
+ return list.get(0);
+ }
+ return null;
+ }
+
+ @Transactional
+ @Override
+ public boolean updateCard(TCard bean) {
+ boolean flag = false;
+ try {
+ entityManager.merge(bean);
+ flag = true;
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ return flag;
+ }
}
diff --git a/src/main/java/com/supwisdom/dlpay/mainservice/dao/impl/CustomerDaoImpl.java b/src/main/java/com/supwisdom/dlpay/mainservice/dao/impl/CustomerDaoImpl.java
index 71230c1..4a37d73 100644
--- a/src/main/java/com/supwisdom/dlpay/mainservice/dao/impl/CustomerDaoImpl.java
+++ b/src/main/java/com/supwisdom/dlpay/mainservice/dao/impl/CustomerDaoImpl.java
@@ -21,12 +21,24 @@
@Transactional
@Override
- public TCustomer findCustomerByNo(String cardno, String bankcardno) {
+ public TCustomer findCustomerByNo(String cardno) {
String sql = "select bean from TCustomer bean left join TCard a on a.custid= bean.custid " +
- " where a.cardno=:cardno and a.bankcardno = :bankcarno ";
+ " where a.cardno=:cardno ";
TypedQuery<TCustomer> query = entityManager.createQuery(sql, TCustomer.class);
query.setParameter("cardno", cardno);
- query.setParameter("bankcarno", bankcardno);
+ List<TCustomer> list = query.getResultList();
+ if (list!=null && list.size()>0){
+ return list.get(0);
+ }
+ return null;
+ }
+
+ @Transactional
+ @Override
+ public TCustomer findCustomerById(String custid) {
+ String sql = "select bean from TCustomer bean where bean.custid=:custid";
+ TypedQuery<TCustomer> query = entityManager.createQuery(sql, TCustomer.class);
+ query.setParameter("custid", custid);
List<TCustomer> list = query.getResultList();
if (list!=null && list.size()>0){
return list.get(0);
@@ -51,7 +63,7 @@
@Override
public List<TCustomerInfo> getAllTCustomerList(String perName, String cardno, String bankcardno) {
String sql = "select a.custid,a.custname,b.cardno,b.bankcardno,b.cardphyid,b.expiredate from T_Customer a left join t_card b on a.custid = b.custid " +
- " where a.status='1' and b.status='1' and b.lossflag='0' and b.frozeflag='0' ";
+ " where a.status='1' and b.status='normal' and b.transtatus='normal' ";
if (!StringUtil.isEmpty(perName)){
sql += " and a.custname like :perName ";
}
@@ -80,7 +92,7 @@
@Override
public TCustomerInfo getTCustomerByExcel(String cardno) {
String sql = "select a.custid,a.custname,b.cardno,b.bankcardno,b.cardphyid,b.expiredate from t_customer a,t_card b " +
- " where a.custid = b.custid and b.status = '1' and cardno=?1 ";
+ " where a.custid = b.custid and b.status = 'normal' and b.transtatus='normal' and cardno=?1 ";
Query query = entityManager.createNativeQuery(sql, TCustomerInfo.class);
query.setParameter(1, cardno);
List<TCustomerInfo> list = query.getResultList();
diff --git a/src/main/java/com/supwisdom/dlpay/mainservice/domain/TCard.java b/src/main/java/com/supwisdom/dlpay/mainservice/domain/TCard.java
index 4f28641..afd9c4c 100644
--- a/src/main/java/com/supwisdom/dlpay/mainservice/domain/TCard.java
+++ b/src/main/java/com/supwisdom/dlpay/mainservice/domain/TCard.java
@@ -20,14 +20,7 @@
private String cardphyid;
private String expiredate;
private String status;
- private String lossflag;
- private String lossdate;
- private String renewflag;
- private String renewdate;
- private String renewcardno;
- private String lossefttime;
- private String frozeflag;
- private String frozedate;
+ private String transtatus;
private String cardverno;
private String lastsavedtime;
private String bankcardno;
@@ -42,28 +35,23 @@
/** minimal constructor */
- /** full constructor */
- public TCard(String cardno, String oldcardno, String custid, String cardphyid, String expiredate, String status, String lossflag, String lossdate, String renewflag, String renewdate, String renewcardno, String lossefttime, String frozeflag, String frozedate, String cardverno, String lastsavedtime, String bankcardno, String cardid) {
+ public TCard(String cardno, String oldcardno, String custid, String cardphyid, String expiredate, String status, String transtatus, String cardverno, String lastsavedtime, String bankcardno, String cardid) {
this.cardno = cardno;
this.oldcardno = oldcardno;
this.custid = custid;
this.cardphyid = cardphyid;
this.expiredate = expiredate;
this.status = status;
- this.lossflag = lossflag;
- this.lossdate = lossdate;
- this.renewflag = renewflag;
- this.renewdate = renewdate;
- this.renewcardno = renewcardno;
- this.lossefttime = lossefttime;
- this.frozeflag = frozeflag;
- this.frozedate = frozedate;
+ this.transtatus = transtatus;
this.cardverno = cardverno;
this.lastsavedtime = lastsavedtime;
this.bankcardno = bankcardno;
this.cardid = cardid;
}
+ /** full constructor */
+
+
@Id
@GenericGenerator(name = "idGenerator", strategy = "uuid")
@GeneratedValue(generator = "idGenerator")
@@ -121,7 +109,7 @@
this.expiredate = expiredate;
}
- @Column(name = "STATUS", nullable = false, length = 1)
+ @Column(name = "STATUS", nullable = false, length = 10)
public String getStatus() {
return this.status;
}
@@ -130,79 +118,15 @@
this.status = status;
}
- @Column(name = "LOSSFLAG", nullable = false, length = 1)
- public String getLossflag() {
- return this.lossflag;
+ @Column(name = "TRANSTATUS",nullable = false,length = 10)
+ public String getTranstatus() {
+ return transtatus;
}
- public void setLossflag(String lossflag) {
- this.lossflag = lossflag;
+ public void setTranstatus(String transtatus) {
+ this.transtatus = transtatus;
}
- @Column(name = "LOSSDATE", length = 8)
- public String getLossdate() {
- return this.lossdate;
- }
-
- public void setLossdate(String lossdate) {
- this.lossdate = lossdate;
- }
-
- @Column(name = "RENEWFLAG", length = 1)
- public String getRenewflag() {
- return this.renewflag;
- }
-
- public void setRenewflag(String renewflag) {
- this.renewflag = renewflag;
- }
-
- @Column(name = "RENEWDATE", length = 8)
- public String getRenewdate() {
- return this.renewdate;
- }
-
- public void setRenewdate(String renewdate) {
- this.renewdate = renewdate;
- }
-
- @Column(name = "RENEWCARDNO", length = 32)
- public String getRenewcardno() {
- return this.renewcardno;
- }
-
- public void setRenewcardno(String renewcardno) {
- this.renewcardno = renewcardno;
- }
-
- @Column(name = "LOSSEFTTIME", length = 14)
- public String getLossefttime() {
- return this.lossefttime;
- }
-
- public void setLossefttime(String lossefttime) {
- this.lossefttime = lossefttime;
- }
-
- @Column(name = "FROZEFLAG", nullable = false, length = 1)
- public String getFrozeflag() {
- return this.frozeflag;
- }
-
- public void setFrozeflag(String frozeflag) {
- this.frozeflag = frozeflag;
- }
-
- @Column(name = "FROZEDATE", length = 8)
- public String getFrozedate() {
- return this.frozedate;
- }
-
- public void setFrozedate(String frozedate) {
- this.frozedate = frozedate;
- }
-
-
@Column(name = "CARDVERNO", length = 12)
public String getCardverno() {
return this.cardverno;
@@ -221,7 +145,7 @@
this.lastsavedtime = lastsavedtime;
}
- @Column(name = "BANKCARDNO",length = 32,nullable = false)
+ @Column(name = "BANKCARDNO",length = 32)
public String getBankcardno() {
return bankcardno;
}
diff --git a/src/main/java/com/supwisdom/dlpay/mainservice/domain/TCustomer.java b/src/main/java/com/supwisdom/dlpay/mainservice/domain/TCustomer.java
index ad4bf0d..6810fe9 100644
--- a/src/main/java/com/supwisdom/dlpay/mainservice/domain/TCustomer.java
+++ b/src/main/java/com/supwisdom/dlpay/mainservice/domain/TCustomer.java
@@ -57,8 +57,8 @@
// Property accessors
@Id
- @GenericGenerator(name = "idGenerator", strategy = "uuid")
- @GeneratedValue(generator = "idGenerator")
+// @GenericGenerator(name = "idGenerator", strategy = "uuid")
+// @GeneratedValue(generator = "idGenerator")
@Column(name = "CUSTID", unique = true, nullable = false, length = 32)
public String getCustid() {
return this.custid;
diff --git a/src/main/java/com/supwisdom/dlpay/mainservice/service/WebInterfaceService.java b/src/main/java/com/supwisdom/dlpay/mainservice/service/WebInterfaceService.java
index 003a167..6675db4 100644
--- a/src/main/java/com/supwisdom/dlpay/mainservice/service/WebInterfaceService.java
+++ b/src/main/java/com/supwisdom/dlpay/mainservice/service/WebInterfaceService.java
@@ -94,9 +94,13 @@
/*customer*********************/
- //根据卡号和银行卡号查询是否存在customer
+ //根据卡号查询是否存在customer
@Transactional(propagation = Propagation.REQUIRED,rollbackFor = {Exception.class})
- public TCustomer findCustomerByNo(String cardno,String bankcardno);
+ public TCustomer findCustomerByNo(String cardno);
+
+ @Transactional(propagation = Propagation.REQUIRED,rollbackFor = {Exception.class})
+ //根据用户id查询是否存在customer
+ public TCustomer findCustomerById(String custid);
//保存客户
@Transactional(propagation = Propagation.REQUIRED,rollbackFor = {Exception.class})
@@ -120,4 +124,12 @@
//根据excel卡号信息获取客户信息
@Transactional(propagation = Propagation.REQUIRED,rollbackFor = {Exception.class})
public TCustomerInfo getTCustomerByExcel(String cardno);
+
+ //根据同步到的市民卡号判断此卡是否导入门禁数据库
+ @Transactional(propagation = Propagation.REQUIRED,rollbackFor = {Exception.class})
+ public TCard findCardByCardno(String cardno);
+
+ //修改卡信息
+ @Transactional(propagation = Propagation.REQUIRED,rollbackFor = {Exception.class})
+ public boolean updateCard(TCard bean);
}
diff --git a/src/main/java/com/supwisdom/dlpay/mainservice/service/impl/WebInterfaceServiceImpl.java b/src/main/java/com/supwisdom/dlpay/mainservice/service/impl/WebInterfaceServiceImpl.java
index 349a19f..7d2b3c8 100644
--- a/src/main/java/com/supwisdom/dlpay/mainservice/service/impl/WebInterfaceServiceImpl.java
+++ b/src/main/java/com/supwisdom/dlpay/mainservice/service/impl/WebInterfaceServiceImpl.java
@@ -100,8 +100,13 @@
@Override
- public TCustomer findCustomerByNo(String cardno, String bankcardno) {
- return customerDao.findCustomerByNo(cardno, bankcardno);
+ public TCustomer findCustomerByNo(String cardno) {
+ return customerDao.findCustomerByNo(cardno);
+ }
+
+ @Override
+ public TCustomer findCustomerById(String custid) {
+ return customerDao.findCustomerById(custid);
}
@Override
@@ -128,4 +133,15 @@
public TCustomerInfo getTCustomerByExcel(String cardno) {
return customerDao.getTCustomerByExcel(cardno);
}
+
+ @Override
+ public TCard findCardByCardno(String cardno) {
+
+ return cardDao.findCardByCardno(cardno);
+ }
+
+ @Override
+ public boolean updateCard(TCard bean) {
+ return cardDao.updateCard(bean);
+ }
}
diff --git a/src/main/java/com/supwisdom/dlpay/ncmgr/dao/NcCardListDao.java b/src/main/java/com/supwisdom/dlpay/ncmgr/dao/NcCardListDao.java
index 7228e91..ffda9d6 100644
--- a/src/main/java/com/supwisdom/dlpay/ncmgr/dao/NcCardListDao.java
+++ b/src/main/java/com/supwisdom/dlpay/ncmgr/dao/NcCardListDao.java
@@ -27,4 +27,6 @@
public TNcCardlist getNcCardlistById(String id);
public boolean updateNcCardlist(TNcCardlist bean);
+
+ public TNcCardlist getNcCardlistByCardno(String cardno);
}
diff --git a/src/main/java/com/supwisdom/dlpay/ncmgr/dao/impl/NcCardListDaoImpl.java b/src/main/java/com/supwisdom/dlpay/ncmgr/dao/impl/NcCardListDaoImpl.java
index 154af8f..7da5ced 100644
--- a/src/main/java/com/supwisdom/dlpay/ncmgr/dao/impl/NcCardListDaoImpl.java
+++ b/src/main/java/com/supwisdom/dlpay/ncmgr/dao/impl/NcCardListDaoImpl.java
@@ -456,4 +456,17 @@
}
return flag;
}
+
+ @Transactional
+ @Override
+ public TNcCardlist getNcCardlistByCardno(String cardno) {
+ String sql = " select bean from TNcCardlist bean where bean.operflag='A' and bean.cardno = :cardno ";
+ TypedQuery<TNcCardlist> query = entityManager.createQuery(sql, TNcCardlist.class);
+ query.setParameter("cardno", cardno);
+ List<TNcCardlist> list = query.getResultList();
+ if (list!=null && list.size()>0){
+ return list.get(0);
+ }
+ return null;
+ }
}
diff --git a/src/main/java/com/supwisdom/dlpay/system/bean/PayApiConfig.java b/src/main/java/com/supwisdom/dlpay/system/bean/PayApiConfig.java
new file mode 100644
index 0000000..1820435
--- /dev/null
+++ b/src/main/java/com/supwisdom/dlpay/system/bean/PayApiConfig.java
@@ -0,0 +1,20 @@
+package com.supwisdom.dlpay.system.bean;
+
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.stereotype.Component;
+
+@Component
+public class PayApiConfig {
+ @Value("${payapi.appid}")
+ private String appid;
+ @Value("${payapi.secret}")
+ private String secret;
+
+ public String getAppid() {
+ return appid;
+ }
+
+ public String getSecret() {
+ return secret;
+ }
+}
diff --git a/src/main/java/com/supwisdom/dlpay/system/dao/SystemParamDao.java b/src/main/java/com/supwisdom/dlpay/system/dao/SystemParamDao.java
new file mode 100644
index 0000000..2c87853
--- /dev/null
+++ b/src/main/java/com/supwisdom/dlpay/system/dao/SystemParamDao.java
@@ -0,0 +1,13 @@
+package com.supwisdom.dlpay.system.dao;
+
+import com.supwisdom.dlpay.system.domain.TSystemParam;
+
+public interface SystemParamDao {
+
+ public TSystemParam getSystemParamByKey(String paramKey);
+
+ public boolean updateSystemParamValueByKey(String paramKey,String paramValue);
+
+ public boolean saveSystemParam(TSystemParam bean);
+
+}
diff --git a/src/main/java/com/supwisdom/dlpay/system/dao/impl/SystemParamDaoImpl.java b/src/main/java/com/supwisdom/dlpay/system/dao/impl/SystemParamDaoImpl.java
new file mode 100644
index 0000000..d8f65e6
--- /dev/null
+++ b/src/main/java/com/supwisdom/dlpay/system/dao/impl/SystemParamDaoImpl.java
@@ -0,0 +1,61 @@
+package com.supwisdom.dlpay.system.dao.impl;
+
+import com.supwisdom.dlpay.system.dao.SystemParamDao;
+import com.supwisdom.dlpay.system.domain.TSystemParam;
+import org.springframework.stereotype.Repository;
+import org.springframework.transaction.annotation.Transactional;
+
+import javax.persistence.EntityManager;
+import javax.persistence.PersistenceContext;
+import javax.persistence.Query;
+import javax.persistence.TypedQuery;
+import java.util.List;
+
+@Repository
+public class SystemParamDaoImpl implements SystemParamDao {
+ @PersistenceContext
+ EntityManager entityManager;
+
+ @Transactional
+ @Override
+ public TSystemParam getSystemParamByKey(String paramKey) {
+ String sql = "select bean from TSystemParam bean where bean.paramKey=:paramkey";
+ TypedQuery<TSystemParam> query = entityManager.createQuery(sql, TSystemParam.class);
+ query.setParameter("paramkey", paramKey);
+ List<TSystemParam> list = query.getResultList();
+ if (list!=null && list.size()>0){
+ return list.get(0);
+ }
+ return null;
+ }
+
+ @Transactional
+ @Override
+ public boolean updateSystemParamValueByKey(String paramKey, String paramValue) {
+ boolean flag = false;
+ try {
+ String sql = "update Tb_systemparam set param_value=:paramvalue where param_key=:paramkey";
+ Query query = entityManager.createNativeQuery(sql);
+ query.setParameter("paramkey", paramKey);
+ query.setParameter("paramvalue", paramValue);
+ query.executeUpdate();
+ flag=true;
+ }catch (Exception e){
+ e.printStackTrace();
+ }
+ return flag;
+ }
+
+ @Transactional
+ @Override
+ public boolean saveSystemParam(TSystemParam bean) {
+ boolean flag=false;
+ try {
+ entityManager.persist(bean);
+ flag=true;
+ }catch (Exception e){
+ e.printStackTrace();
+ }
+ return flag;
+ }
+}
diff --git a/src/main/java/com/supwisdom/dlpay/system/domain/TSystemParam.java b/src/main/java/com/supwisdom/dlpay/system/domain/TSystemParam.java
new file mode 100644
index 0000000..d08abf4
--- /dev/null
+++ b/src/main/java/com/supwisdom/dlpay/system/domain/TSystemParam.java
@@ -0,0 +1,53 @@
+package com.supwisdom.dlpay.system.domain;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.Id;
+import javax.persistence.Table;
+
+@Entity
+@Table(name = "TB_SYSTEMPARAM")
+public class TSystemParam {
+
+ private String paramKey;
+ private String paramValue;
+ private String paramDesc;
+ private String paramFlag;
+
+ @Id
+ @Column(name = "PARAM_KEY", unique = true, nullable = false)
+ public String getParamKey() {
+ return paramKey;
+ }
+
+ @Column(name="PARAM_VALUE",nullable = false)
+ public String getParamValue() {
+ return paramValue;
+ }
+
+ @Column(name = "PARAM_DESC")
+ public String getParamDesc() {
+ return paramDesc;
+ }
+
+ @Column(name = "PARAM_FLAG",nullable = false,length = 1)
+ public String getParamFlag() {
+ return paramFlag;
+ }
+
+ public void setParamKey(String paramKey) {
+ this.paramKey = paramKey;
+ }
+
+ public void setParamValue(String paramValue) {
+ this.paramValue = paramValue;
+ }
+
+ public void setParamDesc(String paramDesc) {
+ this.paramDesc = paramDesc;
+ }
+
+ public void setParamFlag(String paramFlag) {
+ this.paramFlag = paramFlag;
+ }
+}
diff --git a/src/main/java/com/supwisdom/dlpay/system/service/SystemService.java b/src/main/java/com/supwisdom/dlpay/system/service/SystemService.java
index 1ce9fb9..b78ad54 100644
--- a/src/main/java/com/supwisdom/dlpay/system/service/SystemService.java
+++ b/src/main/java/com/supwisdom/dlpay/system/service/SystemService.java
@@ -48,6 +48,21 @@
public TDictionary updateDictionary(String dicttype, String dicttypename, String dictval, String dictcaption, String oriengaltype, String oriengalval);
+ /*systemParam参数*/
+
+ //根据参数key获取参数value
+ @Transactional(propagation = Propagation.REQUIRED,rollbackFor = {Exception.class})
+ public TSystemParam getSystemParamByKey(String paramKey);
+
+ //根据参数key修改参数value
+ @Transactional(propagation = Propagation.REQUIRED,rollbackFor = {Exception.class})
+ public boolean updateSystemParamValueByKey(String paramKey,String paramValue);
+
+ //保存systemParam参数
+ @Transactional(propagation = Propagation.REQUIRED,rollbackFor = {Exception.class})
+ public boolean saveSystemParam(TSystemParam bean);
+
+
//根据查询条件分页获取所有区域
@Transactional(propagation = Propagation.REQUIRED,rollbackFor = {Exception.class})
public Pagination getSystemRegionList(String regionname,int pageNo,int pageSize);
diff --git a/src/main/java/com/supwisdom/dlpay/system/service/impl/SystemServiceImpl.java b/src/main/java/com/supwisdom/dlpay/system/service/impl/SystemServiceImpl.java
index a5e6493..083c7ca 100644
--- a/src/main/java/com/supwisdom/dlpay/system/service/impl/SystemServiceImpl.java
+++ b/src/main/java/com/supwisdom/dlpay/system/service/impl/SystemServiceImpl.java
@@ -3,10 +3,7 @@
import com.supwisdom.dlpay.ncmgr.domain.TBuilding;
import com.supwisdom.dlpay.system.bean.AllotBuildingBean;
import com.supwisdom.dlpay.system.bean.RegionZTreeNodes;
-import com.supwisdom.dlpay.system.dao.BuildingDao;
-import com.supwisdom.dlpay.system.dao.DictionaryDao;
-import com.supwisdom.dlpay.system.dao.OperatorDao;
-import com.supwisdom.dlpay.system.dao.RegionDao;
+import com.supwisdom.dlpay.system.dao.*;
import com.supwisdom.dlpay.system.domain.*;
import com.supwisdom.dlpay.system.page.Pagination;
import com.supwisdom.dlpay.system.service.SystemService;
@@ -28,6 +25,8 @@
private RegionDao regionDao;
@Autowired
private BuildingDao buildingDao;
+ @Autowired
+ private SystemParamDao systemParamDao;
@Override
@CacheEvict(cacheNames = "door_dictionary_cache", key = "'.*'", allEntries = true)
@@ -88,6 +87,21 @@
return dictionaryDao.updateDictionary(dicttype, dicttypename, dictval, dictcaption, oriengaltype, oriengalval);
}
+ @Override
+ public TSystemParam getSystemParamByKey(String paramKey) {
+ return systemParamDao.getSystemParamByKey(paramKey);
+ }
+
+ @Override
+ public boolean updateSystemParamValueByKey(String paramKey, String paramValue) {
+ return systemParamDao.updateSystemParamValueByKey(paramKey, paramValue);
+ }
+
+ @Override
+ public boolean saveSystemParam(TSystemParam bean) {
+ return systemParamDao.saveSystemParam(bean);
+ }
+
@Override
public Pagination getSystemRegionList(String regionname, int pageNo, int pageSize) {
diff --git a/src/main/java/com/supwisdom/dlpay/task/SyncCustomerTask.java b/src/main/java/com/supwisdom/dlpay/task/SyncCustomerTask.java
new file mode 100644
index 0000000..1f25912
--- /dev/null
+++ b/src/main/java/com/supwisdom/dlpay/task/SyncCustomerTask.java
@@ -0,0 +1,128 @@
+package com.supwisdom.dlpay.task;
+
+import com.supwisdom.dlpay.api.bean.CardsResponse;
+import com.supwisdom.dlpay.api.bean.QueryCardsParam;
+import com.supwisdom.dlpay.doorlist.service.DoorlistMgrService;
+import com.supwisdom.dlpay.framework.util.DateUtil;
+import com.supwisdom.dlpay.mainservice.domain.TCard;
+import com.supwisdom.dlpay.mainservice.service.WebInterfaceService;
+import com.supwisdom.dlpay.paysdk.ApiLoginHelper;
+import com.supwisdom.dlpay.paysdk.proxy.ApiLoginProxy;
+import com.supwisdom.dlpay.paysdk.proxy.UserProxy;
+import com.supwisdom.dlpay.system.bean.PayApiConfig;
+import com.supwisdom.dlpay.system.domain.TSystemParam;
+import com.supwisdom.dlpay.system.service.SystemService;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.cloud.openfeign.EnableFeignClients;
+import org.springframework.context.annotation.ComponentScan;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.scheduling.annotation.EnableScheduling;
+import org.springframework.scheduling.annotation.Scheduled;
+import org.springframework.stereotype.Component;
+
+import java.util.LinkedHashMap;
+import java.util.List;
+
+@Component
+@Configuration //1.主要用于标记配置类,兼备Component的效果。
+@EnableScheduling // 2.开启定时任务
+@EnableFeignClients(basePackages = "com.supwisdom.dlpay.paysdk")
+@ComponentScan(basePackages = {"com.supwisdom.dlpay.paysdk"})
+public class SyncCustomerTask {
+
+ protected static Logger logger = LoggerFactory.getLogger(SyncCustomerTask.class);
+
+ private static final String impcustomeFirstFlag = "IMPCUSTOME_FIRST_FLAG";
+
+ private static final String impcustomeFirstTime = "IMPCUSTOME_FIRST_TIME";
+
+ private static final String lastSyncTime = "LAST_SYNC_TIME";
+
+ @Autowired
+ private SystemService systemService;
+
+ @Autowired
+ private WebInterfaceService webInterfaceService;
+
+ @Autowired
+ private DoorlistMgrService doorlistMgrService;
+
+ @Autowired
+ private PayApiConfig payApiConfig;
+
+ @Autowired
+ private ApiLoginProxy apiLoginProxy;
+
+ @Autowired
+ private UserProxy userProxy;
+
+ @Scheduled(cron = "${sync.cardStatus.cron}")//十分钟执行一次
+ private void getCardStatusChangeTask(){
+ String startTime = "";
+ boolean firstImpFlag = false;
+ try {
+ String now = DateUtil.getNow();
+ logger.info("时间:" + now + "--开始进行数据同步");
+ //1.验证是否导入过名单
+ TSystemParam impcustomeFirstParam = systemService.getSystemParamByKey(impcustomeFirstFlag);
+ if ("0".equals(impcustomeFirstParam.getParamValue())) {
+ //没有名单导入 不进行数据同步
+ return;
+ } else if ("1".equals(impcustomeFirstParam.getParamValue())) {
+ //名单第一次导入 未进行数据同步
+ TSystemParam impcustomeFirstTimeParam = systemService.getSystemParamByKey(impcustomeFirstTime);
+ startTime = impcustomeFirstTimeParam.getParamValue();
+ firstImpFlag = true;
+ } else {
+ //上次数据同步时间
+ TSystemParam lastSyncTimeParam = systemService.getSystemParamByKey(lastSyncTime);
+ startTime = lastSyncTimeParam.getParamValue();
+ }
+ //2.登陆核心平台
+ ApiLoginHelper helper = new ApiLoginHelper(apiLoginProxy);
+ String appid = payApiConfig.getAppid();
+ String secret = payApiConfig.getSecret();
+ helper.login(appid, secret);
+
+
+ QueryCardsParam param = new QueryCardsParam();
+ param.setStarttime(startTime);
+ param.setEndtime(now);
+
+ CardsResponse response = userProxy.querycards(param);
+ if (0 == response.getRetcode()) {
+ List<LinkedHashMap> cards = response.getCards();
+ for (LinkedHashMap card : cards) {//3.根据获取到的card数据进行同步
+ String cardno = (String) card.get("cardno");
+ String status = (String) card.get("status");
+ String transStatus = (String) card.get("transStatus");
+ //(1).判断数据库中是否存在该卡
+ TCard cardByCardno = webInterfaceService.findCardByCardno(cardno);
+ if (cardByCardno == null) {
+ continue;
+ }
+ //(2).同步卡状态
+ cardByCardno.setStatus(status);
+ cardByCardno.setTranstatus(transStatus);
+ cardByCardno.setLastsavedtime(now);
+ cardByCardno.setCardverno((Integer.parseInt(cardByCardno.getCardverno()) + 1)+"");
+ webInterfaceService.updateCard(cardByCardno);
+ //(3).同步下发状态
+ doorlistMgrService.syncNcCardlistByCardnoAndStatus(cardno, status, transStatus);
+ }
+
+ if (firstImpFlag) {//第一次导入成功后 需要修改第一次导入参数
+ systemService.updateSystemParamValueByKey(impcustomeFirstFlag, "2");
+ }
+
+ //保存此次同步时间
+ systemService.updateSystemParamValueByKey(lastSyncTime, now);
+
+ }
+ }catch (Exception e){
+ logger.error(e.getMessage());
+ }
+ }
+}
diff --git a/src/main/kotlin/com/supwisdom/dlpay/api/bean/api_request_param.kt b/src/main/kotlin/com/supwisdom/dlpay/api/bean/api_request_param.kt
index 6e06756..7684e22 100644
--- a/src/main/kotlin/com/supwisdom/dlpay/api/bean/api_request_param.kt
+++ b/src/main/kotlin/com/supwisdom/dlpay/api/bean/api_request_param.kt
@@ -41,7 +41,7 @@
}
}
-class QueryUserParam : APIRequestParam() {
+class QueryUsersParam : APIRequestParam() {
@Sign
var userid: String? = null // 用户ID二选一 (两者都传取userid)
@Sign
diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties
index 3421309..55b3907 100644
--- a/src/main/resources/application.properties
+++ b/src/main/resources/application.properties
@@ -38,4 +38,10 @@
server.servlet.context-path=/door
+#当遇到同样名字的时候,是否允许覆盖注册
+spring.main.allow-bean-definition-overriding=true
+
+## quartz task scheduler
+sync.cardStatus.cron=0 0/10 * * * ?
+
diff --git a/src/main/resources/data.sql b/src/main/resources/data.sql
index 2268ef1..90134a0 100644
--- a/src/main/resources/data.sql
+++ b/src/main/resources/data.sql
@@ -156,4 +156,11 @@
INSERT INTO tb_role_function(id,functionid,permissions,roleid) VALUES ('297eec826b97ecf8016b97ee23890035', 21, NULL, 'abcdefghijklmnopqrstuvwxyz012346');
INSERT INTO tb_role_function(id,functionid,permissions,roleid) VALUES ('297eec826b97ecf8016b97ee23890036', 22, NULL, 'abcdefghijklmnopqrstuvwxyz012346');
INSERT INTO tb_role_function(id,functionid,permissions,roleid) VALUES ('297eec826b97ecf8016b97ee23890037', 23, NULL, 'abcdefghijklmnopqrstuvwxyz012346');
-INSERT INTO tb_role_function(id,functionid,permissions,roleid) VALUES ('297eec826b97ecf8016b97ee23890038', 24, NULL, 'abcdefghijklmnopqrstuvwxyz012346');
\ No newline at end of file
+INSERT INTO tb_role_function(id,functionid,permissions,roleid) VALUES ('297eec826b97ecf8016b97ee23890038', 24, NULL, 'abcdefghijklmnopqrstuvwxyz012346');
+
+-- ----------------------------
+-- Records of tb_systemparam
+-- ----------------------------
+INSERT INTO tb_systemparam(param_key,param_value,param_desc,param_flag) VALUES ('IMPCUSTOME_FIRST_FLAG','0','0:名单未导入 1:名单导入数据未同步过 2:数据同步过','1');
+INSERT INTO tb_systemparam(param_key,param_value,param_desc,param_flag) VALUES ('LAST_SYNC_TIME','','上次数据同步时间','1');
+INSERT INTO tb_systemparam(param_key,param_value,param_desc,param_flag) VALUES ('IMPCUSTOME_FIRST_TIME','','第一次名单导入时间','1');
diff --git a/src/main/resources/templates/doorlist/addDoorlist.html b/src/main/resources/templates/doorlist/addDoorlist.html
index d5d9645..2412036 100644
--- a/src/main/resources/templates/doorlist/addDoorlist.html
+++ b/src/main/resources/templates/doorlist/addDoorlist.html
@@ -42,7 +42,7 @@
<el-button size="small" style="height:24px; line-height:9px;overflow:hidden;width:100%;" type="primary" @click="person_searchPerson"> 搜索 </el-button>
</el-col>
<el-col :span="3" :offset="1">
- <el-button type="warning" size="small" style="height:24px; line-height:9px;overflow:hidden; " onclick="javascript:document.getElementById('addDoorlist_importquery').scrollIntoView()" @click="open3">导入选择人员</el-button>
+ <el-button type="warning" size="small" style="height:24px; line-height:9px;overflow:hidden; " onclick="javascript:document.getElementById('addDoorlist_importquery').scrollIntoView()" @click="open3">上传名单</el-button>
</el-col>
</el-col>
</el-row>
diff --git a/src/main/resources/templates/doorlist/impCustomerlist.html b/src/main/resources/templates/doorlist/impCustomerlist.html
index 12b1b61..15c328c 100644
--- a/src/main/resources/templates/doorlist/impCustomerlist.html
+++ b/src/main/resources/templates/doorlist/impCustomerlist.html
@@ -6,8 +6,8 @@
<a><cite>导入人员名单</cite></a>
</span>
</div>
- <div class="layui-card-body">
- <div id="impCustomerlist" v-loading.lock="loading"
+ <div class="layui-card-body" id="impCustomerlist">
+ <div id="impCustomerlist_impExcel" v-loading.lock="loading"
element-loading-text="拼命导入ing不要取消~~~"
element-loading-spinner="el-icon-loading"
element-loading-background="rgba(0, 0, 0, 0.8)">
@@ -45,9 +45,42 @@
<el-tag type="danger">导入说明:</el-tag><br>
<label >1、导入excel格式为xls,内容查看<el-button size="small" type="success" plain @click="downTemplate">导入模板</el-button></label><br>
- <label >2、市民卡号、银行卡号、物理卡号为必填项,每次导入建议在1000条以内</label><br>
- <label >3、为查询方便请尽量完善人员信息</label><br>
- <label >4、注销日期到期则无法开门,请选填。例:20080808</label><br>
+ <label >2、市民卡号为必填项,每次导入建议在1000条以内</label><br>
+ <label >3、人员信息会进行核心平台验证,验证通过才能导入成功,请耐心等待</label><br>
+ <label >4、卡权限到期则无法开门,请注意人员卡权限到期时间</label><br>
+ </div>
+
+ <div id="impCustomerlist_excelTable" style="display:none;">
+ <div style="width:100%;padding:0 10px;font-size: 16px">
+ <p>已查询到<span style="color:#ff9900" id="impCustomerlist_queryNumId"></span>条数据<el-tag type="info">文件路径:<span id="impCustomerlist_fileNameId"></span></el-tag><el-button size="small" style="float:right" type="primary" @click="imporReturn">返回</el-button></p>
+ <span>未查询到<span style="color:#ff9900" id="impCustomerlist_queryNoNumId"></span>条数据,具体如下:</span>
+ </div>
+
+ <template>
+ <el-table
+ ref="multipleTable"
+ tooltip-effect="dark"
+ max-height="2000"
+ :data="customer_exceltable"
+ highlight-current-row
+ stripe
+ border>
+ <el-table-column
+ sortable
+ prop="custname"
+ label="姓名">
+ </el-table-column>
+ <el-table-column
+ sortable
+ prop="cardno"
+ label="市民卡号">
+ </el-table-column>
+
+ </el-table>
+ </template>
+
+
+
</div>
</div>
</div>
@@ -60,7 +93,7 @@
textfield:'',
loading:false,
-
+ customer_exceltable:[],
per_sheetname:'sheet1',
impDoorForm:{
}
@@ -92,6 +125,10 @@
},
+ imporReturn:function(){
+ $('#impCustomerlist_excelTable').hide();
+ $('#impCustomerlist_impExcel').show();
+ },
@@ -143,6 +180,15 @@
if (data.flag==1){
var tmpStr = "共:"+data.imp_totCnt+"条,成功:"+data.imp_succCnt+"条,失败:"+data.imp_errCnt+"条";
layer.alert('人员名单导入完成-->'+tmpStr, {icon: 6});
+
+ $('#impCustomerlist_excelTable').show();
+ $('#impCustomerlist_impExcel').hide();
+
+ if(data.imp_errCnt > 0){
+ impCustomerlist_vue.customer_exceltable=data.tCustomerNoExistInfos;
+ }
+ $("#impCustomerlist_queryNumId").html(data.imp_succCnt);
+ $("#impCustomerlist_queryNoNumId").html(data.imp_errCnt);
}else{
layer.alert("人员名单导入失败", {icon: 5});
}