Commit 2e5b6d80 authored by zhuxiang's avatar zhuxiang
Browse files

绩效分数保留两位小鼠

parent 893a37bc
...@@ -14,6 +14,7 @@ import com.ruzhoukj.sms.service.*; ...@@ -14,6 +14,7 @@ import com.ruzhoukj.sms.service.*;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.text.DecimalFormat;
import java.time.LocalDate; import java.time.LocalDate;
import java.util.List; import java.util.List;
...@@ -92,11 +93,16 @@ public class ReportDataInfoServiceImpl extends ServiceImpl<ReportDataInfoDao, Re ...@@ -92,11 +93,16 @@ public class ReportDataInfoServiceImpl extends ServiceImpl<ReportDataInfoDao, Re
} }
} }
if (!totalScore.equals("0")) { if (!totalScore.equals("0")) {
// 将字符串转换为数值
double value = Double.parseDouble(totalScore);
// 使用 DecimalFormat 保留两位小数
DecimalFormat df = new DecimalFormat("#.##");
String formattedValue = df.format(value);
//更新用户绩效分 //更新用户绩效分
UserPerformanceEntity userPerformanceEntity = new UserPerformanceEntity(); UserPerformanceEntity userPerformanceEntity = new UserPerformanceEntity();
userPerformanceEntity.setUserId(reportDataInfoEntity.getUserId()); userPerformanceEntity.setUserId(reportDataInfoEntity.getUserId());
userPerformanceEntity.setPerformanceDate(reportDataInfoEntity.getYear(), reportDataInfoEntity.getMonth()); userPerformanceEntity.setPerformanceDate(reportDataInfoEntity.getYear(), reportDataInfoEntity.getMonth());
userPerformanceEntity.setPerformanceScore(totalScore); userPerformanceEntity.setPerformanceScore(formattedValue);
userPerformanceEntity.setDeptId(reportDataInfoEntity.getDeptId()); userPerformanceEntity.setDeptId(reportDataInfoEntity.getDeptId());
userPerformanceEntity.setReportDataId(reportDataInfoEntity.getId()); userPerformanceEntity.setReportDataId(reportDataInfoEntity.getId());
userPerformanceService.save(userPerformanceEntity); userPerformanceService.save(userPerformanceEntity);
......
...@@ -24,15 +24,6 @@ import java.util.List; ...@@ -24,15 +24,6 @@ import java.util.List;
public class UserPerformanceServiceImpl extends ServiceImpl<UserPerformanceDao, UserPerformanceEntity> implements UserPerformanceService { public class UserPerformanceServiceImpl extends ServiceImpl<UserPerformanceDao, UserPerformanceEntity> implements UserPerformanceService {
@Override @Override
public List<UserPerformanceVO> queryList(UserPerformanceDTO userPerformanceDTO) { public List<UserPerformanceVO> queryList(UserPerformanceDTO userPerformanceDTO) {
//获取当前年月
// 获取当前日期
LocalDate now = LocalDate.now();
// 获取上个月的日期
LocalDate lastMonth = now.minusMonths(1);
// 格式化为 "yyyy-MM"
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM");
String lastYearMonth = lastMonth.format(formatter);
userPerformanceDTO.setPerformanceDate(lastYearMonth);
return baseMapper.queryList(userPerformanceDTO); return baseMapper.queryList(userPerformanceDTO);
} }
} }
...@@ -24,13 +24,13 @@ ...@@ -24,13 +24,13 @@
r.user_id = u.id r.user_id = u.id
<where> <where>
<if test="deptId != null and deptId != ''"> <if test="deptId != null and deptId != ''">
r.dept_id = #{deptId} and r.dept_id = #{deptId}
</if> </if>
<if test="userId != null and userId != ''"> <if test="userId != null and userId != ''">
r.user_id = #{userId} and r.user_id = #{userId}
</if> </if>
<if test="month != null and month != ''"> <if test="month != null and month != ''">
r.month = #{month} and r.month = #{month}
</if> </if>
</where> </where>
</select> </select>
......
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