diff --git a/esua-epdc/epdc-module/epdc-analysis/epdc-analysis-client/src/main/java/com/elink/esua/epdc/dto/user/MetaUserPartyRankDTO.java b/esua-epdc/epdc-module/epdc-analysis/epdc-analysis-client/src/main/java/com/elink/esua/epdc/dto/user/MetaUserPartyRankDTO.java new file mode 100644 index 000000000..be8c514e5 --- /dev/null +++ b/esua-epdc/epdc-module/epdc-analysis/epdc-analysis-client/src/main/java/com/elink/esua/epdc/dto/user/MetaUserPartyRankDTO.java @@ -0,0 +1,127 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * 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. + *

+ * 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. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +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 MetaUserPartyRankDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 主键 + */ + private String id; + + /** + * 街道id + */ + private String streetId; + + /** + * 街道名称 + */ + private String streetName; + + /** + * 已注册党员数量(已认证) + */ + private Integer partyMemberCount; + + /** + * 年龄超过50岁党员数量 + */ + private Integer oldCount; + + /** + * 老龄化比例 + */ + private BigDecimal oldPercent; + + /** + * 年龄50岁以下的党员数量 + */ + private Integer youngCount; + + /** + * 年轻化比例 + */ + private BigDecimal youngPercent; + + /** + * 男 + */ + private Integer maleCount; + + /** + * 女 + */ + private Integer femaleCount; + + /** + * 未知性别 + */ + private Integer unknownSexCount; + + /** + * 党员认证失败数 + */ + private Integer partyAuthFailureCount; + + /** + * 删除标记 + */ + private String delFlag; + + /** + * 乐观锁 + */ + private Integer revision; + + /** + * 创建人 + */ + private String createdBy; + + /** + * 注册时间 + */ + private Date createdTime; + + /** + * 更新人 + */ + private String updatedBy; + + /** + * 更新时间 + */ + private Date updatedTime; + +} \ No newline at end of file diff --git a/esua-epdc/epdc-module/epdc-analysis/epdc-analysis-server/src/main/java/com/elink/esua/epdc/modules/user/controller/MetaUserPartyRankController.java b/esua-epdc/epdc-module/epdc-analysis/epdc-analysis-server/src/main/java/com/elink/esua/epdc/modules/user/controller/MetaUserPartyRankController.java new file mode 100644 index 000000000..75c5f3ed5 --- /dev/null +++ b/esua-epdc/epdc-module/epdc-analysis/epdc-analysis-server/src/main/java/com/elink/esua/epdc/modules/user/controller/MetaUserPartyRankController.java @@ -0,0 +1,94 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * 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. + *

+ * 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. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +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.MetaUserPartyRankDTO; +import com.elink.esua.epdc.modules.user.excel.MetaUserPartyRankExcel; +import com.elink.esua.epdc.modules.user.service.MetaUserPartyRankService; +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("metauserpartyrank") +public class MetaUserPartyRankController { + + @Autowired + private MetaUserPartyRankService metaUserPartyRankService; + + @GetMapping("page") + public Result> page(@RequestParam Map params){ + PageData page = metaUserPartyRankService.page(params); + return new Result>().ok(page); + } + + @GetMapping("{id}") + public Result get(@PathVariable("id") String id){ + MetaUserPartyRankDTO data = metaUserPartyRankService.get(id); + return new Result().ok(data); + } + + @PostMapping + public Result save(@RequestBody MetaUserPartyRankDTO dto){ + //效验数据 + ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class); + metaUserPartyRankService.save(dto); + return new Result(); + } + + @PutMapping + public Result update(@RequestBody MetaUserPartyRankDTO dto){ + //效验数据 + ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class); + metaUserPartyRankService.update(dto); + return new Result(); + } + + @DeleteMapping + public Result delete(@RequestBody String[] ids){ + //效验数据 + AssertUtils.isArrayEmpty(ids, "id"); + metaUserPartyRankService.delete(ids); + return new Result(); + } + + @GetMapping("export") + public void export(@RequestParam Map params, HttpServletResponse response) throws Exception { + List list = metaUserPartyRankService.list(params); + ExcelUtils.exportExcelToTarget(response, null, list, MetaUserPartyRankExcel.class); + } + +} \ No newline at end of file diff --git a/esua-epdc/epdc-module/epdc-analysis/epdc-analysis-server/src/main/java/com/elink/esua/epdc/modules/user/dao/MetaUserPartyRankDao.java b/esua-epdc/epdc-module/epdc-analysis/epdc-analysis-server/src/main/java/com/elink/esua/epdc/modules/user/dao/MetaUserPartyRankDao.java new file mode 100644 index 000000000..c712f2ccc --- /dev/null +++ b/esua-epdc/epdc-module/epdc-analysis/epdc-analysis-server/src/main/java/com/elink/esua/epdc/modules/user/dao/MetaUserPartyRankDao.java @@ -0,0 +1,32 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * 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. + *

+ * 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. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +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.MetaUserPartyRankEntity; +import org.apache.ibatis.annotations.Mapper; + +/** + * 党员排行 + * + * @author qu elink@elink-cn.com + * @since v1.0.0 2020-03-26 + */ +@Mapper +public interface MetaUserPartyRankDao extends BaseDao { + +} \ No newline at end of file diff --git a/esua-epdc/epdc-module/epdc-analysis/epdc-analysis-server/src/main/java/com/elink/esua/epdc/modules/user/entity/MetaUserPartyRankEntity.java b/esua-epdc/epdc-module/epdc-analysis/epdc-analysis-server/src/main/java/com/elink/esua/epdc/modules/user/entity/MetaUserPartyRankEntity.java new file mode 100644 index 000000000..eec5ce88e --- /dev/null +++ b/esua-epdc/epdc-module/epdc-analysis/epdc-analysis-server/src/main/java/com/elink/esua/epdc/modules/user/entity/MetaUserPartyRankEntity.java @@ -0,0 +1,97 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * 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. + *

+ * 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. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +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_party_rank") +public class MetaUserPartyRankEntity extends BaseEpdcEntity { + + private static final long serialVersionUID = 1L; + + /** + * 街道id + */ + private String streetId; + + /** + * 街道名称 + */ + private String streetName; + + /** + * 已注册党员数量(已认证) + */ + private Integer partyMemberCount; + + /** + * 年龄超过50岁党员数量 + */ + private Integer oldCount; + + /** + * 老龄化比例 + */ + private BigDecimal oldPercent; + + /** + * 年龄50岁以下的党员数量 + */ + private Integer youngCount; + + /** + * 年轻化比例 + */ + private BigDecimal youngPercent; + + /** + * 男 + */ + private Integer maleCount; + + /** + * 女 + */ + private Integer femaleCount; + + /** + * 未知性别 + */ + private Integer unknownSexCount; + + /** + * 党员认证失败数 + */ + private Integer partyAuthFailureCount; + +} \ No newline at end of file diff --git a/esua-epdc/epdc-module/epdc-analysis/epdc-analysis-server/src/main/java/com/elink/esua/epdc/modules/user/excel/MetaUserPartyRankExcel.java b/esua-epdc/epdc-module/epdc-analysis/epdc-analysis-server/src/main/java/com/elink/esua/epdc/modules/user/excel/MetaUserPartyRankExcel.java new file mode 100644 index 000000000..c312a5f13 --- /dev/null +++ b/esua-epdc/epdc-module/epdc-analysis/epdc-analysis-server/src/main/java/com/elink/esua/epdc/modules/user/excel/MetaUserPartyRankExcel.java @@ -0,0 +1,90 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * 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. + *

+ * 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. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +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 MetaUserPartyRankExcel { + + @Excel(name = "主键") + private String id; + + @Excel(name = "街道id") + private String streetId; + + @Excel(name = "街道名称") + private String streetName; + + @Excel(name = "已注册党员数量(已认证)") + private Integer partyMemberCount; + + @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 Integer partyAuthFailureCount; + + @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; + + +} \ No newline at end of file diff --git a/esua-epdc/epdc-module/epdc-analysis/epdc-analysis-server/src/main/java/com/elink/esua/epdc/modules/user/service/MetaUserPartyRankService.java b/esua-epdc/epdc-module/epdc-analysis/epdc-analysis-server/src/main/java/com/elink/esua/epdc/modules/user/service/MetaUserPartyRankService.java new file mode 100644 index 000000000..b73506c94 --- /dev/null +++ b/esua-epdc/epdc-module/epdc-analysis/epdc-analysis-server/src/main/java/com/elink/esua/epdc/modules/user/service/MetaUserPartyRankService.java @@ -0,0 +1,95 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * 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. + *

+ * 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. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +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.dto.user.MetaUserPartyRankDTO; +import com.elink.esua.epdc.modules.user.entity.MetaUserPartyRankEntity; + +import java.util.List; +import java.util.Map; + +/** + * 党员排行 + * + * @author qu elink@elink-cn.com + * @since v1.0.0 2020-03-26 + */ +public interface MetaUserPartyRankService extends BaseService { + + /** + * 默认分页 + * + * @param params + * @return PageData + * @author generator + * @date 2020-03-26 + */ + PageData page(Map params); + + /** + * 默认查询 + * + * @param params + * @return java.util.List + * @author generator + * @date 2020-03-26 + */ + List list(Map params); + + /** + * 单条查询 + * + * @param id + * @return MetaUserPartyRankDTO + * @author generator + * @date 2020-03-26 + */ + MetaUserPartyRankDTO get(String id); + + /** + * 默认保存 + * + * @param dto + * @return void + * @author generator + * @date 2020-03-26 + */ + void save(MetaUserPartyRankDTO dto); + + /** + * 默认更新 + * + * @param dto + * @return void + * @author generator + * @date 2020-03-26 + */ + void update(MetaUserPartyRankDTO dto); + + /** + * 批量删除 + * + * @param ids + * @return void + * @author generator + * @date 2020-03-26 + */ + void delete(String[] ids); +} \ No newline at end of file diff --git a/esua-epdc/epdc-module/epdc-analysis/epdc-analysis-server/src/main/java/com/elink/esua/epdc/modules/user/service/impl/MetaUserPartyRankServiceImpl.java b/esua-epdc/epdc-module/epdc-analysis/epdc-analysis-server/src/main/java/com/elink/esua/epdc/modules/user/service/impl/MetaUserPartyRankServiceImpl.java new file mode 100644 index 000000000..234128f01 --- /dev/null +++ b/esua-epdc/epdc-module/epdc-analysis/epdc-analysis-server/src/main/java/com/elink/esua/epdc/modules/user/service/impl/MetaUserPartyRankServiceImpl.java @@ -0,0 +1,101 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * 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. + *

+ * 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. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +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.dto.user.MetaUserPartyRankDTO; +import com.elink.esua.epdc.modules.user.dao.MetaUserPartyRankDao; +import com.elink.esua.epdc.modules.user.entity.MetaUserPartyRankEntity; +import com.elink.esua.epdc.modules.user.service.MetaUserPartyRankService; +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.List; +import java.util.Map; + +/** + * 党员排行 + * + * @author qu elink@elink-cn.com + * @since v1.0.0 2020-03-26 + */ +@Service +public class MetaUserPartyRankServiceImpl extends BaseServiceImpl implements MetaUserPartyRankService { + + + @Override + public PageData page(Map params) { + IPage page = baseDao.selectPage( + getPage(params, FieldConstant.CREATED_TIME, false), + getWrapper(params) + ); + return getPageData(page, MetaUserPartyRankDTO.class); + } + + @Override + public List list(Map params) { + List entityList = baseDao.selectList(getWrapper(params)); + + return ConvertUtils.sourceToTarget(entityList, MetaUserPartyRankDTO.class); + } + + private QueryWrapper getWrapper(Map params){ + String id = (String)params.get(FieldConstant.ID_HUMP); + + QueryWrapper wrapper = new QueryWrapper<>(); + wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id); + + return wrapper; + } + + @Override + public MetaUserPartyRankDTO get(String id) { + MetaUserPartyRankEntity entity = baseDao.selectById(id); + return ConvertUtils.sourceToTarget(entity, MetaUserPartyRankDTO.class); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void save(MetaUserPartyRankDTO dto) { + MetaUserPartyRankEntity entity = ConvertUtils.sourceToTarget(dto, MetaUserPartyRankEntity.class); + insert(entity); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void update(MetaUserPartyRankDTO dto) { + MetaUserPartyRankEntity entity = ConvertUtils.sourceToTarget(dto, MetaUserPartyRankEntity.class); + updateById(entity); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void delete(String[] ids) { + // 逻辑删除(@TableLogic 注解) + baseDao.deleteBatchIds(Arrays.asList(ids)); + } + +} \ No newline at end of file diff --git a/esua-epdc/epdc-module/epdc-analysis/epdc-analysis-server/src/main/resources/mapper/user/MetaUserPartyRankDao.xml b/esua-epdc/epdc-module/epdc-analysis/epdc-analysis-server/src/main/resources/mapper/user/MetaUserPartyRankDao.xml new file mode 100644 index 000000000..83cc9377a --- /dev/null +++ b/esua-epdc/epdc-module/epdc-analysis/epdc-analysis-server/src/main/resources/mapper/user/MetaUserPartyRankDao.xml @@ -0,0 +1,28 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file