Commit 3d54513b by zhiwj

修改task

parent a26a6220
......@@ -5,7 +5,7 @@ package com.gic.store.constant;
* @date 2019/7/4
*/
public interface Constants {
String STORE_BATCH_IMPORT_MQ_KEY = "tmpStoreBatchImportTaskMq4";
String STORE_BATCH_IMPORT_MQ_KEY = "storeBulkImport";
// String STORE_BATCH_IMPORT_MQ_KEY = "tmpStoreBatchImportTaskMq4.0";
Integer STORE_BATCH_IMPORT_TASK_TYPE = 6;
}
......@@ -23,7 +23,7 @@ public interface StoreBrandApiService {
* @param ids
* @return 不能被删除的品牌(在使用中的品牌)
*/
ServiceResponse<List<Integer>> deleteByIds(Integer enterpriseId, String ids);
ServiceResponse deleteByIds(Integer enterpriseId, String ids);
/**
* 移动顺序
......
......@@ -7,7 +7,7 @@ import com.task.allocation.exception.TaskAllocationException;
* @author zhiwj
* @date 2019/7/4
*/
public interface StoreTaskService extends TaskAllocationOperation {
public interface StoreTaskApiService extends TaskAllocationOperation {
String importDataToStore(Integer enterpriseId, String userId, String uuId) throws TaskAllocationException;
......
......@@ -36,4 +36,6 @@ public interface StoreBrandService {
Integer deleteByIds(Integer enterpriseId, List<Integer> delList);
List<TabStoreBrand> listStoreBrandByIds(String brandIds);
List<TabStoreBrand> listStoreBrandByIds(List<Integer> brandIdList);
}
......@@ -166,4 +166,12 @@ public class StoreBrandServiceImpl implements StoreBrandService {
}
return null;
}
@Override
public List<TabStoreBrand> listStoreBrandByIds(List<Integer> brandIdList) {
if (CollectionUtils.isNotEmpty(brandIdList)) {
return tabStoreBrandMapper.listStoreBrandByIds(brandIdList);
}
return null;
}
}
......@@ -86,7 +86,7 @@ public class StoreBrandApiServiceImpl implements StoreBrandApiService {
}
@Override
public ServiceResponse<List<Integer>> deleteByIds(Integer enterpriseId, String ids) {
public ServiceResponse deleteByIds(Integer enterpriseId, String ids) {
List<Integer> notDelList = new ArrayList<>();
if (StringUtils.isNotBlank(ids)) {
String[] idArr = ids.split(GlobalInfo.FLAG_COMMA);
......@@ -100,11 +100,16 @@ public class StoreBrandApiServiceImpl implements StoreBrandApiService {
return count == 0;
})
.collect(Collectors.toList());
if (CollectionUtils.isNotEmpty(delList)) {
//
if (CollectionUtils.isEmpty(notDelList)) {
storeBrandService.deleteByIds(enterpriseId, delList);
}
List<TabStoreBrand> storeBrandList = storeBrandService.listStoreBrandByIds(notDelList);
EntityUtil.changeEntityListByOrika(StoreBrandDTO.class, storeBrandList);
return ServiceResponse.failure(ErrorCode.ERR_9999.getCode(), "部分数据在使用中", EntityUtil.changeEntityListByOrika(StoreBrandDTO.class, storeBrandList));
} else {
return ServiceResponse.success();
}
return ServiceResponse.success(notDelList);
}
@Override
......
......@@ -51,7 +51,7 @@ public class StoreImportApiServiceImpl implements StoreImportApiService {
private StoreGroupService storeGroupService;
@Autowired
private StoreTaskService storeTaskService;
private StoreTaskApiService storeTaskService;
@Autowired
private StoreExtendService storeExtendService;
......
package com.gic.store.service.impl;
package com.gic.store.service.outer;
import com.alibaba.fastjson.JSON;
import com.gic.api.base.commons.ServiceResponse;
......@@ -31,7 +31,7 @@ import java.util.Optional;
* @date 2019/7/4
*/
@Service
public class StoreTaskServiceImpl extends AbstractTaskAllocationOperation implements StoreTaskService {
public class StoreTaskServiceImpl extends AbstractTaskAllocationOperation implements StoreTaskApiService {
private static final Logger logger = LogManager.getLogger(StoreTaskServiceImpl.class);
......
......@@ -75,11 +75,11 @@ public class StoreBrandController {
@RequestMapping("/delete-store-brand-batch")
public RestResponse deleteByIds(String ids) {
Integer enterpriseId = 1111;
ServiceResponse<List<Integer>> serviceResponse = storeBrandApiService.deleteByIds(enterpriseId, ids);
ServiceResponse serviceResponse = storeBrandApiService.deleteByIds(enterpriseId, ids);
if (serviceResponse.isSuccess()) {
return RestResponse.success(serviceResponse.getResult());
} else {
return RestResponse.failure(serviceResponse.getCode(), serviceResponse.getMessage());
return RestResponse.failure(serviceResponse.getCode(), serviceResponse.getMessage(), serviceResponse.getResult());
}
}
......
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