This commit is contained in:
mx 2024-11-29 17:57:26 +08:00
parent 4832ff9e54
commit aba87556be
9 changed files with 127 additions and 64 deletions

View File

@ -196,6 +196,16 @@ public class DateUtils extends org.apache.commons.lang3.time.DateUtils {
// 使用formatter转换LocalDate到字符串
return date.format(formatter);
}
public static String toString(Date date, String from){
if (date == null){
return null;
}
// 创建一个DateTimeFormatter实例来定义日期格式
DateTimeFormatter formatter = DateTimeFormatter.ofPattern(from);
// 使用formatter转换LocalDate到字符串
return date.toInstant().atZone(ZoneId.systemDefault()).toLocalDateTime().format(formatter);
}
public static String toString(LocalDate date){
return toString(date,"yyyy-MM-dd");

View File

@ -18,7 +18,7 @@ public class AppointBo {
* 任务主表id
*/
@NotNull
private Long id;
private List<Long> id;
/**
* 执行者用户id
*/

View File

@ -271,4 +271,9 @@ public class PsCompanyInfoVo implements Serializable {
private String contractCode;
private PsApproverRecordVo psApproverRecordVo;
/**
* 公司类型
*/
private String companyType;
}

View File

@ -183,7 +183,10 @@ public class PsCustomInfoVo implements Serializable {
* 公司信息DTO
*/
private List<PsCompanyInfoVo> psCompanyInfoVos;
/**
* 服务公司信息DTO
*/
private List<PsCompanyInfoVo> psCompanySerivceVo;
/**
* 服务类别
*/

View File

@ -173,5 +173,10 @@ public class PsTaskMainVo implements Serializable {
* 服务项目
*/
List<PsContractBusinessDetailVo> psContractBusinesses;
/**
* 工单时间
*/
private Date createTime;
}

View File

@ -186,7 +186,7 @@ public class PsCompanyInfoServiceImpl implements IPsCompanyInfoService {
sql.append("and business_type = '2' and is_proxy = '2'");
}
lqw.exists(bo.getType() != 1, sql.toString());
lqw.orderByAsc("bus.min_end_date");
lqw.orderByAsc("CASE WHEN bus.min_end_date IS NULL THEN 1 ELSE 0 END");
lqw.orderByDesc("finish_date");
// lqw.groupBy("com.id");
Page<PsCompanyInfoVo> result = baseMapper.selectPageList2(pageQuery.build(), lqw);
@ -208,14 +208,21 @@ public class PsCompanyInfoServiceImpl implements IPsCompanyInfoService {
}
for (PsCompanyInfoVo record : result.getRecords()) {
record.setFollowUsers(userMap.get(record.getId()));
record.setBusinessVoList(contractBusinessVoMap.get(record.getId()));
if (record.getBusinessVoList() == null){
continue;
}
boolean hasDate = false;
for (PsContractBusinessVo psContractBusinessVo : record.getBusinessVoList()) {
if (psContractBusinessVo.getEndDate() != null){
hasDate = true;
}
int diffDay = DateUtils.diffDay(new Date(), psContractBusinessVo.getEndDate());
psContractBusinessVo.setRemainingDay(diffDay);
}
if (hasDate){
record.setBusinessVoList(contractBusinessVoMap.get(record.getId()));
}
}
}

View File

@ -908,6 +908,10 @@ public class PsContractInfoServiceImpl implements IPsContractInfoService {
//派单者
if (task != null){
serviceScheduleVo.setAppoint(new ServiceScheduleVo.UserAndStatus(task.getOperateUser(), task.getCreateTime()));
}else{
if ("1".equals(contractInfo.getIsDue())){
serviceScheduleVo.setAppoint(new ServiceScheduleVo.UserAndStatus(0l, 1, null));
}
}
if(CollectionUtils.isNotEmpty(appointList)){
appointList.forEach(item->{
@ -922,9 +926,19 @@ public class PsContractInfoServiceImpl implements IPsContractInfoService {
}
//回传
Long rollPdfUid = StringUtils.equals(CommonStatusEnum.SUCCESS.getCode(), contractInfo.getRollBackStatus()) ? customer.getCustomManager() : null;
if (rollPdfUid != null){
if (rollPdfUid != null) {
PsApproverRecordVo psApproverRecordVo = approverRecordService.queryLast(contractInfo.getContractCode(), ApproverTypeEnum.ROLBACK.getCode());
serviceScheduleVo.setRollBack(new ServiceScheduleVo.UserAndStatus(rollPdfUid, psApproverRecordVo != null ? psApproverRecordVo.getApplyDate() : null));
}else{
PsContractInfoVo info = this.queryContractByCode(contractCode);
if (!CommonStatusEnum.SUCCESS.getCode().equals(info.getSignStatus())){
if (info.getContractAmount().doubleValue() < 8000) {
if (!info.isTuoguanService() || info.getIsDue().equals("1")) {
//status = 1客户端显示无需回传合同
serviceScheduleVo.setRollBack(new ServiceScheduleVo.UserAndStatus(0l, 1, null));
}
}
}
}
if(vo.getResidualMoney().compareTo(BigDecimal.ZERO) <= 0 && CollectionUtils.isNotEmpty(payVoList)){

View File

@ -75,15 +75,17 @@ public class PsCustomInfoServiceImpl implements IPsCustomInfoService {
public List<Map<String,Object>> listByLoginUser(String name) {
//查询客户基本信息
List<PsCustomInfo> list = baseMapper.selectList(new QueryWrapper<PsCustomInfo>().select("id", "custom_name","custom_mobile")
List<PsCustomInfo> list = baseMapper.selectList(new QueryWrapper<PsCustomInfo>().select("id", "custom_name","custom_mobile","create_time","custom_source")
.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.forEach(item->{
Map<String,Object> map = new HashMap<>();
map.put("id",item.getId());
map.put("customName",item.getCustomName());
map.put("custom_mobile",item.getCustomMobile());
map.put("id", item.getId());
map.put("customName", item.getCustomName());
map.put("custom_mobile", item.getCustomMobile());
map.put("createTime", DateUtils.toString(item.getCreateTime(),"yyyy-MM-dd"));
map.put("customSource", item.getCustomSource());
listmap.add(map);
});
@ -154,7 +156,8 @@ public class PsCustomInfoServiceImpl implements IPsCustomInfoService {
List<PsCompanyInfoVo> companyInfoVos = companyInfoMapper.selectVoList(Wrappers.<PsCompanyInfo>lambdaQuery()
.in(PsCompanyInfo::getCustomId, ids)
.eq(PsCompanyInfo::getDelFlag, 0)
.eq(PsCompanyInfo::getCompanyType, "1"));
// .eq(PsCompanyInfo::getCompanyType, "1")
);
Map<Long, List<PsCompanyInfoVo>> id_companyMap = new HashMap<>();
if(CollectionUtils.isNotEmpty(companyInfoVos)){
//分组
@ -171,7 +174,21 @@ public class PsCustomInfoServiceImpl implements IPsCustomInfoService {
//装填报价金额vo
info.setPsCustomPriceVo(id_piceMap.get(info.getId()));
//装填公司信息vo
info.setPsCompanyInfoVos(id_companyMap.get(info.getId()));
List<PsCompanyInfoVo> allPsCompanyInfoVos = id_companyMap.get(info.getId());
if (allPsCompanyInfoVos != null){
List<PsCompanyInfoVo> psCompanyInfoVos = new ArrayList<>();
List<PsCompanyInfoVo> psServiceCompanyInfoVos = new ArrayList<>();
for (PsCompanyInfoVo psCompanyInfoVo : allPsCompanyInfoVos) {
if ("1".equals(psCompanyInfoVo.getCompanyType())){
psCompanyInfoVos.add(psCompanyInfoVo);
}else if ("2".equals(psCompanyInfoVo.getCompanyType())){
psServiceCompanyInfoVos.add(psCompanyInfoVo);
}
}
info.setPsCompanyInfoVos(psCompanyInfoVos);
info.setPsCompanySerivceVo(psServiceCompanyInfoVos);
}
//报价金额
if(CollectionUtils.isNotEmpty(info.getPsCustomPriceVo())){
info.setPrice(info.getPsCustomPriceVo().stream().map(PsCustomPriceVo::getServicePrice).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add));

View File

@ -152,7 +152,7 @@ public class PsTaskServiceImpl implements IPsTaskService {
for (PsTaskMainVo vo : page.getRecords()) {
if(vo.getStartDate() != null){
vo.setNumOfDat(DateUtils.calWorkDate(vo.getStartDate(),new Date()));
vo.setNumOfDat(DateUtils.calWorkDate(vo.getCreateTime(), new Date()));
}
//任务作废审批
vo.setTaskStatusDesc(approverRecordService.getLastFail(vo.getId() + "",null,List.of(ApproverTypeEnum.TASKCANCE.getCode())));
@ -317,8 +317,8 @@ public class PsTaskServiceImpl implements IPsTaskService {
.collect(Collectors.groupingBy(Function.identity(), Collectors.counting()))
.entrySet().stream().anyMatch(e -> e.getValue() > 1);
if(repetition){
log.error("请求的任务类型重复");
throw new ServiceException("请求的任务类型重复,请刷新页面重试");
// log.error("请求的任务类型重复");
// throw new ServiceException("请求的任务类型重复,请刷新页面重试");
}
}
@ -363,8 +363,9 @@ public class PsTaskServiceImpl implements IPsTaskService {
@Override
@Transactional
public void appoint(AppointBo bo){
for (Long taskId : bo.getId()) {
//前置校验
PsTaskMain mainTask = baseMapper.selectById(bo.getId());
PsTaskMain mainTask = baseMapper.selectById(taskId);
if(!TaskStatusEnum.canAppoint(mainTask.getTaskStatus())){
throw new ServiceException("任务已完成,无法继续派单");
}
@ -421,6 +422,7 @@ public class PsTaskServiceImpl implements IPsTaskService {
}
}
}
}
/**
* 主任务完成
*