|
@ -21,19 +21,26 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|
|
import com.baomidou.mybatisplus.core.metadata.IPage; |
|
|
import com.baomidou.mybatisplus.core.metadata.IPage; |
|
|
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; |
|
|
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; |
|
|
import com.epmet.commons.tools.constant.FieldConstant; |
|
|
import com.epmet.commons.tools.constant.FieldConstant; |
|
|
|
|
|
import com.epmet.commons.tools.constant.NumConstant; |
|
|
import com.epmet.commons.tools.exception.EpmetErrorCode; |
|
|
import com.epmet.commons.tools.exception.EpmetErrorCode; |
|
|
import com.epmet.commons.tools.exception.RenException; |
|
|
import com.epmet.commons.tools.exception.RenException; |
|
|
import com.epmet.commons.tools.page.PageData; |
|
|
import com.epmet.commons.tools.page.PageData; |
|
|
|
|
|
import com.epmet.commons.tools.security.dto.TokenDto; |
|
|
import com.epmet.commons.tools.utils.ConvertUtils; |
|
|
import com.epmet.commons.tools.utils.ConvertUtils; |
|
|
import com.epmet.commons.tools.utils.Result; |
|
|
import com.epmet.commons.tools.utils.Result; |
|
|
import com.epmet.dao.CustomerFunctionDetailDao; |
|
|
import com.epmet.dao.CustomerFunctionDetailDao; |
|
|
|
|
|
import com.epmet.dao.FunctionCustomizedDao; |
|
|
|
|
|
import com.epmet.dao.FunctionShoppingHistoryDao; |
|
|
import com.epmet.dto.CustomerFunctionDetailDTO; |
|
|
import com.epmet.dto.CustomerFunctionDetailDTO; |
|
|
|
|
|
import com.epmet.dto.FunctionCustomizedDTO; |
|
|
import com.epmet.dto.FunctionShoppingHistoryDTO; |
|
|
import com.epmet.dto.FunctionShoppingHistoryDTO; |
|
|
import com.epmet.dto.form.FunctionDetailFromDTO; |
|
|
import com.epmet.dto.form.*; |
|
|
import com.epmet.dto.form.UpdateCustomerFunctionFormDTO; |
|
|
import com.epmet.dto.result.CustomerFunctionCustomizedListResultDTO; |
|
|
import com.epmet.dto.form.UpdateShoppingStatusFormDTO; |
|
|
import com.epmet.dto.result.CustomerResultDTO; |
|
|
import com.epmet.dto.result.FunctionDetailResultDTO; |
|
|
import com.epmet.dto.result.FunctionDetailResultDTO; |
|
|
|
|
|
import com.epmet.dto.result.FunctionResultDTO; |
|
|
import com.epmet.entity.CustomerFunctionDetailEntity; |
|
|
import com.epmet.entity.CustomerFunctionDetailEntity; |
|
|
|
|
|
import com.epmet.entity.FunctionShoppingHistoryEntity; |
|
|
import com.epmet.redis.CustomerFunctionDetailRedis; |
|
|
import com.epmet.redis.CustomerFunctionDetailRedis; |
|
|
import com.epmet.service.CustomerFunctionDetailService; |
|
|
import com.epmet.service.CustomerFunctionDetailService; |
|
|
import com.epmet.service.FunctionShoppingHistoryService; |
|
|
import com.epmet.service.FunctionShoppingHistoryService; |
|
@ -44,10 +51,8 @@ import org.springframework.beans.factory.annotation.Autowired; |
|
|
import org.springframework.stereotype.Service; |
|
|
import org.springframework.stereotype.Service; |
|
|
import org.springframework.transaction.annotation.Transactional; |
|
|
import org.springframework.transaction.annotation.Transactional; |
|
|
|
|
|
|
|
|
import java.util.ArrayList; |
|
|
import java.util.*; |
|
|
import java.util.Arrays; |
|
|
import java.util.stream.Collectors; |
|
|
import java.util.List; |
|
|
|
|
|
import java.util.Map; |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
* 客户定制功能详情表 |
|
|
* 客户定制功能详情表 |
|
@ -61,9 +66,12 @@ public class CustomerFunctionDetailServiceImpl extends BaseServiceImpl<CustomerF |
|
|
private Logger logger = LogManager.getLogger(CustomerFunctionDetailServiceImpl.class); |
|
|
private Logger logger = LogManager.getLogger(CustomerFunctionDetailServiceImpl.class); |
|
|
@Autowired |
|
|
@Autowired |
|
|
private CustomerFunctionDetailRedis customerFunctionDetailRedis; |
|
|
private CustomerFunctionDetailRedis customerFunctionDetailRedis; |
|
|
|
|
|
|
|
|
@Autowired |
|
|
@Autowired |
|
|
private FunctionShoppingHistoryService functionShoppingHistoryService; |
|
|
private FunctionShoppingHistoryService functionShoppingHistoryService; |
|
|
|
|
|
@Autowired |
|
|
|
|
|
private FunctionCustomizedDao functionCustomizedDao; |
|
|
|
|
|
@Autowired |
|
|
|
|
|
private FunctionShoppingHistoryDao functionShoppingHistoryDao; |
|
|
|
|
|
|
|
|
@Override |
|
|
@Override |
|
|
public PageData<CustomerFunctionDetailDTO> page(Map<String, Object> params) { |
|
|
public PageData<CustomerFunctionDetailDTO> page(Map<String, Object> params) { |
|
@ -159,4 +167,88 @@ public class CustomerFunctionDetailServiceImpl extends BaseServiceImpl<CustomerF |
|
|
return new Result(); |
|
|
return new Result(); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
* @param customerId |
|
|
|
|
|
* @return |
|
|
|
|
|
* @Author sun |
|
|
|
|
|
* @Description 客户定制功能列表 |
|
|
|
|
|
**/ |
|
|
|
|
|
@Override |
|
|
|
|
|
public CustomerFunctionCustomizedListResultDTO customerFunctionList(String customerId) { |
|
|
|
|
|
CustomerFunctionCustomizedListResultDTO resultDTO = new CustomerFunctionCustomizedListResultDTO(); |
|
|
|
|
|
//1.获取客户已有定制功能列表,按排序号排序
|
|
|
|
|
|
List<CustomerResultDTO> customerList = baseDao.selectCustomerFunction(customerId); |
|
|
|
|
|
resultDTO.setCustomerList(customerList); |
|
|
|
|
|
|
|
|
|
|
|
//2.获取客户未有定制功能列表
|
|
|
|
|
|
List<String> functionIds = customerList.stream().map(CustomerResultDTO::getFunctionId).collect(Collectors.toList()); |
|
|
|
|
|
List<FunctionResultDTO> functionList = functionCustomizedDao.selectFunctionCustomizedList(functionIds); |
|
|
|
|
|
resultDTO.setFunctionList(functionList); |
|
|
|
|
|
functionList.forEach(fl->{ |
|
|
|
|
|
fl.setCustomerId(customerId); |
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
return resultDTO; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
* @param formDTO |
|
|
|
|
|
* @return |
|
|
|
|
|
* @Author sun |
|
|
|
|
|
* @Description 客户定制功能顺序修改 |
|
|
|
|
|
**/ |
|
|
|
|
|
@Override |
|
|
|
|
|
public void updateDisplayOrder(TokenDto tokenDto, List<updatedisplayorderListFormDTO> formDTO) { |
|
|
|
|
|
//批量更新客户定制功能排序号信息
|
|
|
|
|
|
List<CustomerFunctionDetailEntity> list = ConvertUtils.sourceToTarget(formDTO, CustomerFunctionDetailEntity.class); |
|
|
|
|
|
list.forEach(l->{ |
|
|
|
|
|
l.setUpdatedBy(tokenDto.getUserId()); |
|
|
|
|
|
}); |
|
|
|
|
|
baseDao.updateFunctionDetailList(list); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
* @param formDTO |
|
|
|
|
|
* @return |
|
|
|
|
|
* @Author sun |
|
|
|
|
|
* @Description 定制功能采集 |
|
|
|
|
|
**/ |
|
|
|
|
|
@Override |
|
|
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
|
|
|
public void customerFunctionCollect(CustomerFunctionCollectFormDTO formDTO) { |
|
|
|
|
|
//1.查询定制功能详细信息
|
|
|
|
|
|
FunctionCustomizedDTO functionDTO = functionCustomizedDao.selectByFunctionId(formDTO.getFunctionId()); |
|
|
|
|
|
if(functionDTO == null){ |
|
|
|
|
|
throw new RenException("根据定制功能Id未查询到定制功能详细信息"); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
//2.查询客户当前已有定制功能最大排序号
|
|
|
|
|
|
CustomerFunctionDetailDTO detailDTO = baseDao.selectOrderByCustomerId(formDTO.getCustomerId()); |
|
|
|
|
|
int displayOrder = NumConstant.ONE; |
|
|
|
|
|
if(null!=detailDTO&&null!=detailDTO.getDisplayOrder()){ |
|
|
|
|
|
displayOrder += detailDTO.getDisplayOrder(); |
|
|
|
|
|
} |
|
|
|
|
|
//3.给客户初始定制功能数据
|
|
|
|
|
|
CustomerFunctionDetailEntity entity = new CustomerFunctionDetailEntity(); |
|
|
|
|
|
entity.setCustomerId(formDTO.getCustomerId()); |
|
|
|
|
|
entity.setFunctionId(formDTO.getFunctionId()); |
|
|
|
|
|
entity.setFunctionName(functionDTO.getFunctionId()); |
|
|
|
|
|
entity.setIconLargeImg(functionDTO.getIconLargeImg()); |
|
|
|
|
|
entity.setIconSmallImg(functionDTO.getIconSmallImg()); |
|
|
|
|
|
entity.setDomainName(functionDTO.getDomainName()); |
|
|
|
|
|
entity.setTargetLink(functionDTO.getTargetLink()); |
|
|
|
|
|
entity.setShoppingStatus(NumConstant.ONE); |
|
|
|
|
|
entity.setDisplayOrder(displayOrder); |
|
|
|
|
|
baseDao.insert(entity); |
|
|
|
|
|
|
|
|
|
|
|
//4.记录上下架操作日志
|
|
|
|
|
|
FunctionShoppingHistoryEntity historyEntity = new FunctionShoppingHistoryEntity(); |
|
|
|
|
|
historyEntity.setCustomerId(formDTO.getCustomerId()); |
|
|
|
|
|
historyEntity.setFunctionId(functionDTO.getFunctionId()); |
|
|
|
|
|
historyEntity.setShoppingStatus(NumConstant.ONE); |
|
|
|
|
|
historyEntity.setReason(formDTO.getReason()); |
|
|
|
|
|
functionShoppingHistoryDao.insert(historyEntity); |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|