use of com.itrus.portal.db.UserInfo in project portal by ixinportal.
the class UserBillServiceTask method run.
/**
* 用户信息推送
*/
@Override
public void run() {
/*if(!isRun()) {
return;
}*/
List<Map> makecertexall = sqlSession.selectList("com.itrus.portal.db.BillMapper.selectAutoMakeCert");
SignatureConfig sc = null;
JSONObject data = null;
JSONObject result = null;
Bill bill = null;
Map param;
Map map;
try {
// for (Map<String,String> dataMap:makecertexall) {
if (makecertexall.isEmpty()) {
return;
}
int index = (int) (Math.random() * makecertexall.size());
Map dataMap = makecertexall.get(index);
param = new HashMap();
param.put("id", dataMap.get("id"));
map = sqlSession.selectOne("com.itrus.portal.db.BillMapper.selectByAllMakeCert", param);
// sc = scs.get(map.get("signature"));
if (sc == null) {
sc = sqlSession.selectOne("com.itrus.portal.db.SignatureConfigMapper.selectByPrimaryKey", map.get("signature"));
}
if (null == sc || sc.getPush() != 1 || null == sc.getSntTime()) {
// 未配置信息、未开启、未配置时间间隔
log.debug("未配置信息、未开启、未配置时间间隔");
return;
}
// 上次时间为空,或者上次时间大于当前时间,则重新设置上次时间为当前时间的毫秒数
if (null == sc.getCreateTime() || sc.getCreateTime().getTime() > System.currentTimeMillis()) {
sc.setCreateTime(new Date());
sqlSession.update("com.itrus.portal.db.SignatureConfigMapper.updateByPrimaryKeySelective", sc);
}
// 判断是否在时间间隔内(当前时间小于 上次时间加上时间间隔)
if (System.currentTimeMillis() < sc.getCreateTime().getTime() + (Integer.parseInt(sc.getSntTime()) * 1000)) {
log.debug("不在时间内");
sc = null;
return;
}
log.debug("任务开始");
// BusinessLicense bl = businessService.getBusinessByBillId(Long.parseLong(String.valueOf(map.get("id"))), null);
UserInfo userInfo = sqlSession.selectOne("com.itrus.portal.db.UserInfoMapper.selectByPrimaryKey", map.get("unique_id"));
Agent agent = agentService.getAgentByBillId(Long.parseLong(String.valueOf(map.get("id"))), null);
Map<String, Object> treeMap = Maps.newTreeMap();
/*if(data == null) {
data = new JSONObject();
}*/
treeMap.put("app_id", sc.getAppId());
treeMap.put("order_number", map.get("bill_id"));
treeMap.put("user_name", map.get("enterprise_name"));
treeMap.put("user_email", userInfo.getEmail());
treeMap.put("user_phone", userInfo.getmPhone());
treeMap.put("user_type", "organization");
String cardType = null;
String sn = null;
BusinessLicense businessLicense = businessService.getBusinessByBillId(Long.parseLong(String.valueOf(map.get("id"))), null);
if (businessLicense != null && businessLicense.getBusinessType() == 1) {
sn = businessLicense.getLicenseNo();
cardType = "UniformSocialCreditCode";
}
if (businessLicense == null || businessLicense.getBusinessType() != 1) {
// 不是五证合一
OrgCode oc = orgCodeService.getOrgCodeByBillId(Long.parseLong(String.valueOf(map.get("id"))), null);
if (oc != null) {
sn = oc.getOrgCode();
cardType = "OrganizationCode";
}
}
/*if(businessLicense == null || businessLicense.getBusinessType()!=1) {//不是五证合一
TaxRegisterCert tc = taxCertService.getTaxRegisterCertByBillId(Long.parseLong(String.valueOf(map.get("id"))), null);
if(tc != null){
sn = tc.getCertNo();
}
}*/
/*if(agent.getCardType()==1){
cardType = "IdentityCard";
}else if(agent.getCardType()==2){
cardType = "NationalPassport";
}else{
cardType = "Other";
}*/
treeMap.put("identity_type", cardType);
// agent.getIdCode()
treeMap.put("identification_number", sn);
String jsondata = JSONObject.toJSONString(treeMap);
String data1 = mapToQueryString(treeMap);
// String content = "{\"autoCert\":true,\"timestamp\":1472105170418,\"apiId\":\"test\",\"autoSeal\":true,\"user\":{\"transactorIdCardNum\":\"120102198904025625\",\"transactorMobile\":\"15822452770\",\"orgCode\":\"120116328553325\",\"papersType\":\"营销执照\",\"businessNum\":\"022-88956296\",\"realInfoUid\":\"151\",\"fullName\":\"天津瑞普生物技术股份有限公司空港经济区分公司\",\"legalPersonName\":\"刘建\",\"transactorName\":\"李洋\",\"realInfoOrder\":\"TWCX20160824170928580820\",\"userType\":1}}";
bill = sqlSession.selectOne("com.itrus.portal.db.BillMapper.selectByPrimaryKey", map.get("id"));
if (bill.getBillStatus() >= 8) {
return;
}
if (bill.getMcstatus() != null && bill.getMcstatus() == 1) {
return;
}
result = JSONObject.parseObject(RequestUtils.post1(sc.getAddress(), jsondata.toString(), data1, sc.getAddressKey(), "HMAC-SHA256"));
log.error("SignServiceTask_user_result :" + result);
/*if(result.getBoolean("isOK") && result.getIntValue("code") == 101) {//用户已存在 改成已撤销
bill.setMcstatus(1);
bill.setBillStatus(9);
sqlSession.update("com.itrus.portal.db.BillMapper.updateByPrimaryKey", bill);
return;
}*/
if (result.getString("code") != null && "SUCCESS".equals(result.getString("code").toString())) {
// temp.put(String.valueOf(dataMap.get("id")), "");
LogUtil.syslog(sqlSession, "推送华侨城", Thread.currentThread().getName() + bill.getBillId() + "企业名称:" + map.get("enterprise_name"));
bill.setMcstatus(1);
bill.setBillStatus(8);
sqlSession.update("com.itrus.portal.db.BillMapper.updateByPrimaryKey", bill);
sqlSession.flushStatements();
return;
}
LogUtil.syslog(sqlSession, "推送华侨城", bill.getBillId() + "企业名称:" + map.get("enterprise_name") + "错误:" + result.getString("message"));
// }
if (null != sc) {
// 设置本次时间
sc.setCreateTime(new Date());
sqlSession.update("com.itrus.portal.db.SignatureConfigMapper.updateByPrimaryKeySelective", sc);
}
log.debug("任务结束");
} catch (Exception e) {
// log.error("ERRORLOG用户推送 {}", e.getMessage());
StackTraceElement stackTraceElement = e.getStackTrace()[e.getStackTrace().length - 1];
LogUtil.syslog(sqlSession, "推送华侨城", "错误:" + stackTraceElement.getLineNumber() + e.getMessage());
}
}
use of com.itrus.portal.db.UserInfo in project portal by ixinportal.
the class UIDInfoUtils method getUidInfo.
/**
* 获取指定表中指定记录的指定属性值
*
* @param billId
* 订单id
* @param fields
* 表名.属性名(businessLicense.enterpriseName)
* @return 未找到返回null
*/
public String getUidInfo(Long billId, String fields) {
// str[0]表名,str[1]字段名
String[] strs = fields.split("\\.");
BusinessLicense businessLicense = null;
OrgCode orgCode = null;
TaxRegisterCert taxRegisterCert = null;
IdentityCard identityCard = null;
UserInfo userInfo = null;
Enterprise enterprise = null;
switch(strs[0]) {
case "businessLicense":
businessLicense = blCache.get(billId);
if (null == businessLicense) {
businessLicense = businessService.getBusinessByBillId(billId, null);
blCache.put(billId, businessLicense);
}
break;
case "orgCode":
orgCode = ocCache.get(billId);
if (null == orgCode) {
orgCode = orgCodeService.getOrgCodeByBillId(billId, null);
ocCache.put(billId, orgCode);
}
break;
case "taxRegisterCert":
taxRegisterCert = trcCache.get(billId);
if (null == taxRegisterCert) {
taxRegisterCert = taxCertService.getTaxRegisterCertByBillId(billId, null);
trcCache.put(billId, taxRegisterCert);
}
break;
case "identityCard":
identityCard = icCache.get(billId);
if (null == identityCard) {
identityCard = identityCardService.getIdentityCardByBillId(billId, null);
icCache.put(billId, identityCard);
}
break;
case "userInfo":
userInfo = uiCache.get(billId);
if (null == userInfo) {
userInfo = userInfoService.getUserInfoByBillId(billId);
uiCache.put(billId, userInfo);
}
break;
case "enterprise":
enterprise = eCache.get(billId);
if (null == enterprise) {
enterprise = enterpriseService.getEnterpriseByBillId(billId);
eCache.put(billId, enterprise);
}
break;
default:
return null;
}
if (null != businessLicense) {
return getBlFieldValue(businessLicense, strs[1]);
}
if (null != orgCode) {
return getOcFieldValue(orgCode, strs[1]);
}
if (null != taxRegisterCert) {
return getTcrFieldValue(taxRegisterCert, strs[1]);
}
if (null != identityCard) {
return getIcFieldValue(identityCard, strs[1]);
}
if (null != userInfo) {
return getUiFieldValue(userInfo, strs[1]);
}
if (null != enterprise) {
return getEFieldValue(enterprise, strs[1]);
}
return null;
}
use of com.itrus.portal.db.UserInfo in project portal by ixinportal.
the class PayWebControllerTest method multiNotfiyUrl.
@Test
public void multiNotfiyUrl() {
DateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss:SSS");
System.out.println("开始时间:" + df.format(System.currentTimeMillis()));
TestRunnable[] testRunnable = new TestRunnable[20];
List<Bill> bills = sqlSession.selectList("com.itrus.portal.db.BillMapper.selectByExample");
for (int i = 0; i < testRunnable.length; i++) {
if (i % 2 == 0) {
System.out.println(bills.get(i).getBillId());
Map<String, String> packageParams = new HashMap<String, String>();
packageParams.put("appid", "112223");
packageParams.put("nonce_str", "nonce_str");
packageParams.put("body", "body");
packageParams.put("out_trade_no", bills.get(i).getBillId());
packageParams.put("transaction_id", UniqueIDUtils.genUUID());
packageParams.put("pay_type", "1");
packageParams.put("return_code", "SUCCESS");
testRunnable[i] = new NotifyUrl(packageParams);
} else {
UserInfo userInfo = new UserInfo();
userInfo.setmPhone("13yyy88986" + i);
Enterprise enterprise = new Enterprise();
enterprise.setEnterpriseName("yaliqiyeyy" + i);
testRunnable[i] = new RegisterUserThread2(userInfo, enterprise);
}
}
MultiThreadedTestRunner mttr = new MultiThreadedTestRunner(testRunnable);
try {
mttr.runTestRunnables();
} catch (Exception e) {
e.printStackTrace();
} catch (Throwable e) {
e.printStackTrace();
}
System.out.println("结束时间:" + df.format(System.currentTimeMillis()));
System.out.println("成功数量" + SUCCESS_COUNT);
}
use of com.itrus.portal.db.UserInfo in project portal by ixinportal.
the class ReadJsonStr method testGetJsonObject.
@Test
public void testGetJsonObject() throws JsonProcessingException, IOException {
jsonTool.configure(DeserializationConfig.Feature.FAIL_ON_UNKNOWN_PROPERTIES, false);
String jsonStr = "{\"editEnterpriseInfo\" : {\"enterpriseName\" : \"企业名称\",\"enterpriseNature\" : \"1\",\"orgIndustry\" : \"1\"},\"editUserInfo\" : {\"realName\" : \"姓名\",\"mPhone\" : \"1234\",\"email\" : \"邮箱\",\"telephone\" : \"固定电话\",\"userPosition\" : \"职位\",\"editUID\" : \"证书uid\"},\"editDelivery\" : {\"courier\" : \"快递方式\",\"cost\" : \"费用\",\"regionCodes\" : \"省市区代码\",\"detailAdds\" : \"详细地址\"},\"editInvoice\" : {\"name\" : \"企业名称\",\"receipt\" : \"发票类型\"},\"editBusinessLicense\" : {\"enterpriseName\" : \"企业名称\",\"licenseNo\" : \"营业执照号\",\"businessType\" : \"1三证合一0不是\",\"imgFile\" : \"图片base64或url\",\"id\" : \"12\"},\"editOrgCode\" : {\"enterpriseName\" : \"企业名称\",\"orgCode\" : \"组织机构代码\",\"imgFile\" : \"图片base64或url\",\"id\" : \"组织机构代码id\"},\"editTaxregisterCert\" : {\"enterpriseName\" : \"企业名称\",\"certNo\" : \"税务登记号\",\"imgFile\" : \"图片base64或url\",\"id\" : \"税务登记号id\"},\"editIdentityCard\" : {\"enterpriseName\" : \"企业名称\",\"name\" : \"法人姓名\",\"idCode\" : \"证件号\",\"frontImg\" : \"证件正面图片\",\"backImg\" : \"证件反面图片\",\"cardType\" : \"证件类型\",\"id\" : \"法代表人id\"},\"editProxy\" : {\"id\" : \"授权书id\",\"imgFile\" : \"图片base或url\"},\"editUID\" : \"证书uid\"}";
JsonNode jsonNode = jsonTool.readTree(jsonStr);
JsonNode editEnterpriseInfo = jsonNode.get("editEnterpriseInfo");
Enterprise enterprise = jsonTool.readValue(editEnterpriseInfo, Enterprise.class);
System.out.println(enterprise.getEnterpriseName());
JsonNode editUserInfo = jsonNode.get("editUserInfo");
UserInfo userInfo = jsonTool.readValue(editUserInfo, UserInfo.class);
System.out.println(userInfo.getmPhone());
}
Aggregations