From 6d8499cd3c2fe8e4b033123be08765b9cbf5517c Mon Sep 17 00:00:00 2001 From: wans <747101512@qq.com> Date: Mon, 14 Dec 2020 18:50:45 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=A4=A7=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E9=A1=B5=E9=9D=A2=E7=9B=B8=E5=85=B3=E6=96=B9=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../config/AuthClientSecurityConfig.java | 33 +++-- .../ThreeMeetLessonResourcesController.java | 59 +++++++++ .../IThreeMeetLessonService.java | 7 ++ .../impl/ThreeMeetLessonServiceImpl.java | 119 ++++++++++++------ .../threemeetlesson-mapper.xml | 12 +- .../static/route/defaultindex/include.html | 4 +- 6 files changed, 179 insertions(+), 55 deletions(-) create mode 100644 src/main/java/com/cm/partybuilding/controller/resources/threemeetlesson/ThreeMeetLessonResourcesController.java diff --git a/src/main/java/com/cm/partybuilding/config/AuthClientSecurityConfig.java b/src/main/java/com/cm/partybuilding/config/AuthClientSecurityConfig.java index a764d0a..4d0c342 100644 --- a/src/main/java/com/cm/partybuilding/config/AuthClientSecurityConfig.java +++ b/src/main/java/com/cm/partybuilding/config/AuthClientSecurityConfig.java @@ -35,23 +35,22 @@ public class AuthClientSecurityConfig extends WebSecurityConfigurerAdapter { @Override protected void configure(HttpSecurity http) throws Exception { - http - .formLogin() - .defaultSuccessUrl("/authorize", true) - .and() - .logout().logoutSuccessUrl(authServer.getOauthLogout()) - .and() - .authorizeRequests().antMatchers("/app/**", "/route/file/**", "/assets/**").permitAll() - .and() - .authorizeRequests() - .anyRequest() - .access("@clientRbacService.hasPermission(request, authentication)") - .and() - .headers().frameOptions().sameOrigin() - .and() - .cors() - .and() - .csrf().disable(); + http.formLogin() + .defaultSuccessUrl("/authorize", true) + .and() + .logout().logoutSuccessUrl(authServer.getOauthLogout()) + .and() + .authorizeRequests().antMatchers("/app/**", "/route/file/**", "/assets/**","/resource/**").permitAll() + .and() + .authorizeRequests() + .anyRequest() + .access("@clientRbacService.hasPermission(request, authentication)") + .and() + .headers().frameOptions().sameOrigin() + .and() + .cors() + .and() + .csrf().disable(); } @Bean diff --git a/src/main/java/com/cm/partybuilding/controller/resources/threemeetlesson/ThreeMeetLessonResourcesController.java b/src/main/java/com/cm/partybuilding/controller/resources/threemeetlesson/ThreeMeetLessonResourcesController.java new file mode 100644 index 0000000..9fa3116 --- /dev/null +++ b/src/main/java/com/cm/partybuilding/controller/resources/threemeetlesson/ThreeMeetLessonResourcesController.java @@ -0,0 +1,59 @@ +package com.cm.partybuilding.controller.resources.threemeetlesson; + +import com.cm.common.base.AbstractController; +import com.cm.common.constants.ISystemConstant; +import com.cm.common.exception.SearchException; +import com.cm.common.result.ErrorResult; +import com.cm.common.result.SuccessResultData; +import com.cm.partybuilding.pojo.dtos.threemeetlesson.ThreeMeetLessonDTO; +import com.cm.partybuilding.service.threemeetlesson.IThreeMeetLessonService; +import io.swagger.annotations.*; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.CrossOrigin; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import java.util.List; +import java.util.Map; + +/** + * 组织生活分类统计接口 + * @ClassName: ThreeMeetLessonResourcesController + * @Description: + * @Author: WenG + * @Date: 2020-10-19 09:46 + * @Version: 1.0 + **/ +@CrossOrigin(origins = "*", maxAge = 3600) +@Api(tags = ISystemConstant.API_TAGS_RESOURCE_PREFIX + "组织生活接口") +@RestController +@RequestMapping(ISystemConstant.RESOURCE_PREFIX + "/threemeetlesson") +public class ThreeMeetLessonResourcesController extends AbstractController { + + @Autowired + private IThreeMeetLessonService threeMeetLessonService; + + @ApiOperation(value = "党组织下各类组织生活数量", notes = "党组织下各类组织生活数量接口") + @ApiImplicitParams({ + @ApiImplicitParam(name = "partyOrganizeId", value = "当前党组织ID", paramType = "query") + }) + @ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)}) + @GetMapping("getorgthreemeetlessoncount") + public List> getOrgThreeMeetLessonCount(){ + Map params = requestParams(); + return threeMeetLessonService.getOrgThreeMeetLessonCount(params); + } + + @ApiOperation(value = "大数据组织生活按周统计量", notes = "大数据组织生活按月统计量接口") + @ApiImplicitParams({ + @ApiImplicitParam(name = "partyOrganizeId", value = "当前党组织ID", paramType = "query") + }) + @ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)}) + @GetMapping("getthreemeetlessonweekcount") + public List> getThreeMeetLessonWeekCount(){ + Map params = requestParams(); + return threeMeetLessonService.getThreeMeetLessonWeekCount(params); + } + +} \ No newline at end of file diff --git a/src/main/java/com/cm/partybuilding/service/threemeetlesson/IThreeMeetLessonService.java b/src/main/java/com/cm/partybuilding/service/threemeetlesson/IThreeMeetLessonService.java index 00d7633..61c2dd7 100644 --- a/src/main/java/com/cm/partybuilding/service/threemeetlesson/IThreeMeetLessonService.java +++ b/src/main/java/com/cm/partybuilding/service/threemeetlesson/IThreeMeetLessonService.java @@ -167,4 +167,11 @@ public interface IThreeMeetLessonService { * @return */ List> getOrgThreeMeetLessonCount(Map params); + + /** + * 大数据组织生活按周统计量 + * @param params + * @return + */ + List> getThreeMeetLessonWeekCount(Map params); } \ No newline at end of file diff --git a/src/main/java/com/cm/partybuilding/service/threemeetlesson/impl/ThreeMeetLessonServiceImpl.java b/src/main/java/com/cm/partybuilding/service/threemeetlesson/impl/ThreeMeetLessonServiceImpl.java index dcc39a9..8dcdb66 100644 --- a/src/main/java/com/cm/partybuilding/service/threemeetlesson/impl/ThreeMeetLessonServiceImpl.java +++ b/src/main/java/com/cm/partybuilding/service/threemeetlesson/impl/ThreeMeetLessonServiceImpl.java @@ -7,6 +7,7 @@ import com.cm.common.pojo.ListPage; import com.cm.common.result.SuccessResult; import com.cm.common.result.SuccessResultData; import com.cm.common.result.SuccessResultList; +import com.cm.common.utils.DateUtil; import com.cm.common.utils.HashMapUtil; import com.cm.common.utils.UUIDUtil; import com.cm.partybuilding.dao.threemeetlesson.IThreeMeetLessonDao; @@ -20,6 +21,7 @@ import com.google.common.base.Joiner; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; +import java.text.SimpleDateFormat; import java.util.*; /** @@ -201,41 +203,88 @@ public class ThreeMeetLessonServiceImpl extends AbstractService implements IThre String userIds = userIdsList.size() == 0 ? "" : Joiner.on(",").join(userIdsList); params.put("userIds",userIds); List> countList = new ArrayList<>(); - //1支部委员会会议 - params.put("category","1"); - Integer oneCount = threeMeetLessonDao.getOrgThreeMeetLessonCount(params); - Map oneDTO = new HashMap<>(4); - oneDTO.put("categoryName","支部委员会会议"); - oneDTO.put("counts",oneCount); - countList.add(oneDTO); - //2全体党员大会 - params.put("category","2"); - Integer twoCount = threeMeetLessonDao.getOrgThreeMeetLessonCount(params); - Map towDTO = new HashMap<>(4); - towDTO.put("categoryName","全体党员大会"); - towDTO.put("counts",twoCount); - countList.add(towDTO); - //3党小组会议 - params.put("category","3"); - Integer threeCount = threeMeetLessonDao.getOrgThreeMeetLessonCount(params); - Map threeDTO = new HashMap<>(4); - threeDTO.put("categoryName","党小组会议"); - threeDTO.put("counts",threeCount); - countList.add(threeDTO); - //4民主评议党员 - params.put("category","4"); - Integer fourCount = threeMeetLessonDao.getOrgThreeMeetLessonCount(params); - Map fourDTO = new HashMap<>(4); - fourDTO.put("categoryName","民主评议党员"); - fourDTO.put("counts",fourCount); - countList.add(fourDTO); - //5组织生活会 - params.put("category","5"); - Integer fiveCount = threeMeetLessonDao.getOrgThreeMeetLessonCount(params); - Map fiveDTO = new HashMap<>(4); - fiveDTO.put("categoryName","组织生活会"); - fiveDTO.put("counts",fiveCount); - countList.add(fiveDTO); + String[] categoryName = {"支部委员会会议","全体党员大会","党小组会议","民主评议党员", + "组织生活会","谈心谈话","党员教育培训","党课"}; + for(int i = 0; i < categoryName.length; i++){ + params.put("category",i + 1); + Integer counts = threeMeetLessonDao.getOrgThreeMeetLessonCount(params); + Map dto = new HashMap<>(4); + dto.put("categoryName",categoryName[i]); + dto.put("counts",counts); + countList.add(dto); + } return countList; } + + @Override + public List> getThreeMeetLessonWeekCount(Map params) { + //查询党组织下所有人员列表 + List userIdsList = threeMeetLessonDao.listOrgUserId(params); + String userIds = userIdsList.size() == 0 ? "" : Joiner.on(",").join(userIdsList); + params.put("userIds",userIds); + String[] categoryName = {"支部委员会会议","全体党员大会","党小组会议","民主评议党员", + "组织生活会","谈心谈话","党员教育培训","党课"}; + String startDate; + String endDate; + /**查询当前周数据**/ + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); + //当前周 + Date weekStartDate = DateUtil.weekStartDate(); + startDate = sdf.format(weekStartDate); + endDate = DateUtil.getDay(); + params.put("startDate",startDate); + params.put("endDate",endDate); + List weekCount = new ArrayList<>(); + weekCount.add("当前周"); + for(int i = 0; i < categoryName.length; i++){ + params.put("category",i + 1); + Integer counts = threeMeetLessonDao.getOrgThreeMeetLessonCount(params); + weekCount.add(counts +""); + } + //上周 + endDate = DateUtil.getBeforeDate(1,startDate); + startDate = DateUtil.getBeforeDate(7,startDate); + params.put("startDate",startDate + " 00:00:00"); + params.put("endDate",endDate + " 59:59:59"); + List lastWeekCount = new ArrayList<>(); + lastWeekCount.add(startDate.substring(5,10) + "至" + endDate.substring(5,10)); + for(int i = 0; i < categoryName.length; i++){ + params.put("category",i + 1); + Integer counts = threeMeetLessonDao.getOrgThreeMeetLessonCount(params); + lastWeekCount.add(counts +""); + } + //上两周 + endDate = DateUtil.getBeforeDate(8,startDate); + startDate = DateUtil.getBeforeDate(14,startDate); + params.put("startDate",startDate); + params.put("endDate",endDate); + List last2WeekCount = new ArrayList<>(); + last2WeekCount.add(startDate.substring(5,10) + "至" + endDate.substring(5,10)); + for(int i = 0; i < categoryName.length; i++){ + params.put("category",i + 1); + Integer counts = threeMeetLessonDao.getOrgThreeMeetLessonCount(params); + last2WeekCount.add(counts +""); + } + //上三周 + endDate = DateUtil.getBeforeDate(15,startDate); + startDate = DateUtil.getBeforeDate(21,startDate); + params.put("startDate",startDate); + params.put("endDate",endDate); + List last3WeekCount = new ArrayList<>(); + last3WeekCount.add(startDate.substring(5,10) + "至" + endDate.substring(5,10)); + for(int i = 0; i < categoryName.length; i++){ + params.put("category",i + 1); + Integer counts = threeMeetLessonDao.getOrgThreeMeetLessonCount(params); + last3WeekCount.add(counts +""); + } + List> result = new ArrayList<>(); + List categoryList = new ArrayList<>(Arrays.asList(categoryName)); + categoryList.add(0,"分类"); + result.add(categoryList); + result.add(last3WeekCount); + result.add(last2WeekCount); + result.add(lastWeekCount); + result.add(weekCount); + return result; + } } \ No newline at end of file diff --git a/src/main/resources/mybatis/mapper/threemeetlesson/threemeetlesson-mapper.xml b/src/main/resources/mybatis/mapper/threemeetlesson/threemeetlesson-mapper.xml index 9410a32..60244f6 100644 --- a/src/main/resources/mybatis/mapper/threemeetlesson/threemeetlesson-mapper.xml +++ b/src/main/resources/mybatis/mapper/threemeetlesson/threemeetlesson-mapper.xml @@ -221,8 +221,16 @@ gen_three_meet_lesson WHERE is_delete = '0' - AND category = #{category} - AND FIND_IN_SET(creator,#{userIds}) + AND category = #{category} + + AND FIND_IN_SET(creator,#{userIds}) + + + AND gmt_create =]]> #{startDate} + + + AND gmt_create #{endDate} +