| | |
| | | import oshi.driver.mac.net.NetStat; |
| | | |
| | | import javax.annotation.Resource; |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import java.math.BigDecimal; |
| | | import java.time.LocalDate; |
| | | import java.util.*; |
| | |
| | | |
| | | @ApiOperation(value = "定制推荐-2政策3公示",tags = {"web-首页"}) |
| | | @PostMapping(value = "/consultation/list") |
| | | public R<List<TConsultation>> consultationlist(@RequestParam Integer type,@RequestParam(required = false) Integer regionId) { |
| | | //获取当前登录人id |
| | | Long userId = tokenService.getLoginUser().getUserId(); |
| | | TUserChange one = changeService.lambdaQuery().eq(TUserChange::getUserId, userId).orderByDesc(TUserChange::getCreateTime).last("limit 1").one(); |
| | | public R<List<TConsultation>> consultationlist(@RequestParam Integer type, @RequestParam(required = false) Integer regionId, HttpServletRequest request) { |
| | | String token = request.getHeader("Authorization"); |
| | | TUserChange one =null; |
| | | if(StringUtils.isNotEmpty(token)){ |
| | | //获取当前登录人id |
| | | Long userId = tokenService.getLoginUser().getUserId(); |
| | | one = changeService.lambdaQuery().eq(TUserChange::getUserId, userId).orderByDesc(TUserChange::getCreateTime).last("limit 1").one(); |
| | | } |
| | | List<TConsultation> notices = new ArrayList<>(); |
| | | |
| | | if (type==1){ |
| | |
| | | .eq(TConsultation::getRegionId,tUserChangeDetail.getRegionId()) |
| | | .eq(TConsultation::getMajorId, tUserChangeDetail.getMajorId()) |
| | | .eq(TConsultation::getLevel, tUserChangeDetail.getLevelId()) |
| | | .eq(TConsultation::getIsRecommend,1) |
| | | .orderByDesc(TConsultation::getClassificationSort,TConsultation::getCreateTime).list(); |
| | | notices.addAll(list1); |
| | | } |
| | |
| | | List<Integer> regionIds = regions.stream().map(TRegion::getId).collect(Collectors.toList()); |
| | | List<TConsultation> list1 = consultationService.lambdaQuery().eq(TConsultation::getClassificationId,type) |
| | | .in(TConsultation::getRegionId,regionIds) |
| | | .eq(TConsultation::getIsRecommend,1) |
| | | .orderByDesc(TConsultation::getCreateTime,TConsultation::getClassificationSort).list(); |
| | | notices.addAll(list1); |
| | | notices.sort(Comparator.comparing(TConsultation::getCreateTime).reversed()); |
| | | } |
| | | List<TConsultation> list1 = consultationService.lambdaQuery().eq(TConsultation::getClassificationId,type).eq(TConsultation::getIsRecommend,1).last("ORDER BY RAND() LIMIT 16").list(); |
| | | notices.addAll(list1); |
| | | if (notices.size() > 16) { |
| | | // List<TConsultation> list1 = consultationService.lambdaQuery().eq(TConsultation::getClassificationId,type).eq(TConsultation::getIsRecommend,1).last("ORDER BY RAND() LIMIT 16").list(); |
| | | // notices.addAll(list1); |
| | | if (notices.size() > 2) { |
| | | // 只保留前 16 条记录 |
| | | notices = new ArrayList<>(notices.subList(0, 16)); |
| | | notices = new ArrayList<>(notices.subList(0, 2)); |
| | | } |
| | | }else { |
| | | if (one!=null){ |
| | |
| | | notices.addAll(list1); |
| | | notices.sort(Comparator.comparing(TConsultation::getCreateTime).reversed()); |
| | | } |
| | | List<TConsultation> list1 = consultationService.lambdaQuery().eq(TConsultation::getClassificationId,type).last("ORDER BY RAND() LIMIT 16").list(); |
| | | notices.addAll(list1); |
| | | if (notices.size() > 16) { |
| | | // List<TConsultation> list1 = consultationService.lambdaQuery().eq(TConsultation::getClassificationId,type).last("ORDER BY RAND() LIMIT 16").list(); |
| | | // notices.addAll(list1); |
| | | if (notices.size() > 2) { |
| | | // 只保留前 16 条记录 |
| | | notices = new ArrayList<>(notices.subList(0, 16)); |
| | | notices = new ArrayList<>(notices.subList(0, 2)); |
| | | } |
| | | } |
| | | return R.ok(notices); |
| | |
| | | "/web/region/tree", |
| | | "/t-index-menu/getByProvinceName/count", |
| | | "/t-index-menu/list", |
| | | "/t-order/export","/t-app-user/forget","/applet/forget","/applet/login","/applet/code/login","/t-app-user//regis","/common/send","/call-back/**","/login","/applet/queryProtocolConfigByType", "/register","/applet/getCode","/applet/loginCode","/applet/changepwd", "/captchaImage","/getCode","/loginCode","/operations/getBySingleNum/**", |
| | | "/t-order/export","/t-app-user/forget","/applet/forget","/applet/login","/applet/code/login","/t-app-user/regis", |
| | | "/common/send","/call-back/**","/login","/applet/queryProtocolConfigByType", "/register", |
| | | "/applet/getCode","/applet/loginCode","/applet/changepwd", "/captchaImage","/getCode","/loginCode", |
| | | "/operations/getBySingleNum/**","/t-index-menu/consultation/list", |
| | | "/user/getUserInfoByNumber/**").permitAll() |
| | | // 静态资源,可匿名访问 |
| | | .antMatchers(HttpMethod.GET, "/", "/*.html", "/**/*.html", "/**/*.css", "/**/*.js", "/profile/**").permitAll() |
| | |
| | | private String provinceName; |
| | | @TableField(exist = false) |
| | | private Long count; |
| | | |
| | | @TableField(exist = false) |
| | | private String address; |
| | | |
| | | |
| | | } |
| | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.ruoyi.system.domain.TRegion; |
| | | import com.ruoyi.system.dto.RegionDto; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | |
| | | import java.util.List; |
| | | |
| | |
| | | * @author luodangjia |
| | | * @since 2024-09-19 |
| | | */ |
| | | @Mapper |
| | | public interface TRegionMapper extends BaseMapper<TRegion> { |
| | | |
| | | List<RegionDto> regionTree(); |
| | |
| | | |
| | | import com.ruoyi.common.basic.PageInfo; |
| | | import com.ruoyi.common.core.domain.BasePage; |
| | | import com.ruoyi.system.domain.TRegion; |
| | | import com.ruoyi.system.domain.TTechnicalTitle; |
| | | import com.ruoyi.system.domain.TTitleMajor; |
| | | import com.ruoyi.system.mapper.TRegionMapper; |
| | | import com.ruoyi.system.mapper.TTechnicalTitleMapper; |
| | | import com.ruoyi.system.query.RegionQuery; |
| | | import com.ruoyi.system.service.TTechnicalTitleService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.Arrays; |
| | | import java.util.List; |
| | | |
| | | /** |
| | |
| | | @Service |
| | | public class TTechnicalTitleServiceImpl extends ServiceImpl<TTechnicalTitleMapper, TTechnicalTitle> implements TTechnicalTitleService { |
| | | |
| | | @Autowired |
| | | private TRegionMapper regionMapper; |
| | | |
| | | @Override |
| | | public PageInfo<TTechnicalTitle> pageList(RegionQuery regionQuery) { |
| | | PageInfo<TTechnicalTitle> pageInfo = new PageInfo<>(regionQuery.getPageNum(), regionQuery.getPageSize()); |
| | | List<TTechnicalTitle> list = this.baseMapper.pageList(regionQuery,pageInfo); |
| | | for (TTechnicalTitle tTechnicalTitle : list) { |
| | | List<TRegion> tRegions = regionMapper.selectBatchIds(Arrays.asList(tTechnicalTitle.getRegionIds().split(","))); |
| | | tRegions.stream().forEach(region -> region.setAddress(region.getProvinceName()+"-"+region.getName())); |
| | | tTechnicalTitle.setRegionNames(tRegions.stream().map(region -> region.getAddress()).reduce((a, b) -> a + "、" + b).get()); |
| | | } |
| | | pageInfo.setRecords(list); |
| | | return pageInfo; |
| | | } |
| | |
| | | |
| | | import com.ruoyi.common.basic.PageInfo; |
| | | import com.ruoyi.common.core.domain.BasePage; |
| | | import com.ruoyi.system.domain.TRegion; |
| | | import com.ruoyi.system.domain.TTechnicalTitle; |
| | | import com.ruoyi.system.domain.TTitleMajor; |
| | | import com.ruoyi.system.mapper.TRegionMapper; |
| | | import com.ruoyi.system.mapper.TTitleMajorMapper; |
| | | import com.ruoyi.system.service.TTitleMajorService; |
| | | import com.ruoyi.system.vo.SysUserVO; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.Arrays; |
| | | import java.util.List; |
| | | |
| | | /** |
| | |
| | | @Service |
| | | public class TTitleMajorServiceImpl extends ServiceImpl<TTitleMajorMapper, TTitleMajor> implements TTitleMajorService { |
| | | |
| | | @Autowired |
| | | private TRegionMapper regionMapper; |
| | | @Override |
| | | public PageInfo<TTitleMajor> pageList(BasePage basePage) { |
| | | PageInfo<TTitleMajor> pageInfo = new PageInfo<>(basePage.getPageNum(), basePage.getPageSize()); |
| | | List<TTitleMajor> list = this.baseMapper.pageList(pageInfo); |
| | | for (TTitleMajor titleMajor : list) { |
| | | List<TRegion> tRegions = regionMapper.selectBatchIds(Arrays.asList(titleMajor.getRegionIds().split(","))); |
| | | tRegions.stream().forEach(region -> region.setAddress(region.getProvinceName()+"-"+region.getName())); |
| | | titleMajor.setRegionNames(tRegions.stream().map(region -> region.getAddress()).reduce((a, b) -> a + "、" + b).get()); |
| | | } |
| | | pageInfo.setRecords(list); |
| | | return pageInfo; |
| | | } |