use of com.itrus.portal.db.SysConfig in project portal by ixinportal.
the class ChargingFailTask 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<ChargingFail> chargingFails = chargingFailService.geChargingFails();
if (null == chargingFails || chargingFails.size() == 0) {
return;
}
for (int i = 0; i < chargingFails.size(); i++) {
ChargingFail chargingFail = chargingFails.get(i);
Map<String, Object> retMap = new HashMap<String, Object>();
ApplicationInfo applicationInfo = certificationChargingService.getApplicationInfoByAppId(chargingFail.getAppId());
AppService appService = certificationChargingService.getAppServiceByAppServiceId(chargingFail.getAppServiceId());
retMap = certificationChargingService.charging(chargingFail.getAppId(), chargingFail.getAppServiceId(), chargingFail.getTransinfoName(), chargingFail.getTransinfoId(), applicationInfo, appService, 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.SysConfig in project portal by ixinportal.
the class ChargingRuleTask method setChargingRuleToInvalid.
/**
* 定时任务,将过期的计费规则置为无效
*
* @Scheduled(fixedRate = 1000 * 60 * 60 * 24)
* @Scheduled(cron = "0 0 2 * * ?")设置为每天凌晨2点触发
*/
@Scheduled(cron = "0 0/35 * * * ?")
public void setChargingRuleToInvalid() {
// 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------------处理双机互斥----------
CertificationChargingExample cce = new CertificationChargingExample();
CertificationChargingExample.Criteria criteria = cce.or();
Date now = new Date();
criteria.andEndTimeLessThan(now);
List<CertificationCharging> list = certificationChargingService.selectByExample(cce);
if (null != list && list.size() > 0) {
List<ServiceName> serviceNames = serviceNameService.selectListByCertificationChargings(list);
if (null != serviceNames && serviceNames.size() > 0) {
for (ServiceName serviceName : serviceNames) {
if (serviceName.getIsValidity() == true) {
serviceName.setIsValidity(false);
serviceNameService.update(serviceName);
LogUtil.syslog(sqlSession, "将计费规则置为无效", "计费规则id为:" + serviceName.getCertificationCharging() + ", 服务表id为:" + serviceName.getId());
}
}
}
}
}
use of com.itrus.portal.db.SysConfig in project portal by ixinportal.
the class SysConfigController method update.
// 修改处理
@RequestMapping(method = RequestMethod.PUT, produces = "text/html")
public String update(@Valid SysConfig sysconfig, BindingResult bindingResult, Model uiModel, HttpServletRequest httpServletRequest) {
if (bindingResult.hasErrors()) {
uiModel.addAttribute("sysconfig", sysconfig);
return "sysconfigs/update";
}
SysConfig sysconfig0 = sqlSession.selectOne("com.itrus.portal.db.SysConfigMapper.selectByPrimaryKey", sysconfig.getId());
checkCDNurl(sysconfig);
sqlSession.update("com.itrus.portal.db.SysConfigMapper.updateByPrimaryKey", sysconfig);
String oper = "修改配置项";
String info = "原内容,名称: " + sysconfig0.getType() + ",内容: " + sysconfig0.getConfig();
LogUtil.adminlog(sqlSession, oper, info);
oper = "修改配置项";
info = "新内容,名称: " + sysconfig.getType() + ",内容: " + sysconfig.getConfig();
LogUtil.adminlog(sqlSession, oper, info);
cacheCustomer.initSysConfig();
return "redirect:/sysconfigs";
}
use of com.itrus.portal.db.SysConfig in project portal by ixinportal.
the class SysConfigController method delete.
// 删除
@RequestMapping(value = "/{id}", method = RequestMethod.DELETE, produces = "text/html")
public String delete(@PathVariable("id") Long id, @RequestParam(value = "page", required = false) Integer page, @RequestParam(value = "size", required = false) Integer size, Model uiModel) {
SysConfig sysconfig = sqlSession.selectOne("com.itrus.portal.db.SysConfigMapper.selectByPrimaryKey", id);
sqlSession.delete("com.itrus.portal.db.SysConfigMapper.deleteByPrimaryKey", id);
String oper = "删除配置项";
String info = "名称: " + sysconfig.getType() + ",内容: " + sysconfig.getConfig();
LogUtil.adminlog(sqlSession, oper, info);
cacheCustomer.initSysConfig();
return "redirect:/sysconfigs";
}
use of com.itrus.portal.db.SysConfig in project portal by ixinportal.
the class SystemConfigService method getpdfurl.
public String getpdfurl() {
String type = SystemConfigService.PDF_URL;
SysConfig sysConfig = sqlSession.selectOne("com.itrus.portal.db.SysConfigMapper.selectByType", type);
if (sysConfig != null) {
return sysConfig.getConfig();
} else {
return null;
}
}
Aggregations