|
@@ -1,15 +1,21 @@
|
|
|
package com.fdkankan.manage.service.impl;
|
|
|
|
|
|
+import com.amazonaws.services.lexmodelbuilding.model.Intent;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
+import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
import com.fdkankan.common.response.PageInfo;
|
|
|
-import com.fdkankan.manage.entity.AgentNew;
|
|
|
-import com.fdkankan.manage.entity.SysUser;
|
|
|
+import com.fdkankan.manage.common.ResultCode;
|
|
|
+import com.fdkankan.manage.entity.*;
|
|
|
+import com.fdkankan.manage.exception.BusinessException;
|
|
|
import com.fdkankan.manage.mapper.IAgentNewMapper;
|
|
|
+import com.fdkankan.manage.service.IAgentIncrementService;
|
|
|
import com.fdkankan.manage.service.IAgentNewService;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
+import com.fdkankan.manage.service.IIncrementTypeService;
|
|
|
import com.fdkankan.manage.service.ISysUserService;
|
|
|
import com.fdkankan.manage.vo.request.AgentParam;
|
|
|
+import com.fdkankan.manage.vo.response.AgentIncrementVo;
|
|
|
import com.fdkankan.manage.vo.response.AgentVo;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
import org.springframework.beans.BeanUtils;
|
|
@@ -17,6 +23,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
import java.util.ArrayList;
|
|
|
+import java.util.HashMap;
|
|
|
import java.util.List;
|
|
|
|
|
|
/**
|
|
@@ -32,6 +39,10 @@ public class AgentNewServiceImpl extends ServiceImpl<IAgentNewMapper, AgentNew>
|
|
|
|
|
|
@Autowired
|
|
|
ISysUserService sysUserService;
|
|
|
+ @Autowired
|
|
|
+ IAgentIncrementService agentIncrementService;
|
|
|
+ @Autowired
|
|
|
+ IIncrementTypeService incrementTypeService;
|
|
|
|
|
|
@Override
|
|
|
public Object pageList(AgentParam agentParam) {
|
|
@@ -42,6 +53,7 @@ public class AgentNewServiceImpl extends ServiceImpl<IAgentNewMapper, AgentNew>
|
|
|
wrapper.orderByDesc(AgentNew::getCreateTime);
|
|
|
Page<AgentNew> page = this.page(new Page<>(agentParam.getPageNum(), agentParam.getPageSize()), wrapper);
|
|
|
List<AgentVo> voList = new ArrayList<>();
|
|
|
+ HashMap<Integer,IncrementType> map = incrementTypeService.getIdMap();
|
|
|
for (AgentNew record : page.getRecords()) {
|
|
|
AgentVo vo = new AgentVo();
|
|
|
BeanUtils.copyProperties(record,vo);
|
|
@@ -49,6 +61,18 @@ public class AgentNewServiceImpl extends ServiceImpl<IAgentNewMapper, AgentNew>
|
|
|
if(sysUser != null){
|
|
|
vo.setSysUserName(sysUser.getNickName());
|
|
|
}
|
|
|
+ List<AgentIncrement> agentIncrements = agentIncrementService.getByAgentId(record.getId());
|
|
|
+ List<AgentIncrementVo> agentIncrementVos = new ArrayList<>();
|
|
|
+ for (AgentIncrement agentIncrement : agentIncrements) {
|
|
|
+ if(map.get(agentIncrement.getIncrementTypeId()) == null){
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ AgentIncrementVo agentVo = new AgentIncrementVo();
|
|
|
+ BeanUtils.copyProperties(agentIncrement,agentVo);
|
|
|
+ agentVo.setIncrementTypeName(map.get(agentIncrement.getIncrementTypeId()).getName());
|
|
|
+ agentIncrementVos.add(agentVo);
|
|
|
+ }
|
|
|
+ vo.setAgentIncrements(agentIncrementVos );
|
|
|
voList.add(vo);
|
|
|
}
|
|
|
|
|
@@ -57,4 +81,21 @@ public class AgentNewServiceImpl extends ServiceImpl<IAgentNewMapper, AgentNew>
|
|
|
voPage.setRecords(voList);
|
|
|
return PageInfo.PageInfo(voPage);
|
|
|
}
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void addIncrementNum(AgentVo param) {
|
|
|
+ if(param.getId() == null ){
|
|
|
+ throw new BusinessException(ResultCode.MISSING_REQUIRED_PARAMETERS);
|
|
|
+ }
|
|
|
+ if(param.getDownTotalNum()!=null){
|
|
|
+ LambdaUpdateWrapper<AgentNew> wrapper = new LambdaUpdateWrapper<>();
|
|
|
+ wrapper.eq(AgentNew::getId,param.getId());
|
|
|
+ wrapper.set(AgentNew::getDownTotalNum, param.getDownTotalNum());
|
|
|
+ this.update(wrapper);
|
|
|
+ }
|
|
|
+ if(param.getAgentIncrements() != null && param.getAgentIncrements().size() >0){
|
|
|
+ agentIncrementService.addNum(param.getAgentIncrements());
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
}
|