Commit ffc1c9e3 by 陶光胜

Merge branch 'developer' of…

Merge branch 'developer' of http://115.159.76.241/base_platform_enterprise/gic-platform-enterprise into developer
parents 64bad82e 211bc290
......@@ -27,7 +27,7 @@ public class PlatformBrandDTO implements Serializable {
*/
private Integer createType;
private Integer enterprisebrandCount;
private Integer enterpriseBrandCount;
public Integer getPlatformBrandId() {
return platformBrandId;
......@@ -69,11 +69,11 @@ public class PlatformBrandDTO implements Serializable {
this.createType = createType;
}
public Integer getEnterprisebrandCount() {
return enterprisebrandCount;
public Integer getEnterpriseBrandCount() {
return enterpriseBrandCount;
}
public void setEnterprisebrandCount(Integer enterprisebrandCount) {
this.enterprisebrandCount = enterprisebrandCount;
public void setEnterpriseBrandCount(Integer enterpriseBrandCount) {
this.enterpriseBrandCount = enterpriseBrandCount;
}
}
......@@ -50,11 +50,11 @@ public interface PlatformBrandApiService {
/**
* 查询品牌list, 条件为:名称:platformBrandName 类目:platformBrandCategoryId 来源:createType
* @Title: listPlatformBrand
* @Description:
* @author zhiwj
* @Description:
* @author zhiwj
* @param platformBrandDTO
* @return com.gic.api.base.commons.ServiceResponse<com.gic.api.base.commons.Page<com.gic.enterprise.dto.PlatformBrandDTO>>
* @throws
* @throws
*/
ServiceResponse<Page<PlatformBrandDTO>> listPlatformBrand(PlatformBrandDTO platformBrandDTO, Integer pageNum, Integer pageSize);
......@@ -113,7 +113,7 @@ public interface PlatformBrandApiService {
* @return com.gic.api.base.commons.ServiceResponse<com.gic.api.base.commons.Page<com.gic.enterprise.dto.PlatformBrandRefDTO>>
* @throws
*/
ServiceResponse<Page<PlatformBrandRefDTO>> listByPlatformBrandRef(String brandName);
ServiceResponse<Page<PlatformBrandRefDTO>> listByPlatformBrandRef(String brandName, Integer pageNum, Integer pageSize);
/**
* 并入操作,将fromBrandId关联的商户品牌, 并入到toBrandId平台品牌下; 并删除fromBrandId平台品牌
......@@ -121,11 +121,11 @@ public interface PlatformBrandApiService {
* @Description:
* @author zhiwj
* @param fromBrandId
* @param toBrandId
* @param toBrandName
* @return com.gic.api.base.commons.ServiceResponse<java.lang.Integer>
* @throws
*/
ServiceResponse<Integer> mergeBrandRef(Integer fromBrandId, Integer toBrandId);
ServiceResponse<Integer> mergeBrandRef(Integer fromBrandId, String toBrandName);
}
......@@ -62,5 +62,7 @@ public interface TabPlatformBrandRefMapper {
Integer delRef(@Param("enterpriseId") Integer enterpriseId, @Param("enterpriseBrandId") Integer enterpriseBrandId);
Page<TabPlatformBrandRef> listByPlatformBrandRef(@Param("brandName") String brandName);
Page<TabPlatformBrandRef> listByPlatformBrandRef(TabPlatformBrandRef brandRef);
Integer updateRef(@Param("fromBrandId") Integer fromBrandId,@Param("toBrandId") Integer toBrandId);
}
\ No newline at end of file
......@@ -17,4 +17,6 @@ public interface PlatformBrandRefService {
Integer delRef(Integer enterpriseId, Integer enterpriseBrandId);
Page<TabPlatformBrandRef> listByPlatformBrandRef(String brandName);
Integer updateRef(Integer fromBrandId, Integer toBrandId);
}
......@@ -8,9 +8,11 @@ import com.gic.enterprise.service.PlatformBrandRefService;
import com.github.pagehelper.Page;
import org.apache.commons.collections.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.*;
@Service
public class PlatformBrandRefServiceImpl implements PlatformBrandRefService {
@Autowired
......@@ -57,6 +59,13 @@ public class PlatformBrandRefServiceImpl implements PlatformBrandRefService {
@Override
public Page<TabPlatformBrandRef> listByPlatformBrandRef(String brandName) {
return tabPlatformBrandRefMapper.listByPlatformBrandRef(brandName);
TabPlatformBrandRef brandRef = new TabPlatformBrandRef();
brandRef.setEnterpriseBrandName(brandName);
return tabPlatformBrandRefMapper.listByPlatformBrandRef(brandRef);
}
@Override
public Integer updateRef(Integer fromBrandId, Integer toBrandId) {
return tabPlatformBrandRefMapper.updateRef(fromBrandId, toBrandId);
}
}
......@@ -8,9 +8,11 @@ import com.gic.enterprise.service.PlatformBrandService;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Date;
@Service
public class PlatformBrandServiceImpl implements PlatformBrandService {
@Autowired
......
......@@ -13,6 +13,7 @@ import com.gic.enterprise.error.ErrorCode;
import com.gic.enterprise.service.PlatformBrandApiService;
import com.gic.enterprise.service.PlatformBrandRefService;
import com.gic.enterprise.service.PlatformBrandService;
import com.github.pagehelper.PageHelper;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -97,7 +98,7 @@ public class PlatformBrandApiServiceImpl implements PlatformBrandApiService {
List<Integer> platformBrandIdList = platformBrandDTOList.stream().map(PlatformBrandDTO::getPlatformBrandId).collect(Collectors.toList());
Map<Integer, Integer> map = platformBrandRefService.countByPlatformBrandIds(platformBrandIdList);
for (PlatformBrandDTO brandDTO : platformBrandDTOList) {
brandDTO.setEnterprisebrandCount(map.get(brandDTO.getPlatformBrandId()));
brandDTO.setEnterpriseBrandCount(map.get(brandDTO.getPlatformBrandId()));
}
}
return ServiceResponse.success(page);
......@@ -148,15 +149,27 @@ public class PlatformBrandApiServiceImpl implements PlatformBrandApiService {
}
@Override
public ServiceResponse<Page<PlatformBrandRefDTO>> listByPlatformBrandRef(String brandName) {
public ServiceResponse<Page<PlatformBrandRefDTO>> listByPlatformBrandRef(String brandName, Integer pageNum, Integer pageSize) {
PageHelper.startPage(pageNum, pageSize);
com.github.pagehelper.Page<TabPlatformBrandRef> brandRefPage = this.platformBrandRefService.listByPlatformBrandRef(brandName);
Page<PlatformBrandRefDTO> page = PageHelperUtils.changePageHelperToCurrentPage(brandRefPage, PlatformBrandRefDTO.class);
return ServiceResponse.success(page);
}
@Override
public ServiceResponse<Integer> mergeBrandRef(Integer fromBrandId, Integer toBrandId) {
return null;
public ServiceResponse<Integer> mergeBrandRef(Integer fromBrandId, String toBrandName) {
if (fromBrandId == null || StringUtils.isBlank(toBrandName)) {
return ServiceResponse.failure(ErrorCode.PARAMETER_ERROR.getCode(), ErrorCode.PARAMETER_ERROR.getMsg());
}
TabPlatformBrand platformBrand = this.platformBrandService.getByBrandName(toBrandName);
if (platformBrand == null) {
return ServiceResponse.failure(ErrorCode.NOTEXISTS.getCode(), "品牌名称不存在或已失效");
}
Integer line = this.platformBrandRefService.updateRef(fromBrandId, platformBrand.getPlatformBrandId());
if (line > 0) {
return this.delBrandById(fromBrandId);
} else {
return ServiceResponse.failure(ErrorCode.NOTEXISTS.getCode(), ErrorCode.NOTEXISTS.getMsg());
}
}
}
......@@ -146,7 +146,7 @@
select count(1) from tab_platform_brand_ref where platform_brand_id = #{platformBrandId} and status = 1
</select>
<select id="countByPlatformBrandIds" resultType="java.util.HashMap">
select platform_brand_id platformBrandId , count(1) brandCount from tab_platform_brand_ref where
select platform_brand_id platformBrandId , count(1) enterpriseBrandCount from tab_platform_brand_ref where
status = 1
<if test="null != ids">
and platform_brand_id in
......@@ -163,8 +163,14 @@
<include refid="Base_Column_List" />
from tab_platform_brand_ref
where status = 1
<if test="platformBrandId != null ">
and platform_brand_id = #{platformBrandId}
</if>
<if test="brandName != null and brandName != '' ">
and brand_name = #{brandName}
</if>
</select>
<select id="updateRef" resultType="java.lang.Integer">
update tab_platform_brand_ref set platform_brand_id = #{toBrandId} where status = 1 and platform_brand_id = #{fromBrandId}
</select>
</mapper>
......@@ -35,4 +35,6 @@
<dubbo:reference interface="com.gic.store.service.ProvincesApiService" id="provincesApiService" timeout="60000" />
<dubbo:reference interface="com.gic.store.service.StoreStatusSettingApiService" id="storeStatusSettingApiService" timeout="60000" />
<dubbo:reference interface="com.gic.log.api.service.LogApiService" id="logApiService" timeout="60000" />
</beans>
\ No newline at end of file
......@@ -5,6 +5,7 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
import com.gic.enterprise.constant.EnterpriseInitCodeEnum;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -74,6 +75,15 @@ public class EnterpriseController {
return RestResponse.success(resultMap);
}
@RequestMapping("/list-enterprise-init-config-code")
public RestResponse listEnterpriseInitConfigCode() {
Map<String, String> resultMap = new HashMap<>(16);
for (EnterpriseInitCodeEnum statusEnum : EnterpriseInitCodeEnum.values()) {
resultMap.put(statusEnum.getCode(), statusEnum.getMessage());
}
return RestResponse.success(resultMap);
}
@RequestMapping("/init-enterprise")
public RestResponse initEnterprise(Integer enterpriseId) {
return RestResponse
......@@ -125,6 +135,7 @@ public class EnterpriseController {
data.put("isInitConfig", t.getIsInitConfig());
data.put("level", t.getLevel());
data.put("configUrl", t.getConfigUrl());
data.put("configCode", t.getConfigCode());
List<Map<String, Object>> children = changeListToTree(t.getEnterpriseInitId(), list);
data.put("children", children);
result.add(data);
......
package com.gic.operation.web.controller;
import com.gic.api.base.commons.Page;
import com.gic.api.base.commons.ServiceResponse;
import com.gic.commons.util.EntityUtil;
import com.gic.commons.webapi.reponse.RestResponse;
import com.gic.enterprise.dto.PlatformBrandDTO;
import com.gic.enterprise.dto.PlatformBrandRefDTO;
import com.gic.enterprise.service.PlatformBrandApiService;
import com.gic.operation.web.qo.PageQO;
import com.gic.operation.web.qo.PlatformBrandQO;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
public class PlatformBrandController {
private static final Logger LOGGER = LoggerFactory.getLogger(PlatformBrandController.class);
@Autowired
private PlatformBrandApiService platformBrandApiService;
@RequestMapping("/brand-save")
public RestResponse saveBrand(@Validated({ PlatformBrandQO.SavePlatformBrandValid.class }) PlatformBrandQO platformBrandQO) {
PlatformBrandDTO platformBrandDTO = new PlatformBrandDTO();
platformBrandDTO.setPlatformBrandName(platformBrandQO.getPlatformBrandName());
platformBrandDTO.setPlatformBrandCategoryId(platformBrandQO.getPlatformBrandCategoryId());
ServiceResponse<Integer> serviceResponse = platformBrandApiService.saveOrUpdateBrandFromOperation(platformBrandDTO);
if (serviceResponse.isSuccess()) {
return RestResponse.success(serviceResponse.getResult());
} else {
return RestResponse.failure(serviceResponse.getCode(), serviceResponse.getMessage());
}
}
@RequestMapping("/brand-del")
public RestResponse delBrand(@Validated({ PlatformBrandQO.SavePlatformBrandValid.class }) PlatformBrandQO platformBrandQO) {
ServiceResponse<Integer> serviceResponse = platformBrandApiService.delBrandById(platformBrandQO.getPlatformBrandId());
if (serviceResponse.isSuccess()) {
return RestResponse.success(serviceResponse.getResult());
} else {
return RestResponse.failure(serviceResponse.getCode(), serviceResponse.getMessage());
}
}
@RequestMapping("/brand-list")
public RestResponse listBrand(PlatformBrandQO platformBrandQO, PageQO pageQO) {
ServiceResponse<Page<PlatformBrandDTO>> serviceResponse = platformBrandApiService.listPlatformBrand(EntityUtil.changeEntityByOrika(PlatformBrandDTO.class, platformBrandQO), pageQO.getCurrentPage(), pageQO.getPageSize());
if (serviceResponse.isSuccess()) {
return RestResponse.success(serviceResponse.getResult());
} else {
return RestResponse.failure(serviceResponse.getCode(), serviceResponse.getMessage());
}
}
@RequestMapping("/brand-ref-list")
public RestResponse listBrandRef(PlatformBrandQO platformBrandQO, PageQO pageQO) {
ServiceResponse<Page<PlatformBrandRefDTO>> serviceResponse = platformBrandApiService.listByPlatformBrandRef(platformBrandQO.getPlatformBrandName(), pageQO.getCurrentPage(), pageQO.getPageSize());
if (serviceResponse.isSuccess()) {
return RestResponse.success(serviceResponse.getResult());
} else {
return RestResponse.failure(serviceResponse.getCode(), serviceResponse.getMessage());
}
}
}
package com.gic.operation.web.controller;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
/**
* @author zhiwj
* @date 2019/6/27
*/
@RestController
public class StoreBrandController {
}
package com.gic.operation.web.qo;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
public class PlatformBrandQO implements Serializable {
private static final long serialVersionUID = 3361955210762134043L;
public interface SavePlatformBrandValid {}
public interface DelPlatformBrandValid {}
@NotNull(message = "请选择品牌", groups = DelPlatformBrandValid.class)
private Integer platformBrandId;
@NotNull(message = "品牌名不能为空", groups = {SavePlatformBrandValid.class})
private String platformBrandName;
@NotNull(message = "经营类目不能为空", groups = {SavePlatformBrandValid.class})
private Integer platformBrandCategoryId;
private Integer createType;
public Integer getPlatformBrandId() {
return platformBrandId;
}
public void setPlatformBrandId(Integer platformBrandId) {
this.platformBrandId = platformBrandId;
}
public String getPlatformBrandName() {
return platformBrandName;
}
public void setPlatformBrandName(String platformBrandName) {
this.platformBrandName = platformBrandName;
}
public Integer getPlatformBrandCategoryId() {
return platformBrandCategoryId;
}
public void setPlatformBrandCategoryId(Integer platformBrandCategoryId) {
this.platformBrandCategoryId = platformBrandCategoryId;
}
public Integer getCreateType() {
return createType;
}
public void setCreateType(Integer createType) {
this.createType = createType;
}
}
......@@ -43,4 +43,5 @@
<dubbo:reference interface="com.gic.enterprise.service.EnterpriseInitApiService" id="enterpriseInitApiService" timeout="60000" />
<!--转账审批-->
<dubbo:reference interface="com.gic.enterprise.service.TransferAccountsApprovalApiService" id="transferAccountsApprovalApiService" timeout="60000" />
<dubbo:reference interface="com.gic.enterprise.service.PlatformBrandApiService" id="platformBrandApiService" timeout="60000" />
</beans>
\ 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