客户接受时间

This commit is contained in:
1073413548 2024-09-12 15:21:57 +08:00
parent ad6938e251
commit fd3f2d6654
10 changed files with 144 additions and 25 deletions

View File

@ -73,16 +73,25 @@ public class HomeController extends BaseController {
return R.ok(homeService.getUserContractAmountsByDeptId(type,deptId)); return R.ok(homeService.getUserContractAmountsByDeptId(type,deptId));
} }
/** /**
* 首页大盘数据各渠道成交 * 首页大盘数据各渠道成交(公司总数居)
* @param type 1本月 2上月 3本季度 4本年 5所有 * @param type 1本月 2上月 3本季度 4本年 5所有
* @return * @return
*/ */
@SaCheckPermission("business:salary:list") @SaCheckPermission("business:salary:list")
@GetMapping("/byChannel") @GetMapping("/byChannel")
public R<ChannelAmountVo> byChannel(@RequestParam() Integer type) { public R<ChannelAmountVo> byChannel(@RequestParam() Integer type) {
return R.ok(homeService.byChannel(type)); return R.ok(homeService.byChannel(type,1));
}
/**
* 首页大盘数据销售个人数据
* @param type 1本月 2上月 3本季度 4本年 5所有
* @return
*/
@SaCheckPermission("business:salary:list")
@GetMapping("/channelByUser")
public R<ChannelAmountVo> channelByUser(@RequestParam() Integer type) {
return R.ok(homeService.byChannel(type,2));
} }
/** /**
* 首页大盘数据任务完成情况 * 首页大盘数据任务完成情况
* @param type 1本月 2上月 3本季度 4本年 5所有 * @param type 1本月 2上月 3本季度 4本年 5所有
@ -102,4 +111,14 @@ public class HomeController extends BaseController {
public R<Map<String,Object>> getTaskTime(@RequestParam() Integer type) { public R<Map<String,Object>> getTaskTime(@RequestParam() Integer type) {
return R.ok(homeService.getTaskTime(type)); return R.ok(homeService.getTaskTime(type));
} }
/**
* 首页大盘数据销售数据统计
* @param type 1本月 2上月 3本季度 4本年 5所有
* @return
*/
@GetMapping("/salasData")
public R<Map<String,Object>> salasData(@RequestParam() Integer type) {
return R.ok(homeService.salasData(type));
}
} }

View File

@ -48,8 +48,8 @@ public class PsCustomController extends BaseController {
@SaCheckPermission("business:customInfo:list") @SaCheckPermission("business:customInfo:list")
@GetMapping("/listByLoginUser") @GetMapping("/listByLoginUser")
public R<List<Map<String,Object>>> listByLoginUser() { public R<List<Map<String,Object>>> listByLoginUser(String name) {
return R.ok(psCustomInfoService.listByLoginUser()); return R.ok(psCustomInfoService.listByLoginUser(name));
} }
/** /**
* 查询客户信息列表 * 查询客户信息列表
@ -211,7 +211,7 @@ public class PsCustomController extends BaseController {
*/ */
@SaCheckPermission("business:customInfo:list") @SaCheckPermission("business:customInfo:list")
@RepeatSubmit @RepeatSubmit
@Log(title = "主动认领") @Log(title = "指派")
@GetMapping("/assign") @GetMapping("/assign")
public R<Void> assign(@NotNull Long customerId,@NotNull Long userId) { public R<Void> assign(@NotNull Long customerId,@NotNull Long userId) {
psCustomInfoService.assign(customerId,userId); psCustomInfoService.assign(customerId,userId);

View File

@ -6,6 +6,7 @@ import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
import java.io.Serial; import java.io.Serial;
import java.util.Date;
/** /**
* 客户基本信息对象 ps_custom_info * 客户基本信息对象 ps_custom_info
@ -88,6 +89,9 @@ public class PsCustomInfo extends TenantEntity {
*/ */
@TableLogic @TableLogic
private Integer delFlag; private Integer delFlag;
/**
* 接受时间
*/
private Date acceptDate;
} }

View File

@ -50,4 +50,10 @@ public interface PsContractInfoMapper extends BaseMapperPlus<PsContractInfo, PsC
//首页查询各个渠道成交的合同 //首页查询各个渠道成交的合同
List<ChannelPayInfo> byChannel(@Param(Constants.WRAPPER) Wrapper<PsContractInfo> queryWrapper); List<ChannelPayInfo> byChannel(@Param(Constants.WRAPPER) Wrapper<PsContractInfo> queryWrapper);
//首页查询各个渠道成交的合同
@DataPermission({
@DataColumn(key = "deptName", value = "info.create_dept"),
@DataColumn(key = "userName", value = "info.custom_manager")
})
List<ChannelPayInfo> byChannelUser(@Param(Constants.WRAPPER) Wrapper<PsContractInfo> queryWrapper);
} }

View File

@ -20,7 +20,7 @@ public interface HomeService {
* @param type * @param type
* @return * @return
*/ */
ChannelAmountVo byChannel(Integer type); ChannelAmountVo byChannel(Integer type,Integer dateType);
/** /**
* 首页大盘数据任务完成率 * 首页大盘数据任务完成率
@ -34,4 +34,10 @@ public interface HomeService {
* @return * @return
*/ */
Map<String,Object> getTaskTime(Integer type); Map<String,Object> getTaskTime(Integer type);
/**
* 首页大盘数据销售数据统计
* @param type
* @return
*/
Map<String,Object> salasData(Integer type);
} }

View File

@ -31,7 +31,7 @@ public interface IPsCustomInfoService {
* 查询登陆人下所有的客户名称和id * 查询登陆人下所有的客户名称和id
* @return 客户id和姓名 * @return 客户id和姓名
*/ */
List<Map<String,Object>> listByLoginUser(); List<Map<String,Object>> listByLoginUser(String name);
/** /**
* 分页查询客户基本信息列表 * 分页查询客户基本信息列表
* *

View File

@ -29,10 +29,7 @@ import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.Comparator; import java.util.*;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors; import java.util.stream.Collectors;
/** /**
@ -61,6 +58,7 @@ public class PublicApproverServiceImpl extends ApproverAbstractServiceImpl {
PsCustomInfo info = customInfoMapper.selectById(Long.valueOf(psApproverRecord.getBusinessId())); PsCustomInfo info = customInfoMapper.selectById(Long.valueOf(psApproverRecord.getBusinessId()));
info.setCustomStatus(CustomerStatusEnum.INIT.getCode()); info.setCustomStatus(CustomerStatusEnum.INIT.getCode());
info.setCustomManager(Long.valueOf(psApproverRecord.getUpdateData())); info.setCustomManager(Long.valueOf(psApproverRecord.getUpdateData()));
info.setAcceptDate(new Date());
customInfoMapper.updateById(info); customInfoMapper.updateById(info);
} }

View File

@ -20,6 +20,7 @@ import com.pusong.business.mapper.PsTaskAppointMapper;
import com.pusong.business.mapper.PsTaskMainMapper; import com.pusong.business.mapper.PsTaskMainMapper;
import com.pusong.business.service.HomeService; import com.pusong.business.service.HomeService;
import com.pusong.common.core.constant.CacheNames; import com.pusong.common.core.constant.CacheNames;
import com.pusong.common.core.utils.DateUtils;
import com.pusong.system.domain.bo.SysDictDataBo; import com.pusong.system.domain.bo.SysDictDataBo;
import com.pusong.system.domain.vo.SysDictDataVo; import com.pusong.system.domain.vo.SysDictDataVo;
import com.pusong.system.service.ISysDictDataService; import com.pusong.system.service.ISysDictDataService;
@ -33,6 +34,7 @@ import java.math.BigDecimal;
import java.math.RoundingMode; import java.math.RoundingMode;
import java.time.LocalDate; import java.time.LocalDate;
import java.time.format.DateTimeFormatter; import java.time.format.DateTimeFormatter;
import java.time.temporal.TemporalAdjusters;
import java.util.*; import java.util.*;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@ -297,11 +299,12 @@ public class HomeServiceImpl implements HomeService {
/** /**
* 首页大盘数据各渠道成交 * 首页大盘数据各渠道成交
* @param type * @param type
* @param dateType 1查全部数据 2查个人权限的数据
* @return * @return
*/ */
@Cacheable(cacheNames = CacheNames.HOME_C, key = "#type") @Cacheable(cacheNames = CacheNames.HOME_C, key = "#type+'_'+#dateType")
public ChannelAmountVo byChannel(Integer type){ public ChannelAmountVo byChannel(Integer type,Integer dateType){
Map<String, Object> mapParam = this.getDate(type); Map<String, Object> mapParam = dateType == 1?this.getDate(type):this.getDateByUser(type);
LocalDate startDate = (LocalDate)mapParam.get("startDate"); LocalDate startDate = (LocalDate)mapParam.get("startDate");
LocalDate endDate = (LocalDate)mapParam.get("endDate"); LocalDate endDate = (LocalDate)mapParam.get("endDate");
String date = (String)mapParam.get("date"); String date = (String)mapParam.get("date");
@ -309,10 +312,17 @@ public class HomeServiceImpl implements HomeService {
ChannelAmountVo res = new ChannelAmountVo(); ChannelAmountVo res = new ChannelAmountVo();
res.setDateStr(date); res.setDateStr(date);
log.info("查询日期:{}到{}",startDate,endDate); log.info("查询日期:{}到{}",startDate,endDate);
List<ChannelPayInfo> list = psContractInfoMapper.byChannel(new QueryWrapper<PsContractInfo>() QueryWrapper<PsContractInfo> wq = new QueryWrapper<PsContractInfo>()
.ne("info.is_due", CommonStatusEnum.SUCCESS.getCode()).ne("info.contract_status", ContractStatusEnum.INIT.getCode()) .ne("info.is_due", CommonStatusEnum.SUCCESS.getCode()).ne("info.contract_status", ContractStatusEnum.INIT.getCode())
.eq("pay.pay_status",PayStatusEnum.SUCCESS.getCode()) .eq("pay.pay_status", PayStatusEnum.SUCCESS.getCode())
.ge(startDate != null,"info.apply_date",startDate).le(endDate != null,"info.apply_date",endDate)); .ge(startDate != null, "info.apply_date", startDate).le(endDate != null, "info.apply_date", endDate);
List<ChannelPayInfo> list;
if(dateType == 1){//所有的数据权限
list = psContractInfoMapper.byChannel(wq);
}else{//用户个人的数据权限
list = psContractInfoMapper.byChannelUser(wq);
}
//查询各个渠道的字典表 //查询各个渠道的字典表
SysDictDataBo dictData = new SysDictDataBo(); SysDictDataBo dictData = new SysDictDataBo();
dictData.setInDictType(List.of("custom_source")); dictData.setInDictType(List.of("custom_source"));
@ -411,6 +421,8 @@ public class HomeServiceImpl implements HomeService {
map.put("inAvg",0);//内勤 map.put("inAvg",0);//内勤
map.put("outAvg",0);//外勤 map.put("outAvg",0);//外勤
map.put("secAvg",0);//特勤 map.put("secAvg",0);//特勤
map.put("dateStr",date);//
map.put("currentDate", DateUtils.parseDateToStr("yyyy-MM-dd HH:mm",new Date()));//当前时间
for(Map<String, Object> appointMap : appointList){ for(Map<String, Object> appointMap : appointList){
if(StringUtils.equals("1",appointMap.get("appoint_type").toString())){ if(StringUtils.equals("1",appointMap.get("appoint_type").toString())){
appointMap.put("inAvg",appointMap.get("avg")); appointMap.put("inAvg",appointMap.get("avg"));
@ -422,4 +434,66 @@ public class HomeServiceImpl implements HomeService {
} }
return map; return map;
} }
/**
* 首页大盘数据销售数据统计
* @param type
* @return
*/
public Map<String,Object> salasData(Integer type){
Map<String, Object> mapParam = this.getDateByUser(type);
LocalDate startDate = (LocalDate)mapParam.get("startDate");
LocalDate endDate = (LocalDate)mapParam.get("endDate");
String date = (String)mapParam.get("date");
//返回map
Map<String,Object> map = new HashMap<>();
map.put("dateStr",date);//
map.put("currentDate", DateUtils.parseDateToStr("yyyy-MM-dd HH:mm",new Date()));//当前时间
return null;
}
public static Map<String, Object> getDateByUser(Integer type){
LocalDate startDate = null;
LocalDate endDate = null;
String date = "";
LocalDate now = LocalDate.now();
DateTimeFormatter df = DateTimeFormatter.ofPattern("yyyy-MM-dd");
switch (type){
case 1://今日
startDate = now;
date =startDate.format(df);
break;
case 2: //昨日
startDate = now.plusDays(-1);
endDate = now;
date =startDate.format(df);
break;
case 3: //本周
startDate = now.with(TemporalAdjusters.previousOrSame(java.time.DayOfWeek.MONDAY));
date =startDate.format(df) + " 至今";
break;
case 4: //上周
endDate = now.with(TemporalAdjusters.previousOrSame(java.time.DayOfWeek.MONDAY));
startDate = endDate.plusDays(-7);
date =startDate.format(df) +""+ endDate.format(df);
break;
case 5: //本月
startDate = now.withDayOfMonth(1);
date =startDate.format(DateTimeFormatter.ofPattern("yyyy-MM"));
break;
case 6: //上月
startDate = now.minusMonths(1).withDayOfMonth(1);
endDate = now.withDayOfMonth(1);
date =startDate.format(DateTimeFormatter.ofPattern("yyyy-MM"));
break;
}
Map<String,Object> map = new HashMap<>();
map.put("startDate",startDate);
map.put("endDate",endDate);
map.put("date",date);
return map;
}
} }

View File

@ -74,15 +74,18 @@ public class PsCustomInfoServiceImpl implements IPsCustomInfoService {
* @return 客户id和姓名 * @return 客户id和姓名
*/ */
@Override @Override
public List<Map<String,Object>> listByLoginUser() { public List<Map<String,Object>> listByLoginUser(String name) {
//查询客户基本信息 //查询客户基本信息
List<PsCustomInfo> list = baseMapper.selectList(new QueryWrapper<PsCustomInfo>().select("id", "custom_name") List<PsCustomInfo> list = baseMapper.selectList(new QueryWrapper<PsCustomInfo>().select("id", "custom_name","custom_mobile")
.lambda().eq(PsCustomInfo::getDelFlag, 0).isNotNull(PsCustomInfo::getCustomName).ne(PsCustomInfo::getCustomName,"").ne(PsCustomInfo::getCustomName,"")); .lambda().eq(PsCustomInfo::getDelFlag, 0).isNotNull(PsCustomInfo::getCustomName).ne(PsCustomInfo::getCustomName,"").ne(PsCustomInfo::getCustomName,"")
.and(StringUtils.isNotBlank(name),wq->wq.like(PsCustomInfo::getCustomName,name).or().like(PsCustomInfo::getCustomMobile,name)));
List<Map<String,Object>> listmap = new ArrayList<>(); List<Map<String,Object>> listmap = new ArrayList<>();
list.forEach(item->{ list.forEach(item->{
Map<String,Object> map = new HashMap<>(); Map<String,Object> map = new HashMap<>();
map.put("id",item.getId()); map.put("id",item.getId());
map.put("customName",item.getCustomName()); map.put("customName",item.getCustomName());
map.put("custom_mobile",item.getCustomMobile());
listmap.add(map); listmap.add(map);
}); });
@ -246,6 +249,7 @@ public class PsCustomInfoServiceImpl implements IPsCustomInfoService {
add.setCustomManager(LoginHelper.getUserId()); add.setCustomManager(LoginHelper.getUserId());
add.setBlack(CommonStatusEnum.N.getCode()); add.setBlack(CommonStatusEnum.N.getCode());
add.setCustomStatus(CustomerStatusEnum.INIT.getCode()); add.setCustomStatus(CustomerStatusEnum.INIT.getCode());
add.setAcceptDate(new Date());
boolean flag = baseMapper.insert(add) > 0; boolean flag = baseMapper.insert(add) > 0;
if(CollectionUtils.isNotEmpty(bo.getPriceBos())){ if(CollectionUtils.isNotEmpty(bo.getPriceBos())){
bo.getPriceBos().forEach(item->item.setCustomId(add.getId())); bo.getPriceBos().forEach(item->item.setCustomId(add.getId()));
@ -495,6 +499,7 @@ public class PsCustomInfoServiceImpl implements IPsCustomInfoService {
PsCustomInfo psCustomInfo = baseMapper.selectById(customerId); PsCustomInfo psCustomInfo = baseMapper.selectById(customerId);
psCustomInfo.setCustomStatus(CustomerStatusEnum.INIT.getCode()); psCustomInfo.setCustomStatus(CustomerStatusEnum.INIT.getCode());
psCustomInfo.setCustomManager(userId); psCustomInfo.setCustomManager(userId);
psCustomInfo.setAcceptDate(new Date());
baseMapper.updateById(psCustomInfo); baseMapper.updateById(psCustomInfo);
} }

View File

@ -112,7 +112,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</select> </select>
<select id="byChannel" resultType="com.pusong.business.domain.vo.home.ChannelPayInfo"> <sql id="channel">
select select
cus.custom_source channel, cus.custom_source channel,
info.contract_code, info.contract_code,
@ -120,9 +120,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
pay.business_type, pay.business_type,
pay.money pay.money
from ps_contract_info info from ps_contract_info info
left join ps_custom_info cus on info.custom_id = cus.id left join ps_custom_info cus on info.custom_id = cus.id
left join ps_contract_pay pay on info.contract_code = pay.contract_code left join ps_contract_pay pay on info.contract_code = pay.contract_code
</sql>
<select id="byChannel" resultType="com.pusong.business.domain.vo.home.ChannelPayInfo">
<include refid="channel"/>
${ew.getCustomSqlSegment} ${ew.getCustomSqlSegment}
</select> </select>
<select id="byChannelUser" resultType="com.pusong.business.domain.vo.home.ChannelPayInfo">
<include refid="channel"/>
${ew.getCustomSqlSegment}
</select>
</mapper> </mapper>