企业同步

This commit is contained in:
zhangchenbiao
2023-06-05 11:34:44 +08:00
parent 09f651ed0d
commit 0576ed223a
77 changed files with 3365 additions and 149 deletions

View File

@@ -63,7 +63,6 @@
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-jdbc:3.0.2" level="project" />
<orderEntry type="library" name="Maven: com.zaxxer:HikariCP:3.4.2" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-jdbc:5.2.5.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-tx:5.2.5.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.mybatis.spring.boot:mybatis-spring-boot-autoconfigure:2.2.2" level="project" />
<orderEntry type="library" name="Maven: org.mybatis:mybatis:3.5.9" level="project" />
<orderEntry type="library" name="Maven: org.mybatis:mybatis-spring:2.0.7" level="project" />
@@ -90,5 +89,21 @@
<orderEntry type="library" name="Maven: com.aliyun:openapiutil:0.1.9" level="project" />
<orderEntry type="library" name="Maven: org.bouncycastle:bcpkix-jdk15on:1.65" level="project" />
<orderEntry type="library" name="Maven: org.bouncycastle:bcprov-jdk15on:1.65" level="project" />
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-data-redis:3.0.4" level="project" />
<orderEntry type="library" name="Maven: org.springframework.data:spring-data-redis:2.2.6.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework.data:spring-data-keyvalue:2.2.6.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework.data:spring-data-commons:2.2.6.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-tx:5.2.5.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-oxm:5.2.5.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-context-support:5.2.5.RELEASE" level="project" />
<orderEntry type="library" name="Maven: io.lettuce:lettuce-core:5.2.2.RELEASE" level="project" />
<orderEntry type="library" name="Maven: io.netty:netty-common:4.1.48.Final" level="project" />
<orderEntry type="library" name="Maven: io.netty:netty-handler:4.1.48.Final" level="project" />
<orderEntry type="library" name="Maven: io.netty:netty-resolver:4.1.48.Final" level="project" />
<orderEntry type="library" name="Maven: io.netty:netty-buffer:4.1.48.Final" level="project" />
<orderEntry type="library" name="Maven: io.netty:netty-codec:4.1.48.Final" level="project" />
<orderEntry type="library" name="Maven: io.netty:netty-transport:4.1.48.Final" level="project" />
<orderEntry type="library" name="Maven: io.projectreactor:reactor-core:3.3.4.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.reactivestreams:reactive-streams:1.0.3" level="project" />
</component>
</module>

View File

@@ -82,6 +82,10 @@
<groupId>com.aliyun</groupId>
<artifactId>tea-openapi</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-redis</artifactId>
</dependency>
</dependencies>
</project>

View File

@@ -8,8 +8,6 @@ package com.cool.store.constants;
*/
public class CommonConstants {
public static final String DEFAULT_DB = "coolcollege_intelligent_config";
public static final String REQUEST_ID = "requestId";
public static final String ACCESS_TOKEN_KEY = "access_token";
@@ -71,6 +69,9 @@ public class CommonConstants {
*/
public static final String MaxReconsumeTimes = "2";
public static final String ZERO_STR = "0";
public static final String DELETE_DEPT_ID = "-1";
public static final String AI_USER_ID = "a100000001";
public static final int ZERO = 0;
public static final int ONE = 1;
@@ -94,9 +95,6 @@ public class CommonConstants {
public static final int HUNDRED = 100;
public static final String ZERO_STR = "0";
public static final String ONE_STR = "1";
public static final String TWO_STR = "2";
public static final String THREE_STR = "3";

View File

@@ -0,0 +1,35 @@
package com.cool.store.enums;
import java.util.Arrays;
import java.util.Map;
import java.util.function.Function;
import java.util.stream.Collectors;
/**
* 门店删除状态枚举
*/
public enum StoreIsDeleteEnum {
EFFECTIVE("effective"),//有效
INVALID("invalid"),//无效
IGNORED("ignored"), //忽略
UN_SYNC("unSync"); // 未同步
private final String value;
private static final Map<String, StoreIsDeleteEnum> map = Arrays.stream(values()).collect(Collectors.toMap(StoreIsDeleteEnum::getValue, Function.identity()));
StoreIsDeleteEnum(String value) {
this.value = value;
}
public String getValue() {
return value;
}
public static StoreIsDeleteEnum parse(int value) {
return map.get(value);
}
}

View File

@@ -0,0 +1,174 @@
package com.cool.store.utils;
import com.cool.store.constants.CommonConstants;
import lombok.extern.slf4j.Slf4j;
import org.springframework.data.redis.core.HashOperations;
import org.springframework.data.redis.core.RedisOperations;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Repository;
import javax.annotation.Resource;
import java.util.Collection;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.TimeUnit;
/**
* redis工具类
*
* @author Aaron
* @ClassName RedisUtil
* @Description redis工具类
*/
@Repository
@Slf4j
public class RedisUtil {
@Resource(name = "customizeTemplate")
protected RedisTemplate<String, Object> redisTemplate;
public void put(String key, String hashKey, Map<String, Object> value) {
HashOperations<String, String, Object> hash = redisTemplate.opsForHash();
hash.put(key, hashKey, value);
}
public void put(String key, String hashKey, Object value) {
HashOperations<String, String, Object> hash = redisTemplate.opsForHash();
hash.put(key, hashKey, value);
}
public Boolean haseHashKey(String key, String hashKey) {
HashOperations<String, String, Object> hash = redisTemplate.opsForHash();
Boolean hase = hash.hasKey(key, hashKey);
return hase == null ? Boolean.FALSE : hase;
}
public Boolean putIfAbsent(String key, String hashKey, Object value) {
HashOperations<String, String, Object> hash = redisTemplate.opsForHash();
return hash.putIfAbsent(key, hashKey, value);
}
public void putAll(String key, Map<String, Object> value) {
HashOperations<String, String, Object> hash = redisTemplate.opsForHash();
hash.putAll(key, value);
}
public void putAll(String key, Map<String, Object> value, Long time, TimeUnit timeUnit) {
HashOperations<String, String, Object> hash = redisTemplate.opsForHash();
hash.putAll(key, value);
redisTemplate.expire(key, time, timeUnit);
}
public void put(String key, Object value, Long time, TimeUnit timeUnit) {
redisTemplate.opsForValue().set(key, value, time, timeUnit);
}
public Map<String, Object> entries(String key) {
HashOperations<String, String, Object> hash = redisTemplate.opsForHash();
return hash.entries(key);
}
public Object get(String key, String hashKey) {
HashOperations<String, String, Object> hash = redisTemplate.opsForHash();
return hash.get(key, hashKey);
}
public void flushDb() {
redisTemplate.getConnectionFactory().getConnection().flushDb();
log.info("redis flushDb is ok.");
}
public void delete(String key, Object hashKey) {
HashOperations<String, String, Object> hash = redisTemplate.opsForHash();
hash.delete(key, hashKey);
}
public Collection<Object> multiGet(String key, Collection<String> hashKeys) {
HashOperations<String, String, Object> hash = redisTemplate.opsForHash();
return hash.multiGet(key, hashKeys);
}
public Set<String> keys(String key) {
HashOperations<String, String, Object> hash = redisTemplate.opsForHash();
return hash.keys(key);
}
public Long size(String key) {
HashOperations<String, String, Object> hash = redisTemplate.opsForHash();
return hash.size(key);
}
public Collection<Object> values(String key) {
HashOperations<String, String, Object> hash = redisTemplate.opsForHash();
return hash.values(key);
}
public RedisOperations<String, ?> getOperations() {
HashOperations<String, String, Object> hash = redisTemplate.opsForHash();
return hash.getOperations();
}
public String hashGetString(String key, String hashKey) {
HashOperations<String, String, Object> hash = redisTemplate.opsForHash();
Object value = hash.get(key, hashKey);
return value == null ? null : String.valueOf(value);
}
public void hashSet(String key, String field, String value) {
put(key, field, value);
}
public void lPush(String key, String value) {
redisTemplate.opsForList().leftPush(key, value);
}
public String rPop(String key) {
return (String)redisTemplate.opsForList().rightPop(key);
}
/**
* 检查list是否为空
* @param key
* @return
*/
public Boolean listExists(String key) {
return redisTemplate.opsForList().size(key) > CommonConstants.ZERO;
}
/**
* set集合add
* @param key
* @param value
* @return
*/
public Long setAdd(String key, String value) {
return redisTemplate.opsForSet().add(key, value);
}
/**
* set集合校验value是否存在
* @param key
* @param value
* @return
*/
public Boolean setIsMember(String key, String value) {
return redisTemplate.opsForSet().isMember(key, value);
}
/**
* set集合长度
* @param key
* @return
*/
public Long setSize(String key) {
return redisTemplate.opsForSet().size(key);
}
public void delete(String key) {
redisTemplate.delete(key);
}
}

View File

@@ -112,6 +112,21 @@
<orderEntry type="library" name="Maven: com.aliyun:openapiutil:0.1.9" level="project" />
<orderEntry type="library" name="Maven: org.bouncycastle:bcpkix-jdk15on:1.65" level="project" />
<orderEntry type="library" name="Maven: org.bouncycastle:bcprov-jdk15on:1.65" level="project" />
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-data-redis:3.0.4" level="project" />
<orderEntry type="library" name="Maven: org.springframework.data:spring-data-redis:2.2.6.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework.data:spring-data-keyvalue:2.2.6.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework.data:spring-data-commons:2.2.6.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-oxm:5.2.5.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-context-support:5.2.5.RELEASE" level="project" />
<orderEntry type="library" name="Maven: io.lettuce:lettuce-core:5.2.2.RELEASE" level="project" />
<orderEntry type="library" name="Maven: io.netty:netty-common:4.1.48.Final" level="project" />
<orderEntry type="library" name="Maven: io.netty:netty-handler:4.1.48.Final" level="project" />
<orderEntry type="library" name="Maven: io.netty:netty-resolver:4.1.48.Final" level="project" />
<orderEntry type="library" name="Maven: io.netty:netty-buffer:4.1.48.Final" level="project" />
<orderEntry type="library" name="Maven: io.netty:netty-codec:4.1.48.Final" level="project" />
<orderEntry type="library" name="Maven: io.netty:netty-transport:4.1.48.Final" level="project" />
<orderEntry type="library" name="Maven: io.projectreactor:reactor-core:3.3.4.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.reactivestreams:reactive-streams:1.0.3" level="project" />
<orderEntry type="library" name="Maven: mysql:mysql-connector-java:8.0.18" level="project" />
<orderEntry type="library" name="Maven: com.google.protobuf:protobuf-java:3.6.1" level="project" />
<orderEntry type="library" name="Maven: com.alibaba:druid-spring-boot-starter:1.1.20" level="project" />

View File

@@ -3,7 +3,7 @@ package com.cool.store.dao;
import com.cool.store.mapper.EnterpriseConfigMapper;
import com.cool.store.entity.EnterpriseConfigDO;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
import org.springframework.stereotype.Repository;
import javax.annotation.Resource;
import java.util.List;
@@ -14,7 +14,7 @@ import java.util.List;
* @Description:
* @date 2023-05-18 11:15
*/
@Service
@Repository
public class EnterpriseConfigDAO {
@Resource

View File

@@ -3,7 +3,7 @@ package com.cool.store.dao;
import com.cool.store.entity.EnterpriseDO;
import com.cool.store.mapper.EnterpriseMapper;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
import org.springframework.stereotype.Repository;
import javax.annotation.Resource;
@@ -13,7 +13,7 @@ import javax.annotation.Resource;
* @Description:
* @date 2023-05-23 13:52
*/
@Service
@Repository
public class EnterpriseDAO {
@Resource

View File

@@ -1,23 +1,24 @@
package com.cool.store.dao;
import com.cool.store.dto.enterprise.EnterpriseUserDTO;
import com.cool.store.entity.EnterpriseUserDO;
import com.cool.store.enums.UserSelectRangeEnum;
import com.cool.store.enums.UserStatusEnum;
import com.cool.store.mapper.EnterpriseUserMapper;
import com.google.common.collect.Lists;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Service;
import org.springframework.stereotype.Repository;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
/**
* @author zhangchenbiao
* @date 2023-05-19 02:58
*/
@Service
@Repository
public class EnterpriseUserDAO {
@Resource
@@ -94,4 +95,54 @@ public class EnterpriseUserDAO {
}
return enterpriseUserMapper.listByRegionIdList(eid, regionIdList);
}
public Boolean insertEnterpriseUser(String eid, EnterpriseUserDO entity) {
if(Objects.isNull(entity.getUserStatus())){
entity.setUserStatus(UserStatusEnum.NORMAL.getCode());
}
if(Objects.isNull(entity.getActive())){
entity.setActive(true);
}
if(StringUtils.isBlank(entity.getThirdOaUniqueFlag())){
entity.setThirdOaUniqueFlag(null);
}
entity.setSubordinateRange(UserSelectRangeEnum.ALL.getCode());
if (StringUtils.isBlank(entity.getUnionid()) || StringUtils.isBlank(entity.getUserId())) {
return false;
}
if (StringUtils.isBlank(entity.getName())) {
entity.setName(entity.getUserId());
}
enterpriseUserMapper.insertEnterpriseUser(eid, entity);
return true;
}
public void updateEnterpriseUser(String eid,EnterpriseUserDO enterpriseUser){
if(StringUtils.isBlank(eid) || Objects.isNull(enterpriseUser)){
return;
}
enterpriseUserMapper.updateEnterpriseUser(eid, enterpriseUser);
}
public List<String> getMainAdminUserIds(String eid){
if(StringUtils.isBlank(eid)){
return Lists.newArrayList();
}
return enterpriseUserMapper.getMainAdminUserIds(eid);
}
public List<String> selectSpecifyNodeUserIds(String eid, String dingDeptId) {
return enterpriseUserMapper.selectSpecifyNodeUserIds(eid,dingDeptId);
}
public List<String> selectAllUserId(String eid) {
if(StringUtils.isBlank(eid)){
return Lists.newArrayList();
}
return enterpriseUserMapper.selectAllUserIds(eid);
}
public EnterpriseUserDO selectByUserIdIgnoreActive(String enterpriseId, String userId) {
return enterpriseUserMapper.selectByUserIdIgnoreActive(enterpriseId, userId);
}
}

View File

@@ -0,0 +1,61 @@
package com.cool.store.dao;
import com.cool.store.entity.EnterpriseUserDepartmentDO;
import com.cool.store.mapper.EnterpriseUserDepartmentMapper;
import com.google.common.collect.Lists;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;
import javax.annotation.Resource;
import java.util.List;
/**
* @author zhangchenbiao
* @FileName: EnterpriseUserDepartmentDAO
* @Description:
* @date 2023-06-02 17:08
*/
@Repository
public class EnterpriseUserDepartmentDAO {
@Resource
private EnterpriseUserDepartmentMapper enterpriseUserDepartmentMapper;
public List<Integer> getIdsByUserId( String eid, String userId){
if(StringUtils.isAnyBlank(eid, userId)){
return Lists.newArrayList();
}
return enterpriseUserDepartmentMapper.getIdsByUserId(eid, userId);
}
public void deleteByIdList( String eid, @Param("list") List<Integer> ids){
if(StringUtils.isBlank(eid) || CollectionUtils.isEmpty(ids)){
return;
}
enterpriseUserDepartmentMapper.deleteByIdList(eid, ids);
}
public List<EnterpriseUserDepartmentDO> selectUserDeptByUserId(String eid, String userId){
if(StringUtils.isAnyBlank(eid, userId)){
return Lists.newArrayList();
}
return enterpriseUserDepartmentMapper.selectUserDeptByUserId(eid, userId);
}
public int batchInsert(String eid, List<EnterpriseUserDepartmentDO> deptUsers){
if(StringUtils.isBlank(eid) || CollectionUtils.isEmpty(deptUsers)){
return 0;
}
return enterpriseUserDepartmentMapper.batchInsert(eid, deptUsers);
}
public List<EnterpriseUserDepartmentDO> selectUserDeptAuthByUserId(String eid, String userId){
if(StringUtils.isAnyBlank(eid, userId)){
return Lists.newArrayList();
}
return enterpriseUserDepartmentMapper.selectUserDeptAuthByUserId(eid, userId);
}
}

View File

@@ -4,22 +4,22 @@ import com.cool.store.dto.buser.UserRoleDTO;
import com.cool.store.dto.enterprise.EnterpriseUserRole;
import com.cool.store.entity.SysRoleDO;
import com.cool.store.enums.RoleEnum;
import com.cool.store.mapper.EnterpriseUserMapper;
import com.cool.store.mapper.EnterpriseUserRoleMapper;
import com.google.common.collect.Lists;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.collections4.ListUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
import org.springframework.stereotype.Repository;
import javax.annotation.Resource;
import java.util.List;
import java.util.Objects;
/**
* @author zhangchenbiao
* @date 2023-05-19 02:59
*/
@Service
@Repository
public class EnterpriseUserRoleDAO {
@Resource
@@ -45,5 +45,31 @@ public class EnterpriseUserRoleDAO {
.anyMatch(role-> StringUtils.equals(RoleEnum.MASTER.getRoleEnum(),role.getRoleEnum()));
}
public void deleteBatchByPrimaryKey(String enterpriseId, List<Long> ids){
if(StringUtils.isBlank(enterpriseId) || CollectionUtils.isEmpty(ids)){
return;
}
enterpriseUserRoleMapper.deleteBatchByPrimaryKey(enterpriseId, ids);
}
public List<Long> selectIdsByUserId(String enterpriseId, String userId){
if(StringUtils.isAnyBlank(enterpriseId, userId)){
return Lists.newArrayList();
}
return enterpriseUserRoleMapper.selectIdsByUserId(enterpriseId, userId);
}
public EnterpriseUserRole selectByUserIdAndRoleId(String enterpriseId, String userId, String roleId){
if(StringUtils.isAnyBlank(enterpriseId, userId, roleId)){
return null;
}
return enterpriseUserRoleMapper.selectByUserIdAndRoleId(enterpriseId, userId, roleId);
}
public void save(String enterpriseId, EnterpriseUserRole entity){
if(StringUtils.isBlank(enterpriseId) || Objects.isNull(entity)){
return;
}
}
}

View File

@@ -2,7 +2,7 @@ package com.cool.store.dao;
import com.cool.store.entity.LoginRecordDO;
import com.cool.store.mapper.LoginRecordMapper;
import org.springframework.stereotype.Service;
import org.springframework.stereotype.Repository;
import javax.annotation.Resource;
@@ -12,7 +12,7 @@ import javax.annotation.Resource;
* @Description:
* @date 2023-05-23 15:48
*/
@Service
@Repository
public class LoginRecordDAO {
@Resource

View File

@@ -1,7 +1,9 @@
package com.cool.store.dao;
import com.cool.store.constants.CommonConstants;
import com.cool.store.dto.region.RegionNode;
import com.cool.store.dto.region.RegionPathDTO;
import com.cool.store.dto.region.RegionSyncDTO;
import com.cool.store.entity.RegionDO;
import com.cool.store.enums.RegionTypeEnum;
import com.cool.store.mapper.RegionMapper;
@@ -9,8 +11,7 @@ import com.google.common.collect.Lists;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.collections4.ListUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Service;
import org.springframework.stereotype.Repository;
import javax.annotation.Resource;
import java.util.*;
@@ -20,7 +21,7 @@ import java.util.stream.Collectors;
* @author zhangchenbiao
* @date 2023-05-19 02:59
*/
@Service
@Repository
public class RegionDAO {
@Resource
@@ -53,14 +54,14 @@ public class RegionDAO {
regionDO.setCreateTime(Calendar.getInstance().getTimeInMillis());
regionDO.setRegionPath("/" + CommonConstants.ROOT_DEPT_ID_STR + "/");
regionDO.setUnclassifiedFlag(CommonConstants.ONE);
insertRoot(enterpriseId, regionDO);
insertRegion(enterpriseId, regionDO);
regionDO.setRegionId(regionDO.getId().toString());
return regionDO;
}
return unclassified;
}
public Long insertRoot(String eid, RegionDO regionDO) {
public Long insertRegion(String eid, RegionDO regionDO) {
return regionMapper.insertRoot(eid, regionDO);
}
@@ -104,4 +105,61 @@ public class RegionDAO {
return regionPathDTO;
}).collect(Collectors.toList());
}
public RegionDO getByRegionId(String eid, Long regionId){
if(StringUtils.isBlank(eid) || Objects.isNull(regionId)){
return null;
}
return regionMapper.getByRegionId(eid, regionId);
}
public RegionNode getRegionById(String eid, String regionId){
return regionMapper.getRegionByRegionId(eid, regionId);
}
public void insertOrUpdate(RegionDO regionDO, String eid){
regionMapper.insertOrUpdate(regionDO,eid);
}
public List<RegionSyncDTO> getSpecifiedRegionIdAndDeptId(String eid, Long parentId){
return regionMapper.getSpecifiedRegionIdAndDeptId(eid,parentId);
}
public List<RegionDO> getRegionByDingDeptIds(String enterpriseId, List<String> dingDeptIds){
if(StringUtils.isBlank(enterpriseId) || CollectionUtils.isEmpty(dingDeptIds)){
return Lists.newArrayList();
}
return regionMapper.getRegionByDingDeptIds(enterpriseId, dingDeptIds);
}
public RegionDO getBySynDingDeptId(String eid, String synDingDeptId){
if(StringUtils.isAnyBlank(eid, synDingDeptId)){
return null;
}
return regionMapper.getBySynDingDeptId(eid, synDingDeptId);
}
public Long ignoreInsert(String eid, RegionDO regionDO) {
if(StringUtils.isBlank(eid) || Objects.isNull(regionDO)){
return 0L;
}
return regionMapper.ignoreInsert(eid, regionDO);
}
public Integer updateSyncRegion(String eid, RegionDO regionDO){
if(StringUtils.isBlank(eid) || Objects.isNull(regionDO)){
return 0;
}
return regionMapper.updateSyncRegion(eid, regionDO);
}
public void removeRegion(String eid, List<Long> regionIds) {
if (regionIds.contains(CommonConstants.UNGROUPED_DEPT_ID)) {
regionIds.remove(CommonConstants.UNGROUPED_DEPT_ID);
}
if(CollectionUtils.isEmpty(regionIds)) {
return;
}
regionMapper.removeRegions(eid, regionIds);
}
}

View File

@@ -1,18 +1,18 @@
package com.cool.store.dao;
import com.cool.store.constants.CommonConstants;
import com.cool.store.dto.region.RegionSyncDTO;
import com.cool.store.dto.store.StoreAreaDTO;
import com.cool.store.entity.StoreDO;
import com.cool.store.enums.StoreIsDeleteEnum;
import com.cool.store.mapper.StoreMapper;
import com.google.common.collect.Lists;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Service;
import org.springframework.stereotype.Repository;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.*;
/**
* @author zhangchenbiao
@@ -20,7 +20,7 @@ import java.util.List;
* @Description:
* @date 2023-05-31 11:52
*/
@Service
@Repository
public class StoreDAO {
@Resource
@@ -52,10 +52,55 @@ public class StoreDAO {
}
public List<String> getAllStoreList (String eid,Boolean isReturnList){
List<String> invalidStores=new ArrayList<>();
if(isReturnList){
return storeMapper.listStoreIdList(eid);
}
return null;
}
public List<RegionSyncDTO> getSpecifiedStoreIdsAndDeptId(String eId, Long parentId) {
List<RegionSyncDTO> storeDOList = storeMapper.getSpecifiedStoreIdsAndDeptId(eId, StoreIsDeleteEnum.EFFECTIVE.getValue(), parentId);
return storeDOList;
}
public StoreDO getStoreBySynId(String eid, String synId){
if(StringUtils.isAnyBlank(eid, synId)){
return null;
}
return storeMapper.getStoreBySynId(eid, synId);
}
public Integer updateStore(String enterpriseId, StoreDO storeDO) {
fillAddressPoint(storeDO);
return storeMapper.updateStore(enterpriseId, storeDO);
}
public Integer insertStore(String enterpriseId, StoreDO storeDO) {
fillAddressPoint(storeDO);
return storeMapper.insertStore(enterpriseId, storeDO);
}
private void fillAddressPoint(StoreDO storeDO){
if(StringUtils.isNoneBlank(storeDO.getLatitude(), storeDO.getLongitude()) && StringUtils.isBlank(storeDO.getLongitudeLatitude())){
storeDO.setLongitudeLatitude(storeDO.getLongitude() + CommonConstants.COMMA+ storeDO.getLatitude());
}
if(StringUtils.isNotBlank(storeDO.getLongitudeLatitude())){
List<String> list = Arrays.asList(storeDO.getLongitudeLatitude().split(","));
storeDO.setAddressPoint("POINT("+list.get(0)+" "+list.get(1)+")");
}
}
public List<String> getStoreIdByIdList(String eid, List<String> ids){
if(StringUtils.isBlank(eid) || CollectionUtils.isEmpty(ids)){
return Lists.newArrayList();
}
return storeMapper.getStoreIdByIdList(eid, ids);
}
public Integer deleteStoreByStoreIds(String enterpriseId, List<String> storeIds, String userId, Long updateTime){
if(StringUtils.isAnyBlank(enterpriseId, userId) || CollectionUtils.isEmpty(storeIds) || Objects.isNull(updateTime)){
return 0;
}
return storeMapper.deleteStoreByStoreIds(enterpriseId, storeIds, userId, updateTime);
}
}

View File

@@ -5,7 +5,7 @@ import com.cool.store.mapper.SubordinateMappingMapper;
import com.google.common.collect.Lists;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
import org.springframework.stereotype.Repository;
import javax.annotation.Resource;
import java.util.List;
@@ -17,7 +17,7 @@ import java.util.stream.Collectors;
* @Description:
* @date 2023-05-31 14:27
*/
@Service
@Repository
public class SubordinateMappingDAO {
@Resource
@@ -40,4 +40,12 @@ public class SubordinateMappingDAO {
subordinateMappingMapper.batchInsertSubordinateMapping(enterpriseId, distinctData);
}
public void deletedByUserIds(String enterpriseId,List<String> userIds){
if (CollectionUtils.isEmpty(userIds)){
return;
}
List<String> distinctUserIds = userIds.stream().distinct().collect(Collectors.toList());
subordinateMappingMapper.deletedByUserIds(enterpriseId,distinctUserIds);
}
}

View File

@@ -1,12 +1,13 @@
package com.cool.store.dao;
import com.cool.store.dto.dept.SyncTreeNode;
import com.cool.store.dto.enterprise.QueryDeptChildDTO;
import com.cool.store.entity.SysDepartmentDO;
import com.cool.store.mapper.SysDepartmentMapper;
import com.google.common.collect.Lists;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
import org.springframework.stereotype.Repository;
import javax.annotation.Resource;
import java.util.List;
@@ -15,7 +16,7 @@ import java.util.List;
* @author zhangchenbiao
* @date 2023-05-19 03:00
*/
@Service
@Repository
public class SysDepartmentDAO {
@Resource
@@ -35,4 +36,24 @@ public class SysDepartmentDAO {
return sysDepartmentMapper.getDeptChildListByParentId(eid, parentId);
}
public void deleteByNotInIds(String enterpriseId, List<String> deptIds){
if(StringUtils.isBlank(enterpriseId) || CollectionUtils.isEmpty(deptIds)){
return;
}
sysDepartmentMapper.deleteByNotInIds(deptIds, enterpriseId);
}
public List<SyncTreeNode> getSyncDeptTreeList(String eid) {
if(StringUtils.isBlank(eid)){
return Lists.newArrayList();
}
return sysDepartmentMapper.getSyncDeptTreeList(eid);
}
public List<SysDepartmentDO> selectAllDepts(String enterpriseId){
if(StringUtils.isBlank(enterpriseId)){
return Lists.newArrayList();
}
return sysDepartmentMapper.selectAll(enterpriseId);
}
}

View File

@@ -4,7 +4,7 @@ import com.cool.store.entity.SysRoleDO;
import com.cool.store.enums.RoleEnum;
import com.cool.store.mapper.SysRoleMapper;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
import org.springframework.stereotype.Repository;
import javax.annotation.Resource;
@@ -12,7 +12,7 @@ import javax.annotation.Resource;
* @author zhangchenbiao
* @date 2023-05-19 03:00
*/
@Service
@Repository
public class SysRoleDAO {
@Resource

View File

@@ -1,12 +1,12 @@
package com.cool.store.dao;
import org.springframework.stereotype.Service;
import org.springframework.stereotype.Repository;
/**
* @author zhangchenbiao
* @date 2023-05-19 03:01
*/
@Service
@Repository
public class SysRoleMenuDAO {
}

View File

@@ -5,16 +5,17 @@ import com.cool.store.mapper.UserAuthMappingMapper;
import com.google.common.collect.Lists;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
import org.springframework.stereotype.Repository;
import javax.annotation.Resource;
import java.util.List;
import java.util.Objects;
/**
* @author zhangchenbiao
* @date 2023-05-19 02:54
*/
@Service
@Repository
public class UserAuthMappingDAO {
@Resource
@@ -34,4 +35,32 @@ public class UserAuthMappingDAO {
}
return userAuthMappingMapper.listUserAuthMappingByUserIds(eid, userIds);
}
public void deleteAuthMappingByIds(String eid, List<Long> ids){
if(StringUtils.isBlank(eid) || CollectionUtils.isEmpty(ids)){
return;
}
userAuthMappingMapper.deleteAuthMappingByIds(eid, ids);
}
public List<Long> selectIdsByUserId(String eid, String userId){
if(StringUtils.isAnyBlank(eid, userId)){
return Lists.newArrayList();
}
return userAuthMappingMapper.selectIdsByUserId(eid, userId);
}
public void insertUserAuthMapping(String eid, UserAuthMappingDO auth){
if(StringUtils.isBlank(eid)|| Objects.isNull(auth)){
return;
}
userAuthMappingMapper.insertUserAuthMapping(eid, auth);
}
public void deleteAuthMappingByIdAndType(String eid, List<String> ids, String type){
if(StringUtils.isAnyBlank(eid, type) || CollectionUtils.isEmpty(ids)){
return;
}
userAuthMappingMapper.deleteAuthMappingByIdAndType(eid, ids, type);
}
}

View File

@@ -5,7 +5,7 @@ import com.cool.store.mapper.UserRegionMappingMapper;
import com.google.common.collect.Lists;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
import org.springframework.stereotype.Repository;
import javax.annotation.Resource;
import java.util.List;
@@ -15,7 +15,7 @@ import java.util.stream.Collectors;
* @author zhangchenbiao
* @date 2023-05-19 03:00
*/
@Service
@Repository
public class UserRegionMappingDAO {
@Resource
@@ -50,4 +50,14 @@ public class UserRegionMappingDAO {
return userRegionMappingMapper.listUserRegionMappingByUserId(enterpriseId, userIds);
}
public void deletedByIds(String enterpriseId, List<Integer> ids){
if (CollectionUtils.isEmpty(ids)) {
return;
}
List<Integer> distinctData = ids.stream()
.distinct()
.collect(Collectors.toList());
userRegionMappingMapper.deletedByIds(enterpriseId, distinctData);
}
}

View File

@@ -0,0 +1,39 @@
package com.cool.store.mapper;
import com.cool.store.entity.EnterpriseUserDepartmentDO;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* @author zhangchenbiao
* @date 2023-06-02 05:01
*/
public interface EnterpriseUserDepartmentMapper {
/**
*
* 默认插入方法,只会给有值的字段赋值
* 会对传进来的字段做判空处理如果字段为空则使用数据库默认字段或者null
* dateTime:2023-06-02 05:01
*/
int insertSelective(@Param("record") EnterpriseUserDepartmentDO record, @Param("enterpriseId") String enterpriseId);
/**
*
* 默认更新方法根据主键更新不会把null值更新到数据库避免覆盖之前有值的
* dateTime:2023-06-02 05:01
*/
int updateByPrimaryKeySelective(@Param("record") EnterpriseUserDepartmentDO record, @Param("enterpriseId") String enterpriseId);
List<Integer> getIdsByUserId(@Param("eid") String eid, @Param("userId") String userId);
void deleteByIdList(@Param("eid") String eid, @Param("list") List<Integer> ids);
List<EnterpriseUserDepartmentDO> selectUserDeptByUserId(@Param("eid")String eid, @Param("userId")String userId);
int batchInsert(@Param("eid")String eid, @Param("deptUsers") List<EnterpriseUserDepartmentDO> deptUsers);
List<EnterpriseUserDepartmentDO> selectUserDeptAuthByUserId(@Param("eid")String eid, @Param("userId")String userId);
}

View File

@@ -86,4 +86,17 @@ public interface EnterpriseUserMapper {
List<EnterpriseUserDO> listByRegionIdList(@Param("eid") String eid, @Param("regionIdList") List<String> regionIdList);
void updateEnterpriseUser(@Param("eid") String eid,@Param("enterpriseUserDO") EnterpriseUserDO enterpriseUserDO);
List<String> getMainAdminUserIds(@Param("eid")String eid);
List<String> selectSpecifyNodeUserIds(@Param("eid") String eid, @Param("dingDeptId") String dingDeptId);
List<String> selectAllUserIds(@Param("eid") String eid);
EnterpriseUserDO selectByUserIdIgnoreActive(@Param("enterpriseId") String enterpriseId, @Param("userId") String userId);
void insertEnterpriseUser(@Param("eid") String eid, @Param("entity") EnterpriseUserDO entity);
}

View File

@@ -39,4 +39,12 @@ public interface EnterpriseUserRoleMapper {
List<UserRoleDTO> getUserAndRolesByUserId(@Param("eip") String enterpriseId, @Param("userIdList") List<String> userIdList);
List<SysRoleDO> listRoleByUserId(@Param("eip") String enterpriseId, @Param("userId") String userId);
void deleteBatchByPrimaryKey(@Param("eid") String enterpriseId, @Param("ids") List<Long> ids);
List<Long> selectIdsByUserId(@Param("eid") String enterpriseId, @Param("userId") String userId);
EnterpriseUserRole selectByUserIdAndRoleId(@Param("eid") String enterpriseId, @Param("userId") String userId, @Param("roleId") String roleId);
void save(@Param("eid") String enterpriseId, @Param("entity") EnterpriseUserRole entity);
}

View File

@@ -1,5 +1,7 @@
package com.cool.store.mapper;
import com.cool.store.dto.region.RegionNode;
import com.cool.store.dto.region.RegionSyncDTO;
import com.cool.store.entity.RegionDO;
import org.apache.ibatis.annotations.Param;
@@ -41,4 +43,23 @@ public interface RegionMapper {
List<RegionDO> getAllRegion(@Param("eid") String eid);
List<RegionDO> listStoreRegionByIds(@Param("eid")String enterpriseId, @Param("regionIds")List<Long> regionIds);
RegionDO getByRegionId(@Param("eid") String eid, @Param("regionId") Long regionId);
RegionNode getRegionByRegionId(@Param("eid") String eid, @Param("regionId") String regionId);
Integer insertOrUpdate(@Param("record") RegionDO regionDO, @Param("eid") String eid);
List<RegionSyncDTO> getSpecifiedRegionIdAndDeptId(@Param("eid") String eid, @Param("parentId") Long parentId);
List<RegionDO> getRegionByDingDeptIds(@Param("eid")String enterpriseId, @Param("list")List<String> dingDeptIds);
RegionDO getBySynDingDeptId(@Param("eid") String eid, @Param("synDingDeptId") String synDingDeptId);
Long ignoreInsert(@Param("eid") String eid, @Param("region") RegionDO regionDO);
Integer updateSyncRegion(@Param("eid") String eid, @Param("item")RegionDO regionDO);
Integer removeRegions(@Param("eid")String eid,@Param("regionIds") List<Long> regionIds);
}

View File

@@ -1,5 +1,6 @@
package com.cool.store.mapper;
import com.cool.store.dto.region.RegionSyncDTO;
import com.cool.store.dto.store.StoreAreaDTO;
import com.cool.store.entity.StoreDO;
import org.apache.ibatis.annotations.Param;
@@ -35,4 +36,18 @@ public interface StoreMapper {
Integer countStore(@Param("eid") String eid);
List<String> listStoreIdList(@Param("eid") String eid);
List<RegionSyncDTO> getSpecifiedStoreIdsAndDeptId(@Param("eid") String eid,
@Param("isDelete") String isDelete,
@Param("parentId") Long parentId);
StoreDO getStoreBySynId(@Param("eid") String eid, @Param("synId") String synId);
Integer insertStore(@Param("enterpriseId") String enterpriseId, @Param("storeDO") StoreDO storeDO);
Integer updateStore(@Param("enterpriseId") String enterpriseId, @Param("storeDO") StoreDO storeDO);
List<String> getStoreIdByIdList(@Param("eid") String eid, @Param("ids") List<String> ids);
Integer deleteStoreByStoreIds(@Param("enterpriseId") String enterpriseId, @Param("storeIds") List<String> storeIds, @Param("userId") String userId, @Param("updateTime") Long updateTime);
}

View File

@@ -40,4 +40,6 @@ public interface SubordinateMappingMapper {
* @param subordinateMappingDOS
*/
void batchInsertSubordinateMapping(@Param("enterpriseId") String enterpriseId,@Param("subordinateMappingDOS") List<SubordinateMappingDO> subordinateMappingDOS);
void deletedByUserIds(@Param("enterpriseId") String enterpriseId,@Param("userIds") List<String> userIds);
}

View File

@@ -1,5 +1,6 @@
package com.cool.store.mapper;
import com.cool.store.dto.dept.SyncTreeNode;
import com.cool.store.dto.enterprise.QueryDeptChildDTO;
import com.cool.store.entity.SysDepartmentDO;
import org.apache.ibatis.annotations.Param;
@@ -29,4 +30,10 @@ public interface SysDepartmentMapper {
void batchInsertOrUpdate(@Param("list") List<SysDepartmentDO> sysDepartmentDOList, @Param("eid") String eid);
List<QueryDeptChildDTO> getDeptChildListByParentId(@Param("eid") String eid, @Param("parentId") String parentId);
void deleteByNotInIds(@Param("list") List<String> deptIdList, @Param("eid") String eid);
List<SyncTreeNode> getSyncDeptTreeList(@Param("eid") String eid);
List<SysDepartmentDO> selectAll(@Param("eid") String eid);
}

View File

@@ -27,6 +27,13 @@ public interface UserAuthMappingMapper {
List<UserAuthMappingDO> listUserAuthMappingByUserId(@Param("eid") String eid, @Param("userId") String userId);
List<UserAuthMappingDO> listUserAuthMappingByUserIds(@Param("eid") String eid,
@Param("userIds") List<String> userIds);
List<UserAuthMappingDO> listUserAuthMappingByUserIds(@Param("eid") String eid, @Param("userIds") List<String> userIds);
void deleteAuthMappingByIds(@Param("eid") String eid, @Param("ids") List<Long> ids);
List<Long> selectIdsByUserId(@Param("eid") String eid, @Param("userId") String userId);
void insertUserAuthMapping(@Param("eid") String eid, @Param("auth") UserAuthMappingDO auth);
void deleteAuthMappingByIdAndType(@Param("eid") String eid, @Param("ids") List<String> ids, @Param("type") String type);
}

View File

@@ -30,4 +30,6 @@ public interface UserRegionMappingMapper {
void deletedByUserIds(@Param("enterpriseId") String enterpriseId,@Param("userIds") List<String> userIds);
List<UserRegionMappingDO> listUserRegionMappingByUserId(@Param("enterpriseId") String enterpriseId, @Param("userIds") List<String> userIds);
void deletedByIds(@Param("enterpriseId") String enterpriseId,@Param("ids") List<Integer> ids);
}

View File

@@ -44,7 +44,7 @@
<select id="getDistinctDbServer" resultMap="BaseResultMap">
select
distinct db_server, db_port, db_user, db_pwd
distinct db_server, db_port, db_user, db_pwd, db_name
from
enterprise_config
</select>

View File

@@ -0,0 +1,118 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.cool.store.mapper.EnterpriseUserDepartmentMapper">
<resultMap id="BaseResultMap" type="com.cool.store.entity.EnterpriseUserDepartmentDO">
<id column="id" jdbcType="INTEGER" property="id"/>
<result column="user_id" jdbcType="VARCHAR" property="userId"/>
<result column="department_id" jdbcType="VARCHAR" property="departmentId"/>
<result column="create_time" jdbcType="TIMESTAMP" property="createTime"/>
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime"/>
<result column="is_has_auth" jdbcType="BIT" property="isHasAuth"/>
</resultMap>
<sql id="Base_Column_List">
id, user_id, department_id, create_time, update_time, is_has_auth
</sql>
<insert id="insertSelective" keyColumn="id" keyProperty="record.id" useGeneratedKeys="true">
insert into enterprise_user_department_${enterpriseId}
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="record.userId != null">
user_id,
</if>
<if test="record.departmentId != null">
department_id,
</if>
<if test="record.createTime != null">
create_time,
</if>
<if test="record.updateTime != null">
update_time,
</if>
<if test="record.isHasAuth != null">
is_has_auth,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="record.userId != null">
#{record.userId},
</if>
<if test="record.departmentId != null">
#{record.departmentId},
</if>
<if test="record.createTime != null">
#{record.createTime},
</if>
<if test="record.updateTime != null">
#{record.updateTime},
</if>
<if test="record.isHasAuth != null">
#{record.isHasAuth},
</if>
</trim>
</insert>
<update id="updateByPrimaryKeySelective">
update enterprise_user_department_${enterpriseId}
<set>
<if test="record.userId != null">
user_id = #{record.userId},
</if>
<if test="record.departmentId != null">
department_id = #{record.departmentId},
</if>
<if test="record.createTime != null">
create_time = #{record.createTime},
</if>
<if test="record.updateTime != null">
update_time = #{record.updateTime},
</if>
<if test="record.isHasAuth != null">
is_has_auth = #{record.isHasAuth},
</if>
</set>
where id = #{record.id}
</update>
<select id="getIdsByUserId" resultType="java.lang.Integer">
select id from enterprise_user_department_${eid} where user_id = #{userId} and is_has_auth = 0
</select>
<delete id="deleteByIdList">
delete from enterprise_user_department_${eid} where
<if test="list != null and list.size() > 0 ">
id in
<foreach collection="list" item="id" open="(" separator="," close=")">
#{id}
</foreach>
</if>
</delete>
<select id="selectUserDeptByUserId"
resultType="com.cool.store.entity.EnterpriseUserDepartmentDO">
select
id,
user_id as userId,
department_id as departmentId,
create_time as createTime,
update_time as updateTime
from enterprise_user_department_${eid} where user_id = #{userId} and is_has_auth = 0
</select>
<insert id="batchInsert">
insert into enterprise_user_department_${eid}
(user_id, department_id, create_time, is_has_auth)
values
<foreach collection="deptUsers" item="deptUser" separator=",">
(#{deptUser.userId}, #{deptUser.departmentId}, now(), #{deptUser.isHasAuth})
</foreach>
</insert>
<select id="selectUserDeptAuthByUserId"
resultType="com.cool.store.entity.EnterpriseUserDepartmentDO">
select
id,
user_id as userId,
department_id as departmentId,
create_time as createTime,
update_time as updateTime
from enterprise_user_department_${eid} where user_id = #{userId} and is_has_auth = 1
</select>
</mapper>

View File

@@ -670,4 +670,219 @@
order by id
</select>
<update id="updateEnterpriseUser">
update enterprise_user_${eid}
<set>
<if test="enterpriseUserDO.name != null and enterpriseUserDO.name !=''">`name` = #{enterpriseUserDO.name},</if>
<if test="enterpriseUserDO.tel != null and enterpriseUserDO.tel !=''">`tel` = #{enterpriseUserDO.tel},</if>
<if test="enterpriseUserDO.workPlace != null and enterpriseUserDO.workPlace !=''">`work_place` =
#{enterpriseUserDO.workPlace},
</if>
<if test="enterpriseUserDO.mobile != null and enterpriseUserDO.mobile !=''">`mobile` =
#{enterpriseUserDO.mobile},
</if>
<if test="enterpriseUserDO.email != null and enterpriseUserDO.email !=''">`email` = #{enterpriseUserDO.email},
</if>
<if test="enterpriseUserDO.orgEmail != null and enterpriseUserDO.orgEmail !=''">`org_email` =
#{enterpriseUserDO.orgEmail},
</if>
<if test="enterpriseUserDO.active != null">`active` =
#{enterpriseUserDO.active},
</if>
<if test="enterpriseUserDO.orderInDepts != null and enterpriseUserDO.orderInDepts !=''">`order_in_depts` =
#{enterpriseUserDO.orderInDepts},
</if>
<if test="enterpriseUserDO.mainAdmin != null">`main_admin` = #{enterpriseUserDO.mainAdmin},</if>
<if test="enterpriseUserDO.isAdmin != null">`is_admin` = #{enterpriseUserDO.isAdmin},</if>
<if test="enterpriseUserDO.isBoss != null">`is_boss` = #{enterpriseUserDO.isBoss},</if>
<if test="enterpriseUserDO.dingid != null and enterpriseUserDO.dingid !=''">`dingId` =
#{enterpriseUserDO.dingid},
</if>
<if test="enterpriseUserDO.unionid != null and enterpriseUserDO.unionid !=''">`unionid` =
#{enterpriseUserDO.unionid},
</if>
<if test="enterpriseUserDO.isLeaderInDepts != null and enterpriseUserDO.isLeaderInDepts !=''">
`is_leader_in_depts` = #{enterpriseUserDO.isLeaderInDepts},
</if>
<if test="enterpriseUserDO.isHide != null">`is_hide` = #{enterpriseUserDO.isHide},</if>
<if test="enterpriseUserDO.position != null and enterpriseUserDO.position !=''">`position` =
#{enterpriseUserDO.position},
</if>
<if test="enterpriseUserDO.avatar != null and enterpriseUserDO.avatar !=''">`avatar` =
#{enterpriseUserDO.avatar},
</if>
<if test="enterpriseUserDO.jobnumber != null and enterpriseUserDO.jobnumber !=''">`jobnumber` =
#{enterpriseUserDO.jobnumber},
</if>
<if test="enterpriseUserDO.extattr != null and enterpriseUserDO.extattr !=''">`extattr` =
#{enterpriseUserDO.extattr},
</if>
<if test="enterpriseUserDO.isEnterprise != null">`is_enterprise` =
#{enterpriseUserDO.isEnterprise},
</if>
<if test="enterpriseUserDO.roles != null and enterpriseUserDO.roles !=''">`roles` = #{enterpriseUserDO.roles},
</if>
<if test="enterpriseUserDO.monitoredDepartments != null and enterpriseUserDO.monitoredDepartments !=''">`
monitored_departments` = #{enterpriseUserDO.monitoredDepartments},
</if>
<if test="enterpriseUserDO.departments != null and enterpriseUserDO.departments !=''">`departments` =
#{enterpriseUserDO.departments},
</if>
<if test="enterpriseUserDO.isLeader != null">`is_leader` = #{enterpriseUserDO.isLeader},</if>
<if test="enterpriseUserDO.faceUrl != null and enterpriseUserDO.faceUrl !=''">`face_url` =
#{enterpriseUserDO.faceUrl},
</if>
<if test="enterpriseUserDO.createTime != null">`create_time` = #{enterpriseUserDO.createTime},</if>
<if test="enterpriseUserDO.language != null and enterpriseUserDO.language !=''">`language` =
#{enterpriseUserDO.language},
</if>
<if test="enterpriseUserDO.userStatus != null">`user_status` =
#{enterpriseUserDO.userStatus},
</if>
<if test="enterpriseUserDO.thirdOaUniqueFlag != null and enterpriseUserDO.thirdOaUniqueFlag !=''">`third_oa_unique_flag` =
#{enterpriseUserDO.thirdOaUniqueFlag},
</if>
<if test="enterpriseUserDO.userRegionIds != null and enterpriseUserDO.userRegionIds !=''">
`user_region_ids` = #{enterpriseUserDO.userRegionIds},
</if>
<if test="enterpriseUserDO.subordinateChange != null and enterpriseUserDO.subordinateChange !=''">
`subordinate_change` = #{enterpriseUserDO.subordinateChange},
</if>
<if test="enterpriseUserDO.subordinateRange != null and enterpriseUserDO.subordinateRange !=''">
`subordinate_range` = #{enterpriseUserDO.subordinateRange},
</if>
<if test="enterpriseUserDO.remark != null and enterpriseUserDO.remark !=''">
`remark` = #{enterpriseUserDO.remark},
</if>
</set>
where user_id =#{enterpriseUserDO.userId}
</update>
<select id="getMainAdminUserIds" resultType="string">
select user_id from enterprise_user_${eid} where main_admin = true and active = true
</select>
<select id="selectSpecifyNodeUserIds" resultType="string">
select
user_id
from
enterprise_user_${eid}
where
departments like concat('%/',#{dingDeptId},'/%')
</select>
<select id="selectAllUserIds" resultType="java.lang.String">
select user_id as userId from enterprise_user_${eid}
</select>
<select id="selectByUserIdIgnoreActive" resultType="com.cool.store.entity.EnterpriseUserDO">
select
id as id,
user_id as userId,
`name` as name,
tel as tel,
work_place as workPlace,
remark as remark,
mobile as mobile,
email as email,
org_email as orgEmail,
active as active,
order_in_depts as orderInDepts,
is_admin as isAdmin,
is_boss as isBoss,
dingId as dingId,
unionid as unionid,
is_leader_in_depts as isLeaderInDepts,
is_hide as isHide,
`position` as position,
avatar as avatar,
face_url as faceUrl,
jobnumber as jobnumber,
extattr as extattr,
is_enterprise as isEnterprise,
roles as roles,
monitored_departments as monitoredDepartments,
departments as departments,
is_leader as isLeader,
create_time as createTime,
`language` as language,
third_oa_unique_flag as thirdOaUniqueFlag,
subordinate_change as subordinateChange,
subordinate_range as subordinateRange
from enterprise_user_${enterpriseId} where user_id = #{userId, jdbcType=VARCHAR}
</select>
<insert id="insertEnterpriseUser">
insert into enterprise_user_${eid}
( `id`,
`user_id`,
`name`,
`tel`,
`work_place`,
`remark`,
`mobile`,
`email`,
`org_email`,
`active`,
`order_in_depts`,
`main_admin`,
`is_admin`,
`is_boss`,
`dingId`,
`unionid`,
`is_leader_in_depts`,
`is_hide`,
`position`,
`avatar`,
`jobnumber`,
`extattr`,
`is_enterprise`,
`roles`,
`monitored_departments`,
`departments`,
`is_leader`,
`face_url`,
`create_time`,
`user_status`,
`third_oa_unique_flag`,
`subordinate_range`
)
values
(
#{entity.id},
#{entity.userId},
#{entity.name},
#{entity.tel},
#{entity.workPlace},
#{entity.remark},
#{entity.mobile},
#{entity.email},
#{entity.orgEmail},
#{entity.active},
#{entity.orderInDepts},
#{entity.mainAdmin},
#{entity.isAdmin},
#{entity.isBoss},
#{entity.dingid},
#{entity.unionid},
#{entity.isLeaderInDepts},
#{entity.isHide},
#{entity.position},
#{entity.avatar},
#{entity.jobnumber},
#{entity.extattr},
#{entity.isEnterprise},
#{entity.roles},
#{entity.monitoredDepartments},
#{entity.departments},
#{entity.isLeader},
#{entity.faceUrl},
now(),
#{entity.userStatus},
#{entity.thirdOaUniqueFlag},
#{entity.subordinateRange}
)
</insert>
</mapper>

View File

@@ -100,4 +100,37 @@
left join sys_role_${eip} c on c.id = b.role_id
where b.user_id = #{userId}
</select>
<delete id="deleteBatchByPrimaryKey">
delete from enterprise_user_role_${eid} where id in
<foreach item="id" collection="ids" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
<select id="selectIdsByUserId" resultType="java.lang.Long">
select id from enterprise_user_role_${eid} where user_id = #{userId}
</select>
<select id="selectByUserIdAndRoleId" resultMap="BaseResultMap">
select * from enterprise_user_role_${eid}
where user_id = #{userId} and role_id = #{roleId}
order by id asc
limit 1
</select>
<insert id="save">
insert ignore into enterprise_user_role_${eid}
(
`role_id`,
`user_id`,
`create_time`
)
values
(
#{entity.roleId},
#{entity.userId},
#{entity.createTime}
)
</insert>
</mapper>

View File

@@ -376,6 +376,7 @@
syn_ding_dept_id as synDingDeptId,
region_type as regionType,
deleted as deleted,
region_path as regionPath,
store_id as storeId
from region_${eid}
where region_type = 'store'
@@ -385,4 +386,204 @@
</foreach>
)
</select>
<select id="getByRegionId" resultType="com.cool.store.entity.RegionDO">
select
id ,
id as regionId,
name as name ,
parent_id as parentId,
group_id as groupId,
create_time as createTime,
create_name as createName,
update_time as updateTime,
update_name as updateName,
syn_ding_dept_id as synDingDeptId,
store_id as storeId,
region_type as regionType,
region_path as regionPath,
deleted,
store_num as storeNum
from region_${eid}
where id = #{regionId}
</select>
<select id="getRegionByRegionId" resultType="com.cool.store.dto.region.RegionNode">
select
id ,
id as regionId,
name as name ,
parent_id as parentId,
group_id as groupId,
create_time as createTime,
create_name as createName,
update_time as updateTime,
update_name as updateName,
syn_ding_dept_id as synDingDeptId,
region_type as regionType,
region_path as regionPath,
store_num as storeCount
from region_${eid} where id = #{regionId, jdbcType=BIGINT} and deleted = 0
</select>
<insert id="insertOrUpdate" useGeneratedKeys="true" keyProperty="record.id">
insert into region_${eid}
(
id,
name,
<if test="record.parentId != null">
parent_id,
</if>
region_type,
create_time,
syn_ding_dept_id,
unclassified_flag,
third_dept_id
) value
(
#{record.id, jdbcType=BIGINT},
#{record.name, jdbcType=VARCHAR},
<if test="record.parentId != null">
#{record.parentId, jdbcType=BIGINT},
</if>
#{record.regionType, jdbcType=VARCHAR},
#{record.createTime, jdbcType=BIGINT},
#{record.synDingDeptId, jdbcType=VARCHAR},
#{record.unclassifiedFlag},
#{record.thirdDeptId}
)
ON DUPLICATE KEY UPDATE name=values(name), parent_id=values(parent_id), syn_ding_dept_id=values(syn_ding_dept_id),third_dept_id=values(third_dept_id),
update_time = values(update_time), region_type = values(region_type), deleted = values(deleted)
</insert>
<select id="getSpecifiedRegionIdAndDeptId" resultType="com.cool.store.dto.region.RegionSyncDTO">
select
id ,
syn_ding_dept_id as synDingDeptId
from region_${eid}
where (id > 0 or id = -3) and (deleted = 0 or syn_ding_dept_id is not null)
<if test="parentId!=null">
and region_path like concat('%/',#{parentId},'/%')
</if>
</select>
<select id="getRegionByDingDeptIds" resultType="com.cool.store.entity.RegionDO">
select
id ,
region_id as regionId,
name as name ,
parent_id as parentId,
group_id as groupId,
create_time as createTime,
create_name as createName,
update_time as updateTime,
update_name as updateName,
syn_ding_dept_id as synDingDeptId,
region_type as regionType,
deleted as deleted
from region_${eid}
where deleted = 0
and syn_ding_dept_id in (
<foreach collection="list" item="item" separator=",">
#{item}
</foreach>
)
</select>
<select id="getBySynDingDeptId" resultType="com.cool.store.entity.RegionDO">
select
id ,
id as regionId,
name as name ,
parent_id as parentId,
group_id as groupId,
create_time as createTime,
create_name as createName,
update_time as updateTime,
update_name as updateName,
syn_ding_dept_id as synDingDeptId,
store_id as storeId,
region_type as regionType,
region_path as regionPath,
deleted,
store_num as storeNum
from region_${eid}
where syn_ding_dept_id = #{synDingDeptId}
</select>
<insert id="ignoreInsert" keyColumn="id" keyProperty="region.id" useGeneratedKeys="true">
insert ignore into region_${eid}
(
region_id,
name,
parent_id,
group_id,
create_time,
create_name
<if test="region.regionPath !=null and region.regionPath!=''">
,region_path
</if>
<if test="region.regionType !=null and region.regionType!=''">
,region_type
</if>
<if test="region.storeId !=null and region.storeId!=''">
,store_id
</if>
<if test="region.synDingDeptId !=null and region.synDingDeptId!=''">
,syn_ding_dept_id
</if>
,order_num
)
values
(
#{region.regionId, jdbcType=VARCHAR},
#{region.name, jdbcType=VARCHAR},
#{region.parentId, jdbcType=VARCHAR},
#{region.groupId, jdbcType=VARCHAR},
#{region.createTime, jdbcType=BIGINT},
#{region.createName, jdbcType=VARCHAR}
<if test="region.regionPath !=null and region.regionPath!=''">
,#{region.regionPath}
</if>
<if test="region.regionType !=null and region.regionType!=''">
,#{region.regionType}
</if>
<if test="region.storeId !=null and region.storeId!=''">
,#{region.storeId}
</if>
<if test="region.synDingDeptId !=null and region.synDingDeptId!=''">
,#{region.synDingDeptId}
</if>
,(SELECT max(order_num)+1 FROM region_${eid} AS num)
)
</insert>
<update id="updateSyncRegion" >
update region_${eid}
set `parent_id` = #{item.parentId},
`name` = #{item.name},
<if test="item.regionType != null and item.regionType != ''">
`region_type` = #{item.regionType},
</if>
`deleted` = #{item.deleted},
`update_time` = #{item.updateTime},
<if test="item.storeId != null and item.storeId != ''">
store_id = #{item.storeId},
</if>
`region_path` = #{item.regionPath}
where id = #{item.id}
</update>
<update id="removeRegions">
update region_${eid}
set
deleted = 1,
parent_id = -1
where id in
<foreach collection="regionIds" index="index" item="regionId"
separator="," open="(" close=")">
#{regionId, jdbcType=BIGINT}
</foreach>
and id != 1
</update>
</mapper>

View File

@@ -437,7 +437,7 @@
<if test="regionIdList != null and regionIdList.size >0 ">
and region_id in
<foreach collection="regionIdList" item="regionId" separator="," open="(" close=" )">
#{regionId,jdbcType=BIGINT}
#{regionId}
</foreach>
</if>
</select>
@@ -451,4 +451,187 @@
select store_id from store_${eid}
where is_delete ='effective'
</select>
<select id="getSpecifiedStoreIdsAndDeptId" resultType="com.cool.store.dto.region.RegionSyncDTO">
select
id,
syn_ding_dept_id as synDingDeptId
from store_${eid}
where 1=1
<if test="isDelete!=null and isDelete!=''">
and (is_delete=#{isDelete} or syn_ding_dept_id is not null)
</if>
<if test="parentId!=null and parentId!=''">
and region_path like concat('%/',#{parentId},'/%')
</if>
</select>
<select id="getStoreBySynId" resultMap="BaseResultMap">
select * from store_${eid} where syn_ding_dept_id = #{synId}
</select>
<insert id="insertStore">
insert into store_${enterpriseId}
(
store_id,
store_name,
store_num,
region_id,
avatar,
province,
city,
county,
store_address,
location_address,
is_lock,
longitude_latitude,
longitude,
latitude,
is_delete,
telephone,
business_hours,
store_acreage,
store_bandwidth,
create_time,
create_name,
remark,
region_path,
extend_field,
syn_ding_dept_id,
source,
store_status,
address_point
)
values
(
#{storeDO.storeId},
#{storeDO.storeName},
#{storeDO.storeNum},
#{storeDO.regionId},
#{storeDO.avatar},
#{storeDO.province},
#{storeDO.city},
#{storeDO.county},
#{storeDO.storeAddress},
#{storeDO.locationAddress},
#{storeDO.isLock,jdbcType=CHAR},
#{storeDO.longitudeLatitude},
#{storeDO.longitude},
#{storeDO.latitude},
#{storeDO.isDelete,jdbcType=CHAR},
#{storeDO.telephone},
#{storeDO.businessHours},
#{storeDO.storeAcreage},
#{storeDO.storeBandwidth},
#{storeDO.createTime},
#{storeDO.createName},
#{storeDO.remark},
#{storeDO.regionPath},
#{storeDO.extendField},
#{storeDO.synDingDeptId},
#{storeDO.source},
#{storeDO.storeStatus},
ST_GeomFromText(#{storeDO.addressPoint})
)
</insert>
<update id="updateStore">
update store_${enterpriseId} set
<trim suffixOverrides=",">
<if test="storeDO.storeName != null ">
store_name = #{storeDO.storeName},
</if>
<if test="storeDO.storeNum != null ">
store_num = #{storeDO.storeNum},
</if>
<if test="storeDO.regionPath!= null ">
region_path = #{storeDO.regionPath},
</if>
<if test="storeDO.regionId!= null and storeDO.regionId != 0 ">
region_id = #{storeDO.regionId},
</if>
<if test="storeDO.avatar!= null ">
avatar = #{storeDO.avatar},
</if>
<if test="storeDO.province!= null ">
province = #{storeDO.province},
</if>
<if test="storeDO.city!= null ">
city = #{storeDO.city},
</if>
<if test="storeDO.county!= null ">
county = #{storeDO.county},
</if>
<if test="storeDO.storeAddress!= null ">
store_address = #{storeDO.storeAddress},
</if>
<if test="storeDO.locationAddress!= null ">
location_address = #{storeDO.locationAddress},
</if>
<if test="storeDO.longitudeLatitude!= null ">
longitude_latitude = #{storeDO.longitudeLatitude},
</if>
<if test="storeDO.longitude!= null ">
longitude = #{storeDO.longitude},
</if>
<if test="storeDO.latitude!= null ">
latitude = #{storeDO.latitude},
</if>
<if test="storeDO.addressPoint!= null ">
address_point = ST_GeomFromText(#{storeDO.addressPoint}),
</if>
<if test="storeDO.telephone!= null ">
telephone = #{storeDO.telephone},
</if>
<if test="storeDO.businessHours!= null ">
business_hours = #{storeDO.businessHours},
</if>
<if test="storeDO.storeAcreage!= null ">
store_acreage = #{storeDO.storeAcreage},
</if>
<if test="storeDO.storeBandwidth!= null ">
store_bandwidth = #{storeDO.storeBandwidth},
</if>
<if test="storeDO.updateTime != null ">
update_time = #{storeDO.updateTime},
</if>
<if test="storeDO.updateName != null ">
update_name = #{storeDO.updateName},
</if>
<if test="storeDO.remark!= null ">
remark = #{storeDO.remark},
</if>
<if test="storeDO.isDelete != null ">
is_delete = #{storeDO.isDelete},
</if>
<if test="storeDO.storeStatus != null ">
store_status = #{storeDO.storeStatus},
</if>
<if test="storeDO.extendField != null ">
extend_field = #{storeDO.extendField}
</if>
</trim>
where store_id=#{storeDO.storeId}
</update>
<select id="getStoreIdByIdList" resultType="java.lang.String">
select store_id from store_${eid}
where id in
<foreach collection="ids" item="id" open="(" close=")" separator=",">
#{id}
</foreach>
</select>
<update id="deleteStoreByStoreIds">
update store_${enterpriseId}
set is_delete='invalid',
update_name=#{userId, jdbcType=VARCHAR},
update_time=#{updateTime, jdbcType=BIGINT}
where store_id in
<foreach collection="storeIds" item="storeId" separator="," open="(" close=")">
#{storeId, jdbcType=VARCHAR}
</foreach>
</update>
</mapper>

View File

@@ -164,4 +164,15 @@
)
</foreach>
</insert>
<delete id="deletedByUserIds">
delete from subordinate_mapping_${enterpriseId}
where
user_id in
<foreach collection="userIds" open="(" close=")" separator="," item="userId">
#{userId}
</foreach>
and type = 0
</delete>
</mapper>

View File

@@ -229,4 +229,30 @@
from sys_department_${eid}
where parent_id = #{parentId}
</select>
<delete id="deleteByNotInIds">
delete from sys_department_${eid}
where id not in
<foreach collection="list" item="item" open="(" separator="," close=")" >
#{item}
</foreach>
and id != '1'
</delete>
<select id="getSyncDeptTreeList" resultType="com.cool.store.dto.dept.SyncTreeNode">
select
id,
name,
parent_id as pid
from sys_department_${eid}
</select>
<select id="selectAll" resultType="com.cool.store.entity.SysDepartmentDO">
select
id,
name,
parent_id as parentId,
depart_order as departOrder
from sys_department_${eid}
</select>
</mapper>

View File

@@ -112,4 +112,45 @@
#{userId}
</foreach>
</select>
<delete id="deleteAuthMappingByIds">
delete from user_auth_mapping_${eid}
where id in
<foreach collection="ids" item="id" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
<select id="selectIdsByUserId" resultType="java.lang.Long">
select id from user_auth_mapping_${eid} where user_id = #{userId}
</select>
<insert id="insertUserAuthMapping">
insert into user_auth_mapping_${eid}
(
`user_id`,
`mapping_id`,
`type`,
`source`,
`create_id`,
`create_time`
)
values
(
#{auth.userId},
#{auth.mappingId},
#{auth.type},
#{auth.source},
#{auth.createId},
#{auth.createTime}
)
</insert>
<delete id="deleteAuthMappingByIdAndType">
delete from user_auth_mapping_${eid}
where type=#{type} and mapping_id in
<foreach collection="ids" item="id" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>

View File

@@ -122,4 +122,11 @@
</foreach>
</if>
</select>
<delete id="deletedByIds">
delete from user_region_mapping_${enterpriseId} where id in
<foreach collection="ids" open="(" close=")" separator="," item="id">
#{id}
</foreach>
</delete>
</mapper>

View File

@@ -3,4 +3,4 @@ jdbc.url = jdbc:mysql://dingpushcoolcollege.mysql.rds.aliyuncs.com:3306/coolcoll
jdbc.user= coolstore
jdbc.password = CSCErYcXniNYm7bT
table.name = enterprise_user_group_mapping_e88b6a2bc1334164b54977a4dbfe5d9d
table.name = enterprise_user_department_e88b6a2bc1334164b54977a4dbfe5d9d

View File

@@ -64,7 +64,6 @@
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-jdbc:3.0.2" level="project" />
<orderEntry type="library" name="Maven: com.zaxxer:HikariCP:3.4.2" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-jdbc:5.2.5.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-tx:5.2.5.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.mybatis.spring.boot:mybatis-spring-boot-autoconfigure:2.2.2" level="project" />
<orderEntry type="library" name="Maven: org.mybatis:mybatis:3.5.9" level="project" />
<orderEntry type="library" name="Maven: org.mybatis:mybatis-spring:2.0.7" level="project" />
@@ -91,6 +90,22 @@
<orderEntry type="library" name="Maven: com.aliyun:openapiutil:0.1.9" level="project" />
<orderEntry type="library" name="Maven: org.bouncycastle:bcpkix-jdk15on:1.65" level="project" />
<orderEntry type="library" name="Maven: org.bouncycastle:bcprov-jdk15on:1.65" level="project" />
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-data-redis:3.0.4" level="project" />
<orderEntry type="library" name="Maven: org.springframework.data:spring-data-redis:2.2.6.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework.data:spring-data-keyvalue:2.2.6.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework.data:spring-data-commons:2.2.6.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-tx:5.2.5.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-oxm:5.2.5.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-context-support:5.2.5.RELEASE" level="project" />
<orderEntry type="library" name="Maven: io.lettuce:lettuce-core:5.2.2.RELEASE" level="project" />
<orderEntry type="library" name="Maven: io.netty:netty-common:4.1.48.Final" level="project" />
<orderEntry type="library" name="Maven: io.netty:netty-handler:4.1.48.Final" level="project" />
<orderEntry type="library" name="Maven: io.netty:netty-resolver:4.1.48.Final" level="project" />
<orderEntry type="library" name="Maven: io.netty:netty-buffer:4.1.48.Final" level="project" />
<orderEntry type="library" name="Maven: io.netty:netty-codec:4.1.48.Final" level="project" />
<orderEntry type="library" name="Maven: io.netty:netty-transport:4.1.48.Final" level="project" />
<orderEntry type="library" name="Maven: io.projectreactor:reactor-core:3.3.4.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.reactivestreams:reactive-streams:1.0.3" level="project" />
<orderEntry type="library" name="Maven: com.github.xiaoymin:knife4j-spring-boot-starter:2.0.4" level="project" />
<orderEntry type="library" name="Maven: com.github.xiaoymin:knife4j-spring-boot-autoconfigure:2.0.4" level="project" />
<orderEntry type="library" name="Maven: com.github.xiaoymin:knife4j-spring:2.0.4" level="project" />

View File

@@ -35,6 +35,11 @@ public class DatasourceInfoDTO {
* 数据库密码
*/
private String dbPwd;
/**
* dbName
*/
private String dbName;
public static List<DatasourceInfoDTO> convertList(List<EnterpriseConfigDO> configList){
@@ -48,6 +53,7 @@ public class DatasourceInfoDTO {
datasource.setDbPort(enterpriseConfig.getDbPort());
datasource.setDbUser(enterpriseConfig.getDbUser());
datasource.setDbPwd(enterpriseConfig.getDbPwd());
datasource.setDbName(enterpriseConfig.getDbName());
resultList.add(datasource);
}
return resultList;

View File

@@ -0,0 +1,21 @@
package com.cool.store.dto.dept;
import lombok.Data;
import java.util.List;
/**
* @author 邵凌志
* @date 2020/12/2 14:17
*/
@Data
public class SyncTreeNode {
private String id;
private String pid;
private String name;
private List<SyncTreeNode> child;
}

View File

@@ -0,0 +1,99 @@
package com.cool.store.dto.region;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* @author byd
*/
@Builder
@Data
@NoArgsConstructor
@AllArgsConstructor
public class RegionDTO {
/**
* 自增ID
*/
private Long id;
/**
* 名称
*/
private String name;
/**
* 父ID
*/
private String parentId;
/**
* dinging部门id
*/
private String synDingDeptId;
/**
* 是否删除标记
*/
private Boolean deleted;
/**
* 区域门店数量
*/
private Integer storeNum;
/**
* 区域门店范围是否
*/
private Boolean storeRange = false;
/**
* 门店地址 非DO
*/
private String address;
/**
* 门店经度 非DO
*/
private String longitude;
/**
* 纬度 非DO
*/
private String latitude;
/**
* 门店编号 非DO
*/
private String storeCode;
/**
* 大区名称
*/
private String zoneName;
/**
* brand 主品牌
*/
private String brand;
/**
* 管理分区
*/
private String mangerCity;
/**
* 经营城市
*/
private String bizCity;
/**
* 省区
*/
private String provinceName;
}

View File

@@ -0,0 +1,100 @@
package com.cool.store.dto.region;
import lombok.Data;
import org.apache.commons.lang3.StringUtils;
import java.util.List;
/**
* @ClassName RegionNode
* @Description 用一句话描述什么
*/
@Data
public class RegionNode {
/**
* 自增ID
*/
private Long id;
/**
* 区域ID
*/
private String regionId;
/**
* 名称
*/
private String name;
/**
* 父ID
*/
private String parentId;
private String parentName;
/**
* 分组ID
*/
private String groupId;
/**
* 创建时间
*/
private Long createTime;
/**
* 创建人
*/
private String createName;
/**
* 更新时间
*/
private Long updateTime;
/**
* 更新人
*/
private String updateName;
/**
* 子节点
*/
private List<RegionNode> children;
/**
* 是否有区域权限
*/
private Boolean isAuth;
/**
* 门店数量
*/
private Long storeCount;
/**
* dinging部门id
*/
private String synDingDeptId;
/**
* root path store
*/
private String regionType;
/**
* 路径
*/
private String regionPath;
private String fullRegionPath;
public String getFullRegionPath() {
if(id != null && id == 1L){
return "/1/";
}
if (StringUtils.isNotBlank(regionPath)) {
return regionPath + id + "/";
} else {
return "/" + id + "/";
}
}
}

View File

@@ -0,0 +1,21 @@
package com.cool.store.dto.region;
import lombok.AllArgsConstructor;
import lombok.Data;
import java.util.List;
/**
* describe:
*
* @author zhouyiping
* @date 2021/05/31
*/
@Data
@AllArgsConstructor
public class RegionStoreNumMsgDTO {
private String eid;
private List<Long> regionIdList;
public RegionStoreNumMsgDTO(){}
}

View File

@@ -0,0 +1,25 @@
package com.cool.store.dto.region;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* @author 邵凌志
* @date 2020/12/22 13:48
*/
@Data
@NoArgsConstructor
@AllArgsConstructor
public class RegionSyncDTO {
/**
* 区域id
*/
private Long id;
/**
* 区域钉钉id
*/
private String synDingDeptId;
}

View File

@@ -0,0 +1,43 @@
package com.cool.store.entity;
import io.swagger.annotations.ApiModelProperty;
import java.io.Serializable;
import java.util.Date;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
*
* @author zhangchenbiao
* @date 2023-06-02 05:01
*/
@Data
public class EnterpriseUserDepartmentDO implements Serializable {
@ApiModelProperty("")
private Integer id;
@ApiModelProperty("用户id")
private String userId;
@ApiModelProperty("部门id")
private String departmentId;
@ApiModelProperty("创建时间")
private Date createTime;
@ApiModelProperty("更新时间")
private Date updateTime;
@ApiModelProperty("是否是部门权限数据0否1是")
private Boolean isHasAuth;
public EnterpriseUserDepartmentDO(String userId, String departmentId, Boolean isHasAuth) {
this.userId = userId;
this.departmentId = departmentId;
this.isHasAuth = isHasAuth;
}
public EnterpriseUserDepartmentDO() {}
}

View File

@@ -76,6 +76,29 @@ public class RegionDO implements Serializable {
@ApiModelProperty("第三方唯一id")
private String thirdDeptId;
private Boolean storeRange = false;
/**
* 门店地址 非DO
*/
private String address;
/**
* 门店经度 非DO
*/
private String longitude;
/**
* 纬度 非DO
*/
private String latitude;
/**
* 门店编号 非DO
*/
private String storeCode;
public String getFullRegionPath() {
if(id != null && id == 1L){
return "/1/";

View File

@@ -129,5 +129,5 @@ public class StoreDO implements Serializable {
private String extendField;
@ApiModelProperty("地址经纬度point")
private byte[] addressPoint;
private String addressPoint;
}

View File

@@ -71,4 +71,9 @@ public class SysDepartmentDO implements Serializable {
@ApiModelProperty("部门所有子部门id,以英文逗号分隔")
private String subIds;
/**
* 是否是叶子节点
*/
private Boolean isLeaf;
}

View File

@@ -2,10 +2,7 @@ package com.cool.store.entity;
import io.swagger.annotations.ApiModelProperty;
import java.io.Serializable;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
*
@@ -13,9 +10,6 @@ import lombok.NoArgsConstructor;
* @date 2023-05-19 02:54
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class UserAuthMappingDO implements Serializable {
@ApiModelProperty("主键")
@@ -44,4 +38,15 @@ public class UserAuthMappingDO implements Serializable {
@ApiModelProperty("更新时间")
private Long updateTime;
public UserAuthMappingDO(String userId, String mappingId, String type, String source, String createId, Long createTime) {
this.userId = userId;
this.mappingId = mappingId;
this.type = type;
this.source = source;
this.createId = createId;
this.createTime = createTime;
}
public UserAuthMappingDO(){}
}

View File

@@ -0,0 +1,42 @@
package com.cool.store.vo.oss;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* @author zhangchenbiao
* @FileName: OssUploadConfigVO
* @Description: oss 上传config
* @date 2023-06-01 13:46
*/
@Data
public class OssUploadConfigVO {
@ApiModelProperty("域名")
private String accessKeyId;
@ApiModelProperty("策略 Base64编过")
private String policy;
@ApiModelProperty("对Policy签名后的字符串")
private String signature;
@ApiModelProperty("上传目录")
private String dir;
@ApiModelProperty("域名")
private String host;
@ApiModelProperty("上传策略Policy失效时间")
private String expire;
public OssUploadConfigVO(String accessKeyId, String policy, String signature, String dir, String host, String expire) {
this.accessKeyId = accessKeyId;
this.policy = policy;
this.signature = signature;
this.dir = dir;
this.host = host;
this.expire = expire;
}
}

View File

@@ -61,11 +61,26 @@
<orderEntry type="library" name="Maven: com.github.pagehelper:pagehelper-spring-boot-autoconfigure:1.4.6" level="project" />
<orderEntry type="library" name="Maven: com.google.guava:guava:20.0" level="project" />
<orderEntry type="library" name="Maven: com.aliyun.openservices:ons-client:1.8.8.3.Final" level="project" />
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-data-redis:3.0.4" level="project" />
<orderEntry type="library" name="Maven: org.springframework.data:spring-data-redis:2.2.6.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework.data:spring-data-keyvalue:2.2.6.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework.data:spring-data-commons:2.2.6.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-tx:5.2.5.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-oxm:5.2.5.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-context-support:5.2.5.RELEASE" level="project" />
<orderEntry type="library" name="Maven: io.lettuce:lettuce-core:5.2.2.RELEASE" level="project" />
<orderEntry type="library" name="Maven: io.netty:netty-common:4.1.48.Final" level="project" />
<orderEntry type="library" name="Maven: io.netty:netty-handler:4.1.48.Final" level="project" />
<orderEntry type="library" name="Maven: io.netty:netty-resolver:4.1.48.Final" level="project" />
<orderEntry type="library" name="Maven: io.netty:netty-buffer:4.1.48.Final" level="project" />
<orderEntry type="library" name="Maven: io.netty:netty-codec:4.1.48.Final" level="project" />
<orderEntry type="library" name="Maven: io.netty:netty-transport:4.1.48.Final" level="project" />
<orderEntry type="library" name="Maven: io.projectreactor:reactor-core:3.3.4.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.reactivestreams:reactive-streams:1.0.3" level="project" />
<orderEntry type="module" module-name="coolstore-partner-dao" />
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-jdbc:3.0.2" level="project" />
<orderEntry type="library" name="Maven: com.zaxxer:HikariCP:3.4.2" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-jdbc:5.2.5.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-tx:5.2.5.RELEASE" level="project" />
<orderEntry type="library" name="Maven: mysql:mysql-connector-java:8.0.18" level="project" />
<orderEntry type="library" name="Maven: com.google.protobuf:protobuf-java:3.6.1" level="project" />
<orderEntry type="library" name="Maven: com.alibaba:druid-spring-boot-starter:1.1.20" level="project" />

View File

@@ -1,8 +1,15 @@
package com.cool.store.config.redis;
import com.cool.store.utils.RedisUtilPool;
import com.fasterxml.jackson.annotation.JsonAutoDetect;
import com.fasterxml.jackson.annotation.PropertyAccessor;
import com.fasterxml.jackson.databind.ObjectMapper;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.data.redis.connection.RedisConnectionFactory;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.data.redis.serializer.Jackson2JsonRedisSerializer;
import org.springframework.data.redis.serializer.StringRedisSerializer;
import org.springframework.stereotype.Component;
import redis.clients.jedis.JedisPoolConfig;
import redis.clients.jedis.JedisShardInfo;
@@ -38,4 +45,29 @@ public class RedisUtilConfig {
redisUtil.setShardedJedisPool(new ShardedJedisPool(jedisPoolConfig, shards));
return redisUtil;
}
/**
* 模板序列化
* @Description 模板序列化
* @param redisConnectionFactory
* @return RedisTemplate
* @throws Exception
*/
@Bean(name = "customizeTemplate")
public RedisTemplate<String, Object> redisTemplate(RedisConnectionFactory redisConnectionFactory) {
Jackson2JsonRedisSerializer jacksonSerializer = new Jackson2JsonRedisSerializer<>(Object.class);
ObjectMapper objectMapper = new ObjectMapper();
objectMapper.setVisibility(PropertyAccessor.ALL, JsonAutoDetect.Visibility.ANY);
objectMapper.enableDefaultTyping(ObjectMapper.DefaultTyping.NON_FINAL);
jacksonSerializer.setObjectMapper(objectMapper);
// 创建并配置自定义 RedisTemplateRedisOperator
RedisTemplate<String, Object> template = new RedisTemplate<>();
template.setConnectionFactory(redisConnectionFactory);
template.setKeySerializer(new StringRedisSerializer());
template.setHashKeySerializer(new StringRedisSerializer());
template.setValueSerializer(jacksonSerializer);
template.setHashValueSerializer(jacksonSerializer);
template.afterPropertiesSet();
return template;
}
}

View File

@@ -7,12 +7,17 @@ import com.cool.store.dto.enterprise.EnterpriseUserDTO;
import com.cool.store.dto.enterprise.SysDepartmentDTO;
import com.cool.store.dto.login.UserIdInfoDTO;
import com.cool.store.dto.response.ResultDTO;
import com.cool.store.entity.EnterpriseUserDO;
import com.cool.store.request.EnterpriseUserRequest;
import com.cool.store.utils.RestTemplateUtil;
import com.google.common.collect.Lists;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Service;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Objects;
@@ -178,4 +183,49 @@ public class ISVHttpRequest {
}
return null;
}
public List<SysDepartmentDTO> getSubDepartments(String corpId, String appType, String parentId, Boolean fetchChild) {
String url = isvDomain + "/isv/corp/getSubDepartments";
HashMap requestMap = new HashMap();
requestMap.put("corpId", corpId);
requestMap.put("appType", appType);
requestMap.put("parentId", parentId);
requestMap.put("fetchChild", fetchChild);
ResponseEntity<ResultDTO> responseEntity = null;
try {
responseEntity = RestTemplateUtil.get(url, ResultDTO.class, requestMap);
log.info("url:{}, response:{}", url, JSONObject.toJSONString(responseEntity));
if(Objects.nonNull(responseEntity.getBody()) && responseEntity.getBody().isSuccess()){
return JSONObject.parseArray(JSONObject.toJSONString(responseEntity.getBody().getData()), SysDepartmentDTO.class);
}
} catch (Exception e) {
log.info("调用isv出错{}", e);
}
return null;
}
public List<EnterpriseUserRequest> getDeptUsers(String corpId, String deptId, String appType) {
List<EnterpriseUserDTO> departmentUsers = getDepartmentUsers(corpId, deptId, appType);
if (CollectionUtils.isEmpty(departmentUsers)){
return Lists.newArrayList();
}
List<EnterpriseUserRequest> userList = Lists.newArrayList();
for (EnterpriseUserDTO enterpriseUserDTO:departmentUsers) {
EnterpriseUserDO enterpriseUser = new EnterpriseUserDO();
enterpriseUser.setCreateTime(new Date());
enterpriseUser.setIsAdmin(false);
enterpriseUser.setRemark(enterpriseUserDTO.getRemark());
enterpriseUser.setUserId(enterpriseUserDTO.getUserId());
if (enterpriseUserDTO.getIsLeaderInDepts() != null) {
enterpriseUser.setIsLeaderInDepts(JSONObject.toJSONString(enterpriseUserDTO.getIsLeaderInDepts()));
}
EnterpriseUserRequest enterpriseUserRequest = new EnterpriseUserRequest();
enterpriseUserRequest.setEnterpriseUserDO(enterpriseUser);
if (CollectionUtils.isNotEmpty(enterpriseUserDTO.getDepartmentLists())) {
enterpriseUserRequest.setDepartment(JSONObject.toJSONString(enterpriseUserDTO.getDepartmentLists()));
}
userList.add(enterpriseUserRequest);
}
return userList;
}
}

View File

@@ -19,4 +19,6 @@ public interface EnterpriseInitService {
void enterpriseInit(String cropId, AppTypeEnum appType, String eid, String dbName, String openUserId);
void sendOpenSucceededMsg(String corpId, String appType, List<String> userList);
void sync(String eid, String userName, String userId, Long regionId);
}

View File

@@ -3,6 +3,7 @@ package com.cool.store.service;
import com.cool.store.dto.buser.SubordinateUserRangeDTO;
import com.cool.store.dto.enterprise.EnterpriseUserDTO;
import com.cool.store.entity.EnterpriseUserDO;
import com.cool.store.request.EnterpriseUserRequest;
import com.cool.store.vo.buser.EnterpriseUserPageVO;
import java.util.List;
@@ -34,4 +35,13 @@ public interface EnterpriseUserService {
*/
Map<String, String> getUserRegion(String enterpriseId, List<String> userIdList);
/**
* 更新用户的部门全路径
* @param user
* @param deptIdMap
*/
void updateUserDeptPath(EnterpriseUserRequest user, Map<String, String> deptIdMap);
EnterpriseUserDO selectByUserIdIgnoreActive(String enterpriseId, String userId);
}

View File

@@ -0,0 +1,21 @@
package com.cool.store.service;
import com.cool.store.entity.RegionDO;
import java.util.List;
/**
* @author zhangchenbiao
* @FileName: RegionService
* @Description:
* @date 2023-06-05 10:43
*/
public interface RegionService {
void saveRegionAndStore(String eid, RegionDO regionDO, String userId);
void removeRegions(String eid, List<Long> regionIds);
void deleteByStoreIds(String enterpriseId, List<String> storeIds, String userId);
}

View File

@@ -14,11 +14,13 @@ import com.cool.store.dto.usergroup.UserGroupDTO;
import com.cool.store.entity.*;
import com.cool.store.enums.SubordinateSourceEnum;
import com.cool.store.enums.UserSelectRangeEnum;
import com.cool.store.request.EnterpriseUserRequest;
import com.cool.store.service.AuthVisualService;
import com.cool.store.service.EnterpriseUserGroupService;
import com.cool.store.service.EnterpriseUserService;
import com.cool.store.vo.buser.EnterpriseUserPageVO;
import com.github.pagehelper.PageHelper;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
@@ -367,4 +369,33 @@ public class EnterpriseUserServiceImpl implements EnterpriseUserService {
});
return resultMap;
}
@Override
public void updateUserDeptPath(EnterpriseUserRequest user, Map<String, String> deptIdMap) {
List<String> departmentLists = user.getDepartmentLists();
//logger.info("设置用户部门全路径 start department:{},user:{},id:{}",department,user.getUnionid(),user.getId());
if (CollectionUtils.isNotEmpty(departmentLists)) {
//logger.info("into if else department ");
List<String> deptList = Lists.newArrayList();
departmentLists.forEach(deptId -> {
List<String> tmpList = Lists.newArrayList(deptId);
String parentId;
while ((parentId = deptIdMap.get(deptId)) != null && (!parentId.equals(deptId))) {
tmpList.add(parentId);
deptId = parentId;
}
String collect = Lists.reverse(tmpList).stream().map(String::valueOf).collect(Collectors.joining("/"));
String data = collect.startsWith("/") ? collect : "/" + collect;
data = data.endsWith("/") ? data : data + "/";
deptList.add(data);
});
user.setDepartments("[" + String.join(",", deptList) + "]");
user.getEnterpriseUserDO().setDepartments("[" + String.join(",", deptList) + "]");
}
}
@Override
public EnterpriseUserDO selectByUserIdIgnoreActive(String enterpriseId, String userId) {
return enterpriseUserDAO.selectByUserIdIgnoreActive(enterpriseId, userId);
}
}

View File

@@ -0,0 +1,151 @@
package com.cool.store.service.impl;
import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson.JSONObject;
import com.cool.store.dao.RegionDAO;
import com.cool.store.dao.StoreDAO;
import com.cool.store.dao.UserAuthMappingDAO;
import com.cool.store.dto.region.RegionStoreNumMsgDTO;
import com.cool.store.entity.RegionDO;
import com.cool.store.entity.StoreDO;
import com.cool.store.enums.RegionTypeEnum;
import com.cool.store.enums.RocketMqTagEnum;
import com.cool.store.enums.StoreIsDeleteEnum;
import com.cool.store.enums.UserAuthMappingTypeEnum;
import com.cool.store.mq.producer.SimpleMessageService;
import com.cool.store.service.RegionService;
import com.cool.store.utils.RedisConstantUtil;
import com.cool.store.utils.RedisUtil;
import com.cool.store.utils.UUIDUtils;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.collections4.ListUtils;
import org.apache.commons.collections4.MapUtils;
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 javax.annotation.Resource;
import java.util.Calendar;
import java.util.Collection;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
* @author zhangchenbiao
* @FileName: RegionServiceImpl
* @Description:
* @date 2023-06-05 10:43
*/
@Service
public class RegionServiceImpl implements RegionService {
@Resource
private RedisUtil redisUtil;
@Resource
private RedisConstantUtil redisConstantUtil;
@Resource
private StoreDAO storeDAO;
@Resource
private RegionDAO regionDAO;
@Resource
private UserAuthMappingDAO userAuthMappingDAO;
@Resource
private SimpleMessageService simpleMessageService;
@Transactional(rollbackFor = Exception.class)
@Override
public void saveRegionAndStore(String eid, RegionDO regionDO, String userId) {
String storeKey = redisConstantUtil.getSyncStoreKey(eid);
String storeId = null;
if(regionDO.getStoreRange()){
StoreDO storeDO = storeDAO.getStoreBySynId(eid, regionDO.getSynDingDeptId());
if(storeDO != null && StringUtils.isNotBlank(storeDO.getStoreId())){
storeId = storeDO.getStoreId();
}else {
storeId = UUIDUtils.get32UUID();
}
}
regionDO.setStoreId(storeId);
regionDO.setRegionType(RegionTypeEnum.PATH.getType());
RegionDO oldRegion = regionDAO.getBySynDingDeptId(eid, regionDO.getSynDingDeptId());
boolean isAdd = oldRegion == null;
if (isAdd) {
if(regionDO.getStoreRange()){
regionDO.setStoreId(storeId);
regionDO.setRegionType(RegionTypeEnum.STORE.getType());
}
regionDAO.ignoreInsert(eid, regionDO);
} else {
if(regionDO.getStoreRange()){
regionDO.setRegionType(RegionTypeEnum.STORE.getType());
}
regionDAO.updateSyncRegion(eid, regionDO);
}
if (regionDO.getStoreRange()) {
StoreDO store = new StoreDO();
store.setStoreName(regionDO.getName());
store.setRegionPath(regionDO.getFullRegionPath());
store.setIsDelete(StoreIsDeleteEnum.EFFECTIVE.getValue());
store.setRegionId(Long.valueOf(regionDO.getParentId()));
store.setSource("sync");
store.setStoreAddress(regionDO.getAddress());
store.setLocationAddress(regionDO.getAddress());
store.setStoreNum(regionDO.getStoreCode());
store.setLatitude(regionDO.getLatitude());
store.setLongitude(regionDO.getLongitude());
store.setStoreId(storeId);
String id = redisUtil.hashGetString(storeKey, regionDO.getSynDingDeptId());
if (StringUtils.isNotBlank(id)) {
store.setId(Long.valueOf(id));
//删除对应的已有redis key缓存
redisUtil.delete(storeKey, regionDO.getSynDingDeptId());
store.setUpdateName(userId);
store.setUpdateTime(System.currentTimeMillis());
storeDAO.updateStore(eid, store);
} else {
store.setIsLock("not_locked");
store.setStoreStatus("open");
store.setSynDingDeptId(regionDO.getSynDingDeptId());
store.setCreateName(userId);
store.setCreateTime(System.currentTimeMillis());
storeDAO.insertStore(eid, store);
}
}
}
@Override
public void removeRegions(String eid, List<Long> regionIds) {
regionDAO.removeRegion(eid, regionIds);
}
@Override
public void deleteByStoreIds(String enterpriseId, List<String> storeIds, String userId) {
//获取门店基本信息
List<StoreDO> storeList = storeDAO.getStoreListByStoreIds(enterpriseId, storeIds);
if (CollectionUtils.isEmpty(storeList)) {
return;
}
// 删除门店绑定的权限
userAuthMappingDAO.deleteAuthMappingByIdAndType(enterpriseId, storeIds, UserAuthMappingTypeEnum.STORE.getCode());
// 删除门店本身
storeDAO.deleteStoreByStoreIds(enterpriseId, storeIds, userId, Calendar.getInstance().getTimeInMillis());
//更新区域内的门店数量
List<Long> regionIdList = ListUtils.emptyIfNull(storeList)
.stream()
.map(StoreDO::getRegionId)
.collect(Collectors.toList());
if (CollectionUtils.isNotEmpty(regionIdList)) {
List<RegionDO> regionDOList = regionDAO.listStoreRegionByIds(enterpriseId, regionIdList);
List<Long> updateRegionIdList = ListUtils.emptyIfNull(regionDOList)
.stream()
.map(data -> StrUtil.splitTrim(data.getFullRegionPath(), "/"))
.flatMap(Collection::stream)
.map(Long::valueOf)
.collect(Collectors.toList());
simpleMessageService.send(JSONObject.toJSONString(new RegionStoreNumMsgDTO(enterpriseId, updateRegionIdList)), RocketMqTagEnum.REGION_STORE_NUM_UPDATE);
}
}
}

View File

@@ -31,11 +31,26 @@
<orderEntry type="library" name="Maven: com.github.pagehelper:pagehelper-spring-boot-autoconfigure:1.4.6" level="project" />
<orderEntry type="library" name="Maven: com.google.guava:guava:20.0" level="project" />
<orderEntry type="library" name="Maven: com.aliyun.openservices:ons-client:1.8.8.3.Final" level="project" />
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-data-redis:3.0.4" level="project" />
<orderEntry type="library" name="Maven: org.springframework.data:spring-data-redis:2.2.6.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework.data:spring-data-keyvalue:2.2.6.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework.data:spring-data-commons:2.2.6.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-tx:5.2.5.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-oxm:5.2.5.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-context-support:5.2.5.RELEASE" level="project" />
<orderEntry type="library" name="Maven: io.lettuce:lettuce-core:5.2.2.RELEASE" level="project" />
<orderEntry type="library" name="Maven: io.netty:netty-common:4.1.48.Final" level="project" />
<orderEntry type="library" name="Maven: io.netty:netty-handler:4.1.48.Final" level="project" />
<orderEntry type="library" name="Maven: io.netty:netty-resolver:4.1.48.Final" level="project" />
<orderEntry type="library" name="Maven: io.netty:netty-buffer:4.1.48.Final" level="project" />
<orderEntry type="library" name="Maven: io.netty:netty-codec:4.1.48.Final" level="project" />
<orderEntry type="library" name="Maven: io.netty:netty-transport:4.1.48.Final" level="project" />
<orderEntry type="library" name="Maven: io.projectreactor:reactor-core:3.3.4.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.reactivestreams:reactive-streams:1.0.3" level="project" />
<orderEntry type="module" module-name="coolstore-partner-dao" />
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-jdbc:3.0.2" level="project" />
<orderEntry type="library" name="Maven: com.zaxxer:HikariCP:3.4.2" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-jdbc:5.2.5.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-tx:5.2.5.RELEASE" level="project" />
<orderEntry type="library" name="Maven: mysql:mysql-connector-java:8.0.18" level="project" />
<orderEntry type="library" name="Maven: com.google.protobuf:protobuf-java:3.6.1" level="project" />
<orderEntry type="library" name="Maven: com.alibaba:druid-spring-boot-starter:1.1.20" level="project" />

View File

@@ -28,8 +28,6 @@
<dependency>
<groupId>com.aliyun.oss</groupId>
<artifactId>aliyun-sdk-oss</artifactId>
<version>3.13.0</version>
<scope>compile</scope>
</dependency>
</dependencies>

View File

@@ -6,6 +6,7 @@ import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Primary;
import org.springframework.jdbc.datasource.AbstractDataSource;
import org.springframework.stereotype.Component;
@@ -27,10 +28,13 @@ public class DynamicDataSource extends AbstractDataSource {
@Autowired
private DynamicDataSourceServiceImpl dynamicDataSourceService;
@Value("${default.database.name:coolcollege_intelligent_config}")
private String defaultDb;
@Override
public Connection getConnection() throws SQLException {
String currentDbName = getCurrentDbName();
if(CommonConstants.DEFAULT_DB.equals(currentDbName)){
if(defaultDb.equals(currentDbName)){
Connection connection = defaultDataSource.getConnection();
connection.setCatalog(currentDbName);
return connection;
@@ -43,7 +47,7 @@ public class DynamicDataSource extends AbstractDataSource {
@Override
public Connection getConnection(String username, String password) throws SQLException {
String currentDbName = getCurrentDbName();
if(CommonConstants.DEFAULT_DB.equals(currentDbName)){
if(defaultDb.equals(currentDbName)){
Connection connection = defaultDataSource.getConnection();
connection.setCatalog(currentDbName);
return connection;
@@ -97,7 +101,7 @@ public class DynamicDataSource extends AbstractDataSource {
protected String getCurrentDbName() {
String dbName = DataSourceContext.getDataSourceType();
if (StringUtils.isBlank(dbName)) {
dbName = CommonConstants.DEFAULT_DB;
dbName = defaultDb;
}
return dbName;
}

View File

@@ -14,6 +14,7 @@ import com.zaxxer.hikari.HikariDataSource;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import javax.sql.DataSource;
@@ -33,17 +34,16 @@ public class DynamicDataSourceServiceImpl {
private static int defaultMaxPoolSize = 150;
private static String dbUrl = "jdbc:mysql://{0}:{1}/coolcollege_intelligent_config?useSSL=false&useUnicode=true&characterEncoding=utf8&allowMultiQueries=true&autoReconnect=true";
private static String dbUrl = "jdbc:mysql://{0}:{1}/{2}?useSSL=false&useUnicode=true&characterEncoding=utf8&allowMultiQueries=true&autoReconnect=true";
@Autowired
private RedisUtilPool redisUtilPool;
@Autowired
private MyHikariConfig myHikariConfig;
@Autowired
private EnterpriseConfigService enterpriseConfigService;
@Value("${default.database.name:coolcollege_intelligent_config}")
private String defaultDb;
/**
* 数据库实例和数据源的映射
*/
@@ -71,7 +71,7 @@ public class DynamicDataSourceServiceImpl {
* @return
*/
public String getDbServerByDbName(String dbName) {
if(CommonConstants.DEFAULT_DB.equals(dbName)){
if(defaultDb.equals(dbName)){
return null;
}
String dbServerUrl = dbNameUrlServerMap.get(dbName);
@@ -115,7 +115,7 @@ public class DynamicDataSourceServiceImpl {
*/
private DataSource buildDataSourceByConfig(DatasourceInfoDTO datasource) {
HikariConfig hikariConfig = new HikariConfig();
String url = MessageFormat.format(dbUrl, datasource.getDbServer(), String.valueOf(datasource.getDbPort()));
String url = MessageFormat.format(dbUrl, datasource.getDbServer(), String.valueOf(datasource.getDbPort()), datasource.getDbName());
hikariConfig.setDriverClassName(myHikariConfig.getDriverClassName());
hikariConfig.setMinimumIdle(myHikariConfig.getMinimumIdle());
hikariConfig.setMaximumPoolSize(myHikariConfig.getMaximumPoolSize());

View File

@@ -5,14 +5,15 @@ import com.aliyun.oss.common.utils.BinaryUtil;
import com.aliyun.oss.model.MatchMode;
import com.aliyun.oss.model.PolicyConditions;
import com.cool.store.response.ResponseResult;
import com.cool.store.vo.oss.OssUploadConfigVO;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import java.sql.Date;
import java.util.LinkedHashMap;
import java.util.Map;
/**
* @author zhangchenbiao
@@ -25,24 +26,25 @@ import java.util.Map;
@Slf4j
public class OssClientController {
@Value("${oss.accessKeyId:null}")
private String accessKeyId;
@Value("${oss.accessKeySecret:null}")
private String accessKeySecret;
@Value("${oss.endpoint:null}")
private String endpoint;
@Value("${oss.bucket:null}")
private String bucket;
@GetMapping("/getUploadFileConfig")
public ResponseResult getUploadFileConfig(){
// 请填写您的AccessKeyId。
String accessId = "LTAI5tKSnAbkEbmT6CeBwNN3";
// 请填写您的AccessKeySecret。
String accessKey = "PbXOzUFwAvZ2K5zIawwa7NAJE2pFXS";
// 请填写您的 endpoint。
String endpoint = "oss-cn-shanghai.aliyuncs.com";
// 请填写您的 bucketname 。
String bucket = "vec-coolstore";
public ResponseResult getUploadFileConfig(@RequestParam("enterpriseId")String enterpriseId){
// host的格式为 bucketname.endpoint
String host = "http://" + bucket + "." + endpoint;
// callbackUrl为 上传回调服务器的URL请将下面的IP和Port配置为您自己的真实信息
String dir = "user-dir-prefix/"; // 用户上传文件时指定的前缀。
// 用户上传文件时指定的前缀
String dir = "partner/" + enterpriseId + "/";
OSSClient client = new OSSClient(endpoint, accessId, accessKey);
OSSClient client = new OSSClient(endpoint, accessKeyId, accessKeySecret);
try {
long expireTime = 30;
long expireTime = 300;
long expireEndTime = System.currentTimeMillis() + expireTime * 1000;
Date expiration = new Date(expireEndTime);
PolicyConditions policyConds = new PolicyConditions();
@@ -51,15 +53,9 @@ public class OssClientController {
String postPolicy = client.generatePostPolicy(expiration, policyConds);
byte[] binaryData = postPolicy.getBytes("utf-8");
String encodedPolicy = BinaryUtil.toBase64String(binaryData);
String postSignature = client.calculatePostSignature(postPolicy);
Map<String, String> respMap = new LinkedHashMap<String, String>();
respMap.put("accessid", accessId);
respMap.put("policy", encodedPolicy);
respMap.put("signature", postSignature);
respMap.put("dir", dir);
respMap.put("host", host);
respMap.put("expire", String.valueOf(expireEndTime / 1000));
return ResponseResult.success(respMap);
String signature = client.calculatePostSignature(postPolicy);
OssUploadConfigVO result = new OssUploadConfigVO(accessKeyId, encodedPolicy, signature, dir, host, String.valueOf(expireEndTime / 1000));
return ResponseResult.success(result);
}catch (Exception e){
log.info("exception", e);
}

View File

@@ -1,7 +1,7 @@
#mysql config
default.datasource.url=jdbc:mysql://dingpushcoolcollege.mysql.rds.aliyuncs.com:3306/coolcollege_intelligent_config?useSSL=false&useUnicode=true&characterEncoding=utf8&allowMultiQueries=true&autoReconnect=true&serverTimezone=Asia/Shanghai
default.datasource.username=coolstore
default.datasource.password=CSCErYcXniNYm7bT
default.datasource.url=jdbc:mysql://dingpushcoolcollege.mysql.rds.aliyuncs.com:3306/coolcollege_intelligent_hy?useSSL=false&useUnicode=true&characterEncoding=utf8&allowMultiQueries=true&autoReconnect=true
default.datasource.username=hsay
default.datasource.password=Z3J7xBbgouMD
#redis
spring.redis.host=tstore-coolcollege.redis.rds.aliyuncs.com
@@ -41,3 +41,5 @@ rocketmq.secretKey=yuomDstRjSdihtN5zo8viDbWu8Z0ig
rocketmq.nameSrvAdder=http://MQ_INST_1947409023213164_BX3sLZnA.cn-hangzhou.mq-internal.aliyuncs.com:8080
rocketmq.topic=simple_message
rocketmq.orderTopic=order_message
default.database.name=coolcollege_intelligent_hy

View File

@@ -1,11 +1,7 @@
#mysql config
default.datasource.url=jdbc:mysql://dingpushcoolcollege.mysql.rds.aliyuncs.com:3306/coolcollege_intelligent_config?useSSL=false&useUnicode=true&characterEncoding=utf8&allowMultiQueries=true&autoReconnect=true
#default.datasource.url=jdbc:mysql://dstore-coolcollege.mysql.rds.aliyuncs.com:3306/coolcollege_intelligent_config?useSSL=false&useUnicode=true&characterEncoding=utf8&allowMultiQueries=true&autoReconnect=true&serverTimezone=Asia/Shanghai
default.datasource.username=coolstore
default.datasource.password=CSCErYcXniNYm7bT
#default.datasource.url=jdbc:mysql://127.0.0.1:3306/coolcollege_intelligent_config?useSSL=false&useUnicode=true&characterEncoding=utf8&allowMultiQueries=true&autoReconnect=true&serverTimezone=Asia/Shanghai
#default.datasource.username=root
#default.datasource.password=root
default.datasource.url=jdbc:mysql://dingpushcoolcollege.mysql.rds.aliyuncs.com:3306/coolcollege_intelligent_hy?useSSL=false&useUnicode=true&characterEncoding=utf8&allowMultiQueries=true&autoReconnect=true
default.datasource.username=hsay
default.datasource.password=Z3J7xBbgouMD
#redis
spring.redis.host=tstore-coolcollege.redis.rds.aliyuncs.com
@@ -44,4 +40,6 @@ rocketmq.accessKey=LTAI5t5ouXZuFgxJMbQea3b2
rocketmq.secretKey=yuomDstRjSdihtN5zo8viDbWu8Z0ig
rocketmq.nameSrvAdder=http://MQ_INST_1947409023213164_BX3sLZnA.cn-hangzhou.mq-internal.aliyuncs.com:8080
rocketmq.topic=simple_message
rocketmq.orderTopic=order_message
rocketmq.orderTopic=order_message
default.database.name=coolcollege_intelligent_hy

View File

@@ -1,11 +1,7 @@
#mysql config
default.datasource.url=jdbc:mysql://dingpushcoolcollege.mysql.rds.aliyuncs.com:3306/coolcollege_intelligent_config?useSSL=false&useUnicode=true&characterEncoding=utf8&allowMultiQueries=true&autoReconnect=true
#default.datasource.url=jdbc:mysql://dstore-coolcollege.mysql.rds.aliyuncs.com:3306/coolcollege_intelligent_config?useSSL=false&useUnicode=true&characterEncoding=utf8&allowMultiQueries=true&autoReconnect=true&serverTimezone=Asia/Shanghai
default.datasource.username=coolstore
default.datasource.password=CSCErYcXniNYm7bT
#default.datasource.url=jdbc:mysql://127.0.0.1:3306/coolcollege_intelligent_config?useSSL=false&useUnicode=true&characterEncoding=utf8&allowMultiQueries=true&autoReconnect=true&serverTimezone=Asia/Shanghai
#default.datasource.username=root
#default.datasource.password=root
default.datasource.url=jdbc:mysql://dingpushcoolcollege.mysql.rds.aliyuncs.com:3306/coolcollege_intelligent_hy?useSSL=false&useUnicode=true&characterEncoding=utf8&allowMultiQueries=true&autoReconnect=true
default.datasource.username=hsay
default.datasource.password=Z3J7xBbgouMD
#redis
spring.redis.host=tstore-coolcollege.redis.rds.aliyuncs.com
@@ -47,4 +43,12 @@ rocketmq.accessKey=zK2oVEz4G1ts23d2
rocketmq.secretKey=0UstLCS0mh2ASgBh
rocketmq.nameSrvAdder=http://rmq-cn-9lb38l1rx04.cn-hangzhou.rmq.aliyuncs.com:8080
rocketmq.topic=simple_message
rocketmq.orderTopic=order_message
rocketmq.orderTopic=order_message
#oss配置
oss.accessKeyId=LTAI5tKSnAbkEbmT6CeBwNN3
oss.accessKeySecret=PbXOzUFwAvZ2K5zIawwa7NAJE2pFXS
oss.endpoint=oss-cn-shanghai.aliyuncs.com
oss.bucket=vec-coolstore
default.database.name=coolcollege_intelligent_hy

View File

@@ -1,7 +1,7 @@
#mysql config
default.datasource.url=jdbc:mysql://dingpushcoolcollege.mysql.rds.aliyuncs.com:3306/coolcollege_intelligent_config?useSSL=false&useUnicode=true&characterEncoding=utf8&allowMultiQueries=true&autoReconnect=true&serverTimezone=Asia/Shanghai
default.datasource.username=coolstore
default.datasource.password=CSCErYcXniNYm7bT
default.datasource.url=jdbc:mysql://dingpushcoolcollege.mysql.rds.aliyuncs.com:3306/coolcollege_intelligent_hy?useSSL=false&useUnicode=true&characterEncoding=utf8&allowMultiQueries=true&autoReconnect=true
default.datasource.username=hsay
default.datasource.password=Z3J7xBbgouMD
#redis
spring.redis.host=tstore-coolcollege.redis.rds.aliyuncs.com
@@ -40,4 +40,6 @@ rocketmq.accessKey=LTAI5t5ouXZuFgxJMbQea3b2
rocketmq.secretKey=yuomDstRjSdihtN5zo8viDbWu8Z0ig
rocketmq.nameSrvAdder=http://MQ_INST_1947409023213164_BX3sLZnA.cn-hangzhou.mq-internal.aliyuncs.com:8080
rocketmq.topic=simple_message
rocketmq.orderTopic=order_message
rocketmq.orderTopic=order_message
default.database.name=coolcollege_intelligent_hy

View File

@@ -31,11 +31,26 @@
<orderEntry type="library" name="Maven: com.github.pagehelper:pagehelper-spring-boot-autoconfigure:1.4.6" level="project" />
<orderEntry type="library" name="Maven: com.google.guava:guava:20.0" level="project" />
<orderEntry type="library" name="Maven: com.aliyun.openservices:ons-client:1.8.8.3.Final" level="project" />
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-data-redis:3.0.4" level="project" />
<orderEntry type="library" name="Maven: org.springframework.data:spring-data-redis:2.2.6.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework.data:spring-data-keyvalue:2.2.6.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework.data:spring-data-commons:2.2.6.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-tx:5.2.5.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-oxm:5.2.5.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-context-support:5.2.5.RELEASE" level="project" />
<orderEntry type="library" name="Maven: io.lettuce:lettuce-core:5.2.2.RELEASE" level="project" />
<orderEntry type="library" name="Maven: io.netty:netty-common:4.1.48.Final" level="project" />
<orderEntry type="library" name="Maven: io.netty:netty-handler:4.1.48.Final" level="project" />
<orderEntry type="library" name="Maven: io.netty:netty-resolver:4.1.48.Final" level="project" />
<orderEntry type="library" name="Maven: io.netty:netty-buffer:4.1.48.Final" level="project" />
<orderEntry type="library" name="Maven: io.netty:netty-codec:4.1.48.Final" level="project" />
<orderEntry type="library" name="Maven: io.netty:netty-transport:4.1.48.Final" level="project" />
<orderEntry type="library" name="Maven: io.projectreactor:reactor-core:3.3.4.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.reactivestreams:reactive-streams:1.0.3" level="project" />
<orderEntry type="module" module-name="coolstore-partner-dao" />
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-jdbc:3.0.2" level="project" />
<orderEntry type="library" name="Maven: com.zaxxer:HikariCP:3.4.2" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-jdbc:5.2.5.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-tx:5.2.5.RELEASE" level="project" />
<orderEntry type="library" name="Maven: mysql:mysql-connector-java:8.0.18" level="project" />
<orderEntry type="library" name="Maven: com.google.protobuf:protobuf-java:3.6.1" level="project" />
<orderEntry type="library" name="Maven: com.alibaba:druid-spring-boot-starter:1.1.20" level="project" />

View File

@@ -1,7 +1,7 @@
#mysql config
default.datasource.url=jdbc:mysql://dingpushcoolcollege.mysql.rds.aliyuncs.com:3306/coolcollege_intelligent_config?useSSL=false&useUnicode=true&characterEncoding=utf8&allowMultiQueries=true&autoReconnect=true&serverTimezone=Asia/Shanghai
default.datasource.username=coolstore
default.datasource.password=CSCErYcXniNYm7bT
default.datasource.url=jdbc:mysql://dingpushcoolcollege.mysql.rds.aliyuncs.com:3306/coolcollege_intelligent_hy?useSSL=false&useUnicode=true&characterEncoding=utf8&allowMultiQueries=true&autoReconnect=true
default.datasource.username=hsay
default.datasource.password=Z3J7xBbgouMD
#redis
spring.redis.host=tstore-coolcollege.redis.rds.aliyuncs.com
@@ -40,4 +40,6 @@ rocketmq.accessKey=LTAI5t5ouXZuFgxJMbQea3b2
rocketmq.secretKey=yuomDstRjSdihtN5zo8viDbWu8Z0ig
rocketmq.nameSrvAdder=http://MQ_INST_1947409023213164_BX3sLZnA.cn-hangzhou.mq-internal.aliyuncs.com:8080
rocketmq.topic=simple_message
rocketmq.orderTopic=order_message
rocketmq.orderTopic=order_message
default.database.name=coolcollege_intelligent_hy

View File

@@ -1,11 +1,7 @@
#mysql config
default.datasource.url=jdbc:mysql://dingpushcoolcollege.mysql.rds.aliyuncs.com:3306/coolcollege_intelligent_config?useSSL=false&useUnicode=true&characterEncoding=utf8&allowMultiQueries=true&autoReconnect=true
#default.datasource.url=jdbc:mysql://dstore-coolcollege.mysql.rds.aliyuncs.com:3306/coolcollege_intelligent_config?useSSL=false&useUnicode=true&characterEncoding=utf8&allowMultiQueries=true&autoReconnect=true&serverTimezone=Asia/Shanghai
default.datasource.username=coolstore
default.datasource.password=CSCErYcXniNYm7bT
#default.datasource.url=jdbc:mysql://127.0.0.1:3306/coolcollege_intelligent_config?useSSL=false&useUnicode=true&characterEncoding=utf8&allowMultiQueries=true&autoReconnect=true&serverTimezone=Asia/Shanghai
#default.datasource.username=root
#default.datasource.password=root
default.datasource.url=jdbc:mysql://dingpushcoolcollege.mysql.rds.aliyuncs.com:3306/coolcollege_intelligent_hy?useSSL=false&useUnicode=true&characterEncoding=utf8&allowMultiQueries=true&autoReconnect=true
default.datasource.username=hsay
default.datasource.password=Z3J7xBbgouMD
#redis
spring.redis.host=tstore-coolcollege.redis.rds.aliyuncs.com
@@ -44,4 +40,6 @@ rocketmq.accessKey=LTAI5t5ouXZuFgxJMbQea3b2
rocketmq.secretKey=yuomDstRjSdihtN5zo8viDbWu8Z0ig
rocketmq.nameSrvAdder=http://MQ_INST_1947409023213164_BX3sLZnA.cn-hangzhou.mq-internal.aliyuncs.com:8080
rocketmq.topic=simple_message
rocketmq.orderTopic=order_message
rocketmq.orderTopic=order_message
default.database.name=coolcollege_intelligent_hy

View File

@@ -1,11 +1,7 @@
#mysql config
default.datasource.url=jdbc:mysql://dingpushcoolcollege.mysql.rds.aliyuncs.com:3306/coolcollege_intelligent_config?useSSL=false&useUnicode=true&characterEncoding=utf8&allowMultiQueries=true&autoReconnect=true
#default.datasource.url=jdbc:mysql://dstore-coolcollege.mysql.rds.aliyuncs.com:3306/coolcollege_intelligent_config?useSSL=false&useUnicode=true&characterEncoding=utf8&allowMultiQueries=true&autoReconnect=true&serverTimezone=Asia/Shanghai
default.datasource.username=coolstore
default.datasource.password=CSCErYcXniNYm7bT
#default.datasource.url=jdbc:mysql://127.0.0.1:3306/coolcollege_intelligent_config?useSSL=false&useUnicode=true&characterEncoding=utf8&allowMultiQueries=true&autoReconnect=true&serverTimezone=Asia/Shanghai
#default.datasource.username=root
#default.datasource.password=root
default.datasource.url=jdbc:mysql://dingpushcoolcollege.mysql.rds.aliyuncs.com:3306/coolcollege_intelligent_hy?useSSL=false&useUnicode=true&characterEncoding=utf8&allowMultiQueries=true&autoReconnect=true
default.datasource.username=hsay
default.datasource.password=Z3J7xBbgouMD
#redis
spring.redis.host=tstore-coolcollege.redis.rds.aliyuncs.com
@@ -48,3 +44,5 @@ rocketmq.secretKey=yuomDstRjSdihtN5zo8viDbWu8Z0ig
rocketmq.nameSrvAdder=http://MQ_INST_1947409023213164_BX3sLZnA.cn-hangzhou.mq-internal.aliyuncs.com:8080
rocketmq.topic=simple_message
rocketmq.orderTopic=order_message
default.database.name=coolcollege_intelligent_hy

View File

@@ -1,7 +1,7 @@
#mysql config
default.datasource.url=jdbc:mysql://dingpushcoolcollege.mysql.rds.aliyuncs.com:3306/coolcollege_intelligent_config?useSSL=false&useUnicode=true&characterEncoding=utf8&allowMultiQueries=true&autoReconnect=true&serverTimezone=Asia/Shanghai
default.datasource.username=coolstore
default.datasource.password=CSCErYcXniNYm7bT
default.datasource.url=jdbc:mysql://dingpushcoolcollege.mysql.rds.aliyuncs.com:3306/coolcollege_intelligent_hy?useSSL=false&useUnicode=true&characterEncoding=utf8&allowMultiQueries=true&autoReconnect=true
default.datasource.username=hsay
default.datasource.password=Z3J7xBbgouMD
#redis
spring.redis.host=tstore-coolcollege.redis.rds.aliyuncs.com
@@ -38,4 +38,6 @@ rocketmq.accessKey=LTAI5t5ouXZuFgxJMbQea3b2
rocketmq.secretKey=yuomDstRjSdihtN5zo8viDbWu8Z0ig
rocketmq.nameSrvAdder=http://MQ_INST_1947409023213164_BX3sLZnA.cn-hangzhou.mq-internal.aliyuncs.com:8080
rocketmq.topic=simple_message
rocketmq.orderTopic=order_message
rocketmq.orderTopic=order_message
default.database.name=coolcollege_intelligent_hy

10
pom.xml
View File

@@ -161,6 +161,16 @@
<artifactId>tea-openapi</artifactId>
<version>0.0.19</version>
</dependency>
<dependency>
<groupId>com.aliyun.oss</groupId>
<artifactId>aliyun-sdk-oss</artifactId>
<version>3.13.0</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-redis</artifactId>
<version>3.0.4</version>
</dependency>
</dependencies>
</dependencyManagement>