|
|
@ -1,10 +1,16 @@ |
|
|
|
package com.epmet.service.impl; |
|
|
|
|
|
|
|
import com.epmet.dao.ThirdplatformCustomerActionDao; |
|
|
|
import com.epmet.dao.ThirdplatformCustomerRegisterDao; |
|
|
|
import com.epmet.dao.ThirdplatformDao; |
|
|
|
import com.epmet.dto.form.ThirdPlatformFormDTO; |
|
|
|
import com.epmet.dto.result.ThirdplatformResultDTO; |
|
|
|
import com.epmet.entity.ThirdplatformCustomerActionEntity; |
|
|
|
import com.epmet.entity.ThirdplatformCustomerRegisterEntity; |
|
|
|
import com.epmet.service.ThirdPlatformService; |
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
import org.springframework.transaction.annotation.Transactional; |
|
|
|
|
|
|
|
import java.util.List; |
|
|
|
|
|
|
@ -14,6 +20,12 @@ public class ThirdPlatformServiceImpl implements ThirdPlatformService { |
|
|
|
@Autowired |
|
|
|
private ThirdplatformDao thirdplatformDao; |
|
|
|
|
|
|
|
@Autowired |
|
|
|
private ThirdplatformCustomerActionDao thirdplatformCustomerActionDao; |
|
|
|
|
|
|
|
@Autowired |
|
|
|
private ThirdplatformCustomerRegisterDao thirdplatformCustomerRegisterDao; |
|
|
|
|
|
|
|
@Override |
|
|
|
public List<ThirdplatformResultDTO> listAvailablePlatformsByCustomerAndAction(String customerId, String actionKey) { |
|
|
|
return thirdplatformDao.listAvailablePlatformsByCustomerAndAction(customerId, actionKey); |
|
|
@ -23,4 +35,29 @@ public class ThirdPlatformServiceImpl implements ThirdPlatformService { |
|
|
|
public List<ThirdplatformResultDTO> listSelectableByCustomerAndActionGroup(String customerId, String actionKey) { |
|
|
|
return thirdplatformDao.listSelectableByCustomerAndActionGroup(customerId, actionKey); |
|
|
|
} |
|
|
|
|
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
|
@Override |
|
|
|
public void saveSelectedPlatforms(List<ThirdPlatformFormDTO> platforms) { |
|
|
|
platforms.forEach(p -> { |
|
|
|
ThirdplatformCustomerActionEntity thirdplatformCustomerActionEntity = thirdplatformCustomerActionDao.selectOneEntity(p.getCustomerId(), p.getPlatformId(), p.getActionKey()); |
|
|
|
if (thirdplatformCustomerActionEntity == null) { |
|
|
|
ThirdplatformCustomerActionEntity insert = new ThirdplatformCustomerActionEntity(); |
|
|
|
insert.setActionKey(p.getActionKey()); |
|
|
|
insert.setCustomerId(p.getCustomerId()); |
|
|
|
insert.setPlatformId(p.getPlatformId()); |
|
|
|
thirdplatformCustomerActionDao.insert(insert); |
|
|
|
} |
|
|
|
}); |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public void updateCustomizePlatformInfo(ThirdPlatformFormDTO input) { |
|
|
|
ThirdplatformCustomerRegisterEntity exist = thirdplatformCustomerRegisterDao.getByCustomerIdAndPlatformId(input.getCustomerId(), input.getPlatformId()); |
|
|
|
if (exist != null) { |
|
|
|
exist.setCustomizedPlatformName(input.getPlatformName()); |
|
|
|
exist.setCustomizedPlatformIcon(input.getIcon()); |
|
|
|
thirdplatformCustomerRegisterDao.updateById(exist); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|