|
@@ -25,11 +25,16 @@ import com.dragonsoft.duceap.base.entity.http.ResponseStatus;
|
|
|
import com.dragonsoft.duceap.base.entity.search.SearchDTO;
|
|
|
import com.dragonsoft.duceap.base.entity.uploader.FileHolder;
|
|
|
import com.dragonsoft.duceap.base.enums.BooleanEnum;
|
|
|
+import com.dragonsoft.duceap.cache.annotaion.BatchCachePut;
|
|
|
import com.dragonsoft.duceap.core.context.ContextUtils;
|
|
|
import com.dragonsoft.duceap.core.search.Searchable;
|
|
|
import com.dragonsoft.duceap.mybaitsplus.core.services.BaseMybatisService;
|
|
|
import org.springframework.beans.BeanUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.cache.annotation.CacheConfig;
|
|
|
+import org.springframework.cache.annotation.CacheEvict;
|
|
|
+import org.springframework.cache.annotation.CachePut;
|
|
|
+import org.springframework.cache.annotation.Cacheable;
|
|
|
import org.springframework.data.domain.Page;
|
|
|
import org.springframework.data.domain.Sort;
|
|
|
import org.springframework.stereotype.Service;
|
|
@@ -44,7 +49,7 @@ import java.util.stream.Collectors;
|
|
|
* @author huangzqa
|
|
|
* @date 2020/10/27
|
|
|
*/
|
|
|
-@Transactional(rollbackFor = Exception.class)
|
|
|
+@CacheConfig(cacheNames = "DCUC-APP")
|
|
|
@Service
|
|
|
public class ApplyInfoServiceImpl extends BaseMybatisService<ApplyInfo, String> implements IApplyInfoService {
|
|
|
|
|
@@ -70,21 +75,24 @@ public class ApplyInfoServiceImpl extends BaseMybatisService<ApplyInfo, String>
|
|
|
@Autowired
|
|
|
private IPermissionNotificationFacade permissionNotificationFacade;
|
|
|
|
|
|
+ @Cacheable(key = "targetClass + methodName+#p0")
|
|
|
@Override
|
|
|
public ApplyInfo applyDetail(String id) {
|
|
|
return applyInfoMapper.selectById(id);
|
|
|
}
|
|
|
|
|
|
+ @Cacheable(key = "targetClass + methodName+#p0")
|
|
|
@Override
|
|
|
public Page<ApplyInfo> applyInfoPage(SearchDTO searchDTO) {
|
|
|
|
|
|
Searchable searchable = Searchable.toSearchable(searchDTO);
|
|
|
searchable.addSort(Sort.Direction.DESC, "SORT");
|
|
|
searchable.addSort(Sort.Direction.DESC, "REGISTRATION_TIME");
|
|
|
- // searchable.addSearchFilter("deleted", SearchOperator.eq, BooleanEnum.TRUE.getValue());
|
|
|
return applyInfoMapper.pagingBySearchable(searchable);
|
|
|
}
|
|
|
|
|
|
+ @CachePut(key = "targetClass + #p0.id")
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
@Override
|
|
|
public ApplyInfo saveAppIy(ApplyInfoDTO applyInfoDTO) {
|
|
|
ApplyInfo applyInfo = new ApplyInfo();
|
|
@@ -99,8 +107,6 @@ public class ApplyInfoServiceImpl extends BaseMybatisService<ApplyInfo, String>
|
|
|
applyInfo.setManufacturerName(manufacturerName);
|
|
|
}
|
|
|
|
|
|
-
|
|
|
-
|
|
|
String applyCode = applyInfo.getApplyCode();
|
|
|
String secretKey = getApiKeys(applyCode);
|
|
|
String apiKey = getApiKeys(applyCode);
|
|
@@ -121,7 +127,8 @@ public class ApplyInfoServiceImpl extends BaseMybatisService<ApplyInfo, String>
|
|
|
return applyInfo;
|
|
|
}
|
|
|
|
|
|
-
|
|
|
+ @CachePut(key = "targetClass + #p0.id")
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
@Override
|
|
|
public ApplyInfo updateApply(ApplyInfoDTO applyInfoDTO) {
|
|
|
ApplyInfo applyInfo = new ApplyInfo();
|
|
@@ -159,7 +166,7 @@ public class ApplyInfoServiceImpl extends BaseMybatisService<ApplyInfo, String>
|
|
|
//发送消息
|
|
|
sendMessage(applyInfo, "应用表信息修改", AppMsgTypeEnum.UPDATE);
|
|
|
//权限变更通知
|
|
|
- boolean isNotification = StringUtils.isNotEmpty(oldApplyInfo.getApplyUrl())&&( !oldApplyInfo.getApplyUrl().equals(applyInfo.getApplyUrl())
|
|
|
+ boolean isNotification = StringUtils.isNotEmpty(oldApplyInfo.getApplyUrl()) && (!oldApplyInfo.getApplyUrl().equals(applyInfo.getApplyUrl())
|
|
|
|| !oldApplyInfo.getApplyStatus().equals(applyInfo.getApplyStatus()));
|
|
|
// 应用 url 当发送变更时进行通知
|
|
|
if (isNotification) {
|
|
@@ -168,6 +175,8 @@ public class ApplyInfoServiceImpl extends BaseMybatisService<ApplyInfo, String>
|
|
|
return applyInfo;
|
|
|
}
|
|
|
|
|
|
+ @CacheEvict(key = "targetClass +#p0")
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
@Override
|
|
|
public void del(String id) {
|
|
|
ApplyInfo applyInfo = applyInfoMapper.selectById(id);
|
|
@@ -180,11 +189,14 @@ public class ApplyInfoServiceImpl extends BaseMybatisService<ApplyInfo, String>
|
|
|
permissionNotificationFacade.sendAppAppUpdate(id);
|
|
|
}
|
|
|
|
|
|
+ @Cacheable(key = "targetClass + methodName")
|
|
|
@Override
|
|
|
public String getNewSort() {
|
|
|
return applyInfoMapper.getNewSort();
|
|
|
}
|
|
|
|
|
|
+ @CacheEvict(key = "targetClass +#p0")
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
@Override
|
|
|
public String startOrStop(String id) {
|
|
|
ApplyInfo applyInfo = applyInfoMapper.selectById(id);
|
|
@@ -207,6 +219,8 @@ public class ApplyInfoServiceImpl extends BaseMybatisService<ApplyInfo, String>
|
|
|
return message;
|
|
|
}
|
|
|
|
|
|
+ @CacheEvict(key = "targetClass +#p0")
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
@Override
|
|
|
public void sortApp(String id, String target) {
|
|
|
ApplyInfo applyInfo = applyInfoMapper.selectById(id);
|
|
@@ -224,6 +238,7 @@ public class ApplyInfoServiceImpl extends BaseMybatisService<ApplyInfo, String>
|
|
|
applyInfoMapper.updateById(targetApplyInfo);
|
|
|
}
|
|
|
|
|
|
+ @Cacheable(key = "targetClass + methodName+#p0")
|
|
|
@Override
|
|
|
public String codeConvertToId(String appCode) {
|
|
|
|
|
@@ -261,6 +276,7 @@ public class ApplyInfoServiceImpl extends BaseMybatisService<ApplyInfo, String>
|
|
|
return LangUtil.array2String(stringList, StrUtil.COMMA);
|
|
|
}
|
|
|
|
|
|
+ @Cacheable(key = "targetClass +#p0")
|
|
|
@Override
|
|
|
public ApplyInfo getAppByCode(String appCode) {
|
|
|
LambdaQueryWrapper<ApplyInfo> queryWrapper = Wrappers.lambdaQuery();
|
|
@@ -270,11 +286,13 @@ public class ApplyInfoServiceImpl extends BaseMybatisService<ApplyInfo, String>
|
|
|
return applyInfoMapper.selectOne(queryWrapper);
|
|
|
}
|
|
|
|
|
|
+ @Cacheable(key = "targetClass + methodName+#p0")
|
|
|
@Override
|
|
|
public List<ApplyInfo> getAppById(List<String> ids) {
|
|
|
return applyInfoMapper.selectBatchIds(ids);
|
|
|
}
|
|
|
|
|
|
+ @Cacheable(key = "targetClass + methodName+#p0")
|
|
|
@Override
|
|
|
public List<ApplyInfo> getAppByAppNameLike(String applyName) {
|
|
|
LambdaQueryWrapper<ApplyInfo> queryWrapper = Wrappers.lambdaQuery();
|
|
@@ -282,6 +300,7 @@ public class ApplyInfoServiceImpl extends BaseMybatisService<ApplyInfo, String>
|
|
|
return applyInfoMapper.selectList(queryWrapper);
|
|
|
}
|
|
|
|
|
|
+ @Cacheable(key = "targetClass + methodName+#p0")
|
|
|
@Override
|
|
|
public ApplyInfo getAppByAppUrl(String applyUrl) {
|
|
|
LambdaQueryWrapper<ApplyInfo> queryWrapper = Wrappers.lambdaQuery();
|
|
@@ -295,14 +314,16 @@ public class ApplyInfoServiceImpl extends BaseMybatisService<ApplyInfo, String>
|
|
|
|
|
|
}
|
|
|
|
|
|
+ @Cacheable(key = "targetClass + methodName+#p0")
|
|
|
@Override
|
|
|
public List<ApplyInfo> getIdsByCodes(List<String> appCodes) {
|
|
|
LambdaQueryWrapper<ApplyInfo> queryWrapper = Wrappers.lambdaQuery();
|
|
|
queryWrapper.select(ApplyInfo::getId,ApplyInfo::getApplyCode)
|
|
|
- .in(ApplyInfo::getApplyCode,appCodes);
|
|
|
+ .in(ApplyInfo::getApplyCode,appCodes);
|
|
|
return applyInfoMapper.selectList(queryWrapper);
|
|
|
}
|
|
|
|
|
|
+ @Cacheable(key = "targetClass + methodName+#p0.id")
|
|
|
@Override
|
|
|
public ResponseStatus isRepeat(ApplyInfo applyInfo) {
|
|
|
|
|
@@ -339,11 +360,14 @@ public class ApplyInfoServiceImpl extends BaseMybatisService<ApplyInfo, String>
|
|
|
return ResponseStatus.success();
|
|
|
}
|
|
|
|
|
|
+ @BatchCachePut
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
@Override
|
|
|
public void updateOrgInfos(String orgId, String orgName) {
|
|
|
applyInfoMapper.updateOrgInfo(orgId, orgName);
|
|
|
}
|
|
|
|
|
|
+ @Cacheable(key = "targetClass + methodName+#p0")
|
|
|
@Override
|
|
|
public List<String> getAppIdsByOrgId(String orgId) {
|
|
|
|
|
@@ -358,6 +382,7 @@ public class ApplyInfoServiceImpl extends BaseMybatisService<ApplyInfo, String>
|
|
|
.collect(Collectors.toList());
|
|
|
}
|
|
|
|
|
|
+ @Cacheable(key = "targetClass + methodName+#p0")
|
|
|
@Override
|
|
|
public List<ApplyInfo> fzxmList(String userId) {
|
|
|
|
|
@@ -369,6 +394,8 @@ public class ApplyInfoServiceImpl extends BaseMybatisService<ApplyInfo, String>
|
|
|
return applyInfoMapper.selectList(queryWrapper);
|
|
|
}
|
|
|
|
|
|
+ @BatchCachePut()
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
@Override
|
|
|
public void saveDutyMan(String dutyProject, String userId, String mobileWork) {
|
|
|
Object[] projectIdArray = dutyProject.split(StrUtil.COMMA);
|
|
@@ -381,6 +408,7 @@ public class ApplyInfoServiceImpl extends BaseMybatisService<ApplyInfo, String>
|
|
|
applyInfoMapper.update(new ApplyInfo(), updateWrapper);
|
|
|
}
|
|
|
|
|
|
+ @Cacheable(key = "targetClass + methodName")
|
|
|
@Override
|
|
|
public Map<String, String> findAppNameMap() {
|
|
|
LambdaQueryWrapper<ApplyInfo> queryWrapper = Wrappers.lambdaQuery();
|
|
@@ -395,15 +423,16 @@ public class ApplyInfoServiceImpl extends BaseMybatisService<ApplyInfo, String>
|
|
|
return stringStringMap;
|
|
|
}
|
|
|
|
|
|
+ @Cacheable(key = "targetClass + methodName+#p0")
|
|
|
@Override
|
|
|
public Page<ApplyInfo> findApplyList(SearchDTO searchDTO) {
|
|
|
- // todo 逻辑
|
|
|
Searchable searchable = Searchable.toSearchable(searchDTO);
|
|
|
searchable.removeSearchFilter("userBusiness_eq");
|
|
|
searchable.addSort(Sort.Direction.DESC, "sort");
|
|
|
return applyInfoMapper.pagingBySearchable(searchable);
|
|
|
}
|
|
|
|
|
|
+ @Cacheable(key = "targetClass + methodName+#p0")
|
|
|
@Override
|
|
|
public Integer countByManufacturerId(String manufacturerId) {
|
|
|
LambdaQueryWrapper<ApplyInfo> queryWrapper = Wrappers.lambdaQuery();
|
|
@@ -413,6 +442,7 @@ public class ApplyInfoServiceImpl extends BaseMybatisService<ApplyInfo, String>
|
|
|
return applyInfoMapper.selectCount(queryWrapper);
|
|
|
}
|
|
|
|
|
|
+ @Cacheable(key = "targetClass + methodName+#p0")
|
|
|
@Override
|
|
|
public List<ApplyInfo> getAppListByManufacturerId(String manufacturerId) {
|
|
|
|
|
@@ -423,6 +453,7 @@ public class ApplyInfoServiceImpl extends BaseMybatisService<ApplyInfo, String>
|
|
|
return applyInfoMapper.selectList(queryWrapper);
|
|
|
}
|
|
|
|
|
|
+ @Cacheable(key = "targetClass + methodName")
|
|
|
@Override
|
|
|
public Map<String, String> getAllIdNameMap() {
|
|
|
LambdaQueryWrapper<ApplyInfo> queryWrapper = Wrappers.lambdaQuery();
|
|
@@ -434,6 +465,7 @@ public class ApplyInfoServiceImpl extends BaseMybatisService<ApplyInfo, String>
|
|
|
.collect(Collectors.toMap(ApplyInfo::getId, ApplyInfo::getApplyName));
|
|
|
}
|
|
|
|
|
|
+ @Cacheable(key = "targetClass + methodName+#p0+#p1")
|
|
|
@Override
|
|
|
public ApplyInfo getOneByCodeAndName(String appCode, String appName) {
|
|
|
LambdaQueryWrapper<ApplyInfo> queryWrapper = Wrappers.lambdaQuery();
|
|
@@ -442,6 +474,7 @@ public class ApplyInfoServiceImpl extends BaseMybatisService<ApplyInfo, String>
|
|
|
return applyInfoMapper.selectOne(queryWrapper);
|
|
|
}
|
|
|
|
|
|
+ @Cacheable(key = "targetClass + methodName+#p0 +#p1")
|
|
|
@Override
|
|
|
public ApplyInfo getOneByNameAndManufacturerId(String applyName, String manufacturerId) {
|
|
|
LambdaQueryWrapper<ApplyInfo> queryWrapper = Wrappers.lambdaQuery();
|
|
@@ -451,6 +484,7 @@ public class ApplyInfoServiceImpl extends BaseMybatisService<ApplyInfo, String>
|
|
|
return applyInfoMapper.selectOne(queryWrapper);
|
|
|
}
|
|
|
|
|
|
+ @Cacheable(key = "targetClass + methodName+#p0")
|
|
|
@Override
|
|
|
public ApplyInfo getOneByName(String applyName) {
|
|
|
LambdaQueryWrapper<ApplyInfo> queryWrapper = Wrappers.lambdaQuery();
|