| | |
| | | */ |
| | | package org.springblade.modules.performance.controller; |
| | | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import io.swagger.annotations.ApiParam; |
| | | import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; |
| | | import lombok.AllArgsConstructor; |
| | | import javax.validation.Valid; |
| | | |
| | | import org.springblade.core.boot.ctrl.BladeController; |
| | | import org.springblade.core.mp.support.Condition; |
| | | import org.springblade.core.mp.support.Query; |
| | | import org.springblade.core.tool.api.R; |
| | | import org.springblade.core.tool.utils.Func; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import org.springblade.modules.performance.entity.Performance; |
| | | import org.springblade.modules.performance.vo.PerformanceVO; |
| | | import org.springblade.modules.performance.service.IPerformanceService; |
| | | import org.springblade.core.boot.ctrl.BladeController; |
| | | import org.springblade.modules.performance.vo.PerformanceVO; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.validation.Valid; |
| | | 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; |
| | | } |
| | | |
| | | |
| | | } |
| | |
| | | */ |
| | | package org.springblade.modules.performance.dto; |
| | | |
| | | import org.springblade.modules.performance.entity.Performance; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | import org.springblade.modules.performance.entity.Performance; |
| | | |
| | | /** |
| | | * 数据传输对象实体类 |
| | |
| | | */ |
| | | package org.springblade.modules.performance.entity; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import java.time.LocalDateTime; |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import java.io.Serializable; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | import org.springframework.format.annotation.DateTimeFormat; |
| | | |
| | | import java.io.Serializable; |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * 实体类 |
| | |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | private Integer id; |
| | | /** |
| | | * 保安人编码 |
| | | */ |
| | | @ApiModelProperty(value = "保安人编码") |
| | | @TableField("securityId") |
| | | * 保安人编码 |
| | | */ |
| | | @ApiModelProperty(value = "保安人编码") |
| | | @TableField("securityId") |
| | | private String securityid; |
| | | /** |
| | | * 工作态度 |
| | | */ |
| | | @ApiModelProperty(value = "工作态度") |
| | | @TableField("workingAttitude") |
| | | * 工作态度 |
| | | */ |
| | | @ApiModelProperty(value = "工作态度") |
| | | @TableField("workingAttitude") |
| | | private String workingattitude; |
| | | |
| | | /** |
| | | * 工作能力 |
| | | */ |
| | | @ApiModelProperty(value = "工作能力") |
| | | @TableField("workingAbility") |
| | | private String workingability; |
| | | /** |
| | | * 工作成效 |
| | | */ |
| | | @ApiModelProperty(value = "工作成效") |
| | | @TableField("Achievements") |
| | | * 工作成效 |
| | | */ |
| | | @ApiModelProperty(value = "工作成效") |
| | | @TableField("Achievements") |
| | | private String achievements; |
| | | /** |
| | | * 评分 |
| | | */ |
| | | @ApiModelProperty(value = "评分") |
| | | private String score; |
| | | * 评分 |
| | | */ |
| | | @ApiModelProperty(value = "评分") |
| | | private String score; |
| | | /** |
| | | * 时间 |
| | | */ |
| | | @ApiModelProperty(value = "时间") |
| | | private String time; |
| | | /** |
| | | * 租户ID |
| | | */ |
| | | @ApiModelProperty(value = "租户ID") |
| | | @TableField("tenantId") |
| | | private String tenantid; |
| | | * 时间 |
| | | */ |
| | | @ApiModelProperty(value = "时间") |
| | | @JsonFormat(pattern = "yyyy-MM-dd",timezone = "GMT+8") |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd") |
| | | private Date time; |
| | | private String departmentid; |
| | | |
| | | |
| | | } |
| | |
| | | */ |
| | | package org.springblade.modules.performance.mapper; |
| | | |
| | | import org.springblade.modules.performance.entity.Performance; |
| | | import org.springblade.modules.performance.vo.PerformanceVO; |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import org.springblade.modules.performance.entity.Performance; |
| | | import org.springblade.modules.performance.vo.PerformanceVO; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * Mapper 接口 |
| | |
| | | * @return |
| | | */ |
| | | List<PerformanceVO> selectPerformancePage(IPage page, PerformanceVO performance); |
| | | |
| | | Map<String, String> queryYearPer(String year); |
| | | } |
| | |
| | | <result column="Achievements" property="achievements"/> |
| | | <result column="score" property="score"/> |
| | | <result column="time" property="time"/> |
| | | <result column="tenantId" property="tenantid"/> |
| | | <result column="departmentid" property="departmentid"/> |
| | | </resultMap> |
| | | |
| | | |
| | | <select id="selectPerformancePage" resultMap="performanceResultMap"> |
| | | select * from sys_performance where is_deleted = 0 |
| | | select * from sys_performance |
| | | </select> |
| | | |
| | | |
| | | <!--查询本年所有月份的表现差的数量--> |
| | | <select id="queryYearPer" resultType="java.util.HashMap"> |
| | | SELECT COUNT |
| | | ( CASE WHEN MONTH ( s.time ) = 1 THEN s.score END ) AS '1', |
| | | COUNT ( CASE WHEN MONTH ( s.time ) = 2 THEN s.score END ) AS '2', |
| | | COUNT ( CASE WHEN MONTH ( s.time ) = 3 THEN s.score END ) AS '3', |
| | | COUNT ( CASE WHEN MONTH ( s.time ) = 4 THEN s.score END ) AS '4', |
| | | COUNT ( CASE WHEN MONTH ( s.time ) = 5 THEN s.score END ) AS '5', |
| | | COUNT ( CASE WHEN MONTH ( s.time ) = 6 THEN s.score END ) AS '6', |
| | | COUNT ( CASE WHEN MONTH ( s.time ) = 7 THEN s.score END ) AS '7', |
| | | COUNT ( CASE WHEN MONTH ( s.time ) = 8 THEN s.score END ) AS '8', |
| | | COUNT ( CASE WHEN MONTH ( s.time ) = 9 THEN s.score END ) AS '9', |
| | | COUNT ( CASE WHEN MONTH ( s.time ) = 10 THEN s.score END ) AS '10', |
| | | COUNT ( CASE WHEN MONTH ( s.time ) = 11 THEN s.score END ) AS '11', |
| | | COUNT (CASE WHEN MONTH ( s.time ) = 12 THEN s.score END ) AS '12' |
| | | FROM |
| | | sys_performance AS s |
| | | WHERE |
| | | YEAR ( s.time ) = #{year} AND score=3 |
| | | </select> |
| | | </mapper> |
| | |
| | | */ |
| | | package org.springblade.modules.performance.service; |
| | | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import org.springblade.modules.performance.entity.Performance; |
| | | import org.springblade.modules.performance.vo.PerformanceVO; |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * 服务类 |
| | |
| | | * @return |
| | | */ |
| | | IPage<PerformanceVO> selectPerformancePage(IPage<PerformanceVO> page, PerformanceVO performance); |
| | | |
| | | Map<String, String> queryYearPer(String year); |
| | | } |
| | |
| | | */ |
| | | package org.springblade.modules.performance.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import org.springblade.modules.performance.entity.Performance; |
| | | import org.springblade.modules.performance.vo.PerformanceVO; |
| | | import org.springblade.modules.performance.mapper.PerformanceMapper; |
| | | import org.springblade.modules.performance.service.IPerformanceService; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import org.springblade.modules.performance.vo.PerformanceVO; |
| | | import org.springframework.stereotype.Service; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * 服务实现类 |
| | |
| | | return page.setRecords(baseMapper.selectPerformancePage(page, performance)); |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public Map<String, String> queryYearPer(String year) { |
| | | return baseMapper.queryYearPer(year); |
| | | } |
| | | |
| | | } |
| | |
| | | */ |
| | | package org.springblade.modules.performance.vo; |
| | | |
| | | import org.springblade.modules.performance.entity.Performance; |
| | | import io.swagger.annotations.ApiModel; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | import io.swagger.annotations.ApiModel; |
| | | import org.springblade.modules.performance.entity.Performance; |
| | | |
| | | /** |
| | | * 视图实体类 |
| | |
| | | import org.springblade.core.launch.constant.AppConstant; |
| | | import org.springblade.core.mp.support.Condition; |
| | | import org.springblade.core.secure.BladeUser; |
| | | import org.springblade.core.secure.annotation.PreAuth; |
| | | import org.springblade.core.tenant.annotation.NonDS; |
| | | import org.springblade.core.tool.api.R; |
| | | import org.springblade.core.tool.constant.BladeConstant; |
| | | import org.springblade.core.tool.constant.RoleConstant; |
| | | import org.springblade.core.tool.support.Kv; |
| | | import org.springblade.core.tool.utils.Func; |
| | | import org.springblade.modules.system.entity.Dept; |
| | |
| | | @AllArgsConstructor |
| | | @RequestMapping(AppConstant.APPLICATION_SYSTEM_NAME + "/dept") |
| | | @Api(value = "部门", tags = "部门") |
| | | @PreAuth(RoleConstant.HAS_ROLE_ADMIN) |
| | | //@PreAuth(RoleConstant.HAS_ROLE_ADMIN) |
| | | public class DeptController extends BladeController { |
| | | |
| | | private final IDeptService deptService; |
| | |
| | | } |
| | | |
| | | /** |
| | | * 懒加载获取部门树形结构 |
| | | */ |
| | | @GetMapping("/lazy-trees") |
| | | @ApiOperation(value = "懒加载树形结构", notes = "树形结构") |
| | | public R<List<DeptVO>> lazyTrees() { |
| | | List<DeptVO> tree = deptService.lazyTrees(); |
| | | return R.data(tree); |
| | | } |
| | | |
| | | /** |
| | | * 新增或修改 |
| | | */ |
| | | @PostMapping("/submit") |
| | |
| | | List<DeptVO> lazyTree(String tenantId, Long parentId); |
| | | |
| | | /** |
| | | * 懒加载获取树形节点 |
| | | * |
| | | * @return |
| | | */ |
| | | List<DeptVO> lazyTrees(); |
| | | |
| | | /** |
| | | * 获取部门名 |
| | | * |
| | | * @param ids |
| | |
| | | */ |
| | | List<String> getDeptNames(Long[] ids); |
| | | |
| | | /** |
| | | * 分局树状信息 |
| | | * @return |
| | | */ |
| | | List<String> selectIn(); |
| | | List<Map<Object,String>> selectCount(String name); |
| | | List<Map<Object,String>> selectId(String id); |
| | | Map<Object,Integer> selectHold(String deptid); |
| | | |
| | | } |
| | |
| | | ORDER BY dept.sort |
| | | </select> |
| | | |
| | | |
| | | |
| | | <select id="lazyTrees" resultMap="treeNodeResultMap" > |
| | | SELECT |
| | | dept.id, |
| | | dept.parent_id, |
| | | dept.dept_name AS title, |
| | | dept.id AS "value", |
| | | dept.id AS "key", |
| | | ( |
| | | SELECT |
| | | CASE WHEN count(1) > 0 THEN 0 ELSE 1 END |
| | | FROM |
| | | blade_dept |
| | | WHERE |
| | | parent_id = dept.id and is_deleted = 0 |
| | | ) AS "has_children" |
| | | FROM |
| | | blade_dept dept WHERE ( |
| | | SELECT |
| | | CASE WHEN count(1) > 0 THEN 1 ELSE 0 END |
| | | FROM |
| | | blade_dept |
| | | WHERE |
| | | parent_id = dept.id and is_deleted = 0 |
| | | ) =1 |
| | | </select> |
| | | |
| | | <select id="getDeptNames" resultType="java.lang.String"> |
| | | SELECT |
| | | dept_name |
| | |
| | | and is_deleted = 0 |
| | | </select> |
| | | |
| | | <select id="selectIn" resultType="java.util.HashMap"> |
| | | SELECT |
| | | id, |
| | | dept_name |
| | | FROM |
| | | blade_dept |
| | | </select> |
| | | |
| | | <!--统计单位类型数量--> |
| | | <select id="selectCount" resultType="java.util.HashMap"> |
| | | SELECT dept.id as jurisdiction,dept.dept_name AS title FROM blade_dept dept WHERE dept.dept_name like concat(concat('%', #{name}),'%') |
| | | </select> |
| | | |
| | | <select id="selectHold" resultType="java.util.HashMap"> |
| | | SELECT |
| | | ISNULL(B.cz,0) as cz, |
| | | ISNULL(C.wcz,0) as wcz |
| | | FROM (SELECT jurisdiction FROM blade_user ) A |
| | | LEFT JOIN (SELECT COUNT(hold) as cz,jurisdiction FROM blade_user WHERE hold=0 GROUP BY jurisdiction ) B ON A.jurisdiction=B.jurisdiction |
| | | LEFT JOIN (SELECT COUNT(hold) as wcz,jurisdiction FROM blade_user WHERE hold=1 GROUP BY jurisdiction ) C ON A.jurisdiction=C.jurisdiction |
| | | WHERE A.jurisdiction=#{deptid} GROUP BY cz,wcz |
| | | </select> |
| | | |
| | | <!--查询部门下面的所有单位--> |
| | | <select id="selectId" resultType="java.util.HashMap"> |
| | | SELECT id FROM blade_dept WHERE parent_id =#{id} and is_deleted = 0 |
| | | </select> |
| | | |
| | | </mapper> |
| | |
| | | List<DeptVO> lazyTree(String tenantId, Long parentId); |
| | | |
| | | /** |
| | | * 懒加载获取树形节点 |
| | | * |
| | | * @return |
| | | */ |
| | | List<DeptVO> lazyTrees(); |
| | | |
| | | /** |
| | | * 获取部门ID |
| | | * |
| | | * @param tenantId |
| | |
| | | * @return |
| | | */ |
| | | List<DeptVO> search(String deptName, Long parentId); |
| | | |
| | | List<Map<Object,String>> selectCount(String name); |
| | | List<Map<Object,String>> selectId(String id); |
| | | Map<Object,Integer> selectHold(String deptid); |
| | | } |
| | |
| | | } |
| | | |
| | | @Override |
| | | public List<DeptVO> lazyTrees() { |
| | | return ForestNodeMerger.merge(baseMapper.lazyTrees()); |
| | | } |
| | | |
| | | @Override |
| | | public String getDeptIds(String tenantId, String deptNames) { |
| | | List<Dept> deptList = baseMapper.selectList(Wrappers.<Dept>query().lambda().eq(Dept::getTenantId, tenantId).in(Dept::getDeptName, Func.toStrList(deptNames))); |
| | | if (deptList != null && deptList.size() > 0) { |
| | |
| | | return DeptWrapper.build().listNodeVO(deptList); |
| | | } |
| | | |
| | | @Override |
| | | public List<Map<Object,String>> selectCount(String name) { |
| | | return baseMapper.selectCount(name); |
| | | } |
| | | |
| | | @Override |
| | | public List<Map<Object, String>> selectId(String id) { |
| | | return baseMapper.selectId(id); |
| | | } |
| | | |
| | | @Override |
| | | public Map<Object, Integer> selectHold(String deptid) { |
| | | return baseMapper.selectHold(deptid); |
| | | } |
| | | |
| | | } |