修改功能
This commit is contained in:
parent
010e3a69c0
commit
a1602cd909
@ -0,0 +1,48 @@
|
||||
package com.cm.inspection.controller.app.apis.count;
|
||||
|
||||
import com.cm.common.base.AbstractService;
|
||||
import com.cm.common.constants.ISystemConstant;
|
||||
import com.cm.common.result.ErrorResult;
|
||||
import com.cm.common.result.SuccessResultData;
|
||||
import com.cm.inspection.service.check.ICheckService;
|
||||
import com.cm.inspection.service.count.ICountService;
|
||||
import com.cm.inspection.service.enterprise.IEnterpriseService;
|
||||
import com.cm.inspection.service.gridpersonnel.IGridPersonnelService;
|
||||
import io.swagger.annotations.*;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestHeader;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* When you feel like quitting. Think about why you started
|
||||
* 当你想要放弃的时候,想想当初你为何开始
|
||||
*
|
||||
* @ClassName: CountAppController
|
||||
* @Description: App端统计
|
||||
* @Author: WangGeng
|
||||
* @Date: 2020/9/15 10:36
|
||||
* @Version: 1.0
|
||||
**/
|
||||
@Api(tags = ISystemConstant.API_TAGS_APP_PREFIX + "统计接口")
|
||||
@RestController
|
||||
@RequestMapping(ISystemConstant.APP_PREFIX + "/count")
|
||||
public class CountAppController extends AbstractService {
|
||||
|
||||
@Autowired
|
||||
private ICountService countService;
|
||||
|
||||
@ApiOperation(value = "统计本月个人相关数据", notes = "统计本月个人相关数据接口")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "token", value = "token", paramType = "header"),
|
||||
})
|
||||
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
|
||||
@GetMapping("countcurrentmonthofmine")
|
||||
public SuccessResultData<Map<String, Integer>> countCurrentMonthOfMine(@RequestHeader("token") String token) {
|
||||
return countService.countCurrentMonthOfMine(token);
|
||||
}
|
||||
|
||||
}
|
@ -134,4 +134,12 @@ public interface IEnterpriseOfGridOperatorDao {
|
||||
* @throws SearchException
|
||||
*/
|
||||
Integer countClaimedEnterprise(Map<String, Object> params) throws SearchException;
|
||||
|
||||
/**
|
||||
* 统计认领企业
|
||||
* @param params
|
||||
* @return
|
||||
* @throws SearchException
|
||||
*/
|
||||
Integer countEnterpriseOfGridOperatorSimple(Map<String, Object> params) throws SearchException;
|
||||
}
|
||||
|
@ -106,4 +106,13 @@ public interface ICountService {
|
||||
* @throws SearchException
|
||||
*/
|
||||
SuccessResultData<Map<String, Object>> countEnterprisePlanRealCheckTable(String areaId, Integer areaLevel, String year) throws SearchException;
|
||||
|
||||
/**
|
||||
* 统计本月个人相关数据
|
||||
*
|
||||
* @param token
|
||||
* @return
|
||||
* @throws SearchException
|
||||
*/
|
||||
SuccessResultData<Map<String, Integer>> countCurrentMonthOfMine(String token) throws SearchException;
|
||||
}
|
||||
|
@ -1,9 +1,12 @@
|
||||
package com.cm.inspection.service.count.impl;
|
||||
|
||||
import com.cm.common.constants.ISystemConstant;
|
||||
import com.cm.common.exception.SearchException;
|
||||
import com.cm.common.plugin.pojo.dtos.datadictionary.DataDictionaryDTO;
|
||||
import com.cm.common.plugin.service.datadictionary.IDataDictionaryService;
|
||||
import com.cm.common.result.SuccessResultData;
|
||||
import com.cm.common.token.app.AppTokenManager;
|
||||
import com.cm.common.token.app.entity.AppToken;
|
||||
import com.cm.common.utils.HashMapUtil;
|
||||
import com.cm.inspection.pojo.dtos.check.CheckDTO;
|
||||
import com.cm.inspection.pojo.dtos.checkitem.CheckItemDTO;
|
||||
@ -25,6 +28,7 @@ import org.activiti.engine.task.Task;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.joda.time.DateTime;
|
||||
import org.joda.time.format.DateTimeFormat;
|
||||
import org.omg.PortableInterceptor.USER_EXCEPTION;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@ -424,6 +428,36 @@ public class CountServiceImpl extends BaseService implements ICountService {
|
||||
return new SuccessResultData<>(result);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SuccessResultData<Map<String, Integer>> countCurrentMonthOfMine(String token) throws SearchException {
|
||||
String userId = AppTokenManager.getInstance().getToken(token).getUserId();
|
||||
DateTime nowDateTime = DateTime.now();
|
||||
String yearMonth = nowDateTime.toString(DateTimeFormat.forPattern("yyyy-MM"));
|
||||
Map<String, Object> params = getHashMap(4);
|
||||
params.put("userId", userId);
|
||||
params.put("dateYearMonth", yearMonth);
|
||||
// 本月认领企业
|
||||
Integer enterpriseCount = enterpriseOfGridOperatorService.countEnterpriseOfGridOperator(params);
|
||||
// 本月计划健查数
|
||||
List<String> userIds = new ArrayList<>();
|
||||
userIds.add(userId);
|
||||
Integer checkPlanCount = checkPlanService.countCheckPlanByUserIdsAndYearMonth(userIds, nowDateTime.getYear() + "", nowDateTime.getMonthOfYear());
|
||||
// 本月健查企业数
|
||||
params.put("userId", userId);
|
||||
params.put("checkType", 1);
|
||||
params.put("yearMonth", yearMonth);
|
||||
Integer checkEnterpriseCount = checkService.countEnterpriseCheck(params);
|
||||
params.put("checkType", 2);
|
||||
// 本月复查企业数
|
||||
Integer recheckEnterpriseCount = checkService.countEnterpriseCheck(params);
|
||||
Map<String, Integer> result = new HashMap<>(8);
|
||||
result.put("enterpriseCount", enterpriseCount);
|
||||
result.put("checkPlanCount", checkPlanCount);
|
||||
result.put("checkEnterpriseCount", checkEnterpriseCount);
|
||||
result.put("recheckEnterpriseCount", recheckEnterpriseCount);
|
||||
return new SuccessResultData<>(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* 构建检查结果到检查项中
|
||||
*
|
||||
|
@ -217,4 +217,13 @@ public interface IEnterpriseOfGridOperatorService {
|
||||
* @throws SearchException
|
||||
*/
|
||||
Integer countEnterpriseOfArea(Map<String, Object> params) throws SearchException;
|
||||
|
||||
/**
|
||||
* 统计网格员企业
|
||||
*
|
||||
* @param params
|
||||
* @return
|
||||
* @throws SearchException
|
||||
*/
|
||||
Integer countEnterpriseOfGridOperator(Map<String, Object> params) throws SearchException;
|
||||
}
|
||||
|
@ -265,6 +265,12 @@ public class EnterpriseOfGridOperatorServiceImpl extends BaseService implements
|
||||
return countEnterprise == null ? 0 : countEnterprise;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer countEnterpriseOfGridOperator(Map<String, Object> params) throws SearchException {
|
||||
Integer count = enterpriseOfGridOperatorDao.countEnterpriseOfGridOperatorSimple(params);
|
||||
return count == null ? 0 : count;
|
||||
}
|
||||
|
||||
/**
|
||||
* 初始化未认领地区
|
||||
*
|
||||
|
@ -1,6 +1,6 @@
|
||||
server:
|
||||
port: 7006
|
||||
url: http://192.168.0.113:7006/inspection
|
||||
url: http://192.168.0.103:7006/inspection
|
||||
title: 隐患上报系统
|
||||
servlet:
|
||||
context-path: /inspection
|
||||
@ -78,7 +78,7 @@ file:
|
||||
# 安全
|
||||
security:
|
||||
oauth2:
|
||||
oauth-server: http://192.168.0.113:7001/usercenter
|
||||
oauth-server: http://192.168.0.103:7001/usercenter
|
||||
oauth-logout: ${security.oauth2.oauth-server}/logout?redirect_uri=${server.url}
|
||||
client:
|
||||
client-id: 32ec344a5fd04fd9911586df5d1dc36b
|
||||
|
@ -473,6 +473,14 @@
|
||||
AND
|
||||
LEFT(gmt_create, 7) = #{yearMonth}
|
||||
</if>
|
||||
<if test="checkType != null">
|
||||
AND
|
||||
check_type = #{checkType}
|
||||
</if>
|
||||
<if test="userId != null and userId != ''">
|
||||
AND
|
||||
creator = #{userId}
|
||||
</if>
|
||||
<if test="userIdList != null and userIdList.size > 0">
|
||||
AND
|
||||
creator IN
|
||||
|
@ -643,4 +643,26 @@
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<!-- 统计企业 -->
|
||||
<select id="countEnterpriseOfGridOperatorSimple" parameterType="map" resultType="java.lang.Integer">
|
||||
SELECT
|
||||
COUNT(*)
|
||||
FROM
|
||||
gen_enterprise_of_grid_operator t1
|
||||
WHERE
|
||||
t1.is_delete = 0
|
||||
<if test="userId != null and userId != ''">
|
||||
AND
|
||||
t1.creator = #{userId}
|
||||
</if>
|
||||
<if test="yearMonth != null and yearMonth != ''">
|
||||
AND
|
||||
LEFT(t1.gmt_create, 7) <![CDATA[ <= ]]> #{yearMonth}
|
||||
</if>
|
||||
<if test="dateYearMonth != null and dateYearMonth != ''">
|
||||
AND
|
||||
LEFT(t1.gmt_create, 7) = #{dateYearMonth}
|
||||
</if>
|
||||
</select>
|
||||
|
||||
</mapper>
|
Loading…
Reference in New Issue
Block a user