|
|
@@ -13,9 +13,7 @@ import com.lc.ibps.cloud.entity.APIResult;
|
|
|
import com.lc.ibps.common.api.IDictionaryService;
|
|
|
import com.lc.ibps.common.cat.persistence.entity.DictionaryPo;
|
|
|
import com.lc.ibps.org.api.IPartyPositionService;
|
|
|
-import com.lc.ibps.org.party.persistence.entity.PartyEmployeePo;
|
|
|
import com.lc.ibps.org.party.persistence.entity.PartyPositionPo;
|
|
|
-import com.lc.ibps.wx.entity.Employee;
|
|
|
import org.slf4j.Logger;
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
@@ -31,7 +29,6 @@ import java.time.format.DateTimeFormatter;
|
|
|
import java.time.format.TextStyle;
|
|
|
import java.time.temporal.TemporalAdjusters;
|
|
|
import java.util.*;
|
|
|
-import java.util.stream.IntStream;
|
|
|
|
|
|
@Service
|
|
|
public class StatisticServiceImpl implements StatisticService {
|
|
|
@@ -75,50 +72,10 @@ public class StatisticServiceImpl implements StatisticService {
|
|
|
TrainingDashBoardDTO dashBoardDTO = new TrainingDashBoardDTO();
|
|
|
|
|
|
// 在岗培训计划 自动创建 or 手动创建
|
|
|
- TrainGuardAutoPlanDto planDto = new TrainGuardAutoPlanDto();
|
|
|
- String zdSql = "select count(*) as auto from t_rypxcjb where ji_hua_wai_jian_ in(select id_ from t_ndrypxjhzb) and ji_hua_lei_xing_='在岗培训' ";
|
|
|
- String zsSql = "select count(*) as total from t_rypxcjb where ji_hua_lei_xing_='在岗培训'";
|
|
|
- if (BeanUtils.isNotEmpty(dept)){
|
|
|
- zdSql = zdSql + " and bian_zhi_bu_men_ = '"+dept+"'";
|
|
|
- zsSql = zsSql + " and bian_zhi_bu_men_ = '"+dept+"'";
|
|
|
- }
|
|
|
- int autoNum = Integer.parseInt(commonDao.queryOne(zdSql).get("auto").toString());
|
|
|
- int total = Integer.parseInt(commonDao.queryOne(zsSql).get("total").toString());
|
|
|
- int manual = total - autoNum;
|
|
|
- planDto.setAutoNum(autoNum);
|
|
|
- planDto.setManual(manual);
|
|
|
- planDto.setRemark("自动创建培训计划占比");
|
|
|
+ dashBoardDTO.setPlanDto(getPlanRate(dept));
|
|
|
|
|
|
- BigDecimal sum = new BigDecimal(total);
|
|
|
- BigDecimal sign = new BigDecimal(autoNum);
|
|
|
- if (sum.compareTo(BigDecimal.ZERO) != 0) {
|
|
|
- BigDecimal percentage = sign.divide(sum, 10, RoundingMode.HALF_UP).multiply(new BigDecimal(100));
|
|
|
- percentage = percentage.setScale(2, RoundingMode.HALF_UP);
|
|
|
- planDto.setRate(percentage.toString());
|
|
|
- }else {
|
|
|
- planDto.setRate("0.00");
|
|
|
- }
|
|
|
- dashBoardDTO.setPlanDto(planDto);
|
|
|
-
|
|
|
- // 获取本周的第一天(星期一)
|
|
|
- LocalDate startOfWeek = LocalDate.now().with(TemporalAdjusters.previousOrSame(DayOfWeek.MONDAY));
|
|
|
// 近一周发布计划
|
|
|
- List<TrainWeekDto> weekDtoList = new ArrayList<>();
|
|
|
- List<String> weekDates = getWeeks(startOfWeek);
|
|
|
- for (String dateStr : weekDates) {
|
|
|
- TrainWeekDto weekDto = new TrainWeekDto();
|
|
|
- weekDto.setDate(dateStr);
|
|
|
- weekDto.setDayName(getDayName(dateStr));
|
|
|
- String sql = "select count(*) value from t_rypxcjb where ji_hua_lei_xing_='在岗培训' and shi_fou_guo_shen_='未发布' " +
|
|
|
- " and date_format(pei_xun_shi_jian_,'%Y-%m-%d')='"+dateStr+"'";
|
|
|
- if (BeanUtils.isNotEmpty(dept)){
|
|
|
- sql = sql + " and bian_zhi_bu_men_ = '"+dept+"'";
|
|
|
- }
|
|
|
- Map<String,Object> map = commonDao.queryOne(sql);
|
|
|
- weekDto.setValue(map.get("value"));
|
|
|
- weekDtoList.add(weekDto);
|
|
|
- }
|
|
|
- dashBoardDTO.setWeekDtoList(weekDtoList);
|
|
|
+ dashBoardDTO.setWeekDtoList(getCurrWeek(dept));
|
|
|
|
|
|
// type value
|
|
|
// 周 week 本周 nowWeek 上周 lastWeek 下周 nextWeek
|
|
|
@@ -161,134 +118,206 @@ public class StatisticServiceImpl implements StatisticService {
|
|
|
// }
|
|
|
// 年 year 去年 lastYear 今年 nowYear
|
|
|
|
|
|
- // 培训人员统计情况
|
|
|
+ // 在岗培训人员统计情况
|
|
|
if (dates.contains("-")){
|
|
|
// 月
|
|
|
- List<String> months = getAllDatesOfMonth(dates);
|
|
|
- dashBoardDTO.setPxrytjqkDtoList(getYmdData(months,dept,"month",""));
|
|
|
+ dashBoardDTO.setPxrytjqkDtoList(getYmdData(getAllDatesOfMonth(dates),dept,"month",""));
|
|
|
}else {
|
|
|
// 年
|
|
|
- List<String> years = getYearMonth();
|
|
|
- dashBoardDTO.setPxrytjqkDtoList(getYmdData(years,dept,"year",dates));
|
|
|
+ dashBoardDTO.setPxrytjqkDtoList(getYmdData(getYearMonth(),dept,"year",dates));
|
|
|
}
|
|
|
|
|
|
- // 个人培训次数排名
|
|
|
+ // 在岗个人培训次数排名
|
|
|
dashBoardDTO.setUserRankList(getUserTrainRank(dept));
|
|
|
|
|
|
// 在岗培训类别占比
|
|
|
- getTypeRate(dashBoardDTO,dept);
|
|
|
+ dashBoardDTO.setTypeDto(getTypeRate(dept));
|
|
|
|
|
|
// 在岗培训对象占比
|
|
|
- getObjectRate(dashBoardDTO);
|
|
|
+ dashBoardDTO.setObjectDto(getObjectRate(dept));
|
|
|
|
|
|
// 本年度岗前培训计划
|
|
|
- List<String> years = getYearMonth();
|
|
|
- dashBoardDTO.setNdgqpxList(getCurrentYearData(years,dept));
|
|
|
+ dashBoardDTO.setNdgqpxList(getCurrentYearData(getYearMonth(),dept));
|
|
|
|
|
|
// 本年度岗前培训类别占比
|
|
|
- getYearPre(dashBoardDTO);
|
|
|
+ dashBoardDTO.setYearPreWorkDto(getYearPre(dept));
|
|
|
|
|
|
list.add(dashBoardDTO);
|
|
|
return list;
|
|
|
}
|
|
|
|
|
|
+ public TrainGuardAutoPlanDto getPlanRate(String dept){
|
|
|
+ TrainGuardAutoPlanDto planDto = new TrainGuardAutoPlanDto();
|
|
|
+ String zdSql = "select count(*) as auto from t_rypxcjb where ji_hua_wai_jian_ in(select id_ from t_ndrypxjhzb) and ji_hua_lei_xing_='在岗培训' and di_dian_='"+getDiDian()+"'";
|
|
|
+ String zsSql = "select count(*) as total from t_rypxcjb where ji_hua_lei_xing_='在岗培训' and di_dian_='"+getDiDian()+"' ";
|
|
|
+ if (BeanUtils.isNotEmpty(dept)){
|
|
|
+ zdSql = zdSql + " and bian_zhi_bu_men_ = '"+dept+"'";
|
|
|
+ zsSql = zsSql + " and bian_zhi_bu_men_ = '"+dept+"'";
|
|
|
+ }
|
|
|
+ int autoNum = Integer.parseInt(commonDao.queryOne(zdSql).get("auto").toString());
|
|
|
+ int total = Integer.parseInt(commonDao.queryOne(zsSql).get("total").toString());
|
|
|
+ int manual = total - autoNum;
|
|
|
+ planDto.setTotal(total);
|
|
|
+ planDto.setAutoNum(autoNum);
|
|
|
+ planDto.setManual(manual);
|
|
|
+ planDto.setRemark("自动创建培训计划占比");
|
|
|
+
|
|
|
+ BigDecimal sum = new BigDecimal(total);
|
|
|
+ BigDecimal sign = new BigDecimal(autoNum);
|
|
|
+ if (sum.compareTo(BigDecimal.ZERO) != 0) {
|
|
|
+ BigDecimal percentage = sign.divide(sum, 10, RoundingMode.HALF_UP).multiply(new BigDecimal(100));
|
|
|
+ percentage = percentage.setScale(2, RoundingMode.HALF_UP);
|
|
|
+ planDto.setRate(percentage.toString());
|
|
|
+ }else {
|
|
|
+ planDto.setRate("0.00");
|
|
|
+ }
|
|
|
+ return planDto;
|
|
|
+ }
|
|
|
+
|
|
|
+ public List<TrainWeekDto> getCurrWeek(String dept){
|
|
|
+ LocalDate startOfWeek = LocalDate.now().with(TemporalAdjusters.previousOrSame(DayOfWeek.MONDAY));
|
|
|
+ List<TrainWeekDto> weekDtoList = new ArrayList<>();
|
|
|
+ List<String> weekDates = getWeeks(startOfWeek);
|
|
|
+ for (String dateStr : weekDates) {
|
|
|
+ TrainWeekDto weekDto = new TrainWeekDto();
|
|
|
+ weekDto.setDate(dateStr);
|
|
|
+ weekDto.setDayName(getDayName(dateStr));
|
|
|
+ String sql = "select count(*) value from t_rypxcjb where ji_hua_lei_xing_='在岗培训' and shi_fou_guo_shen_='未发布' " +
|
|
|
+ " and di_dian_='"+getDiDian()+"' and date_format(pei_xun_shi_jian_,'%Y-%m-%d')='"+dateStr+"'";
|
|
|
+ if (BeanUtils.isNotEmpty(dept)){
|
|
|
+ sql = sql + " and bian_zhi_bu_men_ = '"+dept+"'";
|
|
|
+ }
|
|
|
+ Map<String,Object> map = commonDao.queryOne(sql);
|
|
|
+ weekDto.setValue(map.get("value"));
|
|
|
+ weekDtoList.add(weekDto);
|
|
|
+ }
|
|
|
+ return weekDtoList;
|
|
|
+ }
|
|
|
|
|
|
- public void getObjectRate(TrainingDashBoardDTO dashBoardDTO){
|
|
|
- List<TrainObjectDto> objectDtoList = new ArrayList<>();
|
|
|
- String sql = "select pei_xun_lei_xing_,count(pei_xun_lei_xing_)as nums from t_rypxcjb where ji_hua_lei_xing_='在岗培训' and shi_fou_guo_shen_='已结束' group by pei_xun_lei_xing_";
|
|
|
- List<Map<String,Object>> list = (List<Map<String, Object>>) commonDao.query(sql);
|
|
|
+
|
|
|
+ public TrainObjectDto getObjectRate(String dept){
|
|
|
+ TrainObjectDto objectDto = new TrainObjectDto();
|
|
|
+ objectDto.setRemark("在岗培训对象占比");
|
|
|
+ List<TrainRateDto> rateDtoList = new ArrayList<>();
|
|
|
+ String sql = "select pei_xun_lei_xing_,count(pei_xun_lei_xing_)as nums from t_rypxcjb where ji_hua_lei_xing_='在岗培训' " +
|
|
|
+ "and shi_fou_guo_shen_='已结束' and di_dian_='"+getDiDian()+"' group by pei_xun_lei_xing_";
|
|
|
String talSql = "SELECT COALESCE(SUM(nums), 0) AS total_num from (select pei_xun_lei_xing_,COUNT(pei_xun_lei_xing_)as nums " +
|
|
|
- "from t_rypxcjb where ji_hua_lei_xing_='在岗培训' and shi_fou_guo_shen_='已结束' GROUP BY pei_xun_lei_xing_) as qw";
|
|
|
+ "from t_rypxcjb where ji_hua_lei_xing_='在岗培训' and shi_fou_guo_shen_='已结束' and di_dian_='"+getDiDian()+"' GROUP BY pei_xun_lei_xing_) as qw";
|
|
|
+ if (BeanUtils.isNotEmpty(dept)){
|
|
|
+ sql = "select pei_xun_lei_xing_,count(pei_xun_lei_xing_)as nums from t_rypxcjb where ji_hua_lei_xing_='在岗培训' " +
|
|
|
+ "and shi_fou_guo_shen_='已结束' and di_dian_='"+getDiDian()+"' and bian_zhi_bu_men_='"+dept+"' group by pei_xun_lei_xing_";
|
|
|
+ talSql = "SELECT COALESCE(SUM(nums), 0) AS total_num from (select pei_xun_lei_xing_,COUNT(pei_xun_lei_xing_)as nums " +
|
|
|
+ " from t_rypxcjb where ji_hua_lei_xing_='在岗培训' and shi_fou_guo_shen_='已结束' and di_dian_='"+getDiDian()+"' " +
|
|
|
+ " and bian_zhi_bu_men_='"+dept+"' GROUP BY pei_xun_lei_xing_) as qw";
|
|
|
+ }
|
|
|
+ List<Map<String,Object>> list = (List<Map<String, Object>>) commonDao.query(sql);
|
|
|
int total = Integer.parseInt(commonDao.queryOne(talSql).get("total_num").toString());
|
|
|
- dashBoardDTO.setTypeTotal(total);
|
|
|
+ objectDto.setObjectTotal(total);
|
|
|
if (BeanUtils.isNotEmpty(list)){
|
|
|
for (Map<String,Object> map : list){
|
|
|
- TrainObjectDto objectDto = new TrainObjectDto();
|
|
|
+ TrainRateDto rateDto = new TrainRateDto();
|
|
|
String nums = map.get("nums").toString();
|
|
|
- objectDto.setTypeName(map.get("pei_xun_lei_xing_").toString());
|
|
|
- objectDto.setTypeNum(nums);
|
|
|
+ rateDto.setTypeName(map.get("pei_xun_lei_xing_").toString());
|
|
|
+ rateDto.setTypeNum(nums);
|
|
|
BigDecimal sum = new BigDecimal(total);
|
|
|
BigDecimal sign = new BigDecimal(nums);
|
|
|
if (sum.compareTo(BigDecimal.ZERO) != 0) {
|
|
|
BigDecimal percentage = sign.divide(sum, 10, RoundingMode.HALF_UP).multiply(new BigDecimal(100));
|
|
|
percentage = percentage.setScale(2, RoundingMode.HALF_UP);
|
|
|
- objectDto.setRate(percentage.toString());
|
|
|
+ rateDto.setRate(percentage.toString());
|
|
|
}else {
|
|
|
- objectDto.setRate("0.00");
|
|
|
+ rateDto.setRate("0.00");
|
|
|
}
|
|
|
- objectDtoList.add(objectDto);
|
|
|
+ rateDtoList.add(rateDto);
|
|
|
}
|
|
|
+ objectDto.setObjectDtoList(rateDtoList);
|
|
|
}
|
|
|
- dashBoardDTO.setObjectDtoList(objectDtoList);
|
|
|
-
|
|
|
+ return objectDto;
|
|
|
}
|
|
|
|
|
|
- public void getTypeRate(TrainingDashBoardDTO dashBoardDTO,String dept){
|
|
|
- List<TrainTypeDto> typeDtoList = new ArrayList<>();
|
|
|
- String sql = "select pei_xun_lei_bie_,count(pei_xun_lei_bie_)as nums from t_rypxcjb where ji_hua_lei_xing_='在岗培训' and shi_fou_guo_shen_='已结束' group by pei_xun_lei_bie_";
|
|
|
+ public TrainTypeDto getTypeRate(String dept){
|
|
|
+ TrainTypeDto typeDto = new TrainTypeDto();
|
|
|
+ typeDto.setRemark("在岗培训类别占比");
|
|
|
+ List<TrainRateDto> rateDtoList = new ArrayList<>();
|
|
|
+ String sql = "select pei_xun_lei_bie_,count(pei_xun_lei_bie_)as nums from t_rypxcjb where ji_hua_lei_xing_='在岗培训' " +
|
|
|
+ " and shi_fou_guo_shen_='已结束' and di_dian_='"+getDiDian()+"' group by pei_xun_lei_bie_";
|
|
|
String talSql = "SELECT COALESCE(SUM(nums), 0) AS total_num from (select pei_xun_lei_bie_,COUNT(pei_xun_lei_bie_)as nums " +
|
|
|
- "from t_rypxcjb where ji_hua_lei_xing_='在岗培训' and shi_fou_guo_shen_='已结束' GROUP BY pei_xun_lei_bie_) as qw";
|
|
|
+ "from t_rypxcjb where ji_hua_lei_xing_='在岗培训' and shi_fou_guo_shen_='已结束' and di_dian_='"+getDiDian()+"' GROUP BY pei_xun_lei_bie_) as qw";
|
|
|
if (BeanUtils.isNotEmpty(dept)){
|
|
|
sql = "select pei_xun_lei_bie_,count(pei_xun_lei_bie_)as nums from t_rypxcjb where ji_hua_lei_xing_='在岗培训' " +
|
|
|
- "and shi_fou_guo_shen_='已结束' and bian_zhi_bu_men_='"+dept+"' group by pei_xun_lei_bie_";
|
|
|
+ "and shi_fou_guo_shen_='已结束' and di_dian_='"+getDiDian()+"' and bian_zhi_bu_men_='"+dept+"' group by pei_xun_lei_bie_";
|
|
|
talSql = "SELECT COALESCE(SUM(nums), 0) AS total_num from (select pei_xun_lei_bie_,COUNT(pei_xun_lei_bie_)as nums " +
|
|
|
- "from t_rypxcjb where ji_hua_lei_xing_='在岗培训' and shi_fou_guo_shen_='已结束' and bian_zhi_bu_men_='"+dept+"' GROUP BY pei_xun_lei_bie_) as qw";
|
|
|
+ "from t_rypxcjb where ji_hua_lei_xing_='在岗培训' and shi_fou_guo_shen_='已结束' and di_dian_='"+getDiDian()+"'" +
|
|
|
+ " and bian_zhi_bu_men_='"+dept+"' GROUP BY pei_xun_lei_bie_) as qw";
|
|
|
}
|
|
|
int total = Integer.parseInt(commonDao.queryOne(talSql).get("total_num").toString());
|
|
|
List<Map<String,Object>> list = (List<Map<String, Object>>) commonDao.query(sql);
|
|
|
- dashBoardDTO.setTypeTotal(total);
|
|
|
+ typeDto.setTypeTotal(total);
|
|
|
if (BeanUtils.isNotEmpty(list)){
|
|
|
for (Map<String,Object> map : list){
|
|
|
- TrainTypeDto typeDto = new TrainTypeDto();
|
|
|
+ TrainRateDto rateDto = new TrainRateDto();
|
|
|
String nums = map.get("nums").toString();
|
|
|
- typeDto.setTypeName(map.get("pei_xun_lei_bie_").toString());
|
|
|
- typeDto.setTypeNum(nums);
|
|
|
+ rateDto.setTypeName(map.get("pei_xun_lei_bie_").toString());
|
|
|
+ rateDto.setTypeNum(nums);
|
|
|
BigDecimal sum = new BigDecimal(total);
|
|
|
BigDecimal sign = new BigDecimal(nums);
|
|
|
if (sum.compareTo(BigDecimal.ZERO) != 0) {
|
|
|
BigDecimal percentage = sign.divide(sum, 10, RoundingMode.HALF_UP).multiply(new BigDecimal(100));
|
|
|
percentage = percentage.setScale(2, RoundingMode.HALF_UP);
|
|
|
- typeDto.setRate(percentage.toString());
|
|
|
+ rateDto.setRate(percentage.toString());
|
|
|
}else {
|
|
|
- typeDto.setRate("0.00");
|
|
|
+ rateDto.setRate("0.00");
|
|
|
}
|
|
|
- typeDtoList.add(typeDto);
|
|
|
+ rateDtoList.add(rateDto);
|
|
|
}
|
|
|
+ typeDto.setTypeDtoList(rateDtoList);
|
|
|
}
|
|
|
- dashBoardDTO.setTypeDtoList(typeDtoList);
|
|
|
+ return typeDto;
|
|
|
}
|
|
|
|
|
|
- public void getYearPre(TrainingDashBoardDTO dashBoardDTO){
|
|
|
- List<TrainYearPreWorkDto> preWorkDtoList = new ArrayList<>();
|
|
|
- String sql = "select pei_xun_lei_bie_,count(pei_xun_lei_bie_)as nums from t_rypxcjb where ji_hua_lei_xing_='岗前培训' and shi_fou_guo_shen_='已结束' group by pei_xun_lei_bie_";
|
|
|
- List<Map<String,Object>> list = (List<Map<String, Object>>) commonDao.query(sql);
|
|
|
+ public TrainYearPreWorkDto getYearPre(String dept){
|
|
|
+ TrainYearPreWorkDto preWorkDto = new TrainYearPreWorkDto();
|
|
|
+ preWorkDto.setRemark("本年度岗前培训类别占比");
|
|
|
+ List<TrainRateDto> rateDtoList = new ArrayList<>();
|
|
|
+ String sql = "select pei_xun_lei_bie_,count(pei_xun_lei_bie_)as nums from t_rypxcjb where ji_hua_lei_xing_='岗前培训' " +
|
|
|
+ "and shi_fou_guo_shen_='已结束' and di_dian_='"+getDiDian()+"' group by pei_xun_lei_bie_";
|
|
|
String talSql = "SELECT COALESCE(SUM(nums), 0) AS total_num from (select pei_xun_lei_bie_,COUNT(pei_xun_lei_bie_)as nums " +
|
|
|
- "from t_rypxcjb where ji_hua_lei_xing_='岗前培训' and shi_fou_guo_shen_='已结束' GROUP BY pei_xun_lei_bie_) as qw";
|
|
|
+ "from t_rypxcjb where ji_hua_lei_xing_='岗前培训' and shi_fou_guo_shen_='已结束' and di_dian_='"+getDiDian()+"' GROUP BY pei_xun_lei_bie_) as qw";
|
|
|
+ if (BeanUtils.isNotEmpty(dept)){
|
|
|
+ sql = "select pei_xun_lei_bie_,count(pei_xun_lei_bie_)as nums from t_rypxcjb where ji_hua_lei_xing_='岗前培训' " +
|
|
|
+ "and shi_fou_guo_shen_='已结束' and di_dian_='"+getDiDian()+"' and bian_zhi_bu_men_='"+dept+"' group by pei_xun_lei_bie_";
|
|
|
+ talSql = "SELECT COALESCE(SUM(nums), 0) AS total_num from (select pei_xun_lei_bie_,COUNT(pei_xun_lei_bie_)as nums " +
|
|
|
+ "from t_rypxcjb where ji_hua_lei_xing_='岗前培训' and shi_fou_guo_shen_='已结束' and di_dian_='"+getDiDian()+"' " +
|
|
|
+ " and bian_zhi_bu_men_='"+dept+"' GROUP BY pei_xun_lei_bie_) as qw";
|
|
|
+ }
|
|
|
+
|
|
|
+ List<Map<String,Object>> list = (List<Map<String, Object>>) commonDao.query(sql);
|
|
|
int total = Integer.parseInt(commonDao.queryOne(talSql).get("total_num").toString());
|
|
|
- dashBoardDTO.setYearPreWorkTotal(total);
|
|
|
+ preWorkDto.setYearPreWorkTotal(total);
|
|
|
if (BeanUtils.isNotEmpty(list)){
|
|
|
for (Map<String,Object> map : list){
|
|
|
- TrainYearPreWorkDto preWorkDto = new TrainYearPreWorkDto();
|
|
|
+ TrainRateDto rateDto = new TrainRateDto();
|
|
|
String nums = map.get("nums").toString();
|
|
|
- preWorkDto.setTypeName(map.get("pei_xun_lei_bie_").toString());
|
|
|
- preWorkDto.setTypeNum(nums);
|
|
|
+ rateDto.setTypeName(map.get("pei_xun_lei_bie_").toString());
|
|
|
+ rateDto.setTypeNum(nums);
|
|
|
BigDecimal sum = new BigDecimal(total);
|
|
|
BigDecimal sign = new BigDecimal(nums);
|
|
|
if (sum.compareTo(BigDecimal.ZERO) != 0) {
|
|
|
BigDecimal percentage = sign.divide(sum, 10, RoundingMode.HALF_UP).multiply(new BigDecimal(100));
|
|
|
percentage = percentage.setScale(2, RoundingMode.HALF_UP);
|
|
|
- preWorkDto.setRate(percentage.toString());
|
|
|
+ rateDto.setRate(percentage.toString());
|
|
|
}else {
|
|
|
- preWorkDto.setRate("0.00");
|
|
|
+ rateDto.setRate("0.00");
|
|
|
}
|
|
|
- preWorkDtoList.add(preWorkDto);
|
|
|
+ rateDtoList.add(rateDto);
|
|
|
}
|
|
|
+ preWorkDto.setYearProWorkDtoList(rateDtoList);
|
|
|
}
|
|
|
- dashBoardDTO.setYearPreWorkDtoList(preWorkDtoList);
|
|
|
+ return preWorkDto;
|
|
|
}
|
|
|
|
|
|
public List<Map<String, Object>> getCurrentYearData(List<String> dateStr, String dept) {
|
|
|
- String baseSql = "SELECT count(*) AS total FROM t_rypxcjb WHERE ji_hua_lei_xing_ = '岗前培训' AND shi_fou_guo_shen_ = '已结束' ";
|
|
|
+ String baseSql = "SELECT count(*) AS total FROM t_rypxcjb WHERE ji_hua_lei_xing_ = '岗前培训' AND shi_fou_guo_shen_ = '已结束' and di_dian_='"+getDiDian()+"'";
|
|
|
List<Map<String, Object>> list = new ArrayList<>();
|
|
|
int year = Year.now().getValue();
|
|
|
for (String date : dateStr) {
|
|
|
@@ -309,7 +338,7 @@ public class StatisticServiceImpl implements StatisticService {
|
|
|
}
|
|
|
|
|
|
public List<TrainRankDto> getUserTrainRank(String dept){
|
|
|
- String sql = "SELECT a.ren_yuan_id_ userId,e.NAME_ userName,a.rank from (select ren_yuan_id_,COUNT(ren_yuan_id_)as rank from t_qdxxb " +
|
|
|
+ String sql = "SELECT a.ren_yuan_id_ userId,e.NAME_ userName,a.rank as count from (select ren_yuan_id_,COUNT(ren_yuan_id_)as rank from t_qdxxb " +
|
|
|
"where guan_lian_id_ in(select id_ from t_rypxcjb where ji_hua_lei_xing_='在岗培训' and shi_fou_guo_shen_='已结束' " +
|
|
|
"and di_dian_='%s') GROUP BY guan_lian_id_,ren_yuan_id_) a ,ibps_party_employee e WHERE e.id_=a.ren_yuan_id_ ";
|
|
|
if (BeanUtils.isNotEmpty(dept)){
|
|
|
@@ -317,7 +346,18 @@ public class StatisticServiceImpl implements StatisticService {
|
|
|
}
|
|
|
sql = sql + " ORDER BY a.rank desc ";
|
|
|
sql = String.format(sql,getDiDian(),dept);
|
|
|
- return (List<TrainRankDto>) commonDao.query(sql);
|
|
|
+ List<Map<String,Object>> list = (List<Map<String, Object>>) commonDao.query(sql);
|
|
|
+ List<TrainRankDto> rankedResults = new ArrayList<>();
|
|
|
+ int rank = 1;
|
|
|
+ for (Map<String,Object> map : list) {
|
|
|
+ TrainRankDto dto = new TrainRankDto();
|
|
|
+ dto.setUserId(map.get("userId").toString());
|
|
|
+ dto.setUserName(map.get("userName").toString());
|
|
|
+ dto.setCount(Integer.parseInt(map.get("count").toString()));
|
|
|
+ dto.setRank(rank++);
|
|
|
+ rankedResults.add(dto);
|
|
|
+ }
|
|
|
+ return rankedResults;
|
|
|
}
|
|
|
|
|
|
public List<TraineeStatisticsDto> getYmdData(List<String> dateStr, String dept, String type, String year) {
|
|
|
@@ -353,7 +393,7 @@ public class StatisticServiceImpl implements StatisticService {
|
|
|
if (BeanUtils.isNotEmpty(dept)) {
|
|
|
dateCondition += String.format(" AND bian_zhi_bu_men_ = '%s'", dept);
|
|
|
}
|
|
|
-
|
|
|
+ dateCondition += String.format(" AND di_dian_ = '%s'", getDiDian());
|
|
|
String countSql = String.format(countSqlTemplate, dateCondition);
|
|
|
String realSql = String.format(realSqlTemplate, dateCondition);
|
|
|
|