程序不报错,但是走到if (!isHas == false) { 就走不下去
package com.hr.service.impl;
import com.hjsoft.SynClient;
import com.hr.service.util.DBUtil;
import com.hr.service.util.PersonValue;
import com.hr.service.util.StringHandle;
import java.io.PrintStream;
import java.io.StringReader;
import java.sql.Connection;
import java.sql.Date;
import java.sql.ResultSet;
import java.sql.Statement;
import java.util.List;
import org.jdom.Document;
import org.jdom.Element;
import org.jdom.input.SAXBuilder;
public class HrEmpJobTransfer extends SqlServerImpl {
SqlServerImpl sqlserver = new SqlServerImpl();
public String JobTransfer(String resultXml) {
resultXml = resultXml.replace(" ", "");
resultXml = resultXml.replace("<br>", "");
String resultId = "1";
Document document = null;
Connection dbCon = null;
SAXBuilder builder = new SAXBuilder();
try {
document = builder.build(new StringReader(resultXml));
Element root = document.getRootElement();
List childList = root.getChildren();
for (int i = 0; i < childList.size(); i++) {
Element childInfo = (Element) childList.get(i);
String gh = childInfo.getChild("gh").getText();
String zt = childInfo.getChild("zt").getText();
String bm = childInfo.getChild("bm").getText();
String preNo = "";
if ((bm != null) && (!"".equals(bm.trim()))) {
char[] nos = bm.trim().toCharArray();
for (int j = 0; (j < 4) && (nos.length > 4); j++) {
preNo = preNo + nos[j];
}
}
String xgw = childInfo.getChild("xgw").getText();
String zjsj = childInfo.getChild("zjsj").getText();
Date rzrq = this.sqlserver.getStringToDate(childInfo.getChild(
"rzrq").getText());
String zglx = childInfo.getChild("zglx").getText();
Date zrsj = this.sqlserver.getStringToDate(childInfo.getChild(
"zrsj").getText());
Date sqrq = this.sqlserver.getStringToDate(childInfo.getChild(
"sqrq").getText());
String zrbm1 = childInfo.getChild("zrbm1").getText();
String zrgw1 = childInfo.getChild("zrgw1").getText();
String yggxzrbmsj = childInfo.getChild("yggxzrbmsj").getText();
String gzms = childInfo.getChild("gzms").getText();
String gzpj = childInfo.getChild("gzpj").getText();
String yggxyj = childInfo.getChild("yggxyj").getText();
String yrbmyj = childInfo.getChild("yrbmyj").getText();
String kfzxyj = childInfo.getChild("kfzxyj").getText();
double jbgz = Double.parseDouble(childInfo.getChild("jbgz")
.getText());
double gwjt = Double.parseDouble(childInfo.getChild("gwjt")
.getText());
double zwjt = Double.parseDouble(childInfo.getChild("zwjt")
.getText());
double rzjlydjx = Double.parseDouble(childInfo.getChild(
"rzjlydjx").getText());
double rzjljdjx = Double.parseDouble(childInfo.getChild(
"rzjljdjx").getText());
double rzjlndjx = Double.parseDouble(childInfo.getChild(
"rzjlndjx").getText());
String C558H = "00";
String procId = childInfo.getChild("procId").getText();
String procNo = childInfo.getChild("procNo").getText();
String A0100 = getUserId(gh);
int I9999 = getSeriaNo("UsrA55 ", A0100, "A0100");
PersonValue personValue = getEmps(gh);
boolean isHas = procIsHas(procId, "usrA01", "E0127");
System.out.println("isHas=" + isHas);
String insertA01 = null;
String insertA55 = null;
String insertSql = null;
String upsdateA55 = null;
String sqlStr;
if (!isHas == false) {
if (!StringHandle.isEmpty(A0100) == false ) {
sqlStr = "select top 1 * from usrA55 where A0100='"
+ A0100 + "' order by I9999 desc";
dbCon = DBUtil.getInstance().getConnect();
ResultSet rst = dbCon.createStatement().executeQuery(
sqlStr);
if (rst.next()) {
jbgz += rst.getDouble("C558E");
gwjt += rst.getDouble("C558F");
zwjt += rst.getDouble("C558G");
rzjlydjx += rst.getDouble("C558B");
rzjljdjx += rst.getDouble("C558C");
rzjlndjx += rst.getDouble("C558D");
}
insertA55 = "insert into usrA55(A0100,I9999,C558E,C558F,C558G,C558B,C558C,C558D,C558H,A5545)values('"
+ A0100
+ "','"
+ I9999
+ "','"
+ jbgz
+ "','"
+ gwjt
+ "','"
+ zwjt
+ "','"
+ rzjlydjx
+ "','"
+ rzjljdjx
+ "','"
+ rzjlndjx
+ "','"
+ C558H + "','" + zrsj + "')";
insertSql = "insert into UsrA15(A0100,I9999,C150F,C1506,C1502,C1505,C1504,C150N,C1508,C1509,C150A,C150G,C150B,C1503,C150M)values('"
+ A0100
+ "','"
+ I9999
+ "','"
+ zglx
+ "','"
+ zrsj
+ "','"
+ sqrq
+ "','"
+ zrbm1
+ "','"
+ zrgw1
+ "','"
+ yggxzrbmsj
+ "','"
+ gzms
+ "','"
+ gzpj
+ "','"
+ yggxyj
+ "','"
+ kfzxyj
+ "','"
+ yrbmyj
+ "','"
+ xgw
+ "','"
+ getZGSJ(yggxzrbmsj) + "');";
insertA01 = "update UsrA01 set E0122='" + zrbm1
+ "',E01A1='" + zrgw1 + "',C01UZ='"
+ yggxzrbmsj + "',C01V6='" + preNo
+ "' where E0127='" + gh + "'";
System.out.println("insertA55*****************"
+ insertA55);
System.out.println("insertSql*****************"
+ insertSql);
System.out.println("insertA01*****************"
+ insertA01);
resultId = "0";
} else {
System.out.println("在职人员库找不到该员工信息!");
}
}
if (insertSql != null) {
dbCon = DBUtil.getInstance().getConnect();
if (insertA01 != null) {
boolean flag = dbCon.createStatement().execute(insertA01);
}
boolean b2 = dbCon.createStatement().execute(insertA55);
boolean b3 = dbCon.createStatement().execute(insertSql);
String tempSql = "select top 1 I9999 from usrA55 where I9999 not in (select top 1 I9999 from usrA55 where A0100='"
+ A0100
+ "' order by I9999 desc) and A0100='"
+ A0100 + "' order by I9999 desc";
System.out.println(tempSql);
ResultSet r = dbCon.createStatement().executeQuery(tempSql);
String id = null;
if (r.next()) {
id = r.getString("I9999");
}
if ((id != null) && (zrsj != null)) {
upsdateA55 = "update usrA55 set C5557=DATEADD(day,-1,'"
+ zrsj + "') where I9999='" + id
+ "' and A0100 = '" + A0100 + "' ";
System.out.println(upsdateA55);
int count = dbCon.createStatement().executeUpdate(
upsdateA55);
if (count > 0)
System.out.println("更新成功");
else
System.out.println("更新失败");
}
}
}
} catch (Exception e) {
e.printStackTrace();
} finally {
SynClient.closeDb(dbCon, null);
}
return resultId;
}
}
[解决办法]
(!isHas == false)改为(!isHas = false)
[解决办法]
System.out.println("isHas=" + isHas);
你说的isHas=false
那么你下面的if表达式
if (!isHas == false)
就是 true == false
这个条件怎么可能成立呢?
不成立当然不进了!
不进if你程序不就跑到if外面去执行了么?
你if外面没有代码了、所以你觉得程序没有反应了?
你在if后面加一句输出试试!!!
[解决办法]
if (!(isHas == false))
[解决办法]
首先楼主看看isHas 的值是true还是false
if(!isHas == false)
如果isHas值是true这个结果就一定会进if
[解决办法]