Commit 496a0a77 by zhiwj

批量转移

parent 45ef1d63
......@@ -339,4 +339,15 @@ public interface StoreApiService {
* @return
*/
void refreshCache(Integer enterpriseId, Integer storeId);
/**
* @Title: tranOverFlow
* @Description: 批量转移至门店列表
* @author zhiwj
* @param enterpriseId
* @param storeIds
* @return com.gic.api.base.commons.ServiceResponse<java.lang.Void>
* @throws
*/
ServiceResponse<Void> tranOverFlow(Integer enterpriseId, String storeIds);
}
......@@ -54,6 +54,8 @@ public interface StoreService {
*/
Integer countByStoreCode(Integer enterpriseId, String storeCode, Integer storeId);
Integer countByOverflowStatus(Integer enterpriseId, Integer overflowStatus);
Page<StoreDTO> listStore(StoreSearchDBDTO storeDTO, Integer pageNum, Integer pageSize);
/**
......
......@@ -110,6 +110,8 @@ public class StoreServiceImpl implements StoreService {
tabStoreInfo.setStoreType(copy.getStoreType());
tabStoreInfo.setCompleteStatus(copy.getCompleteStatus());
tabStoreInfo.setIndexId(copy.getIndexId());
tabStoreInfo.setOverflowStatus(copy.getOverflowStatus());
TabStore store = new TabStore();
store.setEnterpriseId(copy.getEnterpriseId());
store.setOwnType(StoreOwnTypeEnum.OWNER.getCode());
......@@ -167,6 +169,14 @@ public class StoreServiceImpl implements StoreService {
}
@Override
public Integer countByOverflowStatus(Integer enterpriseId, Integer overflowStatus) {
StoreDTO store = new StoreDTO();
store.setEnterpriseId(enterpriseId);
store.setOverflowStatus(overflowStatus);
return tabStoreInfoMapper.countBySelective(store);
}
@Override
public Page<StoreDTO> listStore(StoreSearchDBDTO storeDTO, Integer pageNum, Integer pageSize) {
PageHelper.startPage(pageNum, pageSize);
return tabStoreInfoMapper.listStore(storeDTO);
......
......@@ -234,6 +234,30 @@ public class StoreApiServiceImpl implements StoreApiService {
RedisUtil.delCache(key);
}
@Override
public ServiceResponse<Void> tranOverFlow(Integer enterpriseId, String storeIds) {
ServiceResponse<List<EnterpriseLicenseDTO>> listEnterpriseLicense = this.enterpriseApiService.listEnterpriseLicense(enterpriseId);
if (listEnterpriseLicense.isSuccess() && CollectionUtils.isNotEmpty(listEnterpriseLicense.getResult())) {
if (listEnterpriseLicense.getResult().size() == 4) {
Integer currCount = this.storeService.countByOverflowStatus(enterpriseId, 1);
Integer upperLimit = listEnterpriseLicense.getResult().get(3).getUpperLimit();
if (currCount + storeIds.split(",").length > upperLimit) {
return EnterpriseServiceResponse.failure(ErrorCode.UNKNOWN_ERROR.getCode(), String.format("本商户剩余门店数量为%s家, 请重新勾选正确的数量!", upperLimit));
}
String[] storeIdArr = storeIds.split(",");
for (String storeIdStr : storeIdArr) {
Integer storeId = Integer.valueOf(storeIdStr);
StoreDTO store = this.getStoreById(enterpriseId, storeId).getResult();
if (store != null) {
store.setOverflowStatus(1);
saveOrUpdate(store);
}
}
}
}
return EnterpriseServiceResponse.failure(ErrorCode.UNKNOWN_ERROR.getCode(), "商户没有门店license");
}
/**
* 修改日志
*/
......
......@@ -320,6 +320,9 @@
<if test="storeDTO.storeCode != null and storeDTO.storeCode != '' ">
and t1.store_code = #{storeDTO.storeCode}
</if>
<if test="storeDTO.overflowStatus != null ">
and t1.overflow_status = #{storeDTO.overflowStatus}
</if>
<if test="storeDTO.storeName != null and storeDTO.storeName != '' ">
and t1.store_name = #{storeDTO.storeName}
</if>
......
......@@ -11,9 +11,11 @@ import com.gic.download.qo.QrcodeContent;
import com.gic.download.utils.*;
import com.gic.download.utils.log.LogUtils;
import com.gic.enterprise.context.RequestContext;
import com.gic.enterprise.dto.EnterpriseLicenseDTO;
import com.gic.enterprise.error.ErrorCode;
import com.gic.enterprise.response.EnterpriseRestResponse;
import com.gic.enterprise.service.DownloadReportApiService;
import com.gic.enterprise.service.EnterpriseApiService;
import com.gic.enterprise.service.QrCodeApiService;
import com.gic.enterprise.utils.ResultControllerUtils;
import com.gic.enterprise.utils.UserDetailUtils;
......@@ -89,6 +91,8 @@ public class StoreController extends DownloadUtils {
private StoreWidgetApiService storeWidgetApiService;
@Autowired
private StoreUpdateApiService storeUpdateApiService;
@Autowired
private EnterpriseApiService enterpriseApiService;
private Map<Integer, SimpleDateFormat> map = new ConcurrentHashMap<>();
private Map<Integer, SimpleDateFormat> map1 = new ConcurrentHashMap<>();
......@@ -272,6 +276,23 @@ public class StoreController extends DownloadUtils {
return EnterpriseRestResponse.failure(response);
}
@RequestMapping("store-license-limit")
public RestResponse storeLicenseLimit() {
ServiceResponse<List<EnterpriseLicenseDTO>> listEnterpriseLicense = this.enterpriseApiService.listEnterpriseLicense(UserDetailUtils.getUserDetail().getEnterpriseId());
if (listEnterpriseLicense.isSuccess() && CollectionUtils.isNotEmpty(listEnterpriseLicense.getResult())) {
if (listEnterpriseLicense.getResult().size() == 4) {
return RestResponse.success(listEnterpriseLicense.getResult().get(3).getUpperLimit());
}
}
return RestResponse.success();
}
@RequestMapping("/tran-overflow")
public RestResponse tranOverFlow(String storeIds) {
ServiceResponse<Void> serviceResponse = this.storeApiService.tranOverFlow(UserDetailUtils.getUserDetail().getEnterpriseId(), storeIds);
return ResultControllerUtils.commonResult(serviceResponse);
}
// @RequestMapping("list-store-log")
// public RestResponse listStoreLog(Integer storeId, PageQO pageQO) {
// Page page = new Page(pageQO.getCurrentPage(), pageQO.getPageSize());
......
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