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/getDfpdUserInfo.jsp

105 lines
4.4 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.List" %>
<%@ page import="java.util.ArrayList" %>
<%@ 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("getDfpdUserInfo"); %>
<%
JSONObject data = new JSONObject();
try {
//1.查询得分评定建模表部门为空的台账,并更新相关信息
updateAllDfpdData();
} catch (Exception e) {
new BaseBean().writeLog("getUserInfo---Exception:" + e.getMessage());
}
out.print(data.toJSONString());
%>
<%!
public List<Map<String,String>> getAllDfpdData() {
List<Map<String,String>> list = new ArrayList<>();
RecordSet rs = new RecordSet();
rs.execute("select gh,yxbz,jxkh,jxpf from uf_glgbryjxhzb 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"));
log.info("-getAllDfpdData-gh:{},yxbz:{},jxkh:{},jxpf:{}", gh,yxbz,jxkh,jxpf);
map.put("gh",gh);
map.put("yxbz",yxbz);
map.put("jxkh",jxkh);
map.put("jxpf",jxpf);
log.info("-getAllDjpdData-gh:{},yxbz:{},jxkh:{},jxpf:{}", gh, yxbz, jxkh, jxpf);
list.add(map);
}
log.info("getAllDfpdData-最终输出的list-----------list{}",list);
return list;
}
%>
<%!
public void updateAllDfpdData() {
List<Map<String, String>> list = getAllDfpdData();
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("-getAllDfpdData-departmentid:{},JOBTITLE:{},companystartdate:{},status:{}", departmentid,JOBTITLE,companystartdate,status);
// 先计算核算结果
BigDecimal hsjg;
DecimalFormat df = new DecimalFormat("#0.00");
// 更新对应的建模表数据
if(StringUtils.equals(status,"1")) {
//判断绩效等级
hsjg = new BigDecimal(map.get("yxbz")).multiply(new BigDecimal(map.get("jxkh"))).multiply(BigDecimal.valueOf(0.0001)).multiply(new BigDecimal(map.get("jxpf")));
log.info("-getAllDfpdData-hsjg1:{}", hsjg);
//绩效评分大于等于60
if(new BigDecimal(map.get("jxpf")).compareTo(BigDecimal.valueOf(60))>=0){
hsjg = hsjg.multiply(BigDecimal.valueOf(2));
log.info("-getAllDfpdData-hsjg2:{}", hsjg);
}
String value = df.format(hsjg);
String updateSql = "update uf_glgbryjxhzb set bm = ?,gw=?,rzrq=?,sfzz=?,hsjgz=? where gh = ? ";
log.info("-getAllDfpdData-updateSql1:{}", updateSql);
rs.executeUpdate(updateSql,departmentid,JOBTITLE,companystartdate,status,value,map.get("gh"));
}else {
String updateSql = "update uf_glgbryjxhzb set bm = ?,gw=?,rzrq=?,sfzz=? where gh = ? ";
rs.executeUpdate(updateSql,departmentid,JOBTITLE,companystartdate,status,map.get("gh"));
log.info("-getAllDfpdData-updateSql2:{}", updateSql);
}
}
}
%>