| | |
| | | package com.panzhihua.service_community.service.impl; |
| | | |
| | | import cn.hutool.core.collection.CollectionUtil; |
| | | import cn.hutool.core.collection.ListUtil; |
| | | import cn.hutool.core.util.PageUtil; |
| | | import cn.hutool.core.collection.CollUtil; |
| | |
| | | import com.panzhihua.common.model.dtos.neighbor.*; |
| | | import com.panzhihua.common.model.vos.PageVO; |
| | | import com.panzhihua.common.model.vos.R; |
| | | import com.panzhihua.common.model.vos.common.PbCheckUnitStatisticsVo; |
| | | import com.panzhihua.common.model.vos.neighbor.*; |
| | | import com.panzhihua.common.model.vos.user.AdministratorsUserVO; |
| | | import com.panzhihua.common.service.user.UserService; |
| | |
| | | |
| | | import javax.annotation.Resource; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.math.BigDecimal; |
| | | import java.text.DecimalFormat; |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | |
| | |
| | | @Override |
| | | public R serviceStatic(ServiceStaticDTO serviceStaticDTO) { |
| | | ServiceStaticsVO serviceStaticsVO = new ServiceStaticsVO(); |
| | | if (serviceStaticDTO.getCheckUnitId() != null) { |
| | | if (serviceStaticDTO.getCheckUnitId() != null) |
| | | { |
| | | //单位服务统计 |
| | | serviceStaticsVO = |
| | | this.baseMapper.selectStatsCheckUnit(serviceStaticDTO.getCheckUnitId(), serviceStaticDTO.getYear()); |
| | | serviceStaticsVO.setServiceDetailStaticsList(this.baseMapper.selectServiceDetailList(serviceStaticDTO.getCheckUnitId(), |
| | | serviceStaticDTO.getYear(), serviceStaticDTO.getServiceType())); |
| | | } else { |
| | | |
| | | List<ServiceDetailStaticsVO> serviceDetailStaticsVOList=this.baseMapper.selectServiceDetailList(serviceStaticDTO.getCheckUnitId(), |
| | | serviceStaticDTO.getYear(), serviceStaticDTO.getServiceType()); |
| | | |
| | | |
| | | if(serviceStaticDTO.getServiceType()==null || serviceStaticDTO.getServiceType()==1) |
| | | { |
| | | List<NewFightNeedProblemClaim> list=baseMapper.getNewServiceNum("",serviceStaticDTO.getCheckUnitId()+""); |
| | | if(list.size()>0) |
| | | { |
| | | //设置次数 |
| | | int timeNum=serviceStaticsVO.getTimes()+list.size(); |
| | | serviceStaticsVO.setTimes(timeNum); |
| | | //设置服务时间 |
| | | double hours=serviceStaticsVO.getHours(); |
| | | |
| | | for (NewFightNeedProblemClaim item:list) |
| | | { |
| | | ServiceDetailStaticsVO newItem=new ServiceDetailStaticsVO(); |
| | | |
| | | String Ltime=item.getServiceTime(); |
| | | if(!StringUtils.isEmpty(Ltime)) |
| | | { |
| | | double time=(Double.valueOf(Ltime)/3600000); |
| | | DecimalFormat df = new DecimalFormat("#.##"); |
| | | String formattedNumber = df.format(time); |
| | | double result = Double.parseDouble(formattedNumber); |
| | | |
| | | hours=hours+result; |
| | | |
| | | newItem.setServiceTime(result); |
| | | item.setServiceTime(result+""); |
| | | } |
| | | newItem.setIsNew("2"); |
| | | newItem.setServiceId(Long.valueOf(item.getTaskId())); |
| | | newItem.setServiceType(1); |
| | | newItem.setServiceAt(item.getCreationTime()); |
| | | serviceDetailStaticsVOList.add(newItem); |
| | | } |
| | | DecimalFormat df = new DecimalFormat("#.##"); |
| | | String formattedNumber = df.format(hours); |
| | | double result = Double.parseDouble(formattedNumber); |
| | | serviceStaticsVO.setHours(result); |
| | | } |
| | | } |
| | | serviceStaticsVO.setServiceDetailStaticsList(serviceDetailStaticsVOList); |
| | | } |
| | | else |
| | | { |
| | | //个人服务统计 |
| | | serviceStaticsVO = this.baseMapper.selectStatsUser(serviceStaticDTO.getPhone(), serviceStaticDTO.getYear()); |
| | | ComPbMemberDO comPbMemberDO = comPbMemberDAO.selectOne(new QueryWrapper<ComPbMemberDO>().lambda() |
| | | .eq(ComPbMemberDO::getPhone, serviceStaticDTO.getPhone()).last("limit 1")); |
| | |
| | | if (comPbMemberDO != null) { |
| | | checkUnitId = comPbMemberDO.getCheckUnitId(); |
| | | } |
| | | serviceStaticsVO.setServiceDetailStaticsList(this.baseMapper.selectServiceDetailListForPersonal(checkUnitId, serviceStaticDTO.getPhone(), |
| | | serviceStaticDTO.getYear(), serviceStaticDTO.getServiceType())); |
| | | |
| | | |
| | | List<ServiceDetailStaticsVO> serviceDetailStaticsVOList=this.baseMapper.selectServiceDetailListForPersonal(checkUnitId, serviceStaticDTO.getPhone(), |
| | | serviceStaticDTO.getYear(), serviceStaticDTO.getServiceType()); |
| | | |
| | | |
| | | if(serviceStaticDTO.getServiceType()==null || serviceStaticDTO.getServiceType()==1) |
| | | { |
| | | //获取新需求服务列表 |
| | | List<NewFightNeedProblemClaim> list=baseMapper.getNewServiceNum(serviceStaticDTO.getPhone(),""); |
| | | |
| | | if(list.size()>0) |
| | | { |
| | | //设置次数 |
| | | int timeNum=serviceStaticsVO.getTimes()+list.size(); |
| | | //设置服务时间 |
| | | double hours=serviceStaticsVO.getHours(); |
| | | serviceStaticsVO.setTimes(timeNum); |
| | | for (NewFightNeedProblemClaim item:list) |
| | | { |
| | | ServiceDetailStaticsVO newItem=new ServiceDetailStaticsVO(); |
| | | |
| | | String Ltime=item.getServiceTime(); |
| | | if(!StringUtils.isEmpty(Ltime)) |
| | | { |
| | | double time=(Double.valueOf(Ltime)/3600000); |
| | | DecimalFormat df = new DecimalFormat("#.##"); |
| | | String formattedNumber = df.format(time); |
| | | double result = Double.parseDouble(formattedNumber); |
| | | |
| | | hours=hours+result; |
| | | |
| | | newItem.setServiceTime(result); |
| | | item.setServiceTime(result+""); |
| | | } |
| | | newItem.setIsNew("2"); |
| | | newItem.setServiceId(Long.valueOf(item.getTaskId())); |
| | | newItem.setServiceType(1); |
| | | newItem.setServiceAt(item.getCreationTime()); |
| | | serviceDetailStaticsVOList.add(newItem); |
| | | } |
| | | |
| | | DecimalFormat df = new DecimalFormat("#.##"); |
| | | String formattedNumber = df.format(hours); |
| | | double result = Double.parseDouble(formattedNumber); |
| | | serviceStaticsVO.setHours(result); |
| | | } |
| | | } |
| | | |
| | | serviceStaticsVO.setServiceDetailStaticsList(serviceDetailStaticsVOList); |
| | | } |
| | | return R.ok(serviceStaticsVO); |
| | | } |
| | |
| | | } |
| | | activityVO.setUnitList(unitPage); |
| | | activityVO.setPartyMemberList(memberPage); |
| | | |
| | | //党员数据 聚合 |
| | | Map<String, Long> map = new HashMap<>(); |
| | | partyMemberAnalysisVOS.forEach(vo->{ |
| | | String name = vo.getBelongTo(); |
| | | Long time = Long.valueOf(vo.getServiceTime()); |
| | | if (map.containsKey(name)) { |
| | | time += map.get(name); |
| | | } |
| | | map.put(name, time); |
| | | }); |
| | | if(CollectionUtil.isNotEmpty(map)){ |
| | | List<PbCheckUnitStatisticsVo> list = new ArrayList<>(); |
| | | map.keySet().forEach(vo->{ |
| | | PbCheckUnitStatisticsVo dto = new PbCheckUnitStatisticsVo(); |
| | | dto.setBelongTo(vo); |
| | | dto.setServiceTime(map.get(vo)); |
| | | list.add(dto); |
| | | }); |
| | | activityVO.setGroupPartyCount(list); |
| | | } |
| | | return R.ok(activityVO); |
| | | |
| | | } |