Commit 9e20f8a4 by guojuxing

Merge remote-tracking branch 'origin/developer' into developer

parents 7167a564 79db24c8
......@@ -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);
}
}
......
......@@ -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
......@@ -611,9 +611,11 @@ public class EnterpriseController {
if (CollectionUtils.isNotEmpty(orderVOList)) {
for (OrderVO orderVO : orderVOList) {
EnterpriseDTO enterpriseDTO = enterpriseInfoMap.get(orderVO.getEnterpriseId().intValue());
orderVO.setCompanyName(enterpriseDTO.getCompanyName());
orderVO.setLogo(enterpriseDTO.getLogo());
orderVO.setApprover(approvalInfoMap.get(orderVO.getOrderNum()));
if(enterpriseDTO != null){
orderVO.setCompanyName(enterpriseDTO.getCompanyName());
orderVO.setLogo(enterpriseDTO.getLogo());
orderVO.setApprover(approvalInfoMap.get(orderVO.getOrderNum()));
}
}
}
resultPage.setResult(orderVOList);
......
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