Browse Source

治理排行管理 - 目标管理功能开发

feature/dangjian
zhangyongzhangyong 6 years ago
parent
commit
d6b41b3aea
  1. 124
      esua-epdc/epdc-module/epdc-kpi/epdc-kpi-client/src/main/java/com/elink/esua/epdc/dto/StreetPersionGoalMonthDTO.java
  2. 134
      esua-epdc/epdc-module/epdc-kpi/epdc-kpi-server/src/main/java/com/elink/esua/epdc/controller/StreetPersionGoalMonthController.java
  3. 14
      esua-epdc/epdc-module/epdc-kpi/epdc-kpi-server/src/main/java/com/elink/esua/epdc/controller/StreetPersonBaseController.java
  4. 90
      esua-epdc/epdc-module/epdc-kpi/epdc-kpi-server/src/main/java/com/elink/esua/epdc/dao/StreetPersionGoalMonthDao.java
  5. 16
      esua-epdc/epdc-module/epdc-kpi/epdc-kpi-server/src/main/java/com/elink/esua/epdc/dao/StreetPersonBaseDao.java
  6. 71
      esua-epdc/epdc-module/epdc-kpi/epdc-kpi-server/src/main/java/com/elink/esua/epdc/entity/StreetPersionGoalMonthEntity.java
  7. 74
      esua-epdc/epdc-module/epdc-kpi/epdc-kpi-server/src/main/java/com/elink/esua/epdc/excel/StreetPersionGoalMonthExcel.java
  8. 47
      esua-epdc/epdc-module/epdc-kpi/epdc-kpi-server/src/main/java/com/elink/esua/epdc/redis/StreetPersionGoalMonthRedis.java
  9. 123
      esua-epdc/epdc-module/epdc-kpi/epdc-kpi-server/src/main/java/com/elink/esua/epdc/service/StreetPersionGoalMonthService.java
  10. 11
      esua-epdc/epdc-module/epdc-kpi/epdc-kpi-server/src/main/java/com/elink/esua/epdc/service/StreetPersonBaseService.java
  11. 194
      esua-epdc/epdc-module/epdc-kpi/epdc-kpi-server/src/main/java/com/elink/esua/epdc/service/impl/StreetPersionGoalMonthServiceImpl.java
  12. 7
      esua-epdc/epdc-module/epdc-kpi/epdc-kpi-server/src/main/java/com/elink/esua/epdc/service/impl/StreetPersonBaseServiceImpl.java
  13. 107
      esua-epdc/epdc-module/epdc-kpi/epdc-kpi-server/src/main/resources/mapper/StreetPersionGoalMonthDao.xml
  14. 10
      esua-epdc/epdc-module/epdc-kpi/epdc-kpi-server/src/main/resources/mapper/StreetPersonBaseDao.xml

124
esua-epdc/epdc-module/epdc-kpi/epdc-kpi-client/src/main/java/com/elink/esua/epdc/dto/StreetPersionGoalMonthDTO.java

@ -0,0 +1,124 @@
/**
* 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;
import java.io.Serializable;
import java.util.Date;
import java.util.List;
import lombok.Data;
/**
* 街道人员目标表
*
* @author zhangyong
* @since v1.0.0 2020-04-22
*/
@Data
public class StreetPersionGoalMonthDTO implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 主键
*/
private String id;
/**
* 街道
*/
private String street;
/**
* 街道ID
*/
private Long streetId;
/**
* 年月
*/
private String monthYear;
/**
* 群众目标数
*/
private Integer residentGoalNum;
/**
* 党员目标数
*/
private Integer partyGoalNum;
/**
* 企业目标数
*/
private Integer companyGoalNum;
/**
* 乐观锁
*/
private Integer revision;
/**
* 创建人
*/
private String createdBy;
/**
* 创建时间
*/
private Date createdTime;
/**
* 更新人
*/
private String updatedBy;
/**
* 更新时间
*/
private Date updatedTime;
/**
* 删除标记
*/
private String delFlag;
// 虚字段
/**
* 街道id集合
*/
private List<Long> streetIdList;
/**
* 本次要增加目标人数 的key确定要为那个目标增加人数
*/
private String personBasicNumberKey;
/**
* 本次要增加的目标人数
*/
private int goalNumber;
/**
* isDisabled = 1 页面按钮批量设置 不可使用0可使用
*/
private String isDisabled;
}

134
esua-epdc/epdc-module/epdc-kpi/epdc-kpi-server/src/main/java/com/elink/esua/epdc/controller/StreetPersionGoalMonthController.java

@ -0,0 +1,134 @@
/**
* 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.controller;
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.StreetPersionGoalMonthDTO;
import com.elink.esua.epdc.excel.StreetPersionGoalMonthExcel;
import com.elink.esua.epdc.service.StreetPersionGoalMonthService;
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 zhangyong
* @since v1.0.0 2020-04-22
*/
@RestController
@RequestMapping("streetpersiongoalmonth")
public class StreetPersionGoalMonthController {
@Autowired
private StreetPersionGoalMonthService streetPersionGoalMonthService;
@GetMapping("{id}")
public Result<StreetPersionGoalMonthDTO> get(@PathVariable("id") String id){
StreetPersionGoalMonthDTO data = streetPersionGoalMonthService.get(id);
return new Result<StreetPersionGoalMonthDTO>().ok(data);
}
/**
* @Description: 新增功能根据街道人员底数 * 目标比例 = 保存所有街道某个月的群众目标数党员目标数企业目标数
* @Description: 需要判断 所选月份目标数是否存在存在返回错误提示信息
* @Param: [dto]
* @return: com.elink.esua.epdc.commons.tools.utils.Result
* @Author: zy
* @Date: 2020-04-26
*/
@PostMapping
public Result save(@RequestBody StreetPersionGoalMonthDTO dto){
//效验数据
ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class);
return streetPersionGoalMonthService.save(dto);
}
@PutMapping
public Result update(@RequestBody StreetPersionGoalMonthDTO dto){
//效验数据
ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class);
streetPersionGoalMonthService.update(dto);
return new Result();
}
@DeleteMapping
public Result delete(@RequestBody String[] ids){
//效验数据
AssertUtils.isArrayEmpty(ids, "id");
streetPersionGoalMonthService.delete(ids);
return new Result();
}
@GetMapping("export")
public void export(@RequestParam Map<String, Object> params, HttpServletResponse response) throws Exception {
List<StreetPersionGoalMonthDTO> list = streetPersionGoalMonthService.list(params);
ExcelUtils.exportExcelToTarget(response, null, list, StreetPersionGoalMonthExcel.class);
}
/**
* @Description: 获取街道目标表的 街道名称
* @Param: []
* @return: java.util.List<com.elink.esua.epdc.dto.StreetPersionGoalMonthDTO>
* @Author: zy
* @Date: 2020-04-22
*/
@GetMapping("queryStreetGoalName")
public Result<List<StreetPersionGoalMonthDTO>> queryStreetGoalName(){
List<StreetPersionGoalMonthDTO> streetName = streetPersionGoalMonthService.lisStreetGoalName();
return new Result<List<StreetPersionGoalMonthDTO>>().ok(streetName);
}
/**
* @Description: 获取街道每月的目标数
* @Param: [params]
* @return: com.elink.esua.epdc.commons.tools.utils.Result<com.elink.esua.epdc.commons.tools.page.PageData<com.elink.esua.epdc.dto.StreetPersionGoalMonthDTO>>
* @Author: zy
* @Date: 2020-04-24
*/
@GetMapping("streetGoalScore")
public Result<List<Map<String,String>>> streetGoalScore(@RequestParam Map<String, Object> params){
List<Map<String,String>> page = streetPersionGoalMonthService.listStreetGoalScore();
return new Result<List<Map<String,String>>>().ok(page);
}
/**
* @Description: 修改街道某个目标数,根据日期和街道ID
* @Param: [dto]
* @return: com.elink.esua.epdc.commons.tools.utils.Result
* @Author: zy
* @Date: 2020-04-26
*/
@PostMapping("updateStreetGoalScore")
public Result updateStreetGoalScore(@RequestBody StreetPersionGoalMonthDTO dto){
//效验数据
ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class);
streetPersionGoalMonthService.modifyStreetGoalScore(dto);
return new Result();
}
}

14
esua-epdc/epdc-module/epdc-kpi/epdc-kpi-server/src/main/java/com/elink/esua/epdc/controller/StreetPersonBaseController.java

@ -39,7 +39,7 @@ import java.util.Map;
/**
* 街道人员底数表
*
* @author elink elink@elink-cn.com
* @author zhangyong
* @since v1.0.0 2020-04-13
*/
@RestController
@ -91,4 +91,16 @@ public class StreetPersonBaseController {
ExcelUtils.exportExcelToTarget(response, null, list, StreetPersonBaseExcel.class);
}
/**
* @Description: 根据单个街道ID查询街道群众党员企业 底数
* @Param: [streetId]
* @return: com.elink.esua.epdc.commons.tools.utils.Result<com.elink.esua.epdc.dto.StreetPersonBaseDTO>
* @Author: zy
* @Date: 2020-04-26
*/
@GetMapping("getStreetPersonBase/{streetId}")
public Result<StreetPersonBaseDTO> getStreetPersonBase(@PathVariable("streetId") String streetId){
StreetPersonBaseDTO data = streetPersonBaseService.getStreetPersonBase(streetId);
return new Result<StreetPersonBaseDTO>().ok(data);
}
}

90
esua-epdc/epdc-module/epdc-kpi/epdc-kpi-server/src/main/java/com/elink/esua/epdc/dao/StreetPersionGoalMonthDao.java

@ -0,0 +1,90 @@
/**
* 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.dao;
import com.elink.esua.epdc.commons.mybatis.dao.BaseDao;
import com.elink.esua.epdc.dto.StreetPersionGoalMonthDTO;
import com.elink.esua.epdc.dto.StreetPersonBaseDTO;
import com.elink.esua.epdc.entity.StreetPersionGoalMonthEntity;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
/**
* 街道人员目标表
*
* @author zhangyong
* @since v1.0.0 2020-04-22
*/
@Mapper
public interface StreetPersionGoalMonthDao extends BaseDao<StreetPersionGoalMonthEntity> {
/**
* @Description: 获取街道目标表的 街道名称
* @Param: []
* @return: java.util.List<com.elink.esua.epdc.dto.StreetPersionGoalMonthDTO>
* @Author: zy
* @Date: 2020-04-22
*/
List<StreetPersionGoalMonthDTO> selectListStreetGoalName();
/**
* @Description: 获取街道目标表的 街道目标分数街道ID日期
* @Param:
* @return: java.util.List<com.elink.esua.epdc.dto.StreetPersionGoalMonthDTO>
* @Author: zy
* @Date: 2020-04-22
*/
List<StreetPersionGoalMonthDTO> selectListStreetGoalScore();
/**
* @Description: 判断所选月份 是否存在 目标数
* @Param: [dto]
* @return: int
* @Author: zy
* @Date: 2020-04-26
*/
int checkTheGoalOfStreetThisMonth(StreetPersionGoalMonthDTO dto);
/**
* @Description: 修改街道目标数
* @Param: [dto]
* @return: void
* @Author: zy
* @Date: 2020-04-26
*/
void updateStreetGoalScore(StreetPersionGoalMonthDTO dto);
/**
* @Description: 获取全部的街道街道id群众党员企业 底数
* @Param: []
* @return: java.util.List<com.elink.esua.epdc.dto.StreetPersonBaseDTO>
* @Author: zy
* @Date: 2020-04-26
*/
List<StreetPersonBaseDTO> selectListStreetPersonBase();
/**
* @Description: 根据街道id月份 查询街道目标表的主键ID
* @Param: [entity]
* @return: java.lang.String
* @Author: zy
* @Date: 2020-04-27
*/
String selectOneStreetGoalId(StreetPersionGoalMonthEntity entity);
}

16
esua-epdc/epdc-module/epdc-kpi/epdc-kpi-server/src/main/java/com/elink/esua/epdc/dao/StreetPersonBaseDao.java

@ -18,16 +18,28 @@
package com.elink.esua.epdc.dao;
import com.elink.esua.epdc.commons.mybatis.dao.BaseDao;
import com.elink.esua.epdc.dto.StreetPersonBaseDTO;
import com.elink.esua.epdc.entity.StreetPersonBaseEntity;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
import java.awt.*;
/**
* 街道人员底数表
*
* @author elink elink@elink-cn.com
* @author zhangyong
* @since v1.0.0 2020-04-13
*/
@Mapper
public interface StreetPersonBaseDao extends BaseDao<StreetPersonBaseEntity> {
/**
* @Description: 根据单个街道ID查询街道群众党员企业 底数
* @Param: [streetId]
* @return: com.elink.esua.epdc.dto.StreetPersonBaseDTO
* @Author: zy
* @Date: 2020-04-26
*/
StreetPersonBaseDTO selectOneStreetPersonBase(String streetId);
}

71
esua-epdc/epdc-module/epdc-kpi/epdc-kpi-server/src/main/java/com/elink/esua/epdc/entity/StreetPersionGoalMonthEntity.java

@ -0,0 +1,71 @@
/**
* 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.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 zhangyong
* @since v1.0.0 2020-04-22
*/
@Data
@EqualsAndHashCode(callSuper=false)
@TableName("epdc_street_persion_goal_month")
public class StreetPersionGoalMonthEntity extends BaseEpdcEntity {
private static final long serialVersionUID = 1L;
/**
* 街道
*/
private String street;
/**
* 街道ID
*/
private Long streetId;
/**
* 年月
*/
private String monthYear;
/**
* 群众目标数
*/
private Integer residentGoalNum;
/**
* 党员目标数
*/
private Integer partyGoalNum;
/**
* 企业目标数
*/
private Integer companyGoalNum;
}

74
esua-epdc/epdc-module/epdc-kpi/epdc-kpi-server/src/main/java/com/elink/esua/epdc/excel/StreetPersionGoalMonthExcel.java

@ -0,0 +1,74 @@
/**
* 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.excel;
import cn.afterturn.easypoi.excel.annotation.Excel;
import lombok.Data;
import java.util.Date;
/**
* 街道人员目标表
*
* @author elink elink@elink-cn.com
* @since v1.0.0 2020-04-22
*/
@Data
public class StreetPersionGoalMonthExcel {
@Excel(name = "主键")
private String id;
@Excel(name = "街道")
private String street;
@Excel(name = "街道ID")
private Long streetId;
@Excel(name = "年月")
private String monthYear;
@Excel(name = "群众目标数")
private Integer residentGoalNum;
@Excel(name = "党员目标数")
private Integer partyGoalNum;
@Excel(name = "企业目标数")
private Integer companyGoalNum;
@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;
@Excel(name = "删除标记")
private String delFlag;
}

47
esua-epdc/epdc-module/epdc-kpi/epdc-kpi-server/src/main/java/com/elink/esua/epdc/redis/StreetPersionGoalMonthRedis.java

@ -0,0 +1,47 @@
/**
* 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.redis;
import com.elink.esua.epdc.commons.tools.redis.RedisUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
/**
* 街道人员目标表
*
* @author zhangyong
* @since v1.0.0 2020-04-22
*/
@Component
public class StreetPersionGoalMonthRedis {
@Autowired
private RedisUtils redisUtils;
public void delete(Object[] ids) {
}
public void set(){
}
public String get(String id){
return null;
}
}

123
esua-epdc/epdc-module/epdc-kpi/epdc-kpi-server/src/main/java/com/elink/esua/epdc/service/StreetPersionGoalMonthService.java

@ -0,0 +1,123 @@
/**
* 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.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.StreetPersionGoalMonthDTO;
import com.elink.esua.epdc.entity.StreetPersionGoalMonthEntity;
import java.util.List;
import java.util.Map;
/**
* 街道人员目标表
*
* @author zhangyong
* @since v1.0.0 2020-04-22
*/
public interface StreetPersionGoalMonthService extends BaseService<StreetPersionGoalMonthEntity> {
/**
* 默认分页
*
* @param params
* @return PageData<StreetPersionGoalMonthDTO>
* @author generator
* @date 2020-04-22
*/
PageData<StreetPersionGoalMonthDTO> page(Map<String, Object> params);
/**
* 默认查询
*
* @param params
* @return java.util.List<StreetPersionGoalMonthDTO>
* @author generator
* @date 2020-04-22
*/
List<StreetPersionGoalMonthDTO> list(Map<String, Object> params);
/**
* 单条查询
*
* @param id
* @return StreetPersionGoalMonthDTO
* @author generator
* @date 2020-04-22
*/
StreetPersionGoalMonthDTO get(String id);
/**
* @Description: 新增功能根据街道人员底数 * 目标比例 = 保存所有街道某个月的群众目标数党员目标数企业目标数
* @Description: 需要判断 所选月份目标数是否存在存在返回错误提示信息
* @Param: [dto]
* @return: com.elink.esua.epdc.commons.tools.utils.Result
* @Author: zy
* @Date: 2020-04-26
*/
Result save(StreetPersionGoalMonthDTO dto);
/**
* 默认更新
*
* @param dto
* @return void
* @author generator
* @date 2020-04-22
*/
void update(StreetPersionGoalMonthDTO dto);
/**
* 批量删除
*
* @param ids
* @return void
* @author generator
* @date 2020-04-22
*/
void delete(String[] ids);
/**
* @Description: 获取街道目标表的 街道名称
* @Param: []
* @return: java.util.List<com.elink.esua.epdc.dto.StreetPersionGoalMonthDTO>
* @Author: zy
* @Date: 2020-04-22
*/
List<StreetPersionGoalMonthDTO> lisStreetGoalName();
/**
* @Description: 获取街道目标表的 街道目标分数街道ID日期
* @Param:
* @return:
* @Author: zy
* @Date: 2020-04-24
*/
List<Map<String,String>> listStreetGoalScore();
/**
* @Description: 修改街道目标数
* @Param: [dto]
* @return: void
* @Author: zy
* @Date: 2020-04-26
*/
void modifyStreetGoalScore(StreetPersionGoalMonthDTO dto);
}

11
esua-epdc/epdc-module/epdc-kpi/epdc-kpi-server/src/main/java/com/elink/esua/epdc/service/StreetPersonBaseService.java

@ -28,7 +28,7 @@ import java.util.Map;
/**
* 街道人员底数表
*
* @author elink elink@elink-cn.com
* @author zhangyong
* @since v1.0.0 2020-04-13
*/
public interface StreetPersonBaseService extends BaseService<StreetPersonBaseEntity> {
@ -92,4 +92,13 @@ public interface StreetPersonBaseService extends BaseService<StreetPersonBaseEnt
* @date 2020-04-13
*/
void delete(String[] ids);
/**
* @Description: 根据单个街道ID查询街道群众党员企业 底数
* @Param: [streetId]
* @return: com.elink.esua.epdc.dto.StreetPersonBaseDTO
* @Author: zy
* @Date: 2020-04-26
*/
StreetPersonBaseDTO getStreetPersonBase(String streetId);
}

194
esua-epdc/epdc-module/epdc-kpi/epdc-kpi-server/src/main/java/com/elink/esua/epdc/service/impl/StreetPersionGoalMonthServiceImpl.java

@ -0,0 +1,194 @@
/**
* 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.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.security.user.SecurityUser;
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.dao.StreetPersionGoalMonthDao;
import com.elink.esua.epdc.dto.StreetPersionGoalMonthDTO;
import com.elink.esua.epdc.dto.StreetPersonBaseDTO;
import com.elink.esua.epdc.entity.StreetPersionGoalMonthEntity;
import com.elink.esua.epdc.redis.StreetPersionGoalMonthRedis;
import com.elink.esua.epdc.service.StreetPersionGoalMonthService;
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.*;
/**
* 街道人员目标表
*
* @author zhangyong
* @since v1.0.0 2020-04-22
*/
@Service
public class StreetPersionGoalMonthServiceImpl extends BaseServiceImpl<StreetPersionGoalMonthDao, StreetPersionGoalMonthEntity> implements StreetPersionGoalMonthService {
@Autowired
private StreetPersionGoalMonthRedis streetPersionGoalMonthRedis;
@Override
public PageData<StreetPersionGoalMonthDTO> page(Map<String, Object> params) {
IPage<StreetPersionGoalMonthEntity> page = baseDao.selectPage(
getPage(params, FieldConstant.CREATED_TIME, false),
getWrapper(params)
);
return getPageData(page, StreetPersionGoalMonthDTO.class);
}
@Override
public List<StreetPersionGoalMonthDTO> list(Map<String, Object> params) {
List<StreetPersionGoalMonthEntity> entityList = baseDao.selectList(getWrapper(params));
return ConvertUtils.sourceToTarget(entityList, StreetPersionGoalMonthDTO.class);
}
private QueryWrapper<StreetPersionGoalMonthEntity> getWrapper(Map<String, Object> params){
String id = (String)params.get(FieldConstant.ID_HUMP);
QueryWrapper<StreetPersionGoalMonthEntity> wrapper = new QueryWrapper<>();
wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id);
return wrapper;
}
@Override
public StreetPersionGoalMonthDTO get(String id) {
StreetPersionGoalMonthEntity entity = baseDao.selectById(id);
return ConvertUtils.sourceToTarget(entity, StreetPersionGoalMonthDTO.class);
}
@Override
@Transactional(rollbackFor = Exception.class)
public Result save(StreetPersionGoalMonthDTO dto) {
// 判断所选月份 是否存在目标分数
int isTargetScore = baseDao.checkTheGoalOfStreetThisMonth(dto);
if (isTargetScore > 0) {
return new Result().error("所选月份已设定目标分数,请重新选择月份");
}
// 查询每个街道的人员底数
List<StreetPersonBaseDTO> streetBaseScore = baseDao.selectListStreetPersonBase();
for (StreetPersonBaseDTO baseDTO :streetBaseScore) {
// 乘以目标比例,计算 所选月份 的目标数
StreetPersionGoalMonthEntity entity = this.streetGoalScoreCount(dto, baseDTO);
insert(entity);
}
return new Result();
}
/**
* @Description: 根据街道人员底数 * 街道目标比例 = 具体目标数
* @Param: [dto, baseDTO]
* @return: com.elink.esua.epdc.entity.StreetPersionGoalMonthEntity
* @Author: zy
* @Date: 2020-04-26
*/
private StreetPersionGoalMonthEntity streetGoalScoreCount(StreetPersionGoalMonthDTO dto, StreetPersonBaseDTO baseDTO) {
StreetPersionGoalMonthEntity entity = new StreetPersionGoalMonthEntity();
entity.setMonthYear(dto.getMonthYear());
entity.setStreet(baseDTO.getStreet());
entity.setStreetId(baseDTO.getStreetId());
int residentGoalNum = Math.round(baseDTO.getResidentBaseNum() * dto.getResidentGoalNum() / 100);
entity.setResidentGoalNum(residentGoalNum);
int partyGoalNum = Math.round(baseDTO.getPartyBaseNum() * dto.getPartyGoalNum() / 100);
entity.setPartyGoalNum(partyGoalNum);
int companyGoalNum = Math.round(baseDTO.getCompanyBaseNum() * dto.getCompanyGoalNum() / 100);
entity.setCompanyGoalNum(companyGoalNum);
return entity;
}
@Override
@Transactional(rollbackFor = Exception.class)
public void update(StreetPersionGoalMonthDTO dto) {
// 查询每个街道的人员底数
List<StreetPersonBaseDTO> streetBaseScore = baseDao.selectListStreetPersonBase();
for (StreetPersonBaseDTO baseDTO :streetBaseScore) {
// 乘以目标比例,计算 所选月份 的目标数
StreetPersionGoalMonthEntity entity = this.streetGoalScoreCount(dto, baseDTO);
//根据街道id 和 月份 查询 街道目标表id
String goalId = baseDao.selectOneStreetGoalId(entity);
entity.setId(goalId);
updateById(entity);
}
}
@Override
@Transactional(rollbackFor = Exception.class)
public void delete(String[] ids) {
// 逻辑删除(@TableLogic 注解)
baseDao.deleteBatchIds(Arrays.asList(ids));
}
@Override
public List<StreetPersionGoalMonthDTO> lisStreetGoalName() {
List<StreetPersionGoalMonthDTO> streetName = baseDao.selectListStreetGoalName(); //获取街道名称
return streetName;
}
@Override
public List<Map<String,String>> listStreetGoalScore() {
List<StreetPersionGoalMonthDTO> data = baseDao.selectListStreetGoalScore();
List<Map<String,String>> list = new ArrayList<>();
Map<String, String> map = new HashMap<>();
String month = ""; //当前循环月份
for (StreetPersionGoalMonthDTO dto : data) {
if(month.equals(dto.getMonthYear())){
map = this.splicingStreetGoalScore(map, dto); //拼接街道每月目标数
}else{
if(map.size() > 0){
list.add(map);
map = new HashMap<>();
}
month = dto.getMonthYear(); //赋值循环新的当前月份
map = this.splicingStreetGoalScore(map, dto); //拼接街道每月目标数
}
}
list.add(map);
return list;
}
@Override
public void modifyStreetGoalScore(StreetPersionGoalMonthDTO dto) {
dto.setUpdatedBy(SecurityUser.getUserId().toString());
baseDao.updateStreetGoalScore(dto);
}
/**
* @Description: 拼接街道每月目标数
* @Param: [map, dto]
* @return: java.util.Map<java.lang.String,java.lang.String>
* @Author: zy
* @Date: 2020-04-24
*/
private Map<String, String> splicingStreetGoalScore(Map<String, String> map, StreetPersionGoalMonthDTO dto) {
map.put("isDisabled", dto.getIsDisabled());
map.put("monthYear", dto.getMonthYear());
map.put(dto.getStreetId() + "-CompanyGoalNum", dto.getCompanyGoalNum().toString());
map.put(dto.getStreetId() + "-ResidentGoalNum", dto.getResidentGoalNum().toString());
map.put(dto.getStreetId() + "-PartyGoalNum", dto.getPartyGoalNum().toString());
return map;
}
}

7
esua-epdc/epdc-module/epdc-kpi/epdc-kpi-server/src/main/java/com/elink/esua/epdc/service/impl/StreetPersonBaseServiceImpl.java

@ -40,7 +40,7 @@ import java.util.Map;
/**
* 街道人员底数表
*
* @author elink elink@elink-cn.com
* @author zhangyong
* @since v1.0.0 2020-04-13
*/
@Service
@ -101,4 +101,9 @@ public class StreetPersonBaseServiceImpl extends BaseServiceImpl<StreetPersonBas
baseDao.deleteBatchIds(Arrays.asList(ids));
}
@Override
public StreetPersonBaseDTO getStreetPersonBase(String streetId) {
return baseDao.selectOneStreetPersonBase(streetId);
}
}

107
esua-epdc/epdc-module/epdc-kpi/epdc-kpi-server/src/main/resources/mapper/StreetPersionGoalMonthDao.xml

@ -0,0 +1,107 @@
<?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.dao.StreetPersionGoalMonthDao">
<resultMap type="com.elink.esua.epdc.entity.StreetPersionGoalMonthEntity" id="streetPersionGoalMonthMap">
<result property="id" column="ID"/>
<result property="street" column="STREET"/>
<result property="streetId" column="STREET_ID"/>
<result property="monthYear" column="MONTH_YEAR"/>
<result property="residentGoalNum" column="RESIDENT_GOAL_NUM"/>
<result property="partyGoalNum" column="PARTY_GOAL_NUM"/>
<result property="companyGoalNum" column="COMPANY_GOAL_NUM"/>
<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"/>
<result property="delFlag" column="DEL_FLAG"/>
</resultMap>
<select id="selectListStreetGoalName" resultType="com.elink.esua.epdc.dto.StreetPersionGoalMonthDTO">
SELECT
DISTINCT STREET,
STREET_ID
FROM epdc_street_persion_goal_month
WHERE DEL_FLAG = 0
ORDER BY CREATED_TIME
</select>
<select id="selectListStreetGoalScore" resultType="com.elink.esua.epdc.dto.StreetPersionGoalMonthDTO">
SELECT
d.ID,
d.streetId,
d.STREET,
d.monthYear,
d.residentGoalNum,
d.partyGoalNum,
d.companyGoalNum,
CASE
WHEN d.isDisabled > d.monthYear THEN '0'
ELSE '1' END isDisabled
FROM(
SELECT
ID,
STREET_ID streetId,
STREET,
MONTH_YEAR monthYear,
IFNULL(RESIDENT_GOAL_NUM,0) residentGoalNum,
IFNULL(PARTY_GOAL_NUM,0) partyGoalNum,
IFNULL(COMPANY_GOAL_NUM,0) companyGoalNum,
date_format(CURDATE(), '%Y-%m') isDisabled
FROM
epdc_street_persion_goal_month
WHERE
DEL_FLAG = 0
) d
ORDER BY d.monthYear
</select>
<update id="updateStreetGoalScore" parameterType="com.elink.esua.epdc.dto.StreetPersionGoalMonthDTO">
UPDATE epdc_street_persion_goal_month
SET
UPDATED_TIME = NOW(),
UPDATED_BY = #{updatedBy},
<if test='personBasicNumberKey != null and personBasicNumberKey != "" and personBasicNumberKey == "CompanyGoalNum"'>
COMPANY_GOAL_NUM = #{goalNumber}
</if>
<if test='personBasicNumberKey != null and personBasicNumberKey != "" and personBasicNumberKey == "ResidentGoalNum"'>
RESIDENT_GOAL_NUM = #{goalNumber}
</if>
<if test='personBasicNumberKey != null and personBasicNumberKey != "" and personBasicNumberKey == "PartyGoalNum"'>
PARTY_GOAL_NUM = #{goalNumber}
</if>
WHERE MONTH_YEAR = #{monthYear} and STREET_ID = #{streetId}
</update>
<select id="checkTheGoalOfStreetThisMonth" resultType="int">
SELECT
count(1)
FROM
epdc_street_persion_goal_month
WHERE
DEL_FLAG = 0
AND MONTH_YEAR = #{monthYear}
</select>
<select id="selectListStreetPersonBase" resultType="com.elink.esua.epdc.dto.StreetPersonBaseDTO">
SELECT
STREET_ID streetId,
STREET street,
RESIDENT_BASE_NUM residentBaseNum,
PARTY_BASE_NUM partyBaseNum,
COMPANY_BASE_NUM companyBaseNum
FROM epdc_street_person_base
WHERE DEL_FLAG = 0
</select>
<select id="selectOneStreetGoalId" resultType="String">
SELECT
ID id
FROM epdc_street_persion_goal_month
WHERE DEL_FLAG = 0
and STREET_ID = #{streetId}
and MONTH_YEAR = #{monthYear}
</select>
</mapper>

10
esua-epdc/epdc-module/epdc-kpi/epdc-kpi-server/src/main/resources/mapper/StreetPersonBaseDao.xml

@ -18,5 +18,13 @@
<result property="delFlag" column="DEL_FLAG"/>
</resultMap>
<select id="selectOneStreetPersonBase" resultType="com.elink.esua.epdc.dto.StreetPersonBaseDTO">
SELECT
STREET_ID streetId,
RESIDENT_BASE_NUM residentBaseNum,
PARTY_BASE_NUM partyBaseNum,
COMPANY_BASE_NUM companyBaseNum
FROM epdc_street_person_base
WHERE STREET_ID = #{streetId} AND DEL_FLAG = 0
</select>
</mapper>
Loading…
Cancel
Save