huanghongfa
2021-07-05 2dcf4b9d75cc1b6613aea59cec4a0f9cc97f1c0e
springcloud_k8s_panzhihuazhihuishequ/service_grid/src/main/java/com/panzhihua/service_grid/service/impl/EventServiceImpl.java
@@ -14,7 +14,6 @@
import com.panzhihua.common.model.dtos.community.ComMngPopulationDTO;
import com.panzhihua.common.model.dtos.community.bigscreen.event.ScreenEventListDTO;
import com.panzhihua.common.model.dtos.grid.*;
import com.panzhihua.common.model.helper.AESUtil;
import com.panzhihua.common.model.vos.R;
import com.panzhihua.common.model.vos.community.ComActVO;
import com.panzhihua.common.model.vos.community.screen.event.EventListVO;
@@ -22,15 +21,14 @@
import com.panzhihua.common.model.vos.screen.*;
import com.panzhihua.common.service.community.CommunityService;
import com.panzhihua.common.utlis.DateUtils;
import com.panzhihua.common.utlis.ExcelSelectListUtil;
import com.panzhihua.common.utlis.LngLatUtils;
import com.panzhihua.common.utlis.StringUtils;
import com.panzhihua.service_grid.dao.*;
import com.panzhihua.service_grid.model.dos.*;
import com.panzhihua.service_grid.service.*;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
@@ -1737,7 +1735,11 @@
    public R getNearByGrid(PageEventGridNearbyDTO pageEventGridNearbyDTO) {
        Page page = new Page(pageEventGridNearbyDTO.getPageNum(), pageEventGridNearbyDTO.getPageSize());
        String latLng = pageEventGridNearbyDTO.getHappentLatLng();
        if(!latLng.matches("^[\\-\\+]?(0(\\.\\d{1,10})?|([1-9](\\d)?)(\\.\\d{1,10})?|1[0-7]\\d{1}(\\.\\d{1,10})?|180\\.0{1,10}),[\\-\\+]?((0|([1-8]\\d?))(\\.\\d{1,10})?|90(\\.0{1,10})?)$")){
//        if(!latLng.matches("^[\\-\\+]?(0(\\.\\d{1,10})?|([1-9](\\d)?)(\\.\\d{1,10})?|1[0-7]\\d{1}(\\.\\d{1,10})?|180\\.0{1,10}),[\\-\\+]?((0|([1-8]\\d?))(\\.\\d{1,10})?|90(\\.0{1,10})?)$")){
//            return R.fail("经纬度参数错误");
//        }
        //经纬度匹配规则:(短(纬度)在前长(经度)在后,不要擅自修改此规则,否则出现问题后果自负)
        if(!latLng.matches("[1-9][0-9](\\.[0-9]{1,6})?,[1-9][0-9]{2}(\\.[0-9]{1,6})?")){
            return R.fail("经纬度参数错误");
        }
        String latLngArr[] = latLng.split(",");
@@ -2195,7 +2197,12 @@
        IPage<EventSpecialPopulationVO> specialPopulationVOIPage = this.baseMapper.specialPopulationList(new Page(specialPopulationDTO.getPageNum(), specialPopulationDTO.getPageSize()), specialPopulationDTO);
        if(!specialPopulationVOIPage.getRecords().isEmpty()){
            specialPopulationVOIPage.getRecords().forEach(specialPopulation -> {
                specialPopulation.setAge(IdcardUtil.getAgeByIdCard(specialPopulation.getIdCard()));
                try {
                    Integer age = IdcardUtil.getAgeByIdCard(specialPopulation.getIdCard());
                    specialPopulation.setAge(age);
                }catch (Exception e){
                    log.error("身份证号码转换年龄失败,人员id:" + specialPopulation.getId());
                }
            });
        }
        return R.ok(specialPopulationVOIPage);
@@ -2207,6 +2214,7 @@
        List<EventDO> unEventList = baseMapper.selectList(
                new QueryWrapper<EventDO>()
                        .eq("upload", false)
                        .eq("event_process_status", 2)
        );
        unEventList.forEach(eventDO -> {
            eventDetailsVOList.add(eventDetails(eventDO.getId()).getData());
@@ -2237,14 +2245,14 @@
        if(!countMap.isEmpty()){
            workScreenVO.setResolvedNum(countMap.get("resolvedNum")== null ? 0L : Long.valueOf(countMap.get("resolvedNum").toString()));
            workScreenVO.setPendingNum(countMap.get("pendingNum")== null ? 0L : Long.valueOf(countMap.get("pendingNum").toString()));
            workScreenVO.setPropagandaNum(countMap.get("propagandaNum")== null ? 0L : Long.valueOf(countMap.get("propagandaNum").toString()));
            workScreenVO.setPropagandaNum(countMap.get("propagandaNum")== null ? 13L : Long.valueOf(countMap.get("propagandaNum").toString()));
            workScreenVO.setCurrentNum(countMap.get("currentNum")== null ? 0L : Long.valueOf(countMap.get("currentNum").toString()));
        }
        //计算处理时间消耗的时间
        DateScreenVO countAvg = this.eventMapper.countByAvgCommunityId(communityId);
        if(countAvg != null){
            int second = (int) (countAvg.getStartTime().getTime() - countAvg.getEndTime().getTime())/1000;
            int second = (int) (countAvg.getEndTime().getTime() - countAvg.getStartTime().getTime())/1000;
            if(second > 0){
                second = second/workScreenVO.getResolvedNum().intValue();
                workScreenVO.setAvgCost(second);
@@ -2286,10 +2294,10 @@
            DateTime endDay = DateUtil.endOfMonth(date);
            int m = DateUtil.month(endDay);
//            if(m == 0){
//                m = 11;
//            }
//            m--;
            m++;
            if(m == 12){
                m = 0;
            }
            int day = DateUtil.dayOfMonth(endDay);
            int half = day/2;
            String month = DateUtil.format(date,moth_format_str);
@@ -2309,9 +2317,10 @@
    }
    public static void main(String[] args) {
        EventServiceImpl service = new EventServiceImpl();
        List<EventWorkVO> list = service.listHalfYearByDyn();
        System.out.println(list);
        String content = "30,104";
        String re = "[1-9][0-9](\\.[0-9]{1,6})?,[1-9][0-9]{2}(\\.[0-9]{1,6})?";
        System.out.println(content.matches(re));
    }
}