| | |
| | | import com.whyc.dto.Response; |
| | | import com.whyc.pojo.FaultUpload; |
| | | import com.whyc.service.FaultUploadService; |
| | | import com.whyc.util.ActionUtil; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | |
| | | @ApiOperation(value = "列表分页-组内",notes = "包机组内成员可见") |
| | | public Response listPage(@RequestParam int pageNum,@RequestParam int pageSize, |
| | | @RequestBody FaultUpload upload){ |
| | | return service.listPage(pageNum, pageSize,upload); |
| | | int userId = ActionUtil.getUser().getUId().intValue(); |
| | | return service.listPage(pageNum, pageSize,upload,userId); |
| | | } |
| | | |
| | | @GetMapping("typeCount") |
| | | @ApiOperation(value = "隐患故障上报类型统计",notes = "timeType:不传-所有,1-本月,2-本季度,3-本年") |
| | | public Response getTypeCount(@RequestParam(required = false) Integer timeType){ |
| | | return service.getTypeCount(timeType); |
| | | int userId = ActionUtil.getUser().getUId().intValue(); |
| | | return service.getTypeCount(timeType,userId); |
| | | } |
| | | |
| | | @PostMapping("listPage2") |
| | | @ApiOperation(value = "列表分页-管理") |
| | | public Response listPage2(@RequestParam int pageNum,@RequestParam int pageSize, |
| | | @RequestBody FaultUpload upload){ |
| | | return service.listPage2(pageNum, pageSize,upload); |
| | | int userId = ActionUtil.getUser().getUId().intValue(); |
| | | return service.listPage2(pageNum, pageSize,upload,userId); |
| | | } |
| | | |
| | | @GetMapping("groupNameCount") |
| | | @ApiOperation(value = "隐患故障上报统计-管理",notes = "timeType:1-本月,2-本季度,3-本年") |
| | | public Response groupNameCount(@RequestParam int timeType){ |
| | | return service.groupNameCount(timeType); |
| | | int userId = ActionUtil.getUser().getUId().intValue(); |
| | | return service.groupNameCount(timeType,userId); |
| | | } |
| | | |
| | | @GetMapping("listOfLastPeriod") |
| | | @ApiOperation(value = "隐患故障上报进度-最近一周及最近一月-管理",notes = "type:1-最近一周,2-最近一月") |
| | | public Response getListOfLastPeriod(int type){ |
| | | return service.getListOfLastPeriod(type); |
| | | int userId = ActionUtil.getUser().getUId().intValue(); |
| | | return service.getListOfLastPeriod(type,userId); |
| | | } |
| | | |
| | | @GetMapping("myUploadStatusCount") |
| | | @ApiOperation(value = "我的隐患故障上报状态数量统计") |
| | | public Response getMyUploadStatusCount(){ |
| | | return service.getMyUploadStatusCount(); |
| | | int userId = ActionUtil.getUser().getUId().intValue(); |
| | | return service.getMyUploadStatusCount(userId); |
| | | } |
| | | |
| | | } |
| | |
| | | * 已审批,审批中,已撤销,已驳回 |
| | | * */ |
| | | @GetMapping("ownListPage") |
| | | @ApiOperation(value = "本人的单据列表分页",notes = "status传参:1-审批中,2-审批完成且通过,3-审批完成且驳回") |
| | | @ApiOperation(value = "本人的单据列表分页",notes = "status传参:0:全部,1-审批中,2-审批完成且通过,3-审批完成且驳回") |
| | | public Response<PageInfo<WorkflowMain>> ownListPage(int type,int status,int pageNum,int pageSize){ |
| | | int userId = ActionUtil.getUser().getUId().intValue(); |
| | | return service.ownListPage(userId,type,status,pageNum,pageSize); |
| | |
| | | * 放电计划临时表中存在: 待审核,待接单审核,已审核 |
| | | * */ |
| | | @GetMapping("receivedListPage") |
| | | @ApiOperation(value = "接收到的单据列表分页",notes = "status传参:1-待接单,6-待审核,5|8-已审核(通过|驳回)") |
| | | @ApiOperation(value = "接收到的单据列表分页",notes = "status传参:0-全部,1-待接单,6-待审核,5|8-已审核(通过|驳回)") |
| | | public Response<PageInfo<WorkflowMain>> getReceivedListPage(int type,int status,int pageNum,int pageSize){ |
| | | UserInf user = ActionUtil.getUser(); |
| | | return service.getReceivedListPage(type,status,user,pageNum,pageSize); |
| | |
| | | |
| | | List<UserInf> getUserListByRole(Set<Long> baoJiGroupIds, Integer role); |
| | | |
| | | List<BaoJiGroup> getGroupAndUserListWithDischargeFlag(); |
| | | } |
| | |
| | | private String confirmStartTime; |
| | | @TableField(exist = false) |
| | | private String confirmEndTime; |
| | | @TableField(exist = false) |
| | | private Integer totalNum; |
| | | @TableField(exist = false) |
| | | private Integer confirmedNum; |
| | | |
| | | public Integer getId() { |
| | | return id; |
| | |
| | | public void setConfirmEndTime(String confirmEndTime) { |
| | | this.confirmEndTime = confirmEndTime; |
| | | } |
| | | |
| | | public Integer getTotalNum() { |
| | | return totalNum; |
| | | } |
| | | |
| | | public void setTotalNum(Integer totalNum) { |
| | | this.totalNum = totalNum; |
| | | } |
| | | |
| | | public Integer getConfirmedNum() { |
| | | return confirmedNum; |
| | | } |
| | | |
| | | public void setConfirmedNum(Integer confirmedNum) { |
| | | this.confirmedNum = confirmedNum; |
| | | } |
| | | } |
| | |
| | | package com.whyc.service; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.whyc.mapper.BaoJiGroupUserMapper; |
| | | import com.whyc.mapper.UserInfMapper; |
| | | import com.whyc.pojo.BaoJiGroup; |
| | | import com.whyc.pojo.BaoJiGroupUser; |
| | | import com.whyc.pojo.UserInf; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.annotation.Resource; |
| | |
| | | public List<UserInf> getUserListByRole(Set<Long> baoJiGroupIds, Integer role) { |
| | | return mapper.getUserListByRole(baoJiGroupIds,role); |
| | | } |
| | | |
| | | public List<BaoJiGroup> getGroupAndUserListWithDischargeFlag() { |
| | | return mapper.getGroupAndUserListWithDischargeFlag(); |
| | | } |
| | | } |
| | |
| | | return new Response().setII(1,"确认完成"); |
| | | } |
| | | |
| | | public Response listPage(int pageNum, int pageSize, FaultUpload upload) { |
| | | public Response listPage(int pageNum, int pageSize, FaultUpload upload,int userId) { |
| | | PageHelper.startPage(pageNum,pageSize); |
| | | int userId = ActionUtil.getUser().getUId().intValue(); |
| | | List<FaultUpload> faultUploads = mapper.getList(userId,upload); |
| | | //联查拆分,组装 用户名 |
| | | List<UserInf> users = userService.getAll(); |
| | |
| | | return new Response().set(1,pageInfo); |
| | | } |
| | | |
| | | public Response listPage2(int pageNum, int pageSize, FaultUpload upload) { |
| | | public Response listPage2(int pageNum, int pageSize, FaultUpload upload, int userId) { |
| | | PageHelper.startPage(pageNum,pageSize); |
| | | int userId = ActionUtil.getUser().getUId().intValue(); |
| | | List<FaultUpload> faultUploads = mapper.getList2(userId,upload); |
| | | //联查拆分,组装 用户名 |
| | | List<UserInf> users = userService.getAll(); |
| | |
| | | return new Response().set(1,pageInfo); |
| | | } |
| | | |
| | | public Response getTypeCount(Integer timeType) { |
| | | int userId = ActionUtil.getUser().getUId().intValue(); |
| | | public Response getTypeCount(Integer timeType, int userId) { |
| | | FaultUpload upload = new FaultUpload(); |
| | | Date now = new Date(); |
| | | String uploadStartTime = null; |
| | |
| | | |
| | | } |
| | | |
| | | public Response groupNameCount(int timeType) { |
| | | int userId = ActionUtil.getUser().getUId().intValue(); |
| | | public Response groupNameCount(int timeType, int userId) { |
| | | FaultUpload upload = new FaultUpload(); |
| | | Date now = new Date(); |
| | | String uploadStartTime = null; |
| | |
| | | |
| | | } |
| | | |
| | | public Response getListOfLastPeriod(int type) { |
| | | int userId = ActionUtil.getUser().getUId().intValue(); |
| | | public Response getListOfLastPeriod(int type, int userId) { |
| | | FaultUpload upload = new FaultUpload(); |
| | | Date now = new Date(); |
| | | Calendar instance = Calendar.getInstance(); |
| | |
| | | return new Response().set(1,faultUploads); |
| | | } |
| | | |
| | | public Response getMyUploadStatusCount() { |
| | | public Response getMyUploadStatusCount(int userId) { |
| | | Map<String,Integer> map = new HashMap<>(); |
| | | int userId = ActionUtil.getUser().getUId().intValue(); |
| | | FaultUpload upload = new FaultUpload(); |
| | | List<FaultUpload> list = mapper.getList(userId, upload); |
| | | List<FaultUpload> confirmedList = list.stream().filter(temp -> temp.getStatus() == 1).collect(Collectors.toList()); |
| | |
| | | return new Response().set(1,map); |
| | | } |
| | | |
| | | public Response getUploadWithGroupName() { |
| | | Map<String,Integer> map = new HashMap<>(); |
| | | public Map<String,FaultUpload> getUploadWithGroupName() { |
| | | Map<String,FaultUpload> resMap = new HashMap<>(); |
| | | |
| | | int userId = ActionUtil.getUser().getUId().intValue(); |
| | | List<FaultUpload> list = mapper.getListWithGroupName(); |
| | | List<FaultUpload> confirmedList = list.stream().filter(temp -> temp.getStatus() == 1).collect(Collectors.toList()); |
| | | Map<String, List<FaultUpload>> userListMap = list.stream().collect(Collectors.groupingBy(FaultUpload::getUploadUserName)); |
| | | Set<String> userNameSet = userListMap.keySet(); |
| | | for (String userName : userNameSet) { |
| | | List<FaultUpload> faultUploads = userListMap.get(userName); |
| | | List<FaultUpload> confirmedList = faultUploads.stream().filter(temp -> temp.getStatus() == 1).collect(Collectors.toList()); |
| | | FaultUpload upload = new FaultUpload(); |
| | | upload.setTotalNum(faultUploads.size()); |
| | | upload.setConfirmedNum(confirmedList.size()); |
| | | upload.setGroupName(faultUploads.get(0).getGroupName()); |
| | | resMap.put(userName,upload); |
| | | } |
| | | |
| | | return null; |
| | | return resMap; |
| | | } |
| | | } |
| | |
| | | package com.whyc.service; |
| | | |
| | | import com.whyc.dto.KPIDetail; |
| | | import com.whyc.dto.Response; |
| | | import com.whyc.pojo.BaoJiGroup; |
| | | import com.whyc.pojo.BaoJiGroupUser; |
| | | import com.whyc.pojo.FaultUpload; |
| | | import com.whyc.pojo.UserInf; |
| | | import com.whyc.util.MathUtil; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.LinkedList; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.Set; |
| | | |
| | | @Service |
| | | public class KPIService { |
| | |
| | | @Autowired |
| | | private FaultUploadService uploadService; |
| | | |
| | | @Autowired |
| | | private BaoJiGroupUserService baoJiGroupUserService; |
| | | |
| | | |
| | | public Response annualDetail() { |
| | | //放电任务,班组 |
| | | Map<String, Map<String, Integer>> planCount = planService.getPlanCount(); |
| | | |
| | | //隐患故障上报,个人 |
| | | Response myUploadStatusCount = uploadService.getUploadWithGroupName(); |
| | | Map<String, FaultUpload> uploadWithGroupName = uploadService.getUploadWithGroupName(); |
| | | |
| | | //整理最终需要统计的所有用户及所属的包机组 |
| | | List<BaoJiGroup> baoJiGroupUserList = baoJiGroupUserService.getGroupAndUserListWithDischargeFlag(); |
| | | List<KPIDetail> kpiDetails = new LinkedList<>(); |
| | | for (BaoJiGroup baoJiGroup : baoJiGroupUserList) { |
| | | String baoJiGroupName = baoJiGroup.getBaoJiGroupName(); |
| | | List<UserInf> userList = baoJiGroup.getUserList(); |
| | | for (UserInf userInf : userList) { |
| | | KPIDetail detail = new KPIDetail(); |
| | | detail.setUserName(userInf.getUName()); |
| | | detail.setGroupName(baoJiGroupName); |
| | | kpiDetails.add(detail); |
| | | } |
| | | } |
| | | //数据接入,任务 |
| | | Set<String> groupNameSet = planCount.keySet(); |
| | | for (String groupName : groupNameSet) { |
| | | Map<String, Integer> map = planCount.get(groupName); |
| | | |
| | | for (KPIDetail kpiDetail : kpiDetails) { |
| | | if(kpiDetail.getGroupName().equals(groupName)){ |
| | | kpiDetail.setDischargePlanNumTotal(map.get("total")); |
| | | kpiDetail.setDischargePlanNumFinished(map.get("finishNum")); |
| | | /*//数据接入,故障 |
| | | String userName = kpiDetail.getUserName(); |
| | | FaultUpload upload = uploadWithGroupName.get(userName); |
| | | if(upload!=null){ |
| | | kpiDetail.setFaultUploadNumTotal(upload.getTotalNum()); |
| | | kpiDetail.setFaultUploadNumFinished(upload.getConfirmedNum()); |
| | | }*/ |
| | | } |
| | | } |
| | | } |
| | | //数据接入,故障 |
| | | Set<String> userNameSet = uploadWithGroupName.keySet(); |
| | | for (String userName : userNameSet) { |
| | | for (KPIDetail kpiDetail : kpiDetails) { |
| | | String userName2 = kpiDetail.getUserName(); |
| | | if(userName.equals(userName2)){ |
| | | FaultUpload upload = uploadWithGroupName.get(userName); |
| | | if(upload!=null){ |
| | | kpiDetail.setFaultUploadNumTotal(upload.getTotalNum()); |
| | | kpiDetail.setFaultUploadNumFinished(upload.getConfirmedNum()); |
| | | } |
| | | break; |
| | | } |
| | | } |
| | | } |
| | | |
| | | //个人考核得分 |
| | | for (KPIDetail kpiDetail : kpiDetails) { |
| | | Integer dischargePlanNumFinished = kpiDetail.getDischargePlanNumFinished(); |
| | | Integer dischargePlanNumTotal = kpiDetail.getDischargePlanNumTotal(); |
| | | |
| | | Integer faultUploadNumFinished = kpiDetail.getFaultUploadNumFinished(); |
| | | Integer faultUploadNumTotal = kpiDetail.getFaultUploadNumTotal(); |
| | | |
| | | String dischargePlanScoreStr = (String) MathUtil.divide(dischargePlanNumFinished, dischargePlanNumTotal, 2, 4); |
| | | float dischargePlanScore = Float.parseFloat(dischargePlanScoreStr); |
| | | |
| | | float faultUploadScore = faultUploadNumTotal * 0.3f + (Float) MathUtil.divide(faultUploadNumFinished, faultUploadNumTotal, 1, 3) * 70f; |
| | | |
| | | float personalScore = dischargePlanScore * 0.4f + faultUploadScore * 0.6f; |
| | | kpiDetail.setPersonalScore(personalScore); |
| | | |
| | | } |
| | | |
| | | |
| | | |
| | | return null; |
| | |
| | | |
| | | private List<WorkflowMain> getOwnListByUserAndType(int userId, int type, int status) { |
| | | QueryWrapper<WorkflowMain> query = Wrappers.query(); |
| | | query.eq("create_user_id",userId).eq("type",type).eq("status",status); |
| | | if(status == 0){ |
| | | query.eq("create_user_id",userId).eq("type",type); |
| | | }else { |
| | | query.eq("create_user_id", userId).eq("type", type).eq("status", status); |
| | | } |
| | | return mapper.selectList(query); |
| | | } |
| | | |
| | |
| | | bu.baoji_group_id = b.baoji_group_id |
| | | AND bu.uId = u.uId; |
| | | </select> |
| | | <select id="getGroupAndUserListWithDischargeFlag" resultMap="Map_Group"> |
| | | SELECT |
| | | bu.*, |
| | | b.baoji_group_name, |
| | | u.uName |
| | | FROM |
| | | db_user.tb_user_battgroup_baojigroup_usr bu, |
| | | db_user.tb_user_battgroup_baojigroup b, |
| | | db_user.tb_user_inf u |
| | | WHERE |
| | | bu.baoji_group_id = b.baoji_group_id |
| | | AND bu.uId = u.uId |
| | | AND b.discharge_plan_flag = 1 |
| | | </select> |
| | | <select id="getGroupListOfCurrentUser" resultMap="Map_Group"> |
| | | SELECT |
| | | bu.*, |
| | |
| | | </select> |
| | | <select id="getPlanCount" resultType="com.whyc.pojo.BattdischargePlan"> |
| | | SELECT |
| | | baoJiGroup.baoji_group_name,plan.* |
| | | distinct baoJiGroup.baoji_group_name,plan.* |
| | | FROM |
| | | web_site.tb_battdischarge_plan plan, |
| | | db_user.tb_user_battgroup_baojigroup_battgroup baoJiGroupBattGroup, |
| | | db_user.tb_user_battgroup_baojigroup baoJiGroup, |
| | | db_user.tb_user_battgroup_baojigroup_usr baoJiGroupUser |
| | | db_user.tb_user_battgroup_baojigroup baoJiGroup |
| | | WHERE |
| | | plan.battgroupid = baoJiGroupBattGroup.BattGroupId |
| | | AND baoJiGroupBattGroup.baoji_group_id = baoJiGroup.baoji_group_id |
| | | AND baoJiGroupBattGroup.baoji_group_id = baoJiGroupUser.baoji_group_id |
| | | AND baoJiGroupUser.uId = #{userId} |
| | | AND plan.BattGroupId in (select distinct db_battinf.tb_battinf.BattGroupId |
| | | from db_battinf.tb_battinf, |
| | | db_user.tb_user_battgroup_baojigroup_battgroup, |
| | | db_user.tb_user_battgroup_baojigroup_usr, |
| | | db_user.tb_user_inf |
| | | where db_user.tb_user_battgroup_baojigroup_battgroup.BattGroupId = |
| | | db_battinf.tb_battinf.BattGroupId |
| | | and db_user.tb_user_battgroup_baojigroup_usr.baoji_group_id = |
| | | db_user.tb_user_battgroup_baojigroup_battgroup.baoji_group_id |
| | | and db_user.tb_user_inf.uid = db_user.tb_user_battgroup_baojigroup_usr.uid |
| | | and db_user.tb_user_inf.uid = #{userId}) |
| | | </select> |
| | | |
| | | </mapper> |
| | |
| | | </select> |
| | | <select id="getReceivedListByUserAndType" resultMap="Map_WorkflowMain"> |
| | | <choose> |
| | | <!--全部--> |
| | | <when test="status==0"> |
| | | (SELECT m.*,<include refid="linkColumn" /> |
| | | FROM web_site.tb_workflow_main m,web_site.tb_workflow_link l |
| | | where m.id = l.main_id |
| | | and m.type = #{type} |
| | | and l.deal_role_id = #{user.uRole} |
| | | and l.deal_user_id is null |
| | | ) |
| | | union all |
| | | (SELECT m.*,<include refid="linkColumn" /> |
| | | FROM web_site.tb_workflow_main m,web_site.tb_workflow_link l |
| | | where m.id = l.main_id |
| | | and m.type = #{type} |
| | | and l.deal_user_id = #{user.uId} |
| | | ) |
| | | </when> |
| | | <!--待接单--> |
| | | <when test="status==1"> |
| | | SELECT m.*,<include refid="linkColumn" /> |