绩效需求开发
This commit is contained in:
commit
d83623fd90
|
|
@ -0,0 +1,15 @@
|
|||
package com.api.gds.controller;
|
||||
|
||||
import javax.ws.rs.Path;
|
||||
|
||||
/**
|
||||
* @version 1.0
|
||||
* @Title ecology-9
|
||||
* @Company 泛微软件
|
||||
* @CreateDate 2025/6/19
|
||||
* @Description 绩效
|
||||
* @Author AdminZm
|
||||
*/
|
||||
@Path("/gds/jx")
|
||||
public class MeritsController extends com.engine.gds.controller.MeritsController {
|
||||
}
|
||||
|
|
@ -0,0 +1,46 @@
|
|||
package com.engine.gds.controller;
|
||||
|
||||
import com.engine.common.util.ParamUtil;
|
||||
import com.engine.common.util.ServiceUtil;
|
||||
import com.engine.gds.service.MeritsService;
|
||||
import com.engine.gds.service.impl.MeritsServiceImpl;
|
||||
import com.google.gson.Gson;
|
||||
import weaver.hrm.HrmUserVarify;
|
||||
import weaver.hrm.User;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.ws.rs.POST;
|
||||
import javax.ws.rs.Path;
|
||||
import javax.ws.rs.Produces;
|
||||
import javax.ws.rs.core.Context;
|
||||
import javax.ws.rs.core.MediaType;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @version 1.0
|
||||
* @Title ecology-9
|
||||
* @Company 泛微软件
|
||||
* @CreateDate 2025/6/19
|
||||
* @Description 绩效
|
||||
* @Author AdminZm
|
||||
*/
|
||||
public class MeritsController {
|
||||
|
||||
public MeritsService getMeritsService(User user) {
|
||||
return ServiceUtil.getService(MeritsServiceImpl.class,user);
|
||||
}
|
||||
|
||||
/**
|
||||
* 绩效得分计算
|
||||
*/
|
||||
@POST
|
||||
@Path("/meritsScoreCount")
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
public String meritsScoreCount(@Context HttpServletRequest request, @Context HttpServletResponse response) {
|
||||
User user = HrmUserVarify.getUser(request, response);
|
||||
Map<String, Object> params = ParamUtil.request2Map(request);
|
||||
Map<String, Object> resultDatas = getMeritsService(user).meritsScoreCount(params);
|
||||
return new Gson().toJson(resultDatas);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,19 @@
|
|||
package com.engine.gds.service;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @version 1.0
|
||||
* @Title ecology-9
|
||||
* @Company 泛微软件
|
||||
* @CreateDate 2025/6/19
|
||||
* @Description
|
||||
* @Author AdminZm
|
||||
*/
|
||||
public interface MeritsService {
|
||||
|
||||
/**
|
||||
* 绩效得分计算
|
||||
*/
|
||||
Map<String, Object> meritsScoreCount(Map<String, Object> params);
|
||||
}
|
||||
|
|
@ -0,0 +1,120 @@
|
|||
package com.engine.gds.service.impl;
|
||||
|
||||
import com.engine.core.impl.Service;
|
||||
import com.engine.gds.service.MeritsService;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
import weaver.conn.RecordSet;
|
||||
import weaver.general.BaseBean;
|
||||
import weaver.general.Util;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @version 1.0
|
||||
* @Title ecology-9
|
||||
* @Company 泛微软件
|
||||
* @CreateDate 2025/6/19
|
||||
* @Description
|
||||
* @Author AdminZm
|
||||
*/
|
||||
public class MeritsServiceImpl extends Service implements MeritsService {
|
||||
|
||||
BaseBean baseBean = new BaseBean();
|
||||
|
||||
@Override
|
||||
public Map<String, Object> meritsScoreCount(Map<String, Object> params) {
|
||||
Map<String, Object> result = new HashMap<>();
|
||||
baseBean.writeLog("meritsScoreCount start:" + params);
|
||||
try {
|
||||
// 年月
|
||||
String nyParam = Util.null2String(params.get("ny"));
|
||||
if (StringUtils.isEmpty(nyParam)) {
|
||||
baseBean.writeLog("meritsScoreCount ny is null.");
|
||||
result.put("mes", "请选择计算的月份!");
|
||||
result.put("code", "200");
|
||||
return result;
|
||||
}
|
||||
|
||||
RecordSet rs = new RecordSet();
|
||||
|
||||
// 获取加减分台账数据
|
||||
Map<String, String> jjfMap = new HashMap<>();
|
||||
rs.execute("SELECT * FROM uf_jjfgltz");
|
||||
while (rs.next()) {
|
||||
String khyf = rs.getString("khyf");
|
||||
String xm = rs.getString("xm");
|
||||
String jjf = rs.getString("jjf");
|
||||
if (StringUtils.isEmpty(khyf) || StringUtils.isEmpty(xm)) {
|
||||
continue;
|
||||
}
|
||||
jjfMap.put(khyf + "_" + xm, jjf);
|
||||
}
|
||||
|
||||
List<List> updateList = new ArrayList<>();
|
||||
rs.executeQuery("SELECT id, khyf, xm1, khfs, khfs1 FROM uf_jxkhjg WHERE khyf = ?", nyParam);
|
||||
while (rs.next()) {
|
||||
String id = rs.getString("id");
|
||||
String khyf = rs.getString("khyf");
|
||||
String xm1 = rs.getString("xm1");
|
||||
String khfs = rs.getString("khfs");
|
||||
String khfs1 = rs.getString("khfs1");
|
||||
if (StringUtils.isEmpty(id) || StringUtils.isEmpty(khyf) || StringUtils.isEmpty(xm1)) {
|
||||
continue;
|
||||
}
|
||||
if (StringUtils.isEmpty(khfs)) {
|
||||
khfs = "0";
|
||||
}
|
||||
String jjf = jjfMap.get(khyf + "_" + xm1);
|
||||
if (StringUtils.isEmpty(jjf)) {
|
||||
jjf = "0";
|
||||
}
|
||||
|
||||
BigDecimal jxfsjjfh = new BigDecimal(khfs).add(new BigDecimal(jjf));
|
||||
String jxxs = null;
|
||||
if (StringUtils.isNotEmpty(khfs1) && new BigDecimal(khfs1).compareTo(BigDecimal.ZERO) == 0) {
|
||||
if (jxfsjjfh.compareTo(new BigDecimal("90")) > 0) {
|
||||
jxxs = "1.2";
|
||||
} else if (jxfsjjfh.compareTo(new BigDecimal("90")) <= 0 && jxfsjjfh.compareTo(new BigDecimal("80")) > 0) {
|
||||
jxxs = "1";
|
||||
} else if (jxfsjjfh.compareTo(new BigDecimal("80")) <= 0 && jxfsjjfh.compareTo(new BigDecimal("70")) > 0) {
|
||||
jxxs = "0.8";
|
||||
} else if (jxfsjjfh.compareTo(new BigDecimal("70")) <= 0 && jxfsjjfh.compareTo(new BigDecimal("60")) > 0) {
|
||||
jxxs = "0.6";
|
||||
} else {
|
||||
jxxs = "0.5";
|
||||
}
|
||||
}
|
||||
|
||||
List arrayList = new ArrayList<>();
|
||||
arrayList.add(jjf);
|
||||
arrayList.add(jxfsjjfh.toString());
|
||||
arrayList.add(jxxs);
|
||||
arrayList.add(id);
|
||||
updateList.add(arrayList);
|
||||
}
|
||||
|
||||
|
||||
if (CollectionUtils.isEmpty(updateList)) {
|
||||
baseBean.writeLog("updateList is null.");
|
||||
} else {
|
||||
baseBean.writeLog("updateList size is:" + updateList.size());
|
||||
String updateSql = "UPDATE uf_jxkhjg SET jjf = ?, jxfsjjfh = ?, jxxs = ? WHERE id = ?";
|
||||
rs.executeBatchSql(updateSql, updateList);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
baseBean.writeLog("meritsScoreCount error:" + e);
|
||||
result.put("mes", "系统错误,请联系管理员!");
|
||||
result.put("code", "400");
|
||||
return result;
|
||||
}
|
||||
baseBean.writeLog("meritsScoreCount end.");
|
||||
result.put("mes", "正在计算,请稍等!");
|
||||
result.put("code", "200");
|
||||
return result;
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue