diff --git a/esua-epdc/epdc-module/epdc-kpi/epdc-kpi-client/src/main/java/com/elink/esua/epdc/dto/StreetPersionGoalMonthDTO.java b/esua-epdc/epdc-module/epdc-kpi/epdc-kpi-client/src/main/java/com/elink/esua/epdc/dto/StreetPersionGoalMonthDTO.java new file mode 100644 index 000000000..25723411b --- /dev/null +++ b/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 + *

+ * 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; + +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 streetIdList; + + /** + * 本次要增加目标人数 的key,确定要为那个目标增加人数 + */ + private String personBasicNumberKey; + + /** + * 本次要增加的目标人数 + */ + private int goalNumber; + + /** + * isDisabled = 1 页面按钮:批量设置 不可使用,0可使用 + */ + private String isDisabled; +} \ No newline at end of file diff --git a/esua-epdc/epdc-module/epdc-kpi/epdc-kpi-server/src/main/java/com/elink/esua/epdc/controller/StreetPersionGoalMonthController.java b/esua-epdc/epdc-module/epdc-kpi/epdc-kpi-server/src/main/java/com/elink/esua/epdc/controller/StreetPersionGoalMonthController.java new file mode 100644 index 000000000..f4aacb9d0 --- /dev/null +++ b/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 + *

+ * 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.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 get(@PathVariable("id") String id){ + StreetPersionGoalMonthDTO data = streetPersionGoalMonthService.get(id); + return new Result().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 params, HttpServletResponse response) throws Exception { + List list = streetPersionGoalMonthService.list(params); + ExcelUtils.exportExcelToTarget(response, null, list, StreetPersionGoalMonthExcel.class); + } + + /** + * @Description: 获取街道目标表的 街道名称 + * @Param: [] + * @return: java.util.List + * @Author: zy + * @Date: 2020-04-22 + */ + @GetMapping("queryStreetGoalName") + public Result> queryStreetGoalName(){ + List streetName = streetPersionGoalMonthService.lisStreetGoalName(); + return new Result>().ok(streetName); + } + + /** + * @Description: 获取街道每月的目标数 + * @Param: [params] + * @return: com.elink.esua.epdc.commons.tools.utils.Result> + * @Author: zy + * @Date: 2020-04-24 + */ + @GetMapping("streetGoalScore") + public Result>> streetGoalScore(@RequestParam Map params){ + List> page = streetPersionGoalMonthService.listStreetGoalScore(); + return new Result>>().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(); + } +} \ No newline at end of file diff --git a/esua-epdc/epdc-module/epdc-kpi/epdc-kpi-server/src/main/java/com/elink/esua/epdc/controller/StreetPersonBaseController.java b/esua-epdc/epdc-module/epdc-kpi/epdc-kpi-server/src/main/java/com/elink/esua/epdc/controller/StreetPersonBaseController.java index 7366d190a..bf13f4636 100644 --- a/esua-epdc/epdc-module/epdc-kpi/epdc-kpi-server/src/main/java/com/elink/esua/epdc/controller/StreetPersonBaseController.java +++ b/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 + * @Author: zy + * @Date: 2020-04-26 + */ + @GetMapping("getStreetPersonBase/{streetId}") + public Result getStreetPersonBase(@PathVariable("streetId") String streetId){ + StreetPersonBaseDTO data = streetPersonBaseService.getStreetPersonBase(streetId); + return new Result().ok(data); + } } \ No newline at end of file diff --git a/esua-epdc/epdc-module/epdc-kpi/epdc-kpi-server/src/main/java/com/elink/esua/epdc/dao/StreetPersionGoalMonthDao.java b/esua-epdc/epdc-module/epdc-kpi/epdc-kpi-server/src/main/java/com/elink/esua/epdc/dao/StreetPersionGoalMonthDao.java new file mode 100644 index 000000000..264242f79 --- /dev/null +++ b/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 + *

+ * 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.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 { + + /** + * @Description: 获取街道目标表的 街道名称 + * @Param: [] + * @return: java.util.List + * @Author: zy + * @Date: 2020-04-22 + */ + List selectListStreetGoalName(); + + /** + * @Description: 获取街道目标表的 街道目标分数、街道ID、日期 + * @Param: + * @return: java.util.List + * @Author: zy + * @Date: 2020-04-22 + */ + List 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 + * @Author: zy + * @Date: 2020-04-26 + */ + List selectListStreetPersonBase(); + + /** + * @Description: 根据街道id、月份 查询街道目标表的主键ID + * @Param: [entity] + * @return: java.lang.String + * @Author: zy + * @Date: 2020-04-27 + */ + String selectOneStreetGoalId(StreetPersionGoalMonthEntity entity); +} \ No newline at end of file diff --git a/esua-epdc/epdc-module/epdc-kpi/epdc-kpi-server/src/main/java/com/elink/esua/epdc/dao/StreetPersonBaseDao.java b/esua-epdc/epdc-module/epdc-kpi/epdc-kpi-server/src/main/java/com/elink/esua/epdc/dao/StreetPersonBaseDao.java index 63f3b09c0..f055ef201 100644 --- a/esua-epdc/epdc-module/epdc-kpi/epdc-kpi-server/src/main/java/com/elink/esua/epdc/dao/StreetPersonBaseDao.java +++ b/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 { - + + /** + * @Description: 根据单个街道ID,查询街道群众、党员、企业 底数 + * @Param: [streetId] + * @return: com.elink.esua.epdc.dto.StreetPersonBaseDTO + * @Author: zy + * @Date: 2020-04-26 + */ + StreetPersonBaseDTO selectOneStreetPersonBase(String streetId); } \ No newline at end of file diff --git a/esua-epdc/epdc-module/epdc-kpi/epdc-kpi-server/src/main/java/com/elink/esua/epdc/entity/StreetPersionGoalMonthEntity.java b/esua-epdc/epdc-module/epdc-kpi/epdc-kpi-server/src/main/java/com/elink/esua/epdc/entity/StreetPersionGoalMonthEntity.java new file mode 100644 index 000000000..9bdeb7f3b --- /dev/null +++ b/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 + *

+ * 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.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; + +} \ No newline at end of file diff --git a/esua-epdc/epdc-module/epdc-kpi/epdc-kpi-server/src/main/java/com/elink/esua/epdc/excel/StreetPersionGoalMonthExcel.java b/esua-epdc/epdc-module/epdc-kpi/epdc-kpi-server/src/main/java/com/elink/esua/epdc/excel/StreetPersionGoalMonthExcel.java new file mode 100644 index 000000000..79170df98 --- /dev/null +++ b/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 + *

+ * 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.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; + + +} \ No newline at end of file diff --git a/esua-epdc/epdc-module/epdc-kpi/epdc-kpi-server/src/main/java/com/elink/esua/epdc/redis/StreetPersionGoalMonthRedis.java b/esua-epdc/epdc-module/epdc-kpi/epdc-kpi-server/src/main/java/com/elink/esua/epdc/redis/StreetPersionGoalMonthRedis.java new file mode 100644 index 000000000..be817efac --- /dev/null +++ b/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 + *

+ * 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.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; + } + +} \ No newline at end of file diff --git a/esua-epdc/epdc-module/epdc-kpi/epdc-kpi-server/src/main/java/com/elink/esua/epdc/service/StreetPersionGoalMonthService.java b/esua-epdc/epdc-module/epdc-kpi/epdc-kpi-server/src/main/java/com/elink/esua/epdc/service/StreetPersionGoalMonthService.java new file mode 100644 index 000000000..fd2fa1246 --- /dev/null +++ b/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 + *

+ * 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.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 { + + /** + * 默认分页 + * + * @param params + * @return PageData + * @author generator + * @date 2020-04-22 + */ + PageData page(Map params); + + /** + * 默认查询 + * + * @param params + * @return java.util.List + * @author generator + * @date 2020-04-22 + */ + List list(Map 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 + * @Author: zy + * @Date: 2020-04-22 + */ + List lisStreetGoalName(); + + /** + * @Description: 获取街道目标表的 街道目标分数、街道ID、日期 + * @Param: + * @return: + * @Author: zy + * @Date: 2020-04-24 + */ + List> listStreetGoalScore(); + + /** + * @Description: 修改街道目标数 + * @Param: [dto] + * @return: void + * @Author: zy + * @Date: 2020-04-26 + */ + void modifyStreetGoalScore(StreetPersionGoalMonthDTO dto); +} \ No newline at end of file diff --git a/esua-epdc/epdc-module/epdc-kpi/epdc-kpi-server/src/main/java/com/elink/esua/epdc/service/StreetPersonBaseService.java b/esua-epdc/epdc-module/epdc-kpi/epdc-kpi-server/src/main/java/com/elink/esua/epdc/service/StreetPersonBaseService.java index 33f51d59b..e38829417 100644 --- a/esua-epdc/epdc-module/epdc-kpi/epdc-kpi-server/src/main/java/com/elink/esua/epdc/service/StreetPersonBaseService.java +++ b/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 { @@ -92,4 +92,13 @@ public interface StreetPersonBaseService extends BaseService + * 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.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 implements StreetPersionGoalMonthService { + + @Autowired + private StreetPersionGoalMonthRedis streetPersionGoalMonthRedis; + + @Override + public PageData page(Map params) { + IPage page = baseDao.selectPage( + getPage(params, FieldConstant.CREATED_TIME, false), + getWrapper(params) + ); + return getPageData(page, StreetPersionGoalMonthDTO.class); + } + + @Override + public List list(Map params) { + List entityList = baseDao.selectList(getWrapper(params)); + + return ConvertUtils.sourceToTarget(entityList, StreetPersionGoalMonthDTO.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 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 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 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 lisStreetGoalName() { + List streetName = baseDao.selectListStreetGoalName(); //获取街道名称 + return streetName; + } + + @Override + public List> listStreetGoalScore() { + List data = baseDao.selectListStreetGoalScore(); + List> list = new ArrayList<>(); + Map 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 + * @Author: zy + * @Date: 2020-04-24 + */ + private Map splicingStreetGoalScore(Map 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; + } +} \ No newline at end of file diff --git a/esua-epdc/epdc-module/epdc-kpi/epdc-kpi-server/src/main/java/com/elink/esua/epdc/service/impl/StreetPersonBaseServiceImpl.java b/esua-epdc/epdc-module/epdc-kpi/epdc-kpi-server/src/main/java/com/elink/esua/epdc/service/impl/StreetPersonBaseServiceImpl.java index 6fe63cdee..9f007b0cf 100644 --- a/esua-epdc/epdc-module/epdc-kpi/epdc-kpi-server/src/main/java/com/elink/esua/epdc/service/impl/StreetPersonBaseServiceImpl.java +++ b/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 + + + + + + + + + + + + + + + + + + + + + + + + + + UPDATE epdc_street_persion_goal_month + SET + UPDATED_TIME = NOW(), + UPDATED_BY = #{updatedBy}, + + COMPANY_GOAL_NUM = #{goalNumber} + + + RESIDENT_GOAL_NUM = #{goalNumber} + + + PARTY_GOAL_NUM = #{goalNumber} + + WHERE MONTH_YEAR = #{monthYear} and STREET_ID = #{streetId} + + + + + + + + \ No newline at end of file diff --git a/esua-epdc/epdc-module/epdc-kpi/epdc-kpi-server/src/main/resources/mapper/StreetPersonBaseDao.xml b/esua-epdc/epdc-module/epdc-kpi/epdc-kpi-server/src/main/resources/mapper/StreetPersonBaseDao.xml index ff4526215..5729ece9f 100644 --- a/esua-epdc/epdc-module/epdc-kpi/epdc-kpi-server/src/main/resources/mapper/StreetPersonBaseDao.xml +++ b/esua-epdc/epdc-module/epdc-kpi/epdc-kpi-server/src/main/resources/mapper/StreetPersonBaseDao.xml @@ -18,5 +18,13 @@ - + \ No newline at end of file