20 changed files with 956 additions and 2 deletions
@ -0,0 +1,146 @@ |
|||
/** |
|||
* 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; |
|||
|
|||
|
|||
/** |
|||
* 网格开通情况 |
|||
* |
|||
* @author qu elink@elink-cn.com |
|||
* @since v1.0.0 2020-03-25 |
|||
*/ |
|||
@Data |
|||
public class MetaUserGridOpiningDTO implements Serializable { |
|||
|
|||
private static final long serialVersionUID = 1L; |
|||
|
|||
/** |
|||
* 主键 |
|||
*/ |
|||
private String id; |
|||
|
|||
/** |
|||
* 网格id |
|||
*/ |
|||
private Long gridId; |
|||
|
|||
/** |
|||
* 用户总数 |
|||
*/ |
|||
private String registerCount; |
|||
|
|||
/** |
|||
* 党员数 |
|||
*/ |
|||
private String partyCount; |
|||
|
|||
/** |
|||
* 已注册居民 |
|||
*/ |
|||
private String residentCount; |
|||
|
|||
/** |
|||
* 未注册居民 |
|||
*/ |
|||
private String unAuthorizedCount; |
|||
|
|||
/** |
|||
* 新闻发布数 |
|||
*/ |
|||
private String newsCount; |
|||
|
|||
/** |
|||
* 社群数 |
|||
*/ |
|||
private String communityCount; |
|||
|
|||
/** |
|||
* 群成员数 |
|||
*/ |
|||
private String communityMemberCount; |
|||
|
|||
/** |
|||
* 群话题数 |
|||
*/ |
|||
private String communityTopicCount; |
|||
|
|||
/** |
|||
* 议题总数 |
|||
*/ |
|||
private String eventCount; |
|||
|
|||
/** |
|||
* 项目数 |
|||
*/ |
|||
private String itemCount; |
|||
|
|||
/** |
|||
* 项目已解决数 |
|||
*/ |
|||
private String itemCloseCount; |
|||
|
|||
/** |
|||
* 好评数 |
|||
*/ |
|||
private String itemPraiseCount; |
|||
|
|||
/** |
|||
* 网格名称 |
|||
*/ |
|||
private String allDeptNames; |
|||
|
|||
/** |
|||
* 网格党建指导员姓名 |
|||
*/ |
|||
private String gridLeader; |
|||
|
|||
/** |
|||
* 删除标记 |
|||
*/ |
|||
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.MetaUserGridOpiningDTO; |
|||
import com.elink.esua.epdc.dto.user.result.GridOpeningResultDTO; |
|||
import com.elink.esua.epdc.modules.user.excel.MetaUserGridOpiningExcel; |
|||
import com.elink.esua.epdc.modules.user.service.MetaUserGridOpiningService; |
|||
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-25 |
|||
*/ |
|||
@RestController |
|||
@RequestMapping("metausergridopining") |
|||
public class MetaUserGridOpiningController { |
|||
|
|||
@Autowired |
|||
private MetaUserGridOpiningService metaUserGridOpiningService; |
|||
|
|||
@GetMapping("page") |
|||
public Result<PageData<MetaUserGridOpiningDTO>> page(@RequestParam Map<String, Object> params){ |
|||
PageData<MetaUserGridOpiningDTO> page = metaUserGridOpiningService.page(params); |
|||
return new Result<PageData<MetaUserGridOpiningDTO>>().ok(page); |
|||
} |
|||
|
|||
@GetMapping("{id}") |
|||
public Result<MetaUserGridOpiningDTO> get(@PathVariable("id") String id){ |
|||
MetaUserGridOpiningDTO data = metaUserGridOpiningService.get(id); |
|||
return new Result<MetaUserGridOpiningDTO>().ok(data); |
|||
} |
|||
|
|||
@PostMapping |
|||
public Result save(@RequestBody MetaUserGridOpiningDTO dto){ |
|||
//效验数据
|
|||
ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class); |
|||
metaUserGridOpiningService.save(dto); |
|||
return new Result(); |
|||
} |
|||
|
|||
@PutMapping |
|||
public Result update(@RequestBody MetaUserGridOpiningDTO dto){ |
|||
//效验数据
|
|||
ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class); |
|||
metaUserGridOpiningService.update(dto); |
|||
return new Result(); |
|||
} |
|||
|
|||
@DeleteMapping |
|||
public Result delete(@RequestBody String[] ids){ |
|||
//效验数据
|
|||
AssertUtils.isArrayEmpty(ids, "id"); |
|||
metaUserGridOpiningService.delete(ids); |
|||
return new Result(); |
|||
} |
|||
|
|||
@GetMapping("export") |
|||
public void export(@RequestParam Map<String, Object> params, HttpServletResponse response) throws Exception { |
|||
List<MetaUserGridOpiningDTO> list = metaUserGridOpiningService.list(params); |
|||
ExcelUtils.exportExcelToTarget(response, null, list, MetaUserGridOpiningExcel.class); |
|||
} |
|||
|
|||
/** |
|||
* @author: qushutong |
|||
* @Date: 2020/3/25 10:35 |
|||
* @Description: 临时表导入 |
|||
*/ |
|||
@GetMapping("tolead") |
|||
public Result<List<GridOpeningResultDTO>> tolead() { |
|||
return metaUserGridOpiningService.createUserAnalysisData(); |
|||
} |
|||
} |
|||
@ -0,0 +1,45 @@ |
|||
/** |
|||
* 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.commons.tools.page.PageData; |
|||
import com.elink.esua.epdc.modules.user.entity.MetaUserGridOpiningEntity; |
|||
import org.apache.ibatis.annotations.Mapper; |
|||
|
|||
import java.util.List; |
|||
import java.util.Map; |
|||
|
|||
/** |
|||
* 网格开通情况 |
|||
* |
|||
* @author qu elink@elink-cn.com |
|||
* @since v1.0.0 2020-03-25 |
|||
*/ |
|||
@Mapper |
|||
public interface MetaUserGridOpiningDao extends BaseDao<MetaUserGridOpiningEntity> { |
|||
|
|||
/*** |
|||
* 列表 |
|||
* @param params |
|||
* @return com.elink.esua.epdc.commons.tools.page.PageData<com.elink.esua.epdc.modules.user.entity.MetaUserGridOpiningEntity> |
|||
* @author qushutong |
|||
* @date 2020/3/25 17:30 |
|||
*/ |
|||
List<MetaUserGridOpiningEntity> pageselectListPage(Map<String,Object> params); |
|||
} |
|||
@ -0,0 +1,116 @@ |
|||
/** |
|||
* 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.util.Date; |
|||
|
|||
/** |
|||
* 网格开通情况 |
|||
* |
|||
* @author qu elink@elink-cn.com |
|||
* @since v1.0.0 2020-03-25 |
|||
*/ |
|||
@Data |
|||
@EqualsAndHashCode(callSuper=false) |
|||
@TableName("meta_epdc_user_grid_opining") |
|||
public class MetaUserGridOpiningEntity extends BaseEpdcEntity { |
|||
|
|||
private static final long serialVersionUID = 1L; |
|||
|
|||
/** |
|||
* 网格id |
|||
*/ |
|||
private Long gridId; |
|||
|
|||
/** |
|||
* 用户总数 |
|||
*/ |
|||
private String registerCount; |
|||
|
|||
/** |
|||
* 党员数 |
|||
*/ |
|||
private String partyCount; |
|||
|
|||
/** |
|||
* 已注册居民 |
|||
*/ |
|||
private String residentCount; |
|||
|
|||
/** |
|||
* 未注册居民 |
|||
*/ |
|||
private String unAuthorizedCount; |
|||
|
|||
/** |
|||
* 新闻发布数 |
|||
*/ |
|||
private String newsCount; |
|||
|
|||
/** |
|||
* 社群数 |
|||
*/ |
|||
private String communityCount; |
|||
|
|||
/** |
|||
* 群成员数 |
|||
*/ |
|||
private String communityMemberCount; |
|||
|
|||
/** |
|||
* 群话题数 |
|||
*/ |
|||
private String communityTopicCount; |
|||
|
|||
/** |
|||
* 议题总数 |
|||
*/ |
|||
private String eventCount; |
|||
|
|||
/** |
|||
* 项目数 |
|||
*/ |
|||
private String itemCount; |
|||
|
|||
/** |
|||
* 项目已解决数 |
|||
*/ |
|||
private String itemCloseCount; |
|||
|
|||
/** |
|||
* 好评数 |
|||
*/ |
|||
private String itemPraiseCount; |
|||
|
|||
/** |
|||
* 网格名称 |
|||
*/ |
|||
private String allDeptNames; |
|||
|
|||
/** |
|||
* 网格党建指导员姓名 |
|||
*/ |
|||
private String gridLeader; |
|||
|
|||
} |
|||
@ -0,0 +1,101 @@ |
|||
/** |
|||
* 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.util.Date; |
|||
|
|||
/** |
|||
* 网格开通情况 |
|||
* |
|||
* @author qu elink@elink-cn.com |
|||
* @since v1.0.0 2020-03-25 |
|||
*/ |
|||
@Data |
|||
public class MetaUserGridOpiningExcel { |
|||
|
|||
@Excel(name = "主键") |
|||
private String id; |
|||
|
|||
@Excel(name = "网格id") |
|||
private Long gridId; |
|||
|
|||
@Excel(name = "用户总数") |
|||
private String registerCount; |
|||
|
|||
@Excel(name = "党员数") |
|||
private String partyCount; |
|||
|
|||
@Excel(name = "已注册居民") |
|||
private String residentCount; |
|||
|
|||
@Excel(name = "未注册居民") |
|||
private String unAuthorizedCount; |
|||
|
|||
@Excel(name = "新闻发布数") |
|||
private String newsCount; |
|||
|
|||
@Excel(name = "社群数") |
|||
private String communityCount; |
|||
|
|||
@Excel(name = "群成员数") |
|||
private String communityMemberCount; |
|||
|
|||
@Excel(name = "群话题数") |
|||
private String communityTopicCount; |
|||
|
|||
@Excel(name = "议题总数") |
|||
private String eventCount; |
|||
|
|||
@Excel(name = "项目数") |
|||
private String itemCount; |
|||
|
|||
@Excel(name = "项目已解决数") |
|||
private String itemCloseCount; |
|||
|
|||
@Excel(name = "好评数") |
|||
private String itemPraiseCount; |
|||
|
|||
@Excel(name = "网格名称") |
|||
private String allDeptNames; |
|||
|
|||
@Excel(name = "网格党建指导员姓名") |
|||
private String gridLeader; |
|||
|
|||
@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,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.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.MetaUserGridOpiningDTO; |
|||
import com.elink.esua.epdc.modules.user.entity.MetaUserGridOpiningEntity; |
|||
|
|||
import java.util.List; |
|||
import java.util.Map; |
|||
|
|||
/** |
|||
* 网格开通情况 |
|||
* |
|||
* @author qu elink@elink-cn.com |
|||
* @since v1.0.0 2020-03-25 |
|||
*/ |
|||
public interface MetaUserGridOpiningService extends BaseService<MetaUserGridOpiningEntity> { |
|||
|
|||
/** |
|||
* 默认分页 |
|||
* |
|||
* @param params |
|||
* @return PageData<MetaUserGridOpiningDTO> |
|||
* @author generator |
|||
* @date 2020-03-25 |
|||
*/ |
|||
PageData<MetaUserGridOpiningDTO> page(Map<String, Object> params); |
|||
|
|||
/** |
|||
* 默认查询 |
|||
* |
|||
* @param params |
|||
* @return java.util.List<MetaUserGridOpiningDTO> |
|||
* @author generator |
|||
* @date 2020-03-25 |
|||
*/ |
|||
List<MetaUserGridOpiningDTO> list(Map<String, Object> params); |
|||
|
|||
/** |
|||
* 单条查询 |
|||
* |
|||
* @param id |
|||
* @return MetaUserGridOpiningDTO |
|||
* @author generator |
|||
* @date 2020-03-25 |
|||
*/ |
|||
MetaUserGridOpiningDTO get(String id); |
|||
|
|||
/** |
|||
* 默认保存 |
|||
* |
|||
* @param dto |
|||
* @return void |
|||
* @author generator |
|||
* @date 2020-03-25 |
|||
*/ |
|||
void save(MetaUserGridOpiningDTO dto); |
|||
|
|||
/** |
|||
* 默认更新 |
|||
* |
|||
* @param dto |
|||
* @return void |
|||
* @author generator |
|||
* @date 2020-03-25 |
|||
*/ |
|||
void update(MetaUserGridOpiningDTO dto); |
|||
|
|||
/** |
|||
* 批量删除 |
|||
* |
|||
* @param ids |
|||
* @return void |
|||
* @author generator |
|||
* @date 2020-03-25 |
|||
*/ |
|||
void delete(String[] ids); |
|||
|
|||
|
|||
|
|||
/*** |
|||
* 网格开通数据生成临时表导入 |
|||
* @param |
|||
* @return com.elink.esua.epdc.commons.tools.utils.Result |
|||
* @author qushutong |
|||
* @date 2020/3/25 10:42 |
|||
*/ |
|||
Result createUserAnalysisData(); |
|||
} |
|||
@ -0,0 +1,129 @@ |
|||
/** |
|||
* 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.baomidou.mybatisplus.extension.toolkit.SqlHelper; |
|||
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.LocalDateUtils; |
|||
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.MetaUserGridOpiningDTO; |
|||
import com.elink.esua.epdc.dto.user.result.GridOpeningResultDTO; |
|||
import com.elink.esua.epdc.modules.user.dao.MetaUserGridOpiningDao; |
|||
import com.elink.esua.epdc.modules.user.entity.MetaUserGridOpiningEntity; |
|||
import com.elink.esua.epdc.modules.user.service.MetaUserGridOpiningService; |
|||
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.text.SimpleDateFormat; |
|||
import java.util.*; |
|||
|
|||
/** |
|||
* 网格开通情况 |
|||
* |
|||
* @author qu elink@elink-cn.com |
|||
* @since v1.0.0 2020-03-25 |
|||
*/ |
|||
@Service |
|||
public class MetaUserGridOpiningServiceImpl extends BaseServiceImpl<MetaUserGridOpiningDao, MetaUserGridOpiningEntity> implements MetaUserGridOpiningService { |
|||
@Autowired |
|||
private UserAnalysisService userAnalysisService; |
|||
|
|||
@Override |
|||
@DataSource(name = DataSourceNames.TWELVE) |
|||
public PageData<MetaUserGridOpiningDTO> page(Map<String, Object> params) { |
|||
IPage<MetaUserGridOpiningEntity> page = baseDao.selectPage( |
|||
getPage(params, FieldConstant.CREATED_TIME, false), |
|||
getWrapper(params) |
|||
); |
|||
// 获取所有网格
|
|||
List<GridOpeningResultDTO> gridOpeningResultDTOS = userAnalysisService.selectListGridHasMaCode(params); |
|||
List<String> deptIdList = new ArrayList<>(); |
|||
for(GridOpeningResultDTO item:gridOpeningResultDTOS){ |
|||
deptIdList.add(item.getGridId()); |
|||
} |
|||
params.put("deptIdList",deptIdList); |
|||
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd"); |
|||
Calendar c = Calendar.getInstance(); |
|||
c.add(Calendar.DATE, -1); |
|||
Date createdTime = c.getTime(); |
|||
params.put("createdTime",format.format(createdTime)); |
|||
List<MetaUserGridOpiningEntity> metaUserGridOpiningEntityList = baseDao.pageselectListPage(params); |
|||
return getPageData(metaUserGridOpiningEntityList,page.getTotal(), MetaUserGridOpiningDTO.class); |
|||
} |
|||
|
|||
@Override |
|||
public List<MetaUserGridOpiningDTO> list(Map<String, Object> params) { |
|||
List<MetaUserGridOpiningEntity> entityList = baseDao.selectList(getWrapper(params)); |
|||
|
|||
return ConvertUtils.sourceToTarget(entityList, MetaUserGridOpiningDTO.class); |
|||
} |
|||
|
|||
private QueryWrapper<MetaUserGridOpiningEntity> getWrapper(Map<String, Object> params){ |
|||
String id = (String)params.get(FieldConstant.ID_HUMP); |
|||
|
|||
QueryWrapper<MetaUserGridOpiningEntity> wrapper = new QueryWrapper<>(); |
|||
wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id); |
|||
return wrapper; |
|||
} |
|||
|
|||
@Override |
|||
public MetaUserGridOpiningDTO get(String id) { |
|||
MetaUserGridOpiningEntity entity = baseDao.selectById(id); |
|||
return ConvertUtils.sourceToTarget(entity, MetaUserGridOpiningDTO.class); |
|||
} |
|||
|
|||
@Override |
|||
@Transactional(rollbackFor = Exception.class) |
|||
public void save(MetaUserGridOpiningDTO dto) { |
|||
MetaUserGridOpiningEntity entity = ConvertUtils.sourceToTarget(dto, MetaUserGridOpiningEntity.class); |
|||
insert(entity); |
|||
} |
|||
|
|||
@Override |
|||
@Transactional(rollbackFor = Exception.class) |
|||
public void update(MetaUserGridOpiningDTO dto) { |
|||
MetaUserGridOpiningEntity entity = ConvertUtils.sourceToTarget(dto, MetaUserGridOpiningEntity.class); |
|||
updateById(entity); |
|||
} |
|||
|
|||
@Override |
|||
@Transactional(rollbackFor = Exception.class) |
|||
public void delete(String[] ids) { |
|||
// 逻辑删除(@TableLogic 注解)
|
|||
baseDao.deleteBatchIds(Arrays.asList(ids)); |
|||
} |
|||
|
|||
|
|||
@Override |
|||
public Result createUserAnalysisData() { |
|||
List<GridOpeningResultDTO> list = userAnalysisService.listPageGridOpeningsForExport(new HashMap<>()); |
|||
List<MetaUserGridOpiningEntity> metaUserGridOpiningEntities = ConvertUtils.sourceToTarget(list, MetaUserGridOpiningEntity.class); |
|||
boolean b = insertBatch(metaUserGridOpiningEntities); |
|||
return b?new Result<>():new Result().error("录入失败"); |
|||
} |
|||
} |
|||
@ -0,0 +1,45 @@ |
|||
<?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.MetaUserGridOpiningDao"> |
|||
|
|||
<resultMap type="com.elink.esua.epdc.modules.user.entity.MetaUserGridOpiningEntity" id="metaUserGridOpiningMap"> |
|||
<result property="id" column="ID"/> |
|||
<result property="gridId" column="GRID_ID"/> |
|||
<result property="registerCount" column="REGISTER_COUNT"/> |
|||
<result property="partyCount" column="PARTY_COUNT"/> |
|||
<result property="residentCount" column="RESIDENT_COUNT"/> |
|||
<result property="unAuthorizedCount" column="UN_AUTHORIZED_COUNT"/> |
|||
<result property="newsCount" column="NEWS_COUNT"/> |
|||
<result property="communityCount" column="COMMUNITY_COUNT"/> |
|||
<result property="communityMemberCount" column="COMMUNITY_MEMBER_COUNT"/> |
|||
<result property="communityTopicCount" column="COMMUNITY_TOPIC_COUNT"/> |
|||
<result property="eventCount" column="EVENT_COUNT"/> |
|||
<result property="itemCount" column="ITEM_COUNT"/> |
|||
<result property="itemCloseCount" column="ITEM_CLOSE_COUNT"/> |
|||
<result property="itemPraiseCount" column="ITEM_PRAISE_COUNT"/> |
|||
<result property="allDeptNames" column="ALL_DEPT_NAMES"/> |
|||
<result property="gridLeader" column="GRID_LEADER"/> |
|||
<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> |
|||
<select id="pageselectListPage" resultMap="metaUserGridOpiningMap"> |
|||
SELECT |
|||
* |
|||
FROM |
|||
meta_epdc_user_grid_opining op |
|||
WHERE |
|||
del_flag = '0' |
|||
<if test="deptIdList!=null and deptIdList.size()>0"> |
|||
and op.GRID_ID in |
|||
<foreach collection="deptIdList" index="index" item="deptId" open="(" separator="," close=")"> |
|||
#{deptId} |
|||
</foreach> |
|||
</if> |
|||
</select> |
|||
|
|||
</mapper> |
|||
@ -0,0 +1,22 @@ |
|||
package com.elink.esua.epdc.feign; |
|||
|
|||
import com.elink.esua.epdc.commons.tools.utils.Result; |
|||
import org.springframework.web.bind.annotation.GetMapping; |
|||
|
|||
/** |
|||
* @author: qushutong |
|||
* @Date: 2020/3/25 10:20 |
|||
* @Description: 用户数据分析 |
|||
*/ |
|||
public interface UserFeignClint { |
|||
|
|||
/*** |
|||
* 生成用户分析数据导入临时表 |
|||
* @param |
|||
* @return void |
|||
* @author qushutong |
|||
* @date 2020/3/25 10:19 |
|||
*/ |
|||
@GetMapping("analysis/user/tolead") |
|||
Result createUserAnalysisData(); |
|||
} |
|||
@ -0,0 +1,19 @@ |
|||
package com.elink.esua.epdc.feign.fallback; |
|||
|
|||
import com.elink.esua.epdc.commons.tools.constant.ServiceConstant; |
|||
import com.elink.esua.epdc.commons.tools.utils.ModuleUtils; |
|||
import com.elink.esua.epdc.commons.tools.utils.Result; |
|||
import com.elink.esua.epdc.feign.UserFeignClint; |
|||
|
|||
/** |
|||
* @author: qushutong |
|||
* @Date: 2020/3/25 10:22 |
|||
* @Description: 用户数据分析 |
|||
*/ |
|||
public class UserFeignClintFallback implements UserFeignClint { |
|||
|
|||
@Override |
|||
public Result createUserAnalysisData() { |
|||
return ModuleUtils.feignConError(ServiceConstant.EPDC_ANALYSIS_SERVER, "createUserAnalysisData", ""); |
|||
} |
|||
} |
|||
@ -0,0 +1,19 @@ |
|||
package com.elink.esua.epdc.service; |
|||
|
|||
/** |
|||
* @author: qushutong |
|||
* @Date: 2020/3/25 10:18 |
|||
* @Description: 用户数据分析 |
|||
*/ |
|||
public interface ScheduleJobUserService { |
|||
|
|||
/*** |
|||
* 生成用户分析数据导入临时表 |
|||
* @param |
|||
* @return void |
|||
* @author qushutong |
|||
* @date 2020/3/25 10:19 |
|||
*/ |
|||
void createUserAnalysisData(); |
|||
|
|||
} |
|||
@ -0,0 +1,20 @@ |
|||
package com.elink.esua.epdc.service.impl; |
|||
|
|||
import com.elink.esua.epdc.feign.UserFeignClint; |
|||
import com.elink.esua.epdc.service.ScheduleJobUserService; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
|
|||
/** |
|||
* @author: qushutong |
|||
* @Date: 2020/3/25 10:15 |
|||
* @Description: 用户数据数据分析 |
|||
*/ |
|||
public class ScheduleJobUserServiceImpl implements ScheduleJobUserService { |
|||
@Autowired |
|||
private UserFeignClint userFeignClint; |
|||
|
|||
@Override |
|||
public void createUserAnalysisData() { |
|||
userFeignClint.createUserAnalysisData(); |
|||
} |
|||
} |
|||
@ -0,0 +1,18 @@ |
|||
package com.elink.esua.epdc.task.analysis; |
|||
|
|||
/** |
|||
* @author: qushutong |
|||
* @Date: 2020/3/25 10:04 |
|||
* @Description: 用户分析 |
|||
*/ |
|||
public interface UserAnalysisTask { |
|||
|
|||
/*** |
|||
* 网格开通情况 |
|||
* @param |
|||
* @return void |
|||
* @author qushutong |
|||
* @date 2020/3/25 10:11 |
|||
*/ |
|||
void run(); |
|||
} |
|||
@ -0,0 +1,21 @@ |
|||
package com.elink.esua.epdc.task.analysis; |
|||
|
|||
import com.elink.esua.epdc.service.ScheduleJobUserService; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.stereotype.Component; |
|||
|
|||
/** |
|||
* @author: qushutong |
|||
* @Date: 2020/3/25 10:12 |
|||
* @Description: |
|||
*/ |
|||
@Component("UserAnalysisTask") |
|||
public class UserAnalysisTaskImpl implements UserAnalysisTask { |
|||
@Autowired |
|||
private ScheduleJobUserService scheduleJobUserService; |
|||
|
|||
@Override |
|||
public void run() { |
|||
scheduleJobUserService.createUserAnalysisData(); |
|||
} |
|||
} |
|||
Loading…
Reference in new issue