12 changed files with 766 additions and 21 deletions
			
			
		| @ -0,0 +1,137 @@ | |||
| /** | |||
|  * Copyright 2018 人人开源 https://www.renren.io
 | |||
|  * <p> | |||
|  * This program is free software: you can redistribute it and/or modify | |||
|  * it under the terms of the GNU General Public License as published by | |||
|  * the Free Software Foundation, either version 3 of the License, or | |||
|  * (at your option) any later version. | |||
|  * <p> | |||
|  * This program is distributed in the hope that it will be useful, | |||
|  * but WITHOUT ANY WARRANTY; without even the implied warranty of | |||
|  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the | |||
|  * GNU General Public License for more details. | |||
|  * <p> | |||
|  * You should have received a copy of the GNU General Public License | |||
|  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 | |||
|  */ | |||
| 
 | |||
| package com.elink.esua.epdc.dto.user; | |||
| 
 | |||
| import java.io.Serializable; | |||
| import java.util.Date; | |||
| import lombok.Data; | |||
| 
 | |||
| import java.math.BigDecimal; | |||
| 
 | |||
| /** | |||
|  * 用户注册排行 | |||
|  * | |||
|  * @author qu elink@elink-cn.com | |||
|  * @since v1.0.0 2020-03-26 | |||
|  */ | |||
| @Data | |||
| public class MetaUserRegisterRankDTO implements Serializable { | |||
| 
 | |||
|     private static final long serialVersionUID = 1L; | |||
| 
 | |||
|     /** | |||
|      * 主键 | |||
|      */ | |||
| 	private String id; | |||
| 
 | |||
|     /** | |||
|      * 街道id | |||
|      */ | |||
| 	private String streetId; | |||
| 
 | |||
|     /** | |||
|      * 街道名称 | |||
|      */ | |||
| 	private String streetName; | |||
| 
 | |||
|     /** | |||
|      * 用户总数 | |||
|      */ | |||
| 	private Integer userCount; | |||
| 
 | |||
|     /** | |||
|      * 党员数 | |||
|      */ | |||
| 	private Integer partyMemberCount; | |||
| 
 | |||
|     /** | |||
|      * 已注册居民 | |||
|      */ | |||
| 	private Integer residentCount; | |||
| 
 | |||
|     /** | |||
|      * 为注册居民 | |||
|      */ | |||
| 	private Integer unAuthorizedCount; | |||
| 
 | |||
|     /** | |||
|      * 年龄超过50岁 | |||
|      */ | |||
| 	private Integer oldCount; | |||
| 
 | |||
|     /** | |||
|      * 老龄化比例 | |||
|      */ | |||
| 	private BigDecimal oldPercent; | |||
| 
 | |||
|     /** | |||
|      * 50岁以下用户数量 | |||
|      */ | |||
| 	private Integer youngCount; | |||
| 
 | |||
|     /** | |||
|      * 年轻化比例 | |||
|      */ | |||
| 	private BigDecimal youngPercent; | |||
| 
 | |||
|     /** | |||
|      * 男 | |||
|      */ | |||
| 	private Integer maleCount; | |||
| 
 | |||
|     /** | |||
|      * 女 | |||
|      */ | |||
| 	private Integer femaleCount; | |||
| 
 | |||
|     /** | |||
|      * 未知性别 | |||
|      */ | |||
| 	private Integer unknownSexCount; | |||
| 
 | |||
|     /** | |||
|      * 删除标记 | |||
|      */ | |||
| 	private String delFlag; | |||
| 
 | |||
|     /** | |||
|      * 乐观锁 | |||
|      */ | |||
| 	private Integer revision; | |||
| 
 | |||
|     /** | |||
|      * 创建人 | |||
|      */ | |||
| 	private String createdBy; | |||
| 
 | |||
|     /** | |||
|      * 注册时间 | |||
|      */ | |||
| 	private Date createdTime; | |||
| 
 | |||
|     /** | |||
|      * 更新人 | |||
|      */ | |||
| 	private String updatedBy; | |||
| 
 | |||
|     /** | |||
|      * 更新时间 | |||
|      */ | |||
| 	private Date updatedTime; | |||
| 
 | |||
| } | |||
| @ -0,0 +1,104 @@ | |||
| /** | |||
|  * Copyright 2018 人人开源 https://www.renren.io
 | |||
|  * <p> | |||
|  * This program is free software: you can redistribute it and/or modify | |||
|  * it under the terms of the GNU General Public License as published by | |||
|  * the Free Software Foundation, either version 3 of the License, or | |||
|  * (at your option) any later version. | |||
|  * <p> | |||
|  * This program is distributed in the hope that it will be useful, | |||
|  * but WITHOUT ANY WARRANTY; without even the implied warranty of | |||
|  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the | |||
|  * GNU General Public License for more details. | |||
|  * <p> | |||
|  * You should have received a copy of the GNU General Public License | |||
|  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 | |||
|  */ | |||
| 
 | |||
| package com.elink.esua.epdc.modules.user.controller; | |||
| 
 | |||
| import com.elink.esua.epdc.commons.tools.page.PageData; | |||
| import com.elink.esua.epdc.commons.tools.utils.ExcelUtils; | |||
| import com.elink.esua.epdc.commons.tools.utils.Result; | |||
| import com.elink.esua.epdc.commons.tools.validator.AssertUtils; | |||
| import com.elink.esua.epdc.commons.tools.validator.ValidatorUtils; | |||
| import com.elink.esua.epdc.commons.tools.validator.group.AddGroup; | |||
| import com.elink.esua.epdc.commons.tools.validator.group.UpdateGroup; | |||
| import com.elink.esua.epdc.commons.tools.validator.group.DefaultGroup; | |||
| import com.elink.esua.epdc.dto.user.MetaUserRegisterRankDTO; | |||
| import com.elink.esua.epdc.modules.user.excel.MetaUserRegisterRankExcel; | |||
| import com.elink.esua.epdc.modules.user.service.MetaUserRegisterRankService; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.web.bind.annotation.*; | |||
| 
 | |||
| import javax.servlet.http.HttpServletResponse; | |||
| import java.util.List; | |||
| import java.util.Map; | |||
| 
 | |||
| 
 | |||
| /** | |||
|  * 用户注册排行 | |||
|  * | |||
|  * @author qu elink@elink-cn.com | |||
|  * @since v1.0.0 2020-03-26 | |||
|  */ | |||
| @RestController | |||
| @RequestMapping("metauserregisterrank") | |||
| public class MetaUserRegisterRankController { | |||
|      | |||
|     @Autowired | |||
|     private MetaUserRegisterRankService metaUserRegisterRankService; | |||
| 
 | |||
|     @GetMapping("page") | |||
|     public Result<PageData<MetaUserRegisterRankDTO>> page(@RequestParam Map<String, Object> params){ | |||
|         PageData<MetaUserRegisterRankDTO> page = metaUserRegisterRankService.page(params); | |||
|         return new Result<PageData<MetaUserRegisterRankDTO>>().ok(page); | |||
|     } | |||
| 
 | |||
|     @GetMapping("{id}") | |||
|     public Result<MetaUserRegisterRankDTO> get(@PathVariable("id") String id){ | |||
|         MetaUserRegisterRankDTO data = metaUserRegisterRankService.get(id); | |||
|         return new Result<MetaUserRegisterRankDTO>().ok(data); | |||
|     } | |||
| 
 | |||
|     @PostMapping | |||
|     public Result save(@RequestBody MetaUserRegisterRankDTO dto){ | |||
|         //效验数据
 | |||
|         ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class); | |||
|         metaUserRegisterRankService.save(dto); | |||
|         return new Result(); | |||
|     } | |||
| 
 | |||
|     @PutMapping | |||
|     public Result update(@RequestBody MetaUserRegisterRankDTO dto){ | |||
|         //效验数据
 | |||
|         ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class); | |||
|         metaUserRegisterRankService.update(dto); | |||
|         return new Result(); | |||
|     } | |||
| 
 | |||
|     @DeleteMapping | |||
|     public Result delete(@RequestBody String[] ids){ | |||
|         //效验数据
 | |||
|         AssertUtils.isArrayEmpty(ids, "id"); | |||
|         metaUserRegisterRankService.delete(ids); | |||
|         return new Result(); | |||
|     } | |||
| 
 | |||
|     @GetMapping("export") | |||
|     public void export(@RequestParam Map<String, Object> params, HttpServletResponse response) throws Exception { | |||
|         List<MetaUserRegisterRankDTO> list = metaUserRegisterRankService.list(params); | |||
|         ExcelUtils.exportExcelToTarget(response, null, list, MetaUserRegisterRankExcel.class); | |||
|     } | |||
|     /*** | |||
|      * 定时任务用户注册排行导入数据 | |||
|      * @param | |||
|      * @return com.elink.esua.epdc.commons.tools.utils.Result | |||
|      * @author qushutong | |||
|      * @date 2020/3/26 13:44 | |||
|      */ | |||
|     @GetMapping("toLeadUserRegisterRandData") | |||
|     public Result toLeadUserRegisterRandData(){ | |||
|         return metaUserRegisterRankService.toLeadUserRegisterRandData(); | |||
|     } | |||
| } | |||
| @ -0,0 +1,33 @@ | |||
| /** | |||
|  * Copyright 2018 人人开源 https://www.renren.io
 | |||
|  * <p> | |||
|  * This program is free software: you can redistribute it and/or modify | |||
|  * it under the terms of the GNU General Public License as published by | |||
|  * the Free Software Foundation, either version 3 of the License, or | |||
|  * (at your option) any later version. | |||
|  * <p> | |||
|  * This program is distributed in the hope that it will be useful, | |||
|  * but WITHOUT ANY WARRANTY; without even the implied warranty of | |||
|  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the | |||
|  * GNU General Public License for more details. | |||
|  * <p> | |||
|  * You should have received a copy of the GNU General Public License | |||
|  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 | |||
|  */ | |||
| 
 | |||
| package com.elink.esua.epdc.modules.user.dao; | |||
| 
 | |||
| import com.elink.esua.epdc.commons.mybatis.dao.BaseDao; | |||
| import com.elink.esua.epdc.modules.user.entity.MetaUserRegisterRankEntity; | |||
| import org.apache.ibatis.annotations.Mapper; | |||
| 
 | |||
| /** | |||
|  * 用户注册排行 | |||
|  * | |||
|  * @author qu elink@elink-cn.com | |||
|  * @since v1.0.0 2020-03-26 | |||
|  */ | |||
| @Mapper | |||
| public interface MetaUserRegisterRankDao extends BaseDao<MetaUserRegisterRankEntity> { | |||
| 	 | |||
| } | |||
| @ -0,0 +1,107 @@ | |||
| /** | |||
|  * Copyright 2018 人人开源 https://www.renren.io
 | |||
|  * <p> | |||
|  * This program is free software: you can redistribute it and/or modify | |||
|  * it under the terms of the GNU General Public License as published by | |||
|  * the Free Software Foundation, either version 3 of the License, or | |||
|  * (at your option) any later version. | |||
|  * <p> | |||
|  * This program is distributed in the hope that it will be useful, | |||
|  * but WITHOUT ANY WARRANTY; without even the implied warranty of | |||
|  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the | |||
|  * GNU General Public License for more details. | |||
|  * <p> | |||
|  * You should have received a copy of the GNU General Public License | |||
|  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 | |||
|  */ | |||
| 
 | |||
| package com.elink.esua.epdc.modules.user.entity; | |||
| 
 | |||
| import com.baomidou.mybatisplus.annotation.TableName; | |||
| 
 | |||
| import com.elink.esua.epdc.commons.mybatis.entity.BaseEpdcEntity; | |||
| import lombok.Data; | |||
| import lombok.EqualsAndHashCode; | |||
| 
 | |||
| import java.math.BigDecimal; | |||
| import java.util.Date; | |||
| 
 | |||
| /** | |||
|  * 用户注册排行 | |||
|  * | |||
|  * @author qu elink@elink-cn.com | |||
|  * @since v1.0.0 2020-03-26 | |||
|  */ | |||
| @Data | |||
| @EqualsAndHashCode(callSuper=false) | |||
| @TableName("meta_epdc_user_register_rank") | |||
| public class MetaUserRegisterRankEntity extends BaseEpdcEntity { | |||
| 
 | |||
| 	private static final long serialVersionUID = 1L; | |||
| 
 | |||
|     /** | |||
|      * 街道id | |||
|      */ | |||
| 	private String streetId; | |||
| 
 | |||
|     /** | |||
|      * 街道名称 | |||
|      */ | |||
| 	private String streetName; | |||
| 
 | |||
|     /** | |||
|      * 用户总数 | |||
|      */ | |||
| 	private Integer userCount; | |||
| 
 | |||
|     /** | |||
|      * 党员数 | |||
|      */ | |||
| 	private Integer partyMemberCount; | |||
| 
 | |||
|     /** | |||
|      * 已注册居民 | |||
|      */ | |||
| 	private Integer residentCount; | |||
| 
 | |||
|     /** | |||
|      * 为注册居民 | |||
|      */ | |||
| 	private Integer unAuthorizedCount; | |||
| 
 | |||
|     /** | |||
|      * 年龄超过50岁 | |||
|      */ | |||
| 	private Integer oldCount; | |||
| 
 | |||
|     /** | |||
|      * 老龄化比例 | |||
|      */ | |||
| 	private BigDecimal oldPercent; | |||
| 
 | |||
|     /** | |||
|      * 50岁以下用户数量 | |||
|      */ | |||
| 	private Integer youngCount; | |||
| 
 | |||
|     /** | |||
|      * 年轻化比例 | |||
|      */ | |||
| 	private BigDecimal youngPercent; | |||
| 
 | |||
|     /** | |||
|      * 男 | |||
|      */ | |||
| 	private Integer maleCount; | |||
| 
 | |||
|     /** | |||
|      * 女 | |||
|      */ | |||
| 	private Integer femaleCount; | |||
| 
 | |||
|     /** | |||
|      * 未知性别 | |||
|      */ | |||
| 	private Integer unknownSexCount; | |||
| 
 | |||
| } | |||
| @ -0,0 +1,96 @@ | |||
| /** | |||
|  * Copyright 2018 人人开源 https://www.renren.io
 | |||
|  * <p> | |||
|  * This program is free software: you can redistribute it and/or modify | |||
|  * it under the terms of the GNU General Public License as published by | |||
|  * the Free Software Foundation, either version 3 of the License, or | |||
|  * (at your option) any later version. | |||
|  * <p> | |||
|  * This program is distributed in the hope that it will be useful, | |||
|  * but WITHOUT ANY WARRANTY; without even the implied warranty of | |||
|  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the | |||
|  * GNU General Public License for more details. | |||
|  * <p> | |||
|  * You should have received a copy of the GNU General Public License | |||
|  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 | |||
|  */ | |||
| 
 | |||
| package com.elink.esua.epdc.modules.user.excel; | |||
| 
 | |||
| import cn.afterturn.easypoi.excel.annotation.Excel; | |||
| import lombok.Data; | |||
| 
 | |||
| import java.math.BigDecimal; | |||
| import java.util.Date; | |||
| 
 | |||
| /** | |||
|  * 用户注册排行 | |||
|  * | |||
|  * @author qu elink@elink-cn.com | |||
|  * @since v1.0.0 2020-03-26 | |||
|  */ | |||
| @Data | |||
| public class MetaUserRegisterRankExcel { | |||
| 
 | |||
|     @Excel(name = "主键") | |||
|     private String id; | |||
| 
 | |||
|     @Excel(name = "街道id") | |||
|     private String streetId; | |||
| 
 | |||
|     @Excel(name = "街道名称") | |||
|     private String streetName; | |||
| 
 | |||
|     @Excel(name = "用户总数") | |||
|     private Integer userCount; | |||
| 
 | |||
|     @Excel(name = "党员数") | |||
|     private Integer partyMemberCount; | |||
| 
 | |||
|     @Excel(name = "已注册居民") | |||
|     private Integer residentCount; | |||
| 
 | |||
|     @Excel(name = "为注册居民") | |||
|     private Integer unAuthorizedCount; | |||
| 
 | |||
|     @Excel(name = "年龄超过50岁") | |||
|     private Integer oldCount; | |||
| 
 | |||
|     @Excel(name = "老龄化比例") | |||
|     private BigDecimal oldPercent; | |||
| 
 | |||
|     @Excel(name = "50岁以下用户数量") | |||
|     private Integer youngCount; | |||
| 
 | |||
|     @Excel(name = "年轻化比例") | |||
|     private BigDecimal youngPercent; | |||
| 
 | |||
|     @Excel(name = "男") | |||
|     private Integer maleCount; | |||
| 
 | |||
|     @Excel(name = "女") | |||
|     private Integer femaleCount; | |||
| 
 | |||
|     @Excel(name = "未知性别") | |||
|     private Integer unknownSexCount; | |||
| 
 | |||
|     @Excel(name = "删除标记") | |||
|     private String delFlag; | |||
| 
 | |||
|     @Excel(name = "乐观锁") | |||
|     private Integer revision; | |||
| 
 | |||
|     @Excel(name = "创建人") | |||
|     private String createdBy; | |||
| 
 | |||
|     @Excel(name = "注册时间") | |||
|     private Date createdTime; | |||
| 
 | |||
|     @Excel(name = "更新人") | |||
|     private String updatedBy; | |||
| 
 | |||
|     @Excel(name = "更新时间") | |||
|     private Date updatedTime; | |||
| 
 | |||
| 
 | |||
| } | |||
| @ -0,0 +1,105 @@ | |||
| /** | |||
|  * Copyright 2018 人人开源 https://www.renren.io
 | |||
|  * <p> | |||
|  * This program is free software: you can redistribute it and/or modify | |||
|  * it under the terms of the GNU General Public License as published by | |||
|  * the Free Software Foundation, either version 3 of the License, or | |||
|  * (at your option) any later version. | |||
|  * <p> | |||
|  * This program is distributed in the hope that it will be useful, | |||
|  * but WITHOUT ANY WARRANTY; without even the implied warranty of | |||
|  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the | |||
|  * GNU General Public License for more details. | |||
|  * <p> | |||
|  * You should have received a copy of the GNU General Public License | |||
|  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 | |||
|  */ | |||
| 
 | |||
| package com.elink.esua.epdc.modules.user.service; | |||
| 
 | |||
| import com.elink.esua.epdc.commons.mybatis.service.BaseService; | |||
| import com.elink.esua.epdc.commons.tools.page.PageData; | |||
| import com.elink.esua.epdc.commons.tools.utils.Result; | |||
| import com.elink.esua.epdc.dto.user.MetaUserRegisterRankDTO; | |||
| import com.elink.esua.epdc.modules.user.entity.MetaUserRegisterRankEntity; | |||
| 
 | |||
| import java.util.List; | |||
| import java.util.Map; | |||
| 
 | |||
| /** | |||
|  * 用户注册排行 | |||
|  * | |||
|  * @author qu elink@elink-cn.com | |||
|  * @since v1.0.0 2020-03-26 | |||
|  */ | |||
| public interface MetaUserRegisterRankService extends BaseService<MetaUserRegisterRankEntity> { | |||
| 
 | |||
|     /** | |||
|      * 默认分页 | |||
|      * | |||
|      * @param params | |||
|      * @return PageData<MetaUserRegisterRankDTO> | |||
|      * @author generator | |||
|      * @date 2020-03-26 | |||
|      */ | |||
|     PageData<MetaUserRegisterRankDTO> page(Map<String, Object> params); | |||
| 
 | |||
|     /** | |||
|      * 默认查询 | |||
|      * | |||
|      * @param params | |||
|      * @return java.util.List<MetaUserRegisterRankDTO> | |||
|      * @author generator | |||
|      * @date 2020-03-26 | |||
|      */ | |||
|     List<MetaUserRegisterRankDTO> list(Map<String, Object> params); | |||
| 
 | |||
|     /** | |||
|      * 单条查询 | |||
|      * | |||
|      * @param id | |||
|      * @return MetaUserRegisterRankDTO | |||
|      * @author generator | |||
|      * @date 2020-03-26 | |||
|      */ | |||
|     MetaUserRegisterRankDTO get(String id); | |||
| 
 | |||
|     /** | |||
|      * 默认保存 | |||
|      * | |||
|      * @param dto | |||
|      * @return void | |||
|      * @author generator | |||
|      * @date 2020-03-26 | |||
|      */ | |||
|     void save(MetaUserRegisterRankDTO dto); | |||
| 
 | |||
|     /** | |||
|      * 默认更新 | |||
|      * | |||
|      * @param dto | |||
|      * @return void | |||
|      * @author generator | |||
|      * @date 2020-03-26 | |||
|      */ | |||
|     void update(MetaUserRegisterRankDTO dto); | |||
| 
 | |||
|     /** | |||
|      * 批量删除 | |||
|      * | |||
|      * @param ids | |||
|      * @return void | |||
|      * @author generator | |||
|      * @date 2020-03-26 | |||
|      */ | |||
|     void delete(String[] ids); | |||
| 
 | |||
|     /*** | |||
|      * 导入用户注册排行 | |||
|      * @param | |||
|      * @return com.elink.esua.epdc.commons.tools.utils.Result | |||
|      * @author qushutong | |||
|      * @date 2020/3/26 13:26 | |||
|      */ | |||
|     Result toLeadUserRegisterRandData(); | |||
| } | |||
| @ -0,0 +1,118 @@ | |||
| /** | |||
|  * Copyright 2018 人人开源 https://www.renren.io
 | |||
|  * <p> | |||
|  * This program is free software: you can redistribute it and/or modify | |||
|  * it under the terms of the GNU General Public License as published by | |||
|  * the Free Software Foundation, either version 3 of the License, or | |||
|  * (at your option) any later version. | |||
|  * <p> | |||
|  * This program is distributed in the hope that it will be useful, | |||
|  * but WITHOUT ANY WARRANTY; without even the implied warranty of | |||
|  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the | |||
|  * GNU General Public License for more details. | |||
|  * <p> | |||
|  * You should have received a copy of the GNU General Public License | |||
|  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 | |||
|  */ | |||
| 
 | |||
| package com.elink.esua.epdc.modules.user.service.impl; | |||
| 
 | |||
| import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; | |||
| import com.baomidou.mybatisplus.core.metadata.IPage; | |||
| import com.elink.esua.epdc.commons.mybatis.service.impl.BaseServiceImpl; | |||
| import com.elink.esua.epdc.commons.tools.page.PageData; | |||
| import com.elink.esua.epdc.commons.tools.utils.ConvertUtils; | |||
| import com.elink.esua.epdc.commons.tools.constant.FieldConstant; | |||
| import com.elink.esua.epdc.commons.tools.utils.Result; | |||
| import com.elink.esua.epdc.datasources.DataSourceNames; | |||
| import com.elink.esua.epdc.datasources.annotation.DataSource; | |||
| import com.elink.esua.epdc.dto.user.MetaUserRegisterRankDTO; | |||
| import com.elink.esua.epdc.dto.user.result.UserDataRankResultDTO; | |||
| import com.elink.esua.epdc.modules.user.dao.MetaUserRegisterRankDao; | |||
| import com.elink.esua.epdc.modules.user.entity.MetaUserRegisterRankEntity; | |||
| import com.elink.esua.epdc.modules.user.service.MetaUserRegisterRankService; | |||
| import com.elink.esua.epdc.modules.user.service.UserAnalysisService; | |||
| import org.apache.commons.lang3.StringUtils; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.stereotype.Service; | |||
| import org.springframework.transaction.annotation.Transactional; | |||
| 
 | |||
| import java.util.Arrays; | |||
| import java.util.HashMap; | |||
| import java.util.List; | |||
| import java.util.Map; | |||
| 
 | |||
| /** | |||
|  * 用户注册排行 | |||
|  * | |||
|  * @author qu elink@elink-cn.com | |||
|  * @since v1.0.0 2020-03-26 | |||
|  */ | |||
| @Service | |||
| public class MetaUserRegisterRankServiceImpl extends BaseServiceImpl<MetaUserRegisterRankDao, MetaUserRegisterRankEntity> implements MetaUserRegisterRankService { | |||
| 
 | |||
|     @Autowired | |||
|     private UserAnalysisService userAnalysisService; | |||
|     @Override | |||
|     public PageData<MetaUserRegisterRankDTO> page(Map<String, Object> params) { | |||
|         IPage<MetaUserRegisterRankEntity> page = baseDao.selectPage( | |||
|                 getPage(params, FieldConstant.CREATED_TIME, false), | |||
|                 getWrapper(params) | |||
|         ); | |||
|         return getPageData(page, MetaUserRegisterRankDTO.class); | |||
|     } | |||
| 
 | |||
|     @Override | |||
|     public List<MetaUserRegisterRankDTO> list(Map<String, Object> params) { | |||
|         List<MetaUserRegisterRankEntity> entityList = baseDao.selectList(getWrapper(params)); | |||
| 
 | |||
|         return ConvertUtils.sourceToTarget(entityList, MetaUserRegisterRankDTO.class); | |||
|     } | |||
| 
 | |||
|     private QueryWrapper<MetaUserRegisterRankEntity> getWrapper(Map<String, Object> params){ | |||
|         String id = (String)params.get(FieldConstant.ID_HUMP); | |||
| 
 | |||
|         QueryWrapper<MetaUserRegisterRankEntity> wrapper = new QueryWrapper<>(); | |||
|         wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id); | |||
| 
 | |||
|         return wrapper; | |||
|     } | |||
| 
 | |||
|     @Override | |||
|     public MetaUserRegisterRankDTO get(String id) { | |||
|         MetaUserRegisterRankEntity entity = baseDao.selectById(id); | |||
|         return ConvertUtils.sourceToTarget(entity, MetaUserRegisterRankDTO.class); | |||
|     } | |||
| 
 | |||
|     @Override | |||
|     @Transactional(rollbackFor = Exception.class) | |||
|     public void save(MetaUserRegisterRankDTO dto) { | |||
|         MetaUserRegisterRankEntity entity = ConvertUtils.sourceToTarget(dto, MetaUserRegisterRankEntity.class); | |||
|         insert(entity); | |||
|     } | |||
| 
 | |||
|     @Override | |||
|     @Transactional(rollbackFor = Exception.class) | |||
|     public void update(MetaUserRegisterRankDTO dto) { | |||
|         MetaUserRegisterRankEntity entity = ConvertUtils.sourceToTarget(dto, MetaUserRegisterRankEntity.class); | |||
|         updateById(entity); | |||
|     } | |||
| 
 | |||
|     @Override | |||
|     @Transactional(rollbackFor = Exception.class) | |||
|     public void delete(String[] ids) { | |||
|         // 逻辑删除(@TableLogic 注解)
 | |||
|         baseDao.deleteBatchIds(Arrays.asList(ids)); | |||
|     } | |||
| 
 | |||
|     @Override | |||
|     @DataSource(name = DataSourceNames.TWELVE) | |||
|     public Result toLeadUserRegisterRandData() { | |||
|         // 获取导出数据
 | |||
|         List<UserDataRankResultDTO> toLeadUserRegisterRandData = userAnalysisService.getToLeadUserRegisterRandData(new HashMap<>()); | |||
|         // 导入数据
 | |||
|         List<MetaUserRegisterRankEntity> metaUserRegisterRankEntities = ConvertUtils.sourceToTarget(toLeadUserRegisterRandData, MetaUserRegisterRankEntity.class); | |||
|         return insertBatch(metaUserRegisterRankEntities) ? new Result():new Result().error("导入注册用户排行失败"); | |||
|     } | |||
| 
 | |||
| } | |||
| @ -0,0 +1,30 @@ | |||
| <?xml version="1.0" encoding="UTF-8"?> | |||
| <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | |||
| 
 | |||
| <mapper namespace="com.elink.esua.epdc.modules.user.dao.MetaUserRegisterRankDao"> | |||
| 
 | |||
|     <resultMap type="com.elink.esua.epdc.modules.user.entity.MetaUserRegisterRankEntity" id="metaUserRegisterRankMap"> | |||
|         <result property="id" column="ID"/> | |||
|         <result property="streetId" column="STREET_ID"/> | |||
|         <result property="streetName" column="STREET_NAME"/> | |||
|         <result property="userCount" column="USER_COUNT"/> | |||
|         <result property="partyMemberCount" column="PARTY_MEMBER_COUNT"/> | |||
|         <result property="residentCount" column="RESIDENT_COUNT"/> | |||
|         <result property="unAuthorizedCount" column="UN_AUTHORIZED_COUNT"/> | |||
|         <result property="oldCount" column="OLD_COUNT"/> | |||
|         <result property="oldPercent" column="OLD_PERCENT"/> | |||
|         <result property="youngCount" column="YOUNG_COUNT"/> | |||
|         <result property="youngPercent" column="YOUNG_PERCENT"/> | |||
|         <result property="maleCount" column="MALE_COUNT"/> | |||
|         <result property="femaleCount" column="FEMALE_COUNT"/> | |||
|         <result property="unknownSexCount" column="UNKNOWN_SEX_COUNT"/> | |||
|         <result property="delFlag" column="DEL_FLAG"/> | |||
|         <result property="revision" column="REVISION"/> | |||
|         <result property="createdBy" column="CREATED_BY"/> | |||
|         <result property="createdTime" column="CREATED_TIME"/> | |||
|         <result property="updatedBy" column="UPDATED_BY"/> | |||
|         <result property="updatedTime" column="UPDATED_TIME"/> | |||
|     </resultMap> | |||
| 
 | |||
| 
 | |||
| </mapper> | |||
					Loading…
					
					
				
		Reference in new issue