responseSoapMap = clientUtil.responseSoap(xml, "http://123.59.94.75:50000/ssis/ws/DataQueryService", charSet, contentType);
try {
int statusCode = (int) responseSoapMap.get("statusCode");
// 如果是200则调用成功,并且返回相应的信息
if (statusCode == 200) {
String responseSoapxml = (String) responseSoapMap.get("responseSoap");
System.out.println(responseSoapxml);
} else {
result.setCODE(statusCode + "");
result.setMSG("调用接口接口出错");
result.setERRORMSG("调用部级接口接口出错");
}
} catch (Exception e) {
result.setCODE("500");
result.setMSG(e.getMessage());
result.setERRORMSG(e.getMessage());
logger.error(e.getMessage(),e);
}*/
/*
* Bayxxb bayxxb = new Bayxxb(); bayxxb.setBaydj("20");
* bayxxb.setBayzbm("11012011010011");
*//*
* Hwjyxx hwjyxx = new Hwjyxx(); hwjyxx.setBagsbm("11");
* hwjyxx.setBagsmc("12121"); hwjyxx.setGj("1");
*//*
*
* Result result = send("",bayxxb);
*/
/*
* Bayxxb bayxxb = new Bayxxb(); bayxxb.setBaydj("20");
* bayxxb.setBayzbm("11012011010011"); bayxxb.setByzk(2);
* bayxxb.setBz1("备注1"); bayxxb.setBz2("备注2"); bayxxb.setBz3("备注3");
* bayxxb.setCsrq("2017-31-01"); bayxxb.setDxjdjg("机构2");
* bayxxb.setDxjdjgbm("123456789011"); bayxxb.setFzjgbm("110100001234");
* bayxxb.setFzjgmc("北京市公安局"); bayxxb.setFzrq("2017-07-21");
* bayxxb.setHj("110101"); bayxxb.setHyzk("10");
* bayxxb.setLrjgbm("110000000001"); bayxxb.setLrjgmc("北京市公安局");
* bayxxb.setPxdwbm("BAP110011"); bayxxb.setSfzh("211402198903091056");
* bayxxb.setSg(180.0); bayxxb.setWhcd("10"); bayxxb.setXb(1);
* bayxxb.setXm("刘北京"); bayxxb.setXxdz("北京市朝阳区小营北路100号");
* bayxxb.setZpxx("刘北京证件照"); bayxxb.setZwxx("BA211402198903091056");
* bayxxb.setZzmm("10");
*
* System.out.println(result.getMSG());
*/
}
/**
*
* Description: 根据请求报文,请求服务地址获取 响应报文
*
* @param requestSoap
* 请求报文
* @param serviceAddress
* 响应报文
* @param charSet
* 字符集
* @param contentType
* 类型
* @return map封装的 服务器响应参数和返回报文.PS:statusCode :200 正常响应。responseSoap:响应报文
*
* thinking:
*
*
* @author huoge
* */
public Map responseSoap(String requestSoap, String serviceAddress, String charSet, String contentType) {
String responseSoap = "";
Map resultmap = new HashMap();
PostMethod postMethod = new PostMethod(serviceAddress);
byte[] b = new byte[0];
try {
b = requestSoap.getBytes(charSet);
} catch (UnsupportedEncodingException e) {
logger.error(e.getMessage(),e);
}
InputStream is = new ByteArrayInputStream(b, 0, b.length);
RequestEntity re = new InputStreamRequestEntity(is, b.length, contentType);
postMethod.setRequestEntity(re);
HttpClient httpClient = new HttpClient();
int statusCode = 0;
try {
statusCode = httpClient.executeMethod(postMethod);
resultmap.put("statusCode", statusCode);
} catch (IOException e) {
throw new RuntimeException("执行http请求失败", e);
}
if (statusCode == 200) {
try {
responseSoap = postMethod.getResponseBodyAsString();
resultmap.put("responseSoap", responseSoap);
} catch (IOException e) {
throw new RuntimeException("获取请求返回报文失败", e);
}
} else {
logger.error("请求内容:", requestSoap);
throw new RuntimeException("请求失败:" + statusCode);
}
return resultmap;
}
/***
* 保安员背景筛查保存到问题人员表
* @param person 人员信息
* @return
*//*
@Deprecated
public boolean queryPerosnInfoSC(SecurityPerson person) {
//身份证号码
String idNumber = person.getIdNumber();
//姓名
String name = person.getUser().getRealname();
//问题人员
ProblemPerson problemPerson = new ProblemPerson();
problemPerson.setCreateTime(new Date());
//处理状态
problemPerson.setDispose(Constants.DISPOSE_NO);
//如果身份证号为空,显示返回
if (person == null || person.getUser() == null) {
logger.error("异常身份证号:" + idNumber);
return false;
}
User user = userDao.findById(person.getUser().getId());
SecurityCompanyPerson securityCompanyPerson = securityCompanyPersonDao.findByPersonId(person.getId());
problemPerson.setUpdateTime(new Date());
problemPerson.setActive(true);
problemPerson.setUpdateBy("systemAuto");
problemPerson.setIdnumber(idNumber);
//就职状态
problemPerson.setIncumbencyStatus(person.getIncumbencyStatus());
//获取公司信息
if (securityCompanyPerson != null) {
if (securityCompanyPerson.getCompany() != null) {
//公司名称
problemPerson.setCompanyid(securityCompanyPerson.getCompany().getId());
//公司主键
problemPerson.setCompanyname(securityCompanyPerson.getCompany().getName());
//监控机构ID
if (StringUtil.isNotEmpty(securityCompanyPerson.getCompany().getOrgId())) {
problemPerson.setOrgId(Long.valueOf(securityCompanyPerson.getCompany().getOrgId()));
}
//监控机构名称
problemPerson.setOrgName(securityCompanyPerson.getCompany().getOrgName());
//所属区域
problemPerson.setAreaCode(securityCompanyPerson.getCompany().getAreaCode());
}
}
//用户信息
if (user != null) {
//手机
problemPerson.setPhone(user.getPhone());
//姓名
problemPerson.setName(user.getRealname());
}
//性别
problemPerson.setSex(person.getGender());
//人员
problemPerson.setPersonid(person.getId());
//背景筛查标记
boolean result = true;
BackgroundApprovalDto dto = new BackgroundApprovalDto();
//身份证号
dto.setIdNumber(idNumber);
//姓名
dto.setRealName(name);
//主键
dto.setBusinessid(person.getId());
//问题人员
dto.setBusinesstype(Constants.BAY_FZR);
//背景筛查
List backgroundApprovals = censor(dto);
//循环背景筛查记录,检查是否有不通过
for (BackgroundApproval backgroundApproval : backgroundApprovals) {
if (!problemPersonSetStatus(problemPerson, backgroundApproval)) {
result = false;
}
}
problemPerson.setUpdateflag(true);
if (!result && problemPerson.getProblemtype()!=null && !"".equals(problemPerson.getProblemtype())) {
//只有背景筛查不通过再生成记录
problemPersonDao.save(problemPerson);
}
//保存审查报告,如果有记录的话,删除以前记录信息
backgroundApprovalDao.delete(dto);
//批量保存
backgroundApprovalDao.batchSave(backgroundApprovals);
return result;
}*/
/**
* 根据背景筛查结果判断问题人员状态
* @param problemPerson
* @param backgroundApproval
* @return
*//*
private boolean problemPersonSetStatus(ProblemPerson problemPerson,BackgroundApproval backgroundApproval){
boolean result = true;
if(ApprovalState.SHBTG.equals(backgroundApproval.getApprovalstate())){
result = false;
}
StringBuffer problemtype = null;
if(StringUtil.isNotEmpty(problemPerson.getProblemtype())){
problemtype = new StringBuffer(problemPerson.getProblemtype());
}else{
problemtype = new StringBuffer();
}
//问题类型描述
StringBuffer problemTypeFail = new StringBuffer();
switch (backgroundApproval.getLibraryType()){
case Constants.LIBRARYTYPE_CZ:
problemPerson.setCz(result);
problemTypeFail.append(Constants.LIBRARYTYPE_CZ_FAIL);
break;
case Constants.LIBRARYTYPE_XD:
problemPerson.setXd(result);
problemTypeFail.append(Constants.LIBRARYTYPE_XD_FAIL);
break;
case Constants.LIBRARYTYPE_DT:
problemPerson.setZt(result);
problemTypeFail.append(Constants.LIBRARYTYPE_DT_FAIL);
break;
case Constants.LIBRARYTYPE_WF:
problemPerson.setWf(result);
problemTypeFail.append(Constants.LIBRARYTYPE_WF_FAIL);
break;
default:
break;
}
if(!result) {
if (StringUtil.isEmpty(problemtype.toString())) {
problemtype.append(problemTypeFail.toString());
} else {
problemtype.append(Constants.COMMA).append(problemTypeFail.toString());
}
problemPerson.setProblemtype(problemtype.toString());
}
return result;
}*/
/**
* 根据业务id,业务类型 获取姓名
* @param businessid
* @param businesstype
* @return
*/
public String getName(Long businessid,String businesstype) {
String name="";
switch (businesstype) {
case Constants.BAFW_FR:/*保安服务公司许可证法人*/
Sponsorlicense sponsorlicense = sponsorlicenseDao.findById(businessid);
if(sponsorlicense != null) {
name = sponsorlicense.getRepresentative();
}
break;
case Constants.BAFW_GD:
Shareholder shareholder = shareholderDao.findById(businessid);
if(shareholder != null) {
name = shareholder.getName();
}
break;
case Constants.PXDW_JBFR:
Traincompanyapply traincompany = traincompanyapplyDao.findById(businessid);
if(traincompany != null) {
name = traincompany.getLegalname();
}
break;
case Constants.BAFW_NPXDWGD:
Traincompanyapply frTraincompany = traincompanyapplyDao.findById(businessid);
if(frTraincompany != null) {
name = frTraincompany.getTrainlegalname();
}
break;
case Constants.BAYZ:
Personcertificate personcertificate = personcertificateDao.findById(businessid);
if(personcertificate != null) {
name = personcertificate.getName();
}
break;
case Constants.FGS_FR:
Subsidiary subsidiary = subsidiaryDao.findById(businessid);
if(subsidiary != null) {
name = subsidiary.getLegalname();
}
break;
case Constants.FGS_FZR:
Subsidiary fzrSubsidiary = subsidiaryDao.findById(businessid);
if(fzrSubsidiary != null) {
name = fzrSubsidiary.getChargename();
}
break;
case Constants.ZZ_FR:
Confesscompany confesscompany = confesscompanyDao.findById(businessid);
if(confesscompany != null) {
name = confesscompany.getLegalname();
}
break;
case Constants.ZZ_FZR:
Confesscompany fzrConfesscompany = confesscompanyDao.findById(businessid);
if(fzrConfesscompany != null) {
name = fzrConfesscompany.getChargename();
}
break;
case Constants.KQ_FR:
Crosscompany crosscompany = crosscompanyDao.findById(businessid);
if(crosscompany != null) {
name = crosscompany.getLegalname();
}
break;
case Constants.KQ_FZR:
Crosscompany fzrCrosscompany = crosscompanyDao.findById(businessid);
if(fzrCrosscompany != null) {
name = fzrCrosscompany.getChargename();
}
break;
case Constants.GRBG_YFR:
Legalchange legalchange = legalchangeDao.findById(businessid);
if(legalchange != null) {
name = legalchange.getLegalname();
}
break;
case Constants.GRBG_NFR:
Legalchange ndLegalchange = legalchangeDao.findById(businessid);
if(ndLegalchange != null) {
name = ndLegalchange.getNdlegalname();
}
break;
case Constants. PXDWGRBG_YFR:
TrainChange trainChange = trainChangeDao.findById(businessid);
if(trainChange != null) {
name = trainChange.getLegalname();
}
break;
case Constants. PXDWGRBG_NFR:
TrainChange ndTrainChange = trainChangeDao.findById(businessid);
if(ndTrainChange != null) {
name = ndTrainChange.getNdlegalname();
}
break;
case Constants.GRBG_FZR:
break;
case Constants.BAY_FZR:
break;
case Constants.QZPX_YFR:
Armtrainorg armtrainorg = armtrainorgDao.findById(businessid);
if(armtrainorg != null) {
name = armtrainorg.getLegalname();
}
break;
case Constants.QZPX_JGFZR:
Armorgcharge armorgcharge = armorgchargeDao.findById(businessid);
if(armorgcharge != null) {
name = armorgcharge.getName();
}
break;
case Constants.QZPX_PXFZR:
Armtraincharge armtraincharge = armtrainchargeDao.findById(businessid);
if(armtraincharge != null) {
name = armtraincharge.getPxname();
}
break;
case Constants.QZPX_JY:
Armorgteach armorgteach = armorgteachDao.findById(businessid);
if(armorgteach != null) {
name = armorgteach.getJyname();
}
break;
case Constants.QZPX_ZZCX:
Confesscompanyundo confesscompanyundo = confesscompanyundoDao.findById(businessid);
if(confesscompanyundo != null) {
name = confesscompanyundo.getLegalname();
}
break;
case Constants.GRADEPERSON_CENSORSTATUS:
GradePerson gradePerson = gradePersonDao.findById(businessid);
if(gradePerson != null) {
name = gradePerson.getName();
}
break;
case Constants.PERSONGRADE_CENSORSTATUS:
PersonGrade personGrade = personGradeDao.findById(businessid);
if(personGrade != null) {
name = personGrade.getName();
}
break;
case Constants.BAFW_ZJL:
SbSponsorlicenseManager manager = sbSponsorlicenseManagerDao.findById(businessid);
if(manager != null) {
name = manager.getName();
}
break;
case Constants.BAFW_FZJL:
SbSponsorlicenseVmanager vmanager = sbSponsorlicenseVmanagerDao.findById(businessid);
if(vmanager != null) {
name = vmanager.getVname();
}
break;
case Constants.PERSONADAPT_CENSORSTATUS:
PersonAdapt personAdapt = personAdaptDao.findById(businessid);
if(personAdapt != null) {
name = personAdapt.getName();
}
break;
case Constants.BAPXDWBA_FR:
Trainrecord trainrecord = trainrecordDao.findById(businessid);
if(trainrecord != null) {
name = trainrecord.getLegalName();
}
break;
case Constants.BAPXDWBA_FZR:
Trainrecord trainrecord1 = trainrecordDao.findById(businessid);
if(trainrecord1 != null) {
name = trainrecord1.getChargeName();
}
break;
default:
break;
}
return name.trim();
}
/**
* 根据业务id,业务类型 获取身份证
* @param businessid
* @param businesstype
* @return
*/
public String getIdNum(Long businessid,String businesstype) {
String idnum="";
switch (businesstype) {
case Constants.BAFW_FR:/*保安服务公司许可证法人*/
Sponsorlicense sponsorlicense = sponsorlicenseDao.findById(businessid);
if(sponsorlicense != null) {
idnum = sponsorlicense.getLegalPersonNo();
}
break;
case Constants.BAFW_GD:
Shareholder shareholder = shareholderDao.findById(businessid);
if(shareholder != null) {
idnum = shareholder.getIdnumber();
}
break;
case Constants.PXDW_JBFR:
Traincompanyapply traincompany = traincompanyapplyDao.findById(businessid);
if(traincompany != null) {
idnum = traincompany.getLegalcode();
}
break;
case Constants.BAFW_NPXDWGD:
Traincompanyapply frTraincompany = traincompanyapplyDao.findById(businessid);
if(frTraincompany != null) {
idnum = frTraincompany.getTraincreditcode();
}
break;
case Constants.BAYZ:
Personcertificate personcertificate = personcertificateDao.findById(businessid);
if(personcertificate != null) {
idnum = personcertificate.getCardnumber();
}
break;
case Constants.FGS_FR:
Subsidiary subsidiary = subsidiaryDao.findById(businessid);
if(subsidiary != null) {
idnum = subsidiary.getLegalcardnumber();
}
break;
case Constants.FGS_FZR:
Subsidiary fzrSubsidiary = subsidiaryDao.findById(businessid);
if(fzrSubsidiary != null) {
idnum = fzrSubsidiary.getChargecardnumber();
}
break;
case Constants.ZZ_FR:
Confesscompany confesscompany = confesscompanyDao.findById(businessid);
if(confesscompany != null) {
idnum = confesscompany.getLegalcardnumber();
}
break;
case Constants.ZZ_FZR:
Confesscompany fzrConfesscompany = confesscompanyDao.findById(businessid);
if(fzrConfesscompany != null) {
idnum = fzrConfesscompany.getChargecardnumber();
}
break;
case Constants.KQ_FR:
Crosscompany crosscompany = crosscompanyDao.findById(businessid);
if(crosscompany != null) {
idnum = crosscompany.getLegalcardnumber();
}
break;
case Constants.KQ_FZR:
Crosscompany fzrCrosscompany = crosscompanyDao.findById(businessid);
if(fzrCrosscompany != null) {
idnum = fzrCrosscompany.getChargecardnumber();
}
break;
case Constants.GRBG_YFR:
Legalchange legalchange = legalchangeDao.findById(businessid);
if(legalchange != null) {
idnum = legalchange.getLegalcardnumber();
}
break;
case Constants.GRBG_NFR:
Legalchange ndLegalchange = legalchangeDao.findById(businessid);
if(ndLegalchange != null) {
idnum = ndLegalchange.getNdlegalcardnum();
}
break;
case Constants.GRBG_FZR:
break;
case Constants.BAY_FZR:
break;
case Constants.QZPX_YFR:
Armtrainorg armtrainorg = armtrainorgDao.findById(businessid);
if(armtrainorg != null) {
idnum = armtrainorg.getLegalcardnumber();
}
break;
case Constants.QZPX_JGFZR:
Armorgcharge armorgcharge = armorgchargeDao.findById(businessid);
if(armorgcharge != null) {
idnum = armorgcharge.getIdnum();
}
break;
case Constants.QZPX_PXFZR:
Armtraincharge armtraincharge = armtrainchargeDao.findById(businessid);
if(armtraincharge != null) {
idnum = armtraincharge.getPxidnum();
}
break;
case Constants.QZPX_JY:
Armorgteach armorgteach = armorgteachDao.findById(businessid);
if(armorgteach != null) {
idnum = armorgteach.getJyidnum();
}
break;
case Constants.QZPX_ZZCX:
Confesscompanyundo confesscompanyundo = confesscompanyundoDao.findById(businessid);
if(confesscompanyundo != null) {
idnum = confesscompanyundo.getLegalcard();
}
break;
case Constants.GRADEPERSON_CENSORSTATUS:
GradePerson gradePerson = gradePersonDao.findById(businessid);
if(gradePerson != null) {
idnum = gradePerson.getIdnum();
}
break;
case Constants.PERSONGRADE_CENSORSTATUS:
PersonGrade personGrade = personGradeDao.findById(businessid);
if(personGrade != null) {
idnum = personGrade.getIdNum();
}
break;
case Constants.BAFW_ZJL:
SbSponsorlicenseManager manager = sbSponsorlicenseManagerDao.findById(businessid);
if(manager != null) {
idnum = manager.getIdnum();
}
break;
case Constants.BAFW_FZJL:
SbSponsorlicenseVmanager vmanager = sbSponsorlicenseVmanagerDao.findById(businessid);
if(vmanager != null) {
idnum = vmanager.getVidnum();
}
break;
case Constants.PERSONADAPT_CENSORSTATUS:
PersonAdapt personAdapt = personAdaptDao.findById(businessid);
if(personAdapt != null) {
idnum = personAdapt.getIdNum();
}
break;
default:
break;
}
return idnum.trim();
}
/****
* 查询背景筛查结果
* @param idNumber 身份证号
* @param name 姓名
*//*
@Deprecated
public String queryAndBGInfo(String idNumber,String name){
BackgroundApprovalDto dto = new BackgroundApprovalDto();
dto.setIdNumber(idNumber);
dto.setRealName(name);
List backgroundApprovals = censor(dto);
StringBuffer problemtype = new StringBuffer(StringUtil.EMPTY);
for (BackgroundApproval backgroundApproval : backgroundApprovals){
String strResult = StringUtil.EMPTY;
if(ApprovalState.SHBTG.equals(backgroundApproval.getApprovalstate())){
switch (backgroundApproval.getLibraryType()){
case Constants.LIBRARYTYPE_CZ:
strResult = Constants.LIBRARYTYPE_CZ_FAIL;
break;
case Constants.LIBRARYTYPE_XD:
strResult = Constants.LIBRARYTYPE_XD_FAIL;
break;
case Constants.LIBRARYTYPE_DT:
strResult = Constants.LIBRARYTYPE_DT_FAIL;
break;
case Constants.LIBRARYTYPE_WF:
strResult = Constants.LIBRARYTYPE_WF_FAIL;
break;
default:
break;
}
if (StringUtil.isEmpty(problemtype.toString())) {
problemtype.append(strResult);
} else {
problemtype.append(Constants.COMMA + strResult);
}
}
}
return problemtype.toString();
}
*//****
* 查询背景筛查结果
* @param businessid 业务ID
* @param businesstype 业务类型
* @param idNumber 身份证号
* @param name 姓名
*//*
@Deprecated
public void queryAndBGInfo(Long businessid,String businesstype,String idNumber,String name){
//如果姓名没传,先查询
if(StringUtil.isEmpty(name)) {
name = getName(businessid, businesstype);
}
if(StringUtil.isEmpty(name)) {
throw new ArsException("无法获取到姓名!");
}
BackgroundApprovalDto dto = new BackgroundApprovalDto();
dto.setBusinessid(businessid);
dto.setBusinesstype(businesstype);
dto.setIdNumber(idNumber);
dto.setRealName(name);
//如果有记录的话,删除以前记录信息
backgroundApprovalDao.delete(dto);
List backgroundApprovals = censor(dto);
//批量保存
backgroundApprovalDao.batchSave(backgroundApprovals);
}*/
/* *//****
* 查询背景筛查结果
* 判断直接调人口库还是间接调西安接口
* @param dto
*//*
@Deprecated
private List censor(BackgroundApprovalDto dto){
Config current_native_config = configService.getConfigByKey(Constants.CURRENT_NATIVE);
if(current_native_config == null || StringUtil.isEmpty(current_native_config.getValue())){
throw new ArsException("当前省份编码未配置!");
}
*//**
* 是否通过调陕西接口间接调人口库
* 如果没有配置,或者配置0 为直接调人口库
*//*
Config remote_background_config = configService.getConfigByKey(Constants.NEED_REMOTE_BACKGROUND);
//如果是陕西的,则调人口库
if(remote_background_config != null && Constants.NEED_REMOTE_YES.equals(remote_background_config.getValue()) && !Constants.SHANGXI.equals(current_native_config.getValue())) {
//如果不是陕西的,调用陕西的接口,由陕西去调人口库
//获取陕西的背景筛查接口地址
Config remoteConfig = configService.getConfigByKey(Constants.REMOTE_BACKGROUND_URL);
if(remoteConfig != null && StringUtil.isNotEmpty(remoteConfig.getValue())) {
//拼接参数
StringBuffer url = new StringBuffer(remoteConfig.getValue());
url.append("?businessid="+dto.getBusinessid());
url.append("&businesstype="+dto.getBusinesstype());
url.append("&idNumber="+dto.getIdNumber());
url.append("&realName="+dto.getRealName());
String resultStr = messageUtils.getJsonByInternet(url.toString());
//获取结果
AjaxResult result = JSONObject.parseObject(resultStr,AjaxResult.class);
//成功且有值
if(result.isSuccessful() && result.getData() != null) {
//结果会有多条 批量保存到数据库
return (List)result.getData();
}
return null;
}
return queryAndBGInfo(dto);
}else{
return queryAndBGInfo(dto);
}
}*/
/* *//****
* 查询背景筛查结果
* 直接调人口库
* @param dto
*//*
@Deprecated
public List queryAndBGInfo(BackgroundApprovalDto dto){
Long businessid = dto.getBusinessid();
String businesstype = dto.getBusinesstype();
String idNumber = dto.getIdNumber();
String name = dto.getRealName();
List list = new ArrayList<>();
BackgroundApproval cz_BackgroundApproval = new BackgroundApproval();
cz_BackgroundApproval.setActive(true);
cz_BackgroundApproval.setCreateTime(new Date());
cz_BackgroundApproval.setUpdateTime(new Date());
BackgroundApproval xd_BackgroundApproval = new BackgroundApproval();
xd_BackgroundApproval.setActive(true);
xd_BackgroundApproval.setCreateTime(new Date());
xd_BackgroundApproval.setUpdateTime(new Date());
BackgroundApproval dt_BackgroundApproval = new BackgroundApproval();
dt_BackgroundApproval.setActive(true);
dt_BackgroundApproval.setCreateTime(new Date());
dt_BackgroundApproval.setUpdateTime(new Date());
BackgroundApproval wf_BackgroundApproval = new BackgroundApproval();
wf_BackgroundApproval.setActive(true);
wf_BackgroundApproval.setCreateTime(new Date());
wf_BackgroundApproval.setUpdateTime(new Date());
//人口库
try {
cz_BackgroundApproval.setApprovaldate(new Date());
cz_BackgroundApproval.setLibraryType(Constants.LIBRARYTYPE_CZ);
cz_BackgroundApproval.setBusinessid(businessid);
cz_BackgroundApproval.setBusinesstype(businesstype);
boolean cz = send(idNumber,name, Constants.CZ_REQUESTID, Constants.CZ_SERVICEID);
if(cz){
cz_BackgroundApproval.setApprovalreason("主项信息符合");
cz_BackgroundApproval.setApprovalstate(Constants.APPROVALSTATE_TG);
cz_BackgroundApproval.setRgapprovalstate(Constants.APPROVALSTATE_TG);
}else{
cz_BackgroundApproval.setApprovalreason(Constants.LIBRARYTYPE_CZ_FAIL);
cz_BackgroundApproval.setApprovalstate(Constants.APPROVALSTATE_BTG);
cz_BackgroundApproval.setRgapprovalstate(Constants.APPROVALSTATE_BTG);
}
}catch(Exception e){
cz_BackgroundApproval.setApprovalreason("查询公安部人口库超时,请过一会再尝试,如多次失败,请联系客服!");
cz_BackgroundApproval.setApprovalstate(Constants.APPROVALSTATE_CS);
cz_BackgroundApproval.setRgapprovalstate(Constants.APPROVALSTATE_DSP);
}
list.add(cz_BackgroundApproval);
// 吸毒
try {
xd_BackgroundApproval.setApprovaldate(new Date());
xd_BackgroundApproval.setLibraryType(Constants.LIBRARYTYPE_XD);
xd_BackgroundApproval.setBusinessid(businessid);
xd_BackgroundApproval.setBusinesstype(businesstype);
boolean xd = send(idNumber, name,Constants.XD_REQUESTID, Constants.XD_SERVICEID);
if(xd && ZAFLAG!=null && ZAFLAG.equals(Constants.ZAFLAG_YES)){
xd_BackgroundApproval.setApprovalreason("吸毒人员");
xd_BackgroundApproval.setApprovalstate(Constants.APPROVALSTATE_BTG);
xd_BackgroundApproval.setRgapprovalstate(Constants.APPROVALSTATE_BTG);
}else{
xd_BackgroundApproval.setApprovalreason("无吸毒记录");
xd_BackgroundApproval.setApprovalstate(Constants.APPROVALSTATE_TG);
xd_BackgroundApproval.setRgapprovalstate(Constants.APPROVALSTATE_TG);
}
}catch(Exception e){
xd_BackgroundApproval.setApprovalreason("网络通讯异常,比对不成功,请重新审批");
xd_BackgroundApproval.setApprovalstate(Constants.APPROVALSTATE_CS);
xd_BackgroundApproval.setRgapprovalstate(Constants.APPROVALSTATE_DSP);
}
list.add(xd_BackgroundApproval);
// 在逃
try {
dt_BackgroundApproval.setApprovaldate(new Date());
dt_BackgroundApproval.setLibraryType(Constants.LIBRARYTYPE_DT);
dt_BackgroundApproval.setBusinessid(businessid);
dt_BackgroundApproval.setBusinesstype(businesstype);
boolean dt = send(idNumber, name,Constants.DT_REQUESTID, Constants.DT_SERVICEID);
if(dt && ZAFLAG!=null && ZAFLAG.equals(Constants.ZAFLAG_YES)){
dt_BackgroundApproval.setApprovalreason("在逃人员");
dt_BackgroundApproval.setApprovalstate(Constants.APPROVALSTATE_BTG);
dt_BackgroundApproval.setRgapprovalstate(Constants.APPROVALSTATE_BTG);
}else{
dt_BackgroundApproval.setApprovalreason("无在逃记录");
dt_BackgroundApproval.setApprovalstate(Constants.APPROVALSTATE_TG);
dt_BackgroundApproval.setRgapprovalstate(Constants.APPROVALSTATE_TG);
}
}catch(Exception e){
dt_BackgroundApproval.setApprovalreason("网络通讯异常,比对不成功,请重新审批");
dt_BackgroundApproval.setApprovalstate(Constants.APPROVALSTATE_CS);
dt_BackgroundApproval.setRgapprovalstate(Constants.APPROVALSTATE_DSP);
}
list.add(dt_BackgroundApproval);
// 犯罪
try {
wf_BackgroundApproval.setApprovaldate(new Date());
wf_BackgroundApproval.setLibraryType(Constants.LIBRARYTYPE_WF);
wf_BackgroundApproval.setBusinessid(businessid);
wf_BackgroundApproval.setBusinesstype(businesstype);
boolean wf = send(idNumber, name,Constants.WF_REQUESTID, Constants.WF_SERVICEID);
if(wf && ZAFLAG!=null && ZAFLAG.equals(Constants.ZAFLAG_YES)){
wf_BackgroundApproval.setApprovalreason("有违法犯罪记录");
wf_BackgroundApproval.setApprovalstate(Constants.APPROVALSTATE_BTG);
wf_BackgroundApproval.setRgapprovalstate(Constants.APPROVALSTATE_BTG);
}else{
wf_BackgroundApproval.setApprovalreason("无违法犯罪记录");
wf_BackgroundApproval.setApprovalstate(Constants.APPROVALSTATE_TG);
wf_BackgroundApproval.setRgapprovalstate(Constants.APPROVALSTATE_TG);
}
}catch(Exception e){
wf_BackgroundApproval.setApprovalreason("网络通讯异常,比对不成功,请重新审批");
wf_BackgroundApproval.setApprovalstate(Constants.APPROVALSTATE_CS);
wf_BackgroundApproval.setRgapprovalstate(Constants.APPROVALSTATE_DSP);
}
list.add(wf_BackgroundApproval);
return list;
}*/
/***
* 请求四大库
* @param idNumber 身份证号
* @param requestID 请求ID
* @param serviceID 服务ID
*//*
public boolean send(String idNumber,String name ,String requestID,String serviceID){
if(ZAFLAG!=null && ZAFLAG.equals(Constants.ZAFLAG_YES)) {
//执行返回的编码
String code= "";
//结果返回
boolean result = false;
//人口库调用会异常或超时,循环三次,三次还是异常或超时,则获取失败
for(int i= 0;i< Constants.ZAFLAG_COUNT; i++) {
RbspService service = new RbspService(requestID, serviceID);
//用户信息
service.setUserCardId("asdfasd");
service.setUserDept("0100");
service.setUserName("ptjian");
RbspCall call = service.createCall();
call.setUrl(ZAURL);
call.setMethod(RbspConsts.METHOD_QUERY);
Map params = new HashMap();
params.put("DataObjectCode", "M001");
params.put("InfoCodeMode", "1");
//按身份证号查
params.put("Condition", "SFZH = '" + idNumber.toUpperCase() + "'");
//返回字段:身份证号、照片、姓名、性别、文化程度、民族、籍贯省县
params.put("RequiredItems", new String[]{"XM"});
String requestResult = call.invoke(params);
//增加日志
BjRestLog log = new BjRestLog();
log.setResttype(serviceID);
log.setResponseContext(requestResult);
log.setRequestContext("身份证号:" + idNumber + "---姓名:" + name);
//创建时间
log.setCreateTime(new Date());
//有效标记
log.setActive(true);
//更新时间
log.setUpdateTime(new Date());
//更新者
log.setUpdateBy(Constants.APPROVAL_SYSTEM);
bjRestLogDao.save(log);
//如果不为空则没有数据
if (requestResult != null && !requestResult.equals("")) {
try {
SAXReader reader = new SAXReader();
org.dom4j.Document doc = reader.read(new ByteArrayInputStream(requestResult.getBytes("UTF-8")));
org.dom4j.Element root = doc.getRootElement();
Element valueElement = root.element("Method").element("Items").element("Item").element("Value");
//valueElement节点为空的话,请求人口库异常
if (valueElement != null) {
List list = valueElement.elements();
//获取执行返回编码
if(list!=null && list.size()>0){
Element e = list.get(0);
code = e.element("Data").getText();
}
//获取查询结果
if (list != null && list.size() > 2) {
Element e = list.get(2);
String resultname = e.element("Data").getText();
if (resultname != null && resultname.equals(name)) {
result = true;
} else {
result = false;
}
}
}
} catch (Exception e) {
logger.error("身份证号:" + idNumber + "---姓名:" + name);
logger.error("人口库获取异常:" + result);
logger.error(e.getMessage(), e);
}
}
//如果执行成功则返回
if(Constants.ZAFLAG_CODE_SUCCESS.equals(code)){
break;
}
}
return result;
}else{
return true;
}
}*/
/***
* 调人口库获取人口库信息
* 判断直接调人口库还是间接调西安接口
* @param idNumber 身份证号
* @param infoType 获取信息类型 XM 姓名 ZZXZ 详细地址信息 JGSSX 省市区 XP照片
*/
/* @Deprecated
public String getInfo(String idNumber,String infoType) {
Config current_native_config = configService.getConfigByKey(Constants.CURRENT_NATIVE);
if(current_native_config == null || StringUtil.isEmpty(current_native_config.getValue())){
throw new ArsException("当前省份编码未配置!");
}
*//**
* 是否通过调陕西接口间接调人口库
* 如果没有配置,或者配置0 为直接调人口库
*//*
Config remote_background_config = configService.getConfigByKey(Constants.NEED_REMOTE_BACKGROUND);
//如果是陕西的,则调人口库
if(remote_background_config != null && Constants.NEED_REMOTE_YES.equals(remote_background_config.getValue()) && !Constants.SHANGXI.equals(current_native_config.getValue())) {
//如果不是陕西的,调用陕西的接口,由陕西去调人口库
//获取陕西的背景筛查接口地址
Config remoteConfig = configService.getConfigByKey(Constants.REMOTE_BACKGROUND_URL);
if(remoteConfig != null && StringUtil.isNotEmpty(remoteConfig.getValue())) {
//拼接参数
StringBuffer url = new StringBuffer(remoteConfig.getValue());
url.append("?idNumber=" + idNumber);
url.append("&infoType=" + infoType);
String resultStr = messageUtils.getJsonByInternet(url.toString());
//获取结果
AjaxResult result = JSONObject.parseObject(resultStr,AjaxResult.class);
//成功且有值
if(result.isSuccessful() && result.getData() != null) {
//结果会有多条 批量保存到数据库
return result.getData().toString();
}
return null;
}
return getInfoFromPopulationBase(idNumber,infoType);
}else{
return getInfoFromPopulationBase(idNumber,infoType);
}
}*/
/* *//***
* 调人口库获取人口库信息
* @param idNumber 身份证号
* @param infoType 获取信息类型 XM 姓名 ZZXZ 详细地址信息 JGSSX 省市区 XP照片
*//*
@Deprecated*/
/*public String getInfoFromPopulationBase(String idNumber,String infoType) {
String strResult = "";
String code ="";
if (ZAFLAG != null && ZAFLAG.equals(Constants.ZAFLAG_YES)) {
//人口库调用会异常或超时,循环三次,三次还是异常或超时,则获取失败
for(int i= 0;i< 3; i++) {
RbspService service = new RbspService(Constants.XD_REQUESTID, Constants.XD_SERVICEID);
//用户信息
service.setUserCardId("asdfasd");
service.setUserDept("0100");
service.setUserName("ptjian");
RbspCall call = service.createCall();
call.setUrl(ZAURL);
call.setMethod(RbspConsts.METHOD_QUERY);
Map params = new HashMap();
params.put("DataObjectCode", "M001");
params.put("InfoCodeMode", "1");
//按身份证号查
params.put("Condition", "SFZH = '" + idNumber.toUpperCase() + "'");
//返回字段:照片
params.put("RequiredItems", new String[]{infoType});
String result = call.invoke(params);
//如果不为空则没有数据
if (result != null && !result.equals("")) {
try {
SAXReader reader = new SAXReader();
org.dom4j.Document doc = reader.read(new ByteArrayInputStream(result.getBytes(Constants.CHARSETUTF8)));
org.dom4j.Element root = doc.getRootElement();
Element valueElement = root.element("Method").element("Items").element("Item").element("Value");
if (valueElement != null) {
List list = valueElement.elements();
//获取执行返回编码
if (list != null && list.size() > 0) {
Element e = list.get(0);
code = e.element("Data").getText();
}
if (list != null && list.size() > 2) {
Element e = list.get(2);
strResult = e.element("Data").getText();
}
}
} catch (Exception e) {
logger.error("身份证号:" + idNumber);
logger.error("人口库获取异常:" + result);
logger.error(e.getMessage(), e);
}
}
//如果执行成功则返回
if(Constants.ZAFLAG_CODE_SUCCESS.equals(code)){
break;
}
}
}
return strResult;
}*/
/**
* 陕西单点登录
* @param username
* @param pwd
* @return
*/
public Result verifySXNW(String username, String pwd) {
Result result = new Result();
//拼接报文
StringBuffer requestSoap = new StringBuffer();
// 头部
requestSoap.append("\n" +
" \n" +
" \n" +
" \n");
//添加code
requestSoap.append("");
requestSoap.append(SXNWCode);
requestSoap.append("\n");
//添加用户名
requestSoap.append("\n");
requestSoap.append(username);
requestSoap.append("\n");
//添加密码
requestSoap.append("\n");
requestSoap.append(pwd);
requestSoap.append("\n");
//添加尾部
requestSoap.append("\n" +
" \n" +
"");
String charSet = "utf-8";
String contentType = "text/xml; charset=utf-8";
ClientUtil clientUtil = new ClientUtil();
SAXReader reader = new SAXReader();
//webservies请求
try {
Map responseSoapMap = responseSoap(requestSoap.toString(), SXNWAddress, charSet, contentType);
int statusCode = (int) responseSoapMap.get("statusCode");
String responseSoapxml = (String) responseSoapMap.get("responseSoap");
//日志记录
Sxlwlog sxlwlog = new Sxlwlog();
sxlwlog.setCreateTime(new Date());
sxlwlog.setUpdateTime(new Date());
sxlwlog.setCode(SXNWCode);
sxlwlog.setUserName(username);
sxlwlog.setPwd(pwd);
sxlwlog.setActive(true);
sxlwlog.setRequestContext(requestSoap.toString());
sxlwlog.setResponseContext(responseSoapxml);
sxlwlog.setStatusCode(String.valueOf(statusCode));
sxlwlogDao.save(sxlwlog);
// 如果是200则调用成功,并且返回相应的信息
if (StringUtil.equals(String.valueOf(statusCode),Constants.MINISTRY_CODE_SUCCES_SXNW)) {
System.out.println(responseSoapxml);
org.dom4j.Document doc = reader.read(new ByteArrayInputStream(responseSoapxml.getBytes("UTF-8")));
Element root = doc.getRootElement().element("Body").element("getUserinfoResponse").element("out");
if (root != null ) {
result.setDATE(root.getText());
result.setCODE(Constants.MINISTRY_CODE_SUCCES_SXNW);
}
} else {
result.setCODE(statusCode + "");
result.setMSG("调用接口接口出错");
result.setERRORMSG("调用陕西南威公司登录验证出错");
}
} catch (Exception e) {
result.setCODE(Constants.MINISTRY_CODE_ERROR);
result.setMSG(e.getMessage());
result.setERRORMSG(e.getMessage());
logger.error(e.getMessage(),e);
}
return result;
}
/***
* 根据身份证从人口库获取指纹信息(广西)
* @param personcertificate 保安资格证报名信息
* @return 指纹信息
*/
public String queryZWForIdNumber(Personcertificate personcertificate) {
//增加日志
BjRestLog log =new BjRestLog();
String result = "";
String xml ="";
//拼接报文
StringBuffer requestSoap = new StringBuffer();
// 头部
requestSoap.append("");
//添加code
requestSoap.append("");
requestSoap.append("");
requestSoap.append("2.0");//暂定为2.00
requestSoap.append("450000000000201905300001");//查看已发布服务的说明
requestSoap.append("ba_zw_hc");//查看已发布服务的说明
requestSoap.append(""+personcertificate.getPoliceCode()+"");//发送单位的代码
requestSoap.append(""+personcertificate.getPoliceName()+"");//发送单位的名称
requestSoap.append("1");//由不超过5位数字字符组成
requestSoap.append(""+DateUtil.getCurrentDate(DateUtil.FORMAT8)+"");//年月日时分秒
requestSoap.append("");
requestSoap.append("");
requestSoap.append("");
requestSoap.append(""+personcertificate.getCardnumber().toUpperCase()+"");//身份证号
requestSoap.append("");
requestSoap.append("");
//添加尾部
requestSoap.append("");
try {
// 直接引用远程的wsdl文件
org.apache.axis.client.Service service = new org.apache.axis.client.Service();
Call call = (Call) service.createCall();
//地址
call.setTargetEndpointAddress(GXZWAddress);
call.setOperationName("sjpsfw");// WSDL里面描述的接口名称
call.addParameter("dbSource",
org.apache.axis.encoding.XMLType.XSD_DATE,
javax.xml.rpc.ParameterMode.IN);// 接口的参数,dbSource:数据源,接口内部标识,现暂定为tchdb,
String tchdb = "tchdb";
call.addParameter("psxml",
org.apache.axis.encoding.XMLType.XSD_DATE,
javax.xml.rpc.ParameterMode.IN);// 接口的参数,psxml:交换数据内容
call.setReturnType(org.apache.axis.encoding.XMLType.XSD_STRING);// 设置返回类型
xml = (String) call.invoke(new Object[] { tchdb,requestSoap.toString()});
// 给方法传递参数,并且调用方法
SAXReader reader = new SAXReader();
org.dom4j.Document doc = reader.read(new ByteArrayInputStream(xml.getBytes("UTF-8")));
org.dom4j.Element root = doc.getRootElement();
if(root.element("Data")!=null) {
if( root.element("Data").element("Record")!=null) {
List list = root.element("Data").element("Record").elements();
if (list != null && list.size() >= 3 ) {
Element ezw = list.get(2);
String iszw = ezw.getText();
if(Constants.FINGER_YES.equals(iszw)){
Element e = list.get(0);
result = e.getText();
log.setCode("200");
}
}
}
}
} catch (Exception e) {
logger.error(e.getMessage(),e);
logger.error("人口库获取异常"+personcertificate.getCardnumber());
log.setResponseContext(e.getMessage());
}
log.setRequestContext(requestSoap.toString());
if(StringUtil.isNotEmpty(xml)) {
log.setResponseContext(xml);
}
log.setMsg("广西人口库指纹身份证号:"+personcertificate.getCardnumber());
//创建时间
log.setCreateTime(new Date());
//有效标记
log.setActive(true);
//更新时间
log.setUpdateTime(new Date());
//更新者
log.setUpdateBy(Constants.APPROVAL_SYSTEM);
bjRestLogDao.save(log);
return result;
}
}