|
|
@@ -1,5 +1,6 @@ |
|
|
|
package com.iformall.service.sm.impl; |
|
|
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|
|
|
import com.github.pagehelper.PageHelper; |
|
|
|
import com.github.pagehelper.PageInfo; |
|
|
|
import com.iformall.common.ErrorCode; |
|
|
@@ -135,6 +136,11 @@ public class UserDigitalAvatarOrderServiceImpl implements UserDigitalAvatarOrder |
|
|
|
if(record.getUserId() == null){ |
|
|
|
return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(),"未查询到用户"); |
|
|
|
} |
|
|
|
boolean first = true; |
|
|
|
if(this.selectCount(record.getUserId()) > 0){ |
|
|
|
first = false; |
|
|
|
} |
|
|
|
|
|
|
|
if(record.getDigitalAvatarId() == null){ |
|
|
|
return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(),"风格模板为空"); |
|
|
|
} |
|
|
@@ -150,10 +156,15 @@ public class UserDigitalAvatarOrderServiceImpl implements UserDigitalAvatarOrder |
|
|
|
} |
|
|
|
record.setDigitalAvatarSm(digitalAvatarMould.getMouldSmId()); |
|
|
|
record.setDigitalAvatarType(digitalAvatarMould.getMouldType()); |
|
|
|
record.setPrice(digitalAvatarMould.getSalePrice()); |
|
|
|
|
|
|
|
if(record.getUserImageList().size() != record.getDigitalAvatarType()){ |
|
|
|
return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(),"照片数据格式错误"); |
|
|
|
} |
|
|
|
if(first){ |
|
|
|
record.setPrice(0); |
|
|
|
}else{ |
|
|
|
record.setPrice(digitalAvatarMould.getSalePrice()); |
|
|
|
} |
|
|
|
|
|
|
|
if(record.getPrice() > 0){ |
|
|
|
UserBasicProperty userBasicProperty = userBasicPropertyMapper.selectById(record.getUserId()); |
|
|
@@ -283,6 +294,8 @@ public class UserDigitalAvatarOrderServiceImpl implements UserDigitalAvatarOrder |
|
|
|
DigitalAvatarResult result = AiDigitalAvatarHelper.digitalAvatarPhoto(param,record.getId()); |
|
|
|
if(result.isSuccess()){ |
|
|
|
userDigitalAvatarPhotoService.handlePhoto(record,result.getImgList()); |
|
|
|
|
|
|
|
this.sendPhotoSuccess(record); |
|
|
|
}else{ |
|
|
|
updOrder.setStatus(EnumDigitalAvatarOrderStatus.fail.getCode()); |
|
|
|
updOrder.setMsg(result.getMsg()); |
|
|
@@ -310,15 +323,24 @@ public class UserDigitalAvatarOrderServiceImpl implements UserDigitalAvatarOrder |
|
|
|
if(!EnumDigitalAvatarOrderStatus.finish.getCode().equals(userDigitalAvatarOrder.getStatus())){ |
|
|
|
return; |
|
|
|
} |
|
|
|
//默认先发微信订阅消息 |
|
|
|
WxAppinfo appinfo = wxAppinfoService.getProjectCAppInfoFromRedis(EnumProject.PROJECT_5.getCode(), EnumAppPlat.WX.getCode()); |
|
|
|
String toPage = "/pages/lookPhoto/index?id="+record.getId(); |
|
|
|
if(userDigitalAvatarOrder.getPlat() == null){ |
|
|
|
return; |
|
|
|
} |
|
|
|
WxAppinfo appinfo = wxAppinfoService.getProjectCAppInfoFromRedis(EnumProject.PROJECT_5.getCode(), userDigitalAvatarOrder.getPlat()); |
|
|
|
String toPage = "/pages/lookPhoto/index?id="+userDigitalAvatarOrder.getId(); |
|
|
|
Map<String,String> param = new HashMap<>(); |
|
|
|
param.put("thing1",record.getTitle()); |
|
|
|
param.put("character_string3",record.getId().toString()); |
|
|
|
param.put("time4", DateUtils.date2String(record.getUpdateDate())); |
|
|
|
param.put("thing1",userDigitalAvatarOrder.getTitle()); |
|
|
|
param.put("character_string3",userDigitalAvatarOrder.getId().toString()); |
|
|
|
param.put("time4", DateUtils.date2String(userDigitalAvatarOrder.getUpdateDate())); |
|
|
|
|
|
|
|
wxTemplateMsgService.sendTemplateMsg(appinfo,record.getUserId(),toPage,param); |
|
|
|
wxTemplateMsgService.sendTemplateMsg(appinfo,userDigitalAvatarOrder.getUserId(),toPage,param); |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public Integer selectCount(Long userId) { |
|
|
|
UserDigitalAvatarOrder userDigitalAvatarOrderQ = new UserDigitalAvatarOrder(); |
|
|
|
userDigitalAvatarOrderQ.setUserId(userId); |
|
|
|
return userDigitalAvatarOrderMapper.selectCount(new QueryWrapper<>(userDigitalAvatarOrderQ)); |
|
|
|
} |
|
|
|
|
|
|
|
} |