| | |
| | | import io.swagger.annotations.ApiParam; |
| | | import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; |
| | | import lombok.AllArgsConstructor; |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import javax.validation.Valid; |
| | | |
| | | import net.sourceforge.pinyin4j.PinyinHelper; |
| | | import net.sourceforge.pinyin4j.format.HanyuPinyinOutputFormat; |
| | | import net.sourceforge.pinyin4j.format.exception.BadHanyuPinyinOutputFormatCombination; |
| | | import org.springblade.core.mp.support.Condition; |
| | | import org.springblade.core.mp.support.Query; |
| | | import org.springblade.core.tool.api.R; |
| | |
| | | import org.springblade.modules.performance.vo.PerformanceVO; |
| | | import org.springblade.modules.performance.service.IPerformanceService; |
| | | import org.springblade.core.boot.ctrl.BladeController; |
| | | |
| | | import java.util.*; |
| | | |
| | | /** |
| | | * 保安员表现管理 |
| | |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 查询本年所有月份的表现差的数量 |
| | | * @return |
| | | */ |
| | | @GetMapping("/queryYearPer") |
| | | public R queryYearAlarm() { |
| | | Calendar cal = Calendar.getInstance(); |
| | | String year = String.valueOf(cal.get(Calendar.YEAR)); |
| | | Map<String, String> map = performanceService.queryYearPer(year); |
| | | map = (HashMap<String, String>) sortMapBykeyAsc(map) ;//key升序 |
| | | return R.data(map); |
| | | } |
| | | |
| | | //升序 |
| | | public static Map<String, String> sortMapBykeyAsc(Map<String, String> oriMap) { |
| | | Map<String, String> sortedMap = new LinkedHashMap<String, String>(); |
| | | try { |
| | | if (oriMap != null && !oriMap.isEmpty()) { |
| | | List<Map.Entry<String, String>> entryList = new ArrayList<Map.Entry<String, String>>(oriMap.entrySet()); |
| | | Collections.sort(entryList, |
| | | new Comparator<Map.Entry<String, String>>() { |
| | | public int compare(Map.Entry<String, String> entry2, |
| | | Map.Entry<String, String> entry1) { |
| | | int value2 = 0, value1 = 0; |
| | | try { |
| | | value2 = Integer.parseInt(entry1.getKey()); |
| | | value1 = Integer.parseInt(entry2.getKey()); |
| | | } catch (NumberFormatException e) { |
| | | value2 = 0; |
| | | value1 = 0; |
| | | } |
| | | return value1 - value2; |
| | | } |
| | | }); |
| | | Iterator<Map.Entry<String, String>> iter = entryList.iterator(); |
| | | Map.Entry<String, String> tmpEntry = null; |
| | | while (iter.hasNext()) { |
| | | tmpEntry = iter.next(); |
| | | sortedMap.put(tmpEntry.getKey(), tmpEntry.getValue()); |
| | | } |
| | | } |
| | | } catch (Exception e) { |
| | | } |
| | | return sortedMap; |
| | | } |
| | | |
| | | |
| | | } |