Browse Source

Merge remote-tracking branch 'remotes/origin/dev_repeat_aop' into develop

# Conflicts:
#	epmet-user/epmet-user-client/src/main/java/com/epmet/constant/BadgeConstant.java
dev_shibei_match
jianjun 4 years ago
parent
commit
d170d7b1dc
  1. 4
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/aop/NoRepeatSubmit.java
  2. 66
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/aop/NoRepeatSubmitAop.java
  3. 23
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/distributedlock/DistributedLock.java
  4. 1
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java
  5. 9
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/RedisKeys.java
  6. 20
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/govorg/impl/GovOrgServiceImpl.java
  7. 4
      epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/datastats/DatsStatsDao.xml
  8. 1
      epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenProjectCategoryOrgDailyDao.xml
  9. 9
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenProjectCategoryOrgDailyDao.java
  10. 6
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/screen/ScreenProjectCategoryOrgDailyEntity.java
  11. 32
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenProjectCategoryOrgDailyServiceImpl.java
  12. 2
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/impl/GovernanceDataReportServiceImpl.java
  13. 24
      epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenProjectCategoryOrgDailyDao.xml
  14. 10
      epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/controller/AccessConfigController.java
  15. 51
      epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/controller/TestController.java
  16. 1
      epmet-module/gov-project/gov-project-server/src/main/resources/mapper/ResiEventDao.xml
  17. 6
      epmet-user/epmet-user-client/src/main/java/com/epmet/constant/BadgeConstant.java
  18. 6
      epmet-user/epmet-user-server/src/main/java/com/epmet/controller/UserController.java
  19. 2
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/UserServiceImpl.java

4
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/aop/NoRepeatSubmit.java

@ -13,5 +13,9 @@ import java.lang.annotation.Target;
@Target(ElementType.METHOD)
@Retention(RetentionPolicy.RUNTIME)
public @interface NoRepeatSubmit {
/**
* 持锁时长 单位毫秒 默认10秒
*/
long leaseTime() default 10*1000;
}

66
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/aop/NoRepeatSubmitAop.java

@ -1,15 +1,16 @@
package com.epmet.commons.tools.aop;
import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.commons.tools.distributedlock.DistributedLock;
import com.epmet.commons.tools.exception.EpmetErrorCode;
import com.epmet.commons.tools.exception.RenException;
import com.google.common.cache.Cache;
import com.google.common.cache.CacheBuilder;
import com.epmet.commons.tools.redis.RedisKeys;
import lombok.extern.slf4j.Slf4j;
import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before;
import org.aspectj.lang.annotation.Pointcut;
import org.redisson.api.RLock;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;
@ -18,6 +19,7 @@ import javax.servlet.http.HttpServletRequest;
import java.util.concurrent.TimeUnit;
/**
* desc:利用用户token及请求url 防止用户重复提交需要在没有唯一索引的保存或修改操作 方法入口上加上@NoRepeatSubMit注解
* @author zhaoqifeng
* @dscription
* @date 2020/11/24 9:59
@ -26,37 +28,39 @@ import java.util.concurrent.TimeUnit;
@Configuration
@Slf4j
public class NoRepeatSubmitAop {
private static final String AUTHORIZATION_TOKEN_HEADER_KEY = "Authorization";
@Autowired
private DistributedLock distributedLock;
/**
* 重复提交判断时间为2s
*/
private static final Cache<String, Integer> CACHES = CacheBuilder.newBuilder()
// 最大缓存 100 个
.maximumSize(100)
// 设置写缓存后 5 秒钟过期
.expireAfterWrite(5, TimeUnit.SECONDS)
.build();
@Pointcut("@annotation(com.epmet.commons.tools.aop.NoRepeatSubmit)")
public void doAspect() {
@Around("@annotation(noRepeatSubmit)")
public Object around(ProceedingJoinPoint pjp,NoRepeatSubmit noRepeatSubmit) {
}
@Before("doAspect()")
public void around(JoinPoint pjp) {
try {
ServletRequestAttributes attributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes();
assert attributes != null;
HttpServletRequest request = attributes.getRequest();
String key = getKey(request.getRequestURI(), pjp.getArgs());
String internalToken = request.getHeader(AUTHORIZATION_TOKEN_HEADER_KEY);
String key = getKey(request.getRequestURI(), internalToken);
// 如果缓存中有这个url视为重复提交
if (CACHES.getIfPresent(key) == null) {
CACHES.put(key, NumConstant.ZERO);
} else {
log.error("重复提交");
throw new RenException(EpmetErrorCode.REPEATED_SUBMIT_ERROR.getCode());
Object result = null;
try {
long leaseTime = noRepeatSubmit.leaseTime();
//如果获取不到锁等待0秒直接返回 持锁时间为leaseTime
RLock lock = distributedLock.getLock(RedisKeys.getNoRepeatSubmitKey(key), leaseTime, NumConstant.ZERO_L, TimeUnit.MILLISECONDS);
try {
//因为getLock如果获取失败抛异常 所以不做锁状态的判断
result = pjp.proceed();
} finally {
distributedLock.unLock(lock);
}
} catch (Exception e) {
log.warn("noRepeatSubmit exception",e);
//"未获取到锁,重复提交了
throw new RenException(EpmetErrorCode.REPEAT_SUBMIT.getCode());
}
return result;
} catch (RenException e) {
throw e;
} catch (Throwable e) {
@ -65,12 +69,8 @@ public class NoRepeatSubmitAop {
}
}
private String getKey(String keyExpress, Object[] args) {
for (int i = 0; i < args.length; i++) {
keyExpress = keyExpress.replace("arg[" + i + "]", args[i].toString());
private String getKey(String keyExpress,String token) {
return keyExpress+token;
}
return keyExpress;
}
}

23
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/distributedlock/DistributedLock.java

@ -1,6 +1,7 @@
package com.epmet.commons.tools.distributedlock;
import com.epmet.commons.tools.exception.RenException;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.redisson.api.RLock;
import org.redisson.api.RedissonClient;
@ -13,6 +14,7 @@ import java.util.concurrent.TimeUnit;
* @Author zxc
* @DateTime 2020/10/28 9:05 上午
*/
@Slf4j
@Component
public class DistributedLock {
@ -45,9 +47,7 @@ public class DistributedLock {
* @return
*/
public RLock getLock(String name, Long leaseTime, Long waitTime, TimeUnit timeUnit) {
RLock lock = null;
if (StringUtils.isNotBlank(name) && leaseTime > 0 && waitTime > 0) {
lock = redissonClient.getLock(name);
RLock lock = redissonClient.getLock(name);
Boolean lockStatus;
try {
lockStatus = lock.tryLock(waitTime, leaseTime, timeUnit);
@ -55,8 +55,23 @@ public class DistributedLock {
throw new RenException("获取锁🔒失败了......");
}
} catch (InterruptedException e) {
e.printStackTrace();
log.error("getLock interruptedException"+name,e);
}
return lock;
}
/**
* 取锁
*
* @param name 锁key
* @return
*/
public RLock tryLock(String name) {
RLock lock = redissonClient.getLock(name);
Boolean lockStatus = lock.tryLock();
if (!lockStatus) {
throw new RenException("获取锁🔒失败了......");
}
return lock;
}

1
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java

@ -64,6 +64,7 @@ public enum EpmetErrorCode {
ACTUAL_TIME(8124,"请录入实际开始时间,实际结束时间"),
ACTUAL_NOT_FINISHED(8125,"请先结束活动"),
ACT_SIGN_UP_END_TIME_EARLIER_NOW_EERROR(8121,"活动报名截止时间应晚于当前时间"),
REPEAT_SUBMIT(8126,"重复请求,请稍后重试"),
CANNOT_AUDIT_WARM(8201, "请完善居民信息"),
NOT_DEL_AGENCY(8202, "该机关存在下级机关,不允许删除"),

9
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/RedisKeys.java

@ -482,4 +482,13 @@ public class RedisKeys {
public static String getProjectChangedMsgDistinceKey(String customerId) {
return rootPrefix.concat("project_changed:consume:").concat(customerId);
}
/**
* desc:获取防重复提交redis key
* @param key
* @return
*/
public static String getNoRepeatSubmitKey(String key) {
return rootPrefix.concat("no_repeat_submit:").concat(key);
}
}

20
epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/govorg/impl/GovOrgServiceImpl.java

@ -30,6 +30,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
@ -151,17 +152,22 @@ public class GovOrgServiceImpl implements GovOrgService {
List<String> usedAreaCodeList1 = customerAgencyDao.selectUsedAreaCodeList(formDTO.getAreaCode());
//外部子客户:
List<String> usedAreaCodeList2 = customerRelation.selectUsedAreaCodeList(formDTO.getAreaCode());
List<String> list=new ArrayList<>();
if(CollectionUtils.isNotEmpty(usedAreaCodeList1)){
list.addAll(usedAreaCodeList1);
}
if(CollectionUtils.isNotEmpty(usedAreaCodeList2)){
list.addAll(usedAreaCodeList2);
}
HashSet set = new HashSet(list);
list.clear();
list.addAll(set);
//已经被使用的移除不显示
Iterator<NextAreaCodeResultDTO> iterator = allList.iterator();
while (iterator.hasNext()) {
NextAreaCodeResultDTO next = iterator.next();
for (String usedAreaCode1 : usedAreaCodeList1) {
if (next.getAreaCode().equals(usedAreaCode1)) {
iterator.remove();
}
}
for (String usedAreaCode2 : usedAreaCodeList2) {
if (next.getAreaCode().contains(usedAreaCode2)) {
for (String areaCode : list) {
if (next.getAreaCode().equals(areaCode)) {
iterator.remove();
}
}

4
epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/datastats/DatsStatsDao.xml

@ -756,7 +756,7 @@
</select>
<select id="getAgencySumGroup" resultType="com.epmet.dataaggre.dto.datastats.result.TotalAndIncrResultDTO">
SELECT
group_total AS total
SUM(group_total) AS total
FROM
fact_group_total_agency_daily
WHERE
@ -765,8 +765,6 @@
<foreach item="agencyId" collection="agencyList" open="AND (" separator="or" close=")" index="">
agency_id = #{agencyId}
</foreach>
ORDER BY
group_total DESC
</select>
</mapper>

1
epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenProjectCategoryOrgDailyDao.xml

@ -56,7 +56,6 @@
customer_project_category_dict m
WHERE
m.DEL_FLAG = '0'
AND m.EPMET_CATEGORY_CODE IS NULL
AND m.customer_id IN
<foreach item="subCustomerId" collection="subCustomerIds" open="(" separator="," close=")">
#{subCustomerId}

9
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenProjectCategoryOrgDailyDao.java

@ -75,4 +75,13 @@ public interface ScreenProjectCategoryOrgDailyDao extends BaseDao<ScreenProjectC
* @date 2021/5/21 3:26 下午
*/
int deleteAppointData(@Param("customerId") String customerId, @Param("dateId") String dateId,@Param("orgIds")List<String> orgIds);
/**
* @Description 计算平阴县的分类时使用查询内部客户组织的项目分类
* @Param dateId
* @Param orgIds
* @author zxc
* @date 2021/8/16 10:36 上午
*/
List<CategoryProjectResultDTO> selectSelfAgencyCategory(@Param("dateId") String dateId,@Param("orgIds")List<String> orgIds);
}

6
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/screen/ScreenProjectCategoryOrgDailyEntity.java

@ -17,8 +17,10 @@
package com.epmet.entity.evaluationindex.screen;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.epmet.commons.mybatis.entity.BaseEpmetEntity;
import com.fasterxml.jackson.annotation.JsonIgnore;
import lombok.Data;
import lombok.EqualsAndHashCode;
@ -79,4 +81,8 @@ public class ScreenProjectCategoryOrgDailyEntity extends BaseEpmetEntity {
* 分类等级12....
*/
private Integer level;
@JsonIgnore
@TableField(exist = false)
private Boolean useStatus = false;
}

32
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenProjectCategoryOrgDailyServiceImpl.java

@ -413,7 +413,7 @@ public class ScreenProjectCategoryOrgDailyServiceImpl extends BaseServiceImpl<Sc
Map<String, List<CategoryProjectResultDTO>> groupByCategoryCode = categoryProjectResultDTOS.stream().collect(Collectors.groupingBy(CategoryProjectResultDTO::getCategoryCode));
// 这时的result集合要清空,因为被上边使用 【result = ConvertUtils.sourceToTarget(categoryProjectResultDTOS,ScreenProjectCategoryOrgDailyEntity.class);】
result.clear();
List<ScreenProjectCategoryOrgDailyEntity> finalResult = result;
List<ScreenProjectCategoryOrgDailyEntity> finalResult = new ArrayList<>();
groupByCategoryCode.forEach((code, list) -> {
ScreenProjectCategoryOrgDailyEntity e = new ScreenProjectCategoryOrgDailyEntity();
e.setCustomerId(customerId);
@ -428,7 +428,32 @@ public class ScreenProjectCategoryOrgDailyServiceImpl extends BaseServiceImpl<Sc
});
if (!CollectionUtils.isEmpty(sonResult)){
List<ScreenProjectCategoryOrgDailyEntity> entities = ConvertUtils.sourceToTarget(sonResult, ScreenProjectCategoryOrgDailyEntity.class);
result.addAll(entities);
finalResult.addAll(entities);
}
Map<String, List<CustomerAgencyInfoResultDTO>> groupByLevel = agencyIdList.stream().collect(Collectors.groupingBy(CustomerAgencyInfoResultDTO::getLevel));
List<CustomerAgencyInfoResultDTO> levelAgencyInfo = groupByLevel.get(level);
// 计算内部客户的分类
if (!CollectionUtils.isEmpty(levelAgencyInfo)){
List<String> orgIdss = levelAgencyInfo.stream().map(m -> m.getAgencyId()).collect(Collectors.toList());
orgIds.addAll(orgIdss);
List<CategoryProjectResultDTO> selfOrgCategory = baseDao.selectSelfAgencyCategory(dateId, orgIdss);
if (!CollectionUtils.isEmpty(selfOrgCategory)){
List<ScreenProjectCategoryOrgDailyEntity> selfResult = ConvertUtils.sourceToTarget(selfOrgCategory, ScreenProjectCategoryOrgDailyEntity.class);
selfResult.forEach(s -> {
finalResult.forEach(f -> {
if (s.getCategoryCode().equals(f.getCategoryCode())){
s.setProjectTotal(s.getProjectTotal() + f.getProjectTotal());
f.setUseStatus(true);
}
});
});
result.addAll(selfResult);
}
}
Map<Boolean, List<ScreenProjectCategoryOrgDailyEntity>> groupByStatus = finalResult.stream().collect(Collectors.groupingBy(ScreenProjectCategoryOrgDailyEntity::getUseStatus));
List<ScreenProjectCategoryOrgDailyEntity> falseList = groupByStatus.get(false);
if (!CollectionUtils.isEmpty(falseList)){
result.addAll(falseList);
}
// 添加此 锦水、孔村、榆山 orgId,删除时使用
orgIds.add(PingYinConstant.JIN_SHUI_AGENCY_ID);
@ -441,9 +466,8 @@ public class ScreenProjectCategoryOrgDailyServiceImpl extends BaseServiceImpl<Sc
List<CustomerAgencyInfoResultDTO> levelAgencyInfo = groupByLevel.get(level);
if (!CollectionUtils.isEmpty(levelAgencyInfo)) {
List<String> orgIdss = levelAgencyInfo.stream().map(m -> m.getAgencyId()).collect(Collectors.toList());
orgIds.addAll(orgIdss);
// 查询客户下,组织直接立项的,各项目分类下的项目数量【筛选组织创建的项目,fact_origin_project_main_daily表gridId为空】
List<ScreenProjectCategoryGridDailyDTO> screenProjectCategory = factOriginProjectCategoryDailyService.selectListProjectCategoryByOrg(orgIds, customerId);
List<ScreenProjectCategoryGridDailyDTO> screenProjectCategory = factOriginProjectCategoryDailyService.selectListProjectCategoryByOrg(orgIdss, customerId);
if (!CollectionUtils.isEmpty(result)) {
if (!CollectionUtils.isEmpty(screenProjectCategory)) {
result.forEach(r -> {

2
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/impl/GovernanceDataReportServiceImpl.java

@ -43,7 +43,7 @@ public class GovernanceDataReportServiceImpl implements GovernanceDataReportServ
*/
@Override
public void insertGovernRankDataDaily(GovernRankDataDailyFormDTO formDTO, String customerId) {
if (StringUtils.isEmpty(formDTO.getDateId()) || formDTO.getDateId().length() != NumConstant.SIX) {
if (StringUtils.isEmpty(formDTO.getDateId()) || formDTO.getDateId().length() != NumConstant.EIGHT) {
throw new RenException("dateId格式应为: yyyyMMdd,当前传入:" + formDTO.getDateId());
}
if (formDTO.getIsFirst()) {

24
epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenProjectCategoryOrgDailyDao.xml

@ -76,4 +76,28 @@
GROUP BY od.CATEGORY_CODE,od.pid
</select>
<!-- 查询内部客户组织的项目分类 -->
<select id="selectSelfAgencyCategory" resultType="com.epmet.dto.screen.result.CategoryProjectResultDTO">
SELECT
od.pid AS orgId,
IFNULL(sca.PID,'0') AS pid,
IFNULL(sca.PIDS,'0') AS pids,
od.level,
od.CATEGORY_CODE,
IFNULL(SUM(od.PROJECT_TOTAL),0) AS projectTotal,
od.DATE_ID
FROM screen_project_category_org_daily od
LEFT JOIN customer_project_category_dict cd ON (cd.CATEGORY_CODE = od.CATEGORY_CODE AND cd.CUSTOMER_ID = od.CUSTOMER_ID)
LEFT JOIN screen_customer_agency sca ON sca.AGENCY_ID = od.PID
WHERE 1=1
AND od.DEL_FLAG = '0'
AND od.ORG_ID IN (
<foreach collection="orgIds" item="orgId" separator=",">
#{orgId}
</foreach>
)
AND od.date_id = #{dateId}
GROUP BY od.CATEGORY_CODE,od.pid
</select>
</mapper>

10
epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/controller/AccessConfigController.java

@ -1,5 +1,6 @@
package com.epmet.controller;
import com.epmet.commons.tools.aop.NoRepeatSubmit;
import com.epmet.commons.tools.utils.Result;
import com.epmet.commons.tools.validator.ValidatorUtils;
import com.epmet.dto.form.*;
@ -8,11 +9,9 @@ import com.epmet.dto.result.AccessConfigOpesResultDTO;
import com.epmet.dto.result.AccessConfigOptionsResultDTO;
import com.epmet.dto.result.RoleOperationDefaultResultDTO;
import com.epmet.service.AccessConfigService;
import oracle.jdbc.proxy.annotation.Post;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.validation.constraints.NotBlank;
import java.util.List;
import java.util.Set;
@ -49,6 +48,7 @@ public class AccessConfigController {
* 保存角色的操作权限列表
* @return
*/
@NoRepeatSubmit
@PostMapping("saveroleopes")
public Result saveRoleOpes(@RequestBody AccessConfigOpesFormDTO formDTO) {
accessConfigService.saveRoleOpes(formDTO.getRoleId(), formDTO.getOpes(), formDTO.getCustomerId());
@ -71,6 +71,7 @@ public class AccessConfigController {
* @param config
* @return
*/
@NoRepeatSubmit
@PostMapping("saveconfig")
public Result saveSettings(@RequestBody AccessConfigSaveConfigDTO config) {
ValidatorUtils.validateEntity(config);
@ -87,6 +88,7 @@ public class AccessConfigController {
* @param form
* @return
*/
@NoRepeatSubmit
@PostMapping("roledefaultopes/save")
public Result saveRoleDefaultOperations(@RequestBody AccessConfigRoleDefaultOpesFormDTO form) {
ValidatorUtils.validateEntity(form);
@ -111,6 +113,7 @@ public class AccessConfigController {
* @param form
* @return
*/
@NoRepeatSubmit
@PostMapping("opedefaultscopes/save")
public Result saveOpeDefaultScopes(@RequestBody AccessConfigOpeDefaultScopesFormDTO form) {
ValidatorUtils.validateEntity(form, AccessConfigOpeDefaultScopesFormDTO.SaveOpeDefaultScopesGroup.class);
@ -124,6 +127,7 @@ public class AccessConfigController {
* @author wxz
* @date 2020.11.17 17:41
*/
@NoRepeatSubmit
@PostMapping("add-ope-and-scopes-4role")
public Result addOpeAndScopes4Role(@RequestBody AccessConfigAdd4RoletFormDTO form) {
ValidatorUtils.validateEntity(form, AccessConfigAdd4RoletFormDTO.AddSingleOperation4RoleGroup.class);
@ -141,6 +145,7 @@ public class AccessConfigController {
* @author wxz
* @date 2021.07.01 16:07
*/
@NoRepeatSubmit
@PostMapping("add-ope-and-scopes-4role/by-default-conf")
public Result addOpeAndScopes4RoleByDefaultConf(@RequestBody AccessConfigAdd4RoletFormDTO form) {
ValidatorUtils.validateEntity(form, AccessConfigAdd4RoletFormDTO.AddSingleOperations4RoleByDefault.class);
@ -157,6 +162,7 @@ public class AccessConfigController {
* @author wxz
* @date 2020.12.02 16:20
*/
@NoRepeatSubmit
@PostMapping("add-opes-and-scopes-4role")
public Result addOpesAndScopes4Role(@RequestBody AccessConfigAdd4RoletFormDTO form) {
ValidatorUtils.validateEntity(form, AccessConfigAdd4RoletFormDTO.AddMultiOperations4RoleGroup.class);

51
epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/controller/TestController.java

@ -1,11 +1,22 @@
package com.epmet.controller;
import com.epmet.commons.tools.annotation.ExternalRequestAuth;
import com.epmet.commons.tools.exception.RenException;
import com.epmet.commons.tools.aop.NoRepeatSubmit;
import com.epmet.commons.tools.utils.HttpClientManager;
import com.epmet.commons.tools.utils.Result;
import com.epmet.service.TestService;
import lombok.Data;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
@RestController
@RequestMapping("test")
@ -14,13 +25,41 @@ public class TestController {
@Autowired
private TestService testService;
@NoRepeatSubmit
@ExternalRequestAuth
@PostMapping("test")
public void test(@RequestBody Input input) {
if (true) {
throw new RenException("测试报错");
public Result<String> test(@RequestBody(required = false) Input input) {
try {
Thread.sleep(5000);
} catch (InterruptedException e) {
e.printStackTrace();
}
String s = "这里是测试结果!";
return new Result<String>().ok(s);
}
@PostMapping("repeat")
public Result testRepeatSubmit(){
System.out.println("开始执行多线程==========");
CountDownLatch countDownLatch = new CountDownLatch(1);
ExecutorService executorService = Executors.newFixedThreadPool(10);
String url = "http://localhost:8099/gov/access/test/test";
for (int i = 0; i < 10 ; i++) {
executorService.submit(()->{
try {
countDownLatch.await();
Map<String,String> headersMap = new HashMap<>();
headersMap.put("Authorization","token");
Result<String> stringResult = HttpClientManager.getInstance().sendPostByJSONAndHeader(url, "", headersMap);
System.out.println(stringResult.getData());
} catch (InterruptedException e) {
e.printStackTrace();
}
});
}
testService.test();
countDownLatch.countDown();
return new Result().ok(true);
}
@Data

1
epmet-module/gov-project/gov-project-server/src/main/resources/mapper/ResiEventDao.xml

@ -143,6 +143,7 @@
LEFT JOIN resi_event_report_org ro ON (ro.RESI_EVENT_ID = re.ID AND ro.DEL_FLAG = '0')
WHERE re.DEL_FLAG = '0'
AND re.ID = #{eventId}
order by ea.sort asc
</select>
<!-- 更新报事人红点状态 -->

6
epmet-user/epmet-user-client/src/main/java/com/epmet/constant/BadgeConstant.java

@ -42,6 +42,9 @@ public interface BadgeConstant {
String DEFAULT = "default";
// 人大代表徽章KEY
String BADGE_KEY_NPC = "NPC";
/**
* 人大代表的type
*/
@ -56,7 +59,4 @@ public interface BadgeConstant {
String NPC_BADGE = "人大代表徽章";
String CPPCC_BADGE = "政协委员徽章";
// 人大代表徽章KEY
String BADGE_KEY_NPC = "NPC";
}

6
epmet-user/epmet-user-server/src/main/java/com/epmet/controller/UserController.java

@ -1,6 +1,7 @@
package com.epmet.controller;
import com.epmet.commons.tools.annotation.LoginUser;
import com.epmet.commons.tools.aop.NoRepeatSubmit;
import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.commons.tools.utils.Result;
import com.epmet.commons.tools.validator.ValidatorUtils;
@ -50,6 +51,7 @@ public class UserController {
* @Description
* @Date 2020/3/16 15:49
**/
@NoRepeatSubmit
@PostMapping("saveOrUpdateUserWechatDTO")
public Result<UserDTO> saveOrUpdateUserWechatDTO(@RequestBody UserWechatDTO userWechatDTO) {
//效验数据
@ -77,6 +79,7 @@ public class UserController {
* @Author sun
* @Description 居民端个人信息-同步用户微信信息
**/
@NoRepeatSubmit
@PostMapping("updatewxuserinfo")
public Result updateWxUserInfo(@LoginUser TokenDto tokenDTO, @RequestBody WxUserInfoFormDTO wxUserInfoFormDTO) {
wxUserInfoFormDTO.setUserId(tokenDTO.getUserId());
@ -124,6 +127,7 @@ public class UserController {
* @Author sun
* @Description 小程序微信用户登陆新增或更新用户信息
**/
@NoRepeatSubmit
@PostMapping("savewxuser")
public Result<UserDTO> saveWxUser(@RequestBody WxUserFormDTO formDTO){
return new Result<UserDTO>().ok(userService.saveWxUser(formDTO));
@ -138,6 +142,7 @@ public class UserController {
* @Author zhangyong
* @Date 14:51 2020-07-23
**/
@NoRepeatSubmit
@PostMapping("updateUserBaseAndWxUserInfo")
public Result updateUserBaseAndWxUserInfo(@RequestBody WxUserInfoFormDTO wxUserInfoFormDTO) {
ValidatorUtils.validateEntity(wxUserInfoFormDTO);
@ -160,6 +165,7 @@ public class UserController {
* @author zxc
* @date 2021/1/19 上午10:35
*/
@NoRepeatSubmit
@PostMapping("saveuserinfo")
public Result<UserDTO> saveUserInfo(@RequestBody UserInfoFormDTO formDTO){
ValidatorUtils.validateEntity(formDTO, UserInfoFormDTO.UserInfoForm.class);

2
epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/UserServiceImpl.java

@ -182,7 +182,7 @@ public class UserServiceImpl extends BaseServiceImpl<UserDao, UserEntity> implem
if(null != myselfMsg){
MyResiUserInfoResultDTO result = ConvertUtils.sourceToTarget(myselfMsg,MyResiUserInfoResultDTO.class);
//registerFlag 是否已注册居民,true ,false
result.setRegisterFlag(StringUtils.isNotBlank(myselfMsg.getResiId()) ? true : false);
result.setRegisterFlag(StringUtils.isNotBlank(myselfMsg.getResiId()));
result.setRegisterGridName(ModuleConstant.EMPTY_STR);
if(StringUtils.isNotBlank(myselfMsg.getGridId())){
//registerGridName 当前在哪个网格,显示哪个网格的名称

Loading…
Cancel
Save