"src/git@gitlab.ruzhoukj.com:wujipeng/relation.git" did not exist on "f3d7a839de138bd392a4d596f4628fe90c5c6b1d"
Commit 09ff5406 authored by zhuxiang's avatar zhuxiang
Browse files

优化

parent 3de58896
......@@ -15,8 +15,13 @@ public class Constant {
*/
public static final String ADMIN = "ADMIN";
public static final String USER = "NORMAL";
//部门管理员
public static final String D_ADMIN = "D_ADMIN";
public static final String DIR_OA="OA/";
public static final String DIR_OA = "OA/";
//总经理USER_ID
public static final String OA_ADMIN_ID = "1829057630693335052";
}
......@@ -65,4 +65,9 @@ public class ReportDataInfoController extends BaseController {
return toAjax(reportDataInfoService.removeById(id));
}
@PutMapping("/submit/{id}")
public Result submit(@PathVariable String id) {
return toAjax(reportDataInfoService.submit(id));
}
}
......@@ -47,4 +47,7 @@ public class ReportDataInfoEntity {
@TableField("status")
private String status = "1";
@TableField("actor_user")
private String actorUser;
}
......@@ -18,7 +18,15 @@ import java.util.List;
public interface ReportDataInfoService extends IService<ReportDataInfoEntity> {
List<ReportDataInfoVO> queryList(ReportDataInfoDTO reportDataInfoDTO);
void countPerformance(String reportDataInfoId);
void countPerformance(ReportDataInfoEntity reportDataInfoEntity);
boolean saveOrUpdateReportData(ReportDataInfoDTO reportDataInfoDTO);
/**
* 绩效提交
*
* @param id
* @return
*/
boolean submit(String id);
}
......@@ -4,12 +4,15 @@ import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.platform.utils.StringUtils;
import com.ruzhoukj.sms.common.Constant;
import com.ruzhoukj.sms.dao.ReportDataInfoDao;
import com.ruzhoukj.sms.entity.DeptEntity;
import com.ruzhoukj.sms.entity.ReportDataInfoEntity;
import com.ruzhoukj.sms.entity.UserEntity;
import com.ruzhoukj.sms.entity.UserPerformanceEntity;
import com.ruzhoukj.sms.model.dto.ReportDataInfoDTO;
import com.ruzhoukj.sms.model.vo.ReportDataInfoVO;
import com.ruzhoukj.sms.service.DeptService;
import com.ruzhoukj.sms.service.ReportDataInfoService;
import com.ruzhoukj.sms.service.UserPerformanceService;
import com.ruzhoukj.sms.service.UserService;
......@@ -32,6 +35,10 @@ public class ReportDataInfoServiceImpl extends ServiceImpl<ReportDataInfoDao, Re
@Resource
private UserService userService;
@Resource
private DeptService deptService;
@Resource
private ReportDataInfoService reportDataInfoService;
@Resource
private UserPerformanceService userPerformanceService;
@Override
......@@ -40,9 +47,8 @@ public class ReportDataInfoServiceImpl extends ServiceImpl<ReportDataInfoDao, Re
}
@Override
public void countPerformance(String reportDataInfoId) {
public void countPerformance(ReportDataInfoEntity reportDataInfoEntity) {
//查看已填写完成,未计算的绩效
ReportDataInfoEntity reportDataInfoEntity = getById(reportDataInfoId);
String content = reportDataInfoEntity.getAllContent();
// 解析JSON字符串为JSONArray
JSONArray jsonArray = JSONArray.parseArray(content);
......@@ -56,17 +62,17 @@ public class ReportDataInfoServiceImpl extends ServiceImpl<ReportDataInfoDao, Re
for (int i = 5; i < data.size(); i++) {
JSONArray row = data.getJSONArray(i);
JSONObject total = row.getJSONObject(0);
if(StringUtils.isNotEmpty(total)){
if (StringUtils.isNotEmpty(total)) {
String totalStr = total.getString("v");
if (StringUtils.isNotEmpty(totalStr) && totalStr.contains("合计:")) {
//普通员工绩效
JSONObject score = row.getJSONObject(11);
if(StringUtils.isNull(score)){
if (StringUtils.isNull(score)) {
//部门管理员绩效
score = row.getJSONObject(10);
}
//财务绩效
if(StringUtils.isNull(score)){
if (StringUtils.isNull(score)) {
score = row.getJSONObject(4);
}
totalScore = score.getString("v");
......@@ -89,6 +95,7 @@ public class ReportDataInfoServiceImpl extends ServiceImpl<ReportDataInfoDao, Re
userPerformanceService.save(userPerformanceEntity);
reportDataInfoEntity.setStatus("4");
reportDataInfoEntity.setId(reportDataInfoEntity.getId());
reportDataInfoService.updateById(reportDataInfoEntity);
}
} else {
System.out.println("No data available in the JSON array.");
......@@ -119,12 +126,31 @@ public class ReportDataInfoServiceImpl extends ServiceImpl<ReportDataInfoDao, Re
UserEntity user = userService.getById(reportDataInfoDTO.getUserId());
reportDataInfoDTO.setDeptId(user.getDeptId());
reportDataInfoDTO.setUserId(user.getId());
reportDataInfoDTO.setActorUser(user.getId());
save(reportDataInfoDTO);
}
//处理绩效提交
if (StringUtils.isNotEmpty(reportDataInfoDTO.getId()) && reportDataInfoDTO.getStatus().equals("3")) {
countPerformance(reportDataInfoDTO.getId());
}
return Boolean.TRUE;
}
@Override
public boolean submit(String id) {
//查看信息
ReportDataInfoEntity reportDataInfoEntity = getById(id);
if (reportDataInfoEntity != null) {
return Boolean.FALSE;
}
//查看被处理人信息
UserEntity user = userService.getById(reportDataInfoEntity.getActorUser());
if (user.getUserRole().equals(Constant.USER)) {
//普通用户,提交给部门负责人
//查看部门负责人Id
DeptEntity deptEntity = deptService.getById(user.getDeptId());
reportDataInfoEntity.setActorUser(deptEntity.getDeptAdmin());
} else if (user.getUserRole().equals(Constant.D_ADMIN)) {
reportDataInfoEntity.setActorUser(Constant.OA_ADMIN_ID);
} else if (reportDataInfoEntity.getActorUser().equals(Constant.OA_ADMIN_ID)) {
countPerformance(reportDataInfoEntity);
}
return updateById(reportDataInfoEntity);
}
}
......@@ -13,6 +13,7 @@
r.year year,
r.month month,
r.key_value keyValue,
r.
u.name userName,
r.status status
from
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment