Commit 7504c1f0 by 陶光胜

门店品牌变更

parent 2b1d1d5f
......@@ -106,4 +106,16 @@ public interface TabStoreBrandRefMapper {
Integer updateSort(@Param("enterpriseId") Integer enterpriseId, @Param("storeBrandId") Integer storeBrandId, @Param("sort") Double sort);
Integer insertList(@Param("list") List<TabStoreBrandRef> list);
/**
* cancelBrandAuth
* @Title: cancelBrandAuth
* @Description:
* @author taogs
* @param ownEnterpriseId
* @param unionEnterpriseId
* @return int
* @throws
*/
int cancelBrandAuth(@Param("ownEnterpriseId") Integer ownEnterpriseId, @Param("unionEnterpriseId") Integer unionEnterpriseId);
}
\ No newline at end of file
......@@ -131,4 +131,16 @@ public interface TabStoreRegionRelMapper {
* @throws
*/
void deleteRegionRel(@Param("enterpriseId") Integer enterpriseId, @Param("regionId") Integer regionId);
/**
* cancelRegionAuth
* @Title: cancelRegionAuth
* @Description:
* @author taogs
* @param ownEnterpriseId
* @param unionEnterpriseId
* @return int
* @throws
*/
int cancelRegionAuth(@Param("ownEnterpriseId") Integer ownEnterpriseId, @Param("unionEnterpriseId") Integer unionEnterpriseId);
}
\ No newline at end of file
......@@ -11,6 +11,12 @@ public class TabStoreBrandRef {
*/
private Integer id;
/**
*
*/
private Integer fromEnterpriseId;
/**
*
*/
......@@ -109,4 +115,12 @@ public class TabStoreBrandRef {
public void setSort(Double sort) {
this.sort = sort;
}
public Integer getFromEnterpriseId() {
return fromEnterpriseId;
}
public void setFromEnterpriseId(Integer fromEnterpriseId) {
this.fromEnterpriseId = fromEnterpriseId;
}
}
\ No newline at end of file
......@@ -29,11 +29,12 @@ public interface StoreBrandService {
* @author taogs
* @param enterpriseId
* @param storeBrandId
* @param ownEnterpriseId
* @param type
* @return void
* @throws
*/
void saveStoreBrandRef(Integer enterpriseId, Integer storeBrandId, Integer type);
void saveStoreBrandRef(Integer enterpriseId, Integer storeBrandId, Integer type, Integer ownEnterpriseId);
/**
* saveStoreBrandRef
......@@ -42,11 +43,12 @@ public interface StoreBrandService {
* @author taogs
* @param enterpriseId
* @param storeBrandIdList
* @param ownEnterpriseId
* @param type
* @return void
* @throws
*/
void saveStoreBrandRef(Integer enterpriseId, List<Integer> storeBrandIdList, Integer type);
void saveStoreBrandRef(Integer enterpriseId, List<Integer> storeBrandIdList, Integer type, Integer ownEnterpriseId);
/**
* update
......@@ -247,4 +249,16 @@ public interface StoreBrandService {
* @throws
*/
int updateRelByOperation(Integer storeBrandId, Integer hasRel);
/**
* cancelBrandAuth
* @Title: cancelBrandAuth
* @Description: 门店品牌取消授权
* @author taogs
* @param ownEnterpriseId
* @param unionEnterpriseId
* @return int
* @throws
*/
int cancelBrandAuth(Integer ownEnterpriseId, Integer unionEnterpriseId);
}
......@@ -98,4 +98,16 @@ public interface StoreRegionRelService {
* @throws
*/
void updateStatusByOther(Integer enterpriseId, Integer regionId, int status);
/***
* cancelRegionAuth
* @Title: cancelRegionAuth
* @Description: 取消门店域授权
* @author taogs
* @param ownEnterpriseId
* @param unionEnterpriseId
* @return int
* @throws
*/
int cancelRegionAuth(Integer ownEnterpriseId, Integer unionEnterpriseId);
}
......@@ -49,6 +49,7 @@ public class StoreBrandServiceImpl implements StoreBrandService {
Double sort = tabStoreBrandRefMapper.getMinSort(copy.getEnterpriseId());
tabStoreBrandRef.setSort(sort == null ? 1d : sort - 1d);
tabStoreBrandRef.setEnterpriseId(copy.getEnterpriseId());
tabStoreBrandRef.setFromEnterpriseId(copy.getEnterpriseId());
tabStoreBrandRef.setStoreBrandId(storeBrand.getStoreBrandId());
tabStoreBrandRef.setDeleteFlag(0);
tabStoreBrandRef.setCreateTime(date);
......@@ -59,7 +60,7 @@ public class StoreBrandServiceImpl implements StoreBrandService {
}
@Override
public void saveStoreBrandRef(Integer enterpriseId, Integer storeBrandId, Integer type){
public void saveStoreBrandRef(Integer enterpriseId, Integer storeBrandId, Integer type, Integer ownEnterpriseId){
TabStoreBrandRef existTab = tabStoreBrandRefMapper.selectByEidAndBrandId(enterpriseId, storeBrandId);
if(existTab != null){
return;
......@@ -69,6 +70,7 @@ public class StoreBrandServiceImpl implements StoreBrandService {
Double sort = tabStoreBrandRefMapper.getMinSort(enterpriseId);
tabStoreBrandRef.setSort(sort == null ? 1d : sort - 1d);
tabStoreBrandRef.setEnterpriseId(enterpriseId);
tabStoreBrandRef.setFromEnterpriseId(ownEnterpriseId);
tabStoreBrandRef.setStoreBrandId(storeBrandId);
tabStoreBrandRef.setDeleteFlag(0);
tabStoreBrandRef.setCreateTime(date);
......@@ -78,7 +80,7 @@ public class StoreBrandServiceImpl implements StoreBrandService {
}
@Override
public void saveStoreBrandRef(Integer enterpriseId, List<Integer> storeBrandIdList, Integer type) {
public void saveStoreBrandRef(Integer enterpriseId, List<Integer> storeBrandIdList, Integer type, Integer ownEnterpriseId) {
if(CollectionUtils.isNotEmpty(storeBrandIdList)){
List<TabStoreBrandRef> list = new ArrayList<>();
Double sort = tabStoreBrandRefMapper.getMinSort(enterpriseId);
......@@ -93,6 +95,7 @@ public class StoreBrandServiceImpl implements StoreBrandService {
TabStoreBrandRef tabStoreBrandRef = new TabStoreBrandRef();
tabStoreBrandRef.setSort(sort);
tabStoreBrandRef.setEnterpriseId(enterpriseId);
tabStoreBrandRef.setFromEnterpriseId(ownEnterpriseId);
tabStoreBrandRef.setStoreBrandId(storeBrandId);
tabStoreBrandRef.setDeleteFlag(0);
tabStoreBrandRef.setCreateTime(date);
......@@ -258,4 +261,9 @@ public class StoreBrandServiceImpl implements StoreBrandService {
tabStoreBrand.setHasRel(hasRel);
return tabStoreBrandMapper.updateByPrimaryKeySelective(tabStoreBrand);
}
@Override
public int cancelBrandAuth(Integer ownEnterpriseId, Integer unionEnterpriseId) {
return tabStoreBrandRefMapper.cancelBrandAuth(ownEnterpriseId, unionEnterpriseId);
}
}
......@@ -79,4 +79,9 @@ public class StoreRegionRelServiceImpl implements StoreRegionRelService {
public void updateStatusByOther(Integer enterpriseId, Integer regionId, int status) {
tabStoreRegionRelMapper.updateStatusByOther(enterpriseId, regionId, status);
}
@Override
public int cancelRegionAuth(Integer ownEnterpriseId, Integer unionEnterpriseId) {
return tabStoreRegionRelMapper.cancelRegionAuth(ownEnterpriseId, unionEnterpriseId);
}
}
......@@ -63,6 +63,8 @@ public class StoreAuthorizationApiServiceImpl implements StoreAuthorizationApiSe
private AuthStoreLogService authStoreLogService;
@Autowired
private StoreBrandService storeBrandService;
@Autowired
private StoreRegionRelService storeRegionRelService;
@Override
public ServiceResponse<Void> authStore(Integer storeResourceId, Integer unionEnterpriseId, Integer ownEnterpriseId) {
......@@ -173,7 +175,15 @@ public class StoreAuthorizationApiServiceImpl implements StoreAuthorizationApiSe
@Override
public ServiceResponse<Void> cancelStoreAll(Integer unionEnterpriseId, Integer ownEnterpriseId) {
this.storeService.cancelAuthStoreAll(ownEnterpriseId, unionEnterpriseId);
/**门店授权取消**/
int storeCancelCount = this.storeService.cancelAuthStoreAll(ownEnterpriseId, unionEnterpriseId);
log.info("门店取消授权数量:{}", storeCancelCount);
/**门店域取消**/
int count = this.storeRegionRelService.cancelRegionAuth(ownEnterpriseId, unionEnterpriseId);
log.info("门店域取消授权数量:{}", count);
/***门店品牌取消授权**/
int i = this.storeBrandService.cancelBrandAuth(ownEnterpriseId, unionEnterpriseId);
log.info("门店品牌取消授权数量:{}", i);
this.unionEnterpriseAuthResDetailApiService.relieveForStore(UnionEnterpriseAuthDetailStatusEnum.HAS_RELIEVE.getCode(), ownEnterpriseId, unionEnterpriseId);
return ServiceResponse.success();
}
......@@ -245,7 +255,7 @@ public class StoreAuthorizationApiServiceImpl implements StoreAuthorizationApiSe
Set<Integer> storeInfoIdSet, Set<Integer> storeBrandIdSet, Integer enterpriseId, Integer toEnterpriseId, Integer authType){
this.storeRegionApiService.authorizeRegionToOther(enterpriseId, toEnterpriseId, new ArrayList<>(regionSet), authType);
this.storeDictApiService.saveStoreStatusAndStoreType(enterpriseId, statusSet.toArray(new String[0]), storeTypeSet.toArray(new String[0]));
this.storeBrandService.saveStoreBrandRef(toEnterpriseId, new ArrayList<>(storeBrandIdSet), 2);
this.storeBrandService.saveStoreBrandRef(toEnterpriseId, new ArrayList<>(storeBrandIdSet), 2, enterpriseId);
if(CollectionUtils.isNotEmpty(storeInfoIdSet)){
this.storeService.cancelAuthStore(new ArrayList<>(storeInfoIdSet), toEnterpriseId);
}
......
......@@ -170,4 +170,9 @@
#{element.deleteFlag,jdbcType=INTEGER}, #{element.sort,jdbcType=DOUBLE})
</foreach>
</insert>
<update id="cancelBrandAuth">
update tab_store_brand_ref set delete_flag = 1
where enterprise_id=#{unionEnterpriseId} and from_enterpriseId = #{ownEnterpriseId} and delete_flag = 0
</update>
</mapper>
\ No newline at end of file
......@@ -182,4 +182,10 @@
where enterprise_id = #{enterpriseId}
and region_id = #{regionId}
</update>
<update id="cancelRegionAuth">
update tab_store_region_rel set delete_flag = 1
where enterprise_id = #{unionEnterpriseId} and from_enterprise_id = #{ownEnterpriseId}
and detele_flag = 0
</update>
</mapper>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment