use of com.itrus.portal.db.MobileChargingFail in project portal by ixinportal.
the class MobileChargingFailTask method ChargingAgain.
/**
* 遍历所有计费失败的记录,重新计费
*
* @Scheduled(fixedRate = 1000 * 60 * 60 * 24) 设置为每天凌晨2点触发
* @Scheduled(cron = "0 0 2 * * ?")
*/
@Scheduled(cron = "0 0/45 * * * ?")
public void ChargingAgain() {
// start------------处理双机互斥----------
// 系统是否配置同步任务的主机名
SysConfig sysConfigHost = sqlSession.selectOne("com.itrus.portal.db.SysConfigMapper.selectByType", "raInfoHost");
if (null == sysConfigHost) {
// 没有配置,直接返回
return;
}
String host = sysConfigHost.getConfig();
host = host.replaceAll(" ", "");
String[] hosts = host.split(",");
// 获取本机主机名称
InetAddress ia = null;
try {
ia = ia.getLocalHost();
} catch (UnknownHostException e1) {
e1.printStackTrace();
return;
}
String hostName = ia.getHostName();
boolean flag_check = false;
for (String str : hosts) {
if (hostName.equals(str.replaceAll(" ", ""))) {
flag_check = true;
}
}
// 判断本地主机名称是否与系统配置的同步主机名称一致,不一致则返回
if (!flag_check) {
return;
}
// end------------处理双机互斥----------
List<MobileChargingFail> chargingFails = chargingFailService.geChargingFails();
if (null == chargingFails || chargingFails.size() == 0) {
return;
}
for (int i = 0; i < chargingFails.size(); i++) {
MobileChargingFail chargingFail = chargingFails.get(i);
Map<String, Object> retMap = new HashMap<String, Object>();
ApplicationInfo applicationInfo = appServiceChargingService.getApplicationInfoByAppId(chargingFail.getAppId());
// AppService appService = certificationChargingService.getAppServiceByAppServiceId(chargingFail.getAppServiceId());
retMap = appServiceChargingService.charging(chargingFail.getAppId(), /* chargingFail.getAppServiceId(),
chargingFail.getTransinfoName(),
chargingFail.getTransinfoId(),*/
applicationInfo, /*chargingFail.getTransinfoPrimaryId(),*/
chargingFail.getTransinfoTableName());
Integer flag = (Integer) retMap.get("retCode");
// 若插入成功
if (null != flag && flag == 1) {
chargingFail.setIsValidity(false);
chargingFail.setModifyTime(new Date());
Charging charging = (Charging) retMap.get("charging");
chargingFail.setChargingId(charging.getChargingId());
chargingFailService.update(chargingFail);
}
}
}
use of com.itrus.portal.db.MobileChargingFail in project portal by ixinportal.
the class MobileChargingFailServiceImpl method geChargingFails.
/**
* 返回所有未成功计费的实名认证计费记录
* @return
*/
public List<MobileChargingFail> geChargingFails() {
MobileChargingFailExample chargingFailExample = new MobileChargingFailExample();
MobileChargingFailExample.Criteria criteria = chargingFailExample.or();
criteria.andIsValidityEqualTo(true);
// 设置计费类型为实名认证计费
criteria.andTransInfoTypeEqualTo(1L);
List<MobileChargingFail> chargingFails = sqlSession.selectList("com.itrus.portal.db.MobileChargingFailMapper.selectByExample", chargingFailExample);
return chargingFails;
}
Aggregations