Commit 23c21dd9 by zhiwj

Merge branch 'developer' into 'master'

Developer

See merge request !33
parents 02c0923a 76e87203
......@@ -32,7 +32,9 @@ public enum EnterpriseInitCodeEnum {
COMPLETE_DATA_COUNT_CONFIG("completeDataCountConfig", "完成数据统计配置", 6),
CONFIG_EFFECTIVE_ORDER("configEffectiveOrder", "完成有效订单的配置", 6),
CONFIG_PAY("configPay", "完成实付的配置", 6),
INTI_MEMBER_CARD_SMS("initMemberCardSmsTemplate", "初始化会员卡的短信模板", 7);
INTI_MEMBER_CARD_SMS("initMemberCardSmsTemplate", "初始化会员卡的短信模板", 7),
COMPLETE_MEMBER_INDEX("completeMemberIndex", "完成会员索引初始化", 8),
COMPLETE_GOODS_INDEX("completeGoodsIndex", "完成商品索引初始化", 9);
private String code;
private String message;
......
......@@ -19,6 +19,28 @@ public interface EnterpriseInitApiService {
* @return com.gic.api.base.commons.ServiceResponse<java.lang.Void>


 */
ServiceResponse<Void> addMemberCardInitConfig(Integer enterpriseId);
/**
* 完成会员索引初始化
* @Title: completeMemberIndex

* @Description:

* @author guojuxing
* @param enterpriseId

* @return com.gic.api.base.commons.ServiceResponse<java.lang.Void>


*/
ServiceResponse<Void> completeMemberIndex(Integer enterpriseId);
/**
* 完成商品索引初始化
* @Title: completeGoodsIndex

* @Description:

* @author guojuxing
* @param enterpriseId

* @return com.gic.api.base.commons.ServiceResponse<java.lang.Void>


*/
ServiceResponse<Void> completeGoodsIndex(Integer enterpriseId);
/**
* 新建会员等级初始化
* @Title: addMemberGradeInitConfig

......
......@@ -65,5 +65,9 @@ public interface TabAppletServiceConfigMapper {
TabAppletServiceConfig getAppByAppId(@Param("enterpriseId") Integer enterpriseId, @Param("appId") String appId);
TabAppletServiceConfig getByConfigId(@Param("enterpriseId") Integer enterpriseId, @Param("configId") Long configId);
void updateTime(@Param("appId") String appId, @Param("type") int type, @Param("updateTime") Date date);
void delByConfigIdList(@Param("ids") List<Long> configIdList, @Param("enterpriseId") Integer enterpriseId);
}
\ No newline at end of file
......@@ -16,8 +16,10 @@ import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Collections;
import java.util.Date;
import java.util.List;
import java.util.Optional;
import java.util.stream.Collectors;
/**
......@@ -48,45 +50,50 @@ public class AppletServiceConfigServiceImpl implements AppletServiceConfigServic
@Override
public void syncApplet(List<AppletsConfigSimpleOutputDTO> responseResult, Integer enterpriseId) {
if (CollectionUtils.isNotEmpty(responseResult)) {
List<TabAppletServiceConfig> configList = responseResult.stream()
.filter(e -> tabAppletServiceConfigMapper.getAppByAppId(enterpriseId, e.getAppId()) == null)
.map(e -> {
TabAppletServiceConfig appletServiceConfig = new TabAppletServiceConfig();
appletServiceConfig.setEnterpriseId(enterpriseId);
appletServiceConfig.setAppId(e.getAppId());
appletServiceConfig.setName(e.getAppletConfigName());
appletServiceConfig.setType(AppletServiceConfigEnum.APPLET.getCode());
appletServiceConfig.setConfigId(e.getAppletConfigId());
appletServiceConfig.setCreateTime(new Date());
appletServiceConfig.setUpdateTime(new Date());
return appletServiceConfig;
}).collect(Collectors.toList());
if (CollectionUtils.isNotEmpty(configList)) {
tabAppletServiceConfigMapper.insertList(configList);
}
// 先删除configId不在入参里的 如果入参是空的 就全部删除
List<Long> configIdList = Optional.ofNullable(responseResult).orElse(Collections.emptyList())
.stream().map(AppletsConfigSimpleOutputDTO::getAppletConfigId).collect(Collectors.toList());
tabAppletServiceConfigMapper.delByConfigIdList(configIdList, enterpriseId);
List<TabAppletServiceConfig> configList = Optional.ofNullable(responseResult).orElse(Collections.emptyList()).stream()
.filter(e -> tabAppletServiceConfigMapper.getByConfigId(enterpriseId, e.getAppletConfigId()) == null)
.map(e -> {
TabAppletServiceConfig appletServiceConfig = new TabAppletServiceConfig();
appletServiceConfig.setEnterpriseId(enterpriseId);
appletServiceConfig.setAppId(e.getAppId());
appletServiceConfig.setName(e.getAppletConfigName());
appletServiceConfig.setType(AppletServiceConfigEnum.APPLET.getCode());
appletServiceConfig.setConfigId(e.getAppletConfigId());
appletServiceConfig.setCreateTime(new Date());
appletServiceConfig.setUpdateTime(new Date());
return appletServiceConfig;
}).collect(Collectors.toList());
if (CollectionUtils.isNotEmpty(configList)) {
tabAppletServiceConfigMapper.insertList(configList);
}
}
@Override
public void syncServiceConfig(List<ServiceConfigSimpleOutputDTO> responseResult, Integer enterpriseId) {
if (CollectionUtils.isNotEmpty(responseResult)) {
List<TabAppletServiceConfig> configList = responseResult.stream()
.filter(e -> tabAppletServiceConfigMapper.getAppByAppId(enterpriseId, e.getAppId()) == null)
.map(e -> {
TabAppletServiceConfig appletServiceConfig = new TabAppletServiceConfig();
appletServiceConfig.setEnterpriseId(enterpriseId);
appletServiceConfig.setAppId(e.getAppId());
appletServiceConfig.setName(e.getServiceConfigName());
appletServiceConfig.setType(AppletServiceConfigEnum.SERVICE_CONFIG.getCode());
appletServiceConfig.setConfigId(e.getServiceConfigId());
appletServiceConfig.setCreateTime(new Date());
appletServiceConfig.setUpdateTime(new Date());
return appletServiceConfig;
}).collect(Collectors.toList());
if (CollectionUtils.isNotEmpty(configList)) {
tabAppletServiceConfigMapper.insertList(configList);
}
List<Long> configIdList = Optional.ofNullable(responseResult).orElse(Collections.emptyList())
.stream().map(ServiceConfigSimpleOutputDTO::getServiceConfigId).collect(Collectors.toList());
tabAppletServiceConfigMapper.delByConfigIdList(configIdList, enterpriseId);
List<TabAppletServiceConfig> configList = Optional.ofNullable(responseResult).orElse(Collections.emptyList()).stream()
.filter(e -> tabAppletServiceConfigMapper.getByConfigId(enterpriseId, e.getServiceConfigId()) == null)
.map(e -> {
TabAppletServiceConfig appletServiceConfig = new TabAppletServiceConfig();
appletServiceConfig.setEnterpriseId(enterpriseId);
appletServiceConfig.setAppId(e.getAppId());
appletServiceConfig.setName(e.getServiceConfigName());
appletServiceConfig.setType(AppletServiceConfigEnum.SERVICE_CONFIG.getCode());
appletServiceConfig.setConfigId(e.getServiceConfigId());
appletServiceConfig.setCreateTime(new Date());
appletServiceConfig.setUpdateTime(new Date());
return appletServiceConfig;
}).collect(Collectors.toList());
if (CollectionUtils.isNotEmpty(configList)) {
tabAppletServiceConfigMapper.insertList(configList);
}
}
......
......@@ -70,8 +70,8 @@ public class EnterpriseInitApiServiceImpl implements EnterpriseInitApiService{
.getListByParentCode(EnterpriseInitCodeEnum.COMPLETE_MEMBER_CARD_CONFIG.getCode());
if (memberCardConfigList.contains(configCode)) {
//会员组接口初始化
ServiceResponse<Void> memberInitResult = memberInitApiService.configInit(enterpriseId);
LOGGER.warn("新增商户-会员组接口初始化结果:{}", JSONObject.toJSONString(memberInitResult));
// ServiceResponse<Void> memberInitResult = memberInitApiService.configInit(enterpriseId);
// LOGGER.warn("新增商户-会员组接口初始化结果:{}", JSONObject.toJSONString(memberInitResult));
}
}
}
......@@ -84,6 +84,20 @@ public class EnterpriseInitApiServiceImpl implements EnterpriseInitApiService{
}
@Override
public ServiceResponse<Void> completeMemberIndex(Integer enterpriseId) {
ServiceResponse<Void> memberInitResult = memberInitApiService.configInit(enterpriseId);
if (memberInitResult.isSuccess()) {
return initByConfigCode(EnterpriseInitCodeEnum.COMPLETE_MEMBER_INDEX.getCode(), enterpriseId);
}
return ServiceResponse.failure(memberInitResult.getCode(), memberInitResult.getMessage());
}
@Override
public ServiceResponse<Void> completeGoodsIndex(Integer enterpriseId) {
return initByConfigCode(EnterpriseInitCodeEnum.COMPLETE_GOODS_INDEX.getCode(), enterpriseId);
}
@Override
public ServiceResponse<Void> addMemberGradeInitConfig(Integer enterpriseId) {
return initByConfigCode(EnterpriseInitCodeEnum.CREATE_MEMBER_GRADE.getCode(), enterpriseId);
}
......
......@@ -157,7 +157,6 @@
#{item.configId,jdbcType=BIGINT}
)
</foreach>
-- ON DUPLICATE KEY UPDATE name = VALUES(name)
</insert>
<select id="list" resultMap="BaseResultMap">
select
......@@ -186,6 +185,14 @@
and enterprise_id = #{enterpriseId}
and status = 1
</select>
<select id="getByConfigId" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from tab_applet_service_config
where config_id = #{configId}
and enterprise_id = #{enterpriseId}
and status = 1
</select>
<update id="delByAppIdList">
update tab_applet_service_config set status = 0
where enterprise_id = #{enterpriseId}
......@@ -202,4 +209,14 @@
<update id="updateTime">
update tab_applet_service_config set update_time = #{updateTime} where app_id = #{appId} and type = #{type}
</update>
<!-- delByConfigIdList-->
<update id="delByConfigIdList">
update tab_applet_service_config set status = 0 where enterprise_id = #{enterpriseId}
<if test="null != ids and ids.size > 0">
and config_id not in
<foreach collection="ids" index="index" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</if>
</update>
</mapper>
\ No newline at end of file
......@@ -8,6 +8,7 @@ import com.gic.authcenter.security.core.constant.DataResourceEnum;
import com.gic.authcenter.security.core.dto.AuthcenterUserDetails;
import com.gic.enterprise.constants.Constants;
import com.gic.enterprise.dto.*;
import com.gic.enterprise.utils.LicenseUtils;
import com.gic.marketing.api.service.sms.SmsOuterApiService;
import com.gic.member.config.api.dto.OwnerMemberCardDTO;
import com.gic.member.config.api.service.MemberCardApiService;
......@@ -203,17 +204,18 @@ public class EnterpriseController {
listResult.forEach(e -> {
List<ApplicationLicenseDTO> tempLicense = licenseMap.get(Long.valueOf(e.getEnterpriseId()));
if (CollectionUtils.isNotEmpty(tempLicense)) {
Set<String> licenseCodeSet = new HashSet<>(Arrays.asList("165165", "member_card", "wxapp", "wxfwh"));
Set<String> licenseCodeSet = new HashSet<>(Arrays.asList(LicenseUtils.STORE_LICENSE_CODE,
LicenseUtils.MEMBER_CARD_LICENSE_CODE, LicenseUtils.WECHAT_LICENSE_CODE, LicenseUtils.SERVICE_CARD_LICENSE_CODE));
Map<String, Integer> showLicenseMap = new HashMap<>(8);
tempLicense.forEach(license -> {
if (licenseCodeSet.contains(license.getLicenseCode())) {
showLicenseMap.put(license.getLicenseCode(), license.getQuantity());
}
});
Integer memberCardNum = showLicenseMap.get("member_card") == null ? 0 : showLicenseMap.get("member_card");
Integer wxfwhNum = showLicenseMap.get("wxfwh") == null ? 0 : showLicenseMap.get("wxfwh");
Integer wxappNum = showLicenseMap.get("wxapp") == null ? 0 : showLicenseMap.get("wxapp");
Integer storeNum = showLicenseMap.get("165165") == null ? 0 : showLicenseMap.get("165165");
Integer memberCardNum = showLicenseMap.get(LicenseUtils.MEMBER_CARD_LICENSE_CODE) == null ? 0 : showLicenseMap.get(LicenseUtils.MEMBER_CARD_LICENSE_CODE);
Integer wxfwhNum = showLicenseMap.get(LicenseUtils.SERVICE_CARD_LICENSE_CODE) == null ? 0 : showLicenseMap.get(LicenseUtils.SERVICE_CARD_LICENSE_CODE);
Integer wxappNum = showLicenseMap.get(LicenseUtils.WECHAT_LICENSE_CODE) == null ? 0 : showLicenseMap.get(LicenseUtils.WECHAT_LICENSE_CODE);
Integer storeNum = showLicenseMap.get(LicenseUtils.STORE_LICENSE_CODE) == null ? 0 : showLicenseMap.get(LicenseUtils.STORE_LICENSE_CODE);
e.setServiceInfo(memberCardNum + "-" + wxfwhNum + "-" + wxappNum + "-" + storeNum);
}
});
......@@ -652,6 +654,16 @@ public class EnterpriseController {
.collect(Collectors.toList())));
}
@RequestMapping("/init-member-index")
public RestResponse completeMemberIndex(Integer enterpriseId) {
return ResultControllerUtils.commonResult(enterpriseInitApiService.completeMemberIndex(enterpriseId));
}
@RequestMapping("/init-goods-index")
public RestResponse completeGoodsIndex(Integer enterpriseId) {
return ResultControllerUtils.commonResult(enterpriseInitApiService.completeGoodsIndex(enterpriseId));
}
@RequestMapping("/list-coupon")
public RestResponse listCoupon(BigDecimal price, Long isvId, Long enterpriseId, Long serveId, Long skuId) {
return ResultControllerUtils.commonResult(
......
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