You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
weaver-sskj/workflow/request/getDjpdUserInfo.jsp

119 lines
5.3 KiB
Plaintext

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

<%@ page import="com.alibaba.fastjson.JSONObject" %>
<%@ page import="weaver.conn.RecordSet" %>
<%@ page import="weaver.general.Util" %>
<%@ page import="weaver.general.BaseBean" %>
<%@ page import="org.apache.commons.lang3.StringUtils" %>
<%@ page import="java.math.BigDecimal" %>
<%@ page import="java.text.DecimalFormat" %>
<%@ page import="java.util.ArrayList" %>
<%@ page import="java.util.List" %>
<%@ page import="java.util.Map" %>
<%@ page import="java.util.HashMap" %>
<%--
User: xuxy
Design Ideas
天华化工-查询-等级评定员工身份信息
--%>
<%@ page contentType="text/html;charset=UTF-8" %>
<%! org.slf4j.Logger log = org.slf4j.LoggerFactory.getLogger("getDjpdUserInfo"); %>
<%
JSONObject data = new JSONObject();
try {
//1.查询建模表部门为空的台账,并更新相关信息
updateAllDjpdData();
} catch (Exception e) {
new BaseBean().writeLog("getUserInfo---Exception:" + e.getMessage());
}
out.print(data.toJSONString());
%>
<%!
public List<Map<String,String>> getAllDjpdData() {
List<Map<String,String>> list = new ArrayList<>();
RecordSet rs = new RecordSet();
rs.execute("select gh,yxbz,jxkh,jxpf,jxdj from uf_xzryjxkhhzb where bm is null");
while (rs.next()) {
Map<String,String> map = new HashMap<>();
String gh = Util.null2String(rs.getString("gh"));
String yxbz = Util.null2String(rs.getString("yxbz"));
String jxkh = Util.null2String(rs.getString("jxkh"));
String jxpf = Util.null2String(rs.getString("jxpf"));
String jxdj = Util.null2String(rs.getString("jxdj"));
map.put("gh",gh);
map.put("yxbz",yxbz);
map.put("jxkh",jxkh);
map.put("jxpf",jxpf);
map.put("jxdj",jxdj);
log.info("-getAllDjpdData-gh:{},yxbz:{},jxkh:{},jxpf:{},jxdj:{}", gh, yxbz, jxkh, jxpf, jxdj);
list.add(map);
}
return list;
}
%>
<%!
public void updateAllDjpdData() {
List<Map<String,String>> list = getAllDjpdData();
RecordSet rs = new RecordSet();
for (Map<String, String> map : list) {
//通过gh查询员工部门等信息
String departmentid = "";
String JOBTITLE = "";
String companystartdate = "";
String status = "";
rs.execute("select departmentid,JOBTITLE,companystartdate,status from hrmresource where workcode = '" + map.get("gh") + "'");
if (rs.next()) {
departmentid = Util.null2String(rs.getString("departmentid"));
JOBTITLE = Util.null2String(rs.getString("JOBTITLE"));
companystartdate = Util.null2String(rs.getString("companystartdate"));
status = Util.null2String(rs.getString("status"));
}
log.info("-getAllDjpdData-departmentid:{},JOBTITLE:{},companystartdate:{},status:{}", departmentid,JOBTITLE,companystartdate,status);
// 先计算核算结果
BigDecimal hsjg;
String value = "";
DecimalFormat df = new DecimalFormat("#0.00");
// 更新对应的建模表数据
if(StringUtils.equals(status,"1")) {
String updateSql = "";
//判断绩效等级
hsjg = new BigDecimal(map.get("yxbz")).multiply(new BigDecimal(map.get("jxkh"))).multiply(BigDecimal.valueOf(0.01));
log.info("-getAllDjpdData-hsjg:{}", hsjg);
if (StringUtils.equals(map.get("jxdj"), "0")||StringUtils.equals(map.get("jxdj"), "1")||StringUtils.equals(map.get("jxdj"), "2")) {
if (StringUtils.equals(map.get("jxdj"), "0")) {
hsjg = hsjg.multiply(BigDecimal.valueOf(0.4));
} else if (StringUtils.equals(map.get("jxdj"), "1")) {
hsjg = hsjg.multiply(BigDecimal.valueOf(0.2));
} else if (StringUtils.equals(map.get("jxdj"), "2")) {
hsjg = hsjg.multiply(BigDecimal.valueOf(0.0));
}
log.info("-getAllDjpdData-value1:{}", value);
updateSql = "update uf_xzryjxkhhzb set bm = ?,gw=?,rzrq=?,sfzz=?,hsjgz=? where gh = ? ";
}else{
if (StringUtils.equals(map.get("jxdj"), "3")) {
hsjg = hsjg.multiply(BigDecimal.valueOf(0.2));
}else if (StringUtils.equals(map.get("jxdj"), "4")) {
hsjg = hsjg.multiply(BigDecimal.valueOf(0.4));
}
log.info("-getAllDjpdData-value2:{}", value);
updateSql = "update uf_xzryjxkhhzb set bm = ?,gw=?,rzrq=?,sfzz=?,hsjgf=? where gh = ? ";
}
value = df.format(hsjg);
log.info("-getAllDjpdData-updateSql1:{}", updateSql);
rs.executeUpdate(updateSql,departmentid,JOBTITLE,companystartdate,status,value,map.get("gh"));
}else {
String updateSql = "update uf_xzryjxkhhzb set bm = ?,gw=?,rzrq=?,sfzz=? where gh = ? ";
log.info("-getAllDjpdData-updateSql2:{}", updateSql);
rs.executeUpdate(updateSql,departmentid,JOBTITLE,companystartdate,status,map.get("gh"));
}
}
}
%>