@@ -0,0 +1,51 @@ | |||||
package com.iformall.controller; | |||||
import com.github.pagehelper.PageInfo; | |||||
import com.iformall.common.ErrorCode; | |||||
import com.iformall.common.ResultData; | |||||
import com.iformall.domain.po.UserBasicFrom; | |||||
import com.iformall.domain.po.UserBasicPropertyLog; | |||||
import com.iformall.domain.po.base.BaseEntity; | |||||
import com.iformall.service.UserBasicFromService; | |||||
import com.iformall.service.UserBasicPropertyLogService; | |||||
import io.swagger.annotations.Api; | |||||
import io.swagger.annotations.ApiImplicitParam; | |||||
import io.swagger.annotations.ApiImplicitParams; | |||||
import io.swagger.annotations.ApiOperation; | |||||
import org.slf4j.Logger; | |||||
import org.slf4j.LoggerFactory; | |||||
import org.springframework.beans.factory.annotation.Autowired; | |||||
import org.springframework.web.bind.annotation.GetMapping; | |||||
import org.springframework.web.bind.annotation.ModelAttribute; | |||||
import org.springframework.web.bind.annotation.RequestMapping; | |||||
import org.springframework.web.bind.annotation.RestController; | |||||
@RestController | |||||
@RequestMapping("/api/userFrom") | |||||
@Api(description = "模板接口") | |||||
public class UserBasicFromController extends BaseController { | |||||
private final Logger logger = LoggerFactory.getLogger(this.getClass()); | |||||
@Autowired | |||||
private UserBasicFromService userBasicFromService; | |||||
@ApiOperation("分页列表接口") | |||||
@GetMapping("list") | |||||
@ApiImplicitParams({ | |||||
@ApiImplicitParam(name = "pageNum", value = "页数", dataType = "int", paramType = "query", required = true), | |||||
@ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "int", paramType = "query", required = true)}) | |||||
public ResultData list(@ModelAttribute UserBasicFrom record, Integer pageNum, Integer pageSize) { | |||||
logger.debug("[" + getIpAddr() + "] UserBasicFromController::list"); | |||||
if (record == null) record = new UserBasicFrom(); | |||||
if(record.getFromProject() == null){ | |||||
return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(),"项目类型为空"); | |||||
} | |||||
record.setFromUserId(getMemberId()); | |||||
record.setSortColumns(BaseEntity.SortField.CreateDate_DESC); | |||||
final PageInfo<UserBasicFrom> page = userBasicFromService.listAsPage(record, pageNum, pageSize); | |||||
return new ResultData(page); | |||||
} | |||||
} |
@@ -17,6 +17,9 @@ public class UserBasicFrom extends TenantEntity { | |||||
protected Long id; | protected Long id; | ||||
@TableField(exist = false) | |||||
private String userPhone; | |||||
@io.swagger.annotations.ApiModelProperty(value="EnumProject",name="fromProject") | @io.swagger.annotations.ApiModelProperty(value="EnumProject",name="fromProject") | ||||
private Integer fromProject; | private Integer fromProject; | ||||
@@ -39,4 +42,7 @@ public class UserBasicFrom extends TenantEntity { | |||||
@TableField(exist = false) | @TableField(exist = false) | ||||
private Date endDate; | private Date endDate; | ||||
@TableField(exist = false) | |||||
private Integer goldNum; | |||||
} | } |
@@ -7,6 +7,7 @@ import lombok.EqualsAndHashCode; | |||||
import lombok.ToString; | import lombok.ToString; | ||||
import java.util.Date; | import java.util.Date; | ||||
import java.util.List; | |||||
@TableName(value = "user_basic_property_log") | @TableName(value = "user_basic_property_log") | ||||
@Data | @Data | ||||
@@ -46,4 +47,7 @@ public class UserBasicPropertyLog extends TenantEntity { | |||||
@io.swagger.annotations.ApiModelProperty(value="创建时间",name="createDate") | @io.swagger.annotations.ApiModelProperty(value="创建时间",name="createDate") | ||||
private Date createDate; | private Date createDate; | ||||
@io.swagger.annotations.ApiModelProperty(value="记录对应的业务ID",name="extraId") | |||||
private List<Long> extraIds; | |||||
} | } |
@@ -125,7 +125,10 @@ public class BasicCUserService { | |||||
if(from != null){ | if(from != null){ | ||||
from.setId(basicInfo.getId()); | from.setId(basicInfo.getId()); | ||||
userBasicFromService.saveForm(from); | |||||
from.setCreateDate(basicInfo.getCreateDate()); | |||||
try{ | |||||
userBasicFromService.saveForm(from); | |||||
}catch(Exception e){} | |||||
} | } | ||||
} | } | ||||
@@ -2,16 +2,29 @@ package com.iformall.service.impl; | |||||
import com.github.pagehelper.PageHelper; | import com.github.pagehelper.PageHelper; | ||||
import com.github.pagehelper.PageInfo; | import com.github.pagehelper.PageInfo; | ||||
import com.iformall.common.ErrorCode; | |||||
import com.iformall.domain.po.UserBasicFrom; | import com.iformall.domain.po.UserBasicFrom; | ||||
import com.iformall.domain.po.UserBasicPropertyLog; | |||||
import com.iformall.domain.po.WxCUserBasicInfo; | |||||
import com.iformall.enums.EnumPropertyLogType; | |||||
import com.iformall.exception.MallinkException; | |||||
import com.iformall.mapper.UserBasicFromMapper; | import com.iformall.mapper.UserBasicFromMapper; | ||||
import com.iformall.mapper.UserBasicPropertyLogMapper; | |||||
import com.iformall.mapper.WxCUserBasicInfoMapper; | |||||
import com.iformall.service.UserBasicFromService; | import com.iformall.service.UserBasicFromService; | ||||
import lombok.extern.slf4j.Slf4j; | import lombok.extern.slf4j.Slf4j; | ||||
import org.slf4j.Logger; | import org.slf4j.Logger; | ||||
import org.slf4j.LoggerFactory; | import org.slf4j.LoggerFactory; | ||||
import org.springframework.beans.factory.annotation.Autowired; | import org.springframework.beans.factory.annotation.Autowired; | ||||
import org.springframework.stereotype.Service; | import org.springframework.stereotype.Service; | ||||
import org.springframework.transaction.annotation.Propagation; | |||||
import org.springframework.transaction.annotation.Transactional; | |||||
import java.util.Date; | import java.util.Date; | ||||
import java.util.HashMap; | |||||
import java.util.List; | |||||
import java.util.Map; | |||||
import java.util.stream.Collectors; | |||||
@Service | @Service | ||||
@Slf4j | @Slf4j | ||||
@@ -22,12 +35,53 @@ public class UserBasicFromServiceImpl implements UserBasicFromService { | |||||
@Autowired | @Autowired | ||||
UserBasicFromMapper userBasicFromMapper; | UserBasicFromMapper userBasicFromMapper; | ||||
@Autowired | |||||
UserBasicPropertyLogMapper userBasicPropertyLogMapper; | |||||
@Autowired | |||||
WxCUserBasicInfoMapper wxCUserBasicInfoMapper; | |||||
@Override | @Override | ||||
public PageInfo<UserBasicFrom> listAsPage(UserBasicFrom record, Integer pageIndex, Integer pageSize) { | public PageInfo<UserBasicFrom> listAsPage(UserBasicFrom record, Integer pageIndex, Integer pageSize) { | ||||
return PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> userBasicFromMapper.findList(record)); | |||||
PageInfo<UserBasicFrom> pageInfo = PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> userBasicFromMapper.findList(record)); | |||||
if(pageInfo.getList() != null && pageInfo.getList().size() > 0){ | |||||
List<Long> ids = pageInfo.getList().stream().map(from -> from.getId()).collect(Collectors.toList()); | |||||
Map<Long,WxCUserBasicInfo> cUserSimpleMap = new HashMap<Long,WxCUserBasicInfo>(); | |||||
WxCUserBasicInfo cBasicInfoQ = new WxCUserBasicInfo(); | |||||
cBasicInfoQ.setIds(ids); | |||||
List<WxCUserBasicInfo> listPhoneAndNameByIds = wxCUserBasicInfoMapper.findListPhoneAndNameByIds(cBasicInfoQ); | |||||
for (WxCUserBasicInfo user:listPhoneAndNameByIds) { | |||||
cUserSimpleMap.put(user.getId(),user); | |||||
} | |||||
Map<Long,UserBasicPropertyLog> userPropertyLogMap = new HashMap<Long,UserBasicPropertyLog>(); | |||||
UserBasicPropertyLog propertyLogQ = new UserBasicPropertyLog(); | |||||
propertyLogQ.setUserId(record.getFromUserId()); | |||||
propertyLogQ.setProjectType(record.getFromProject()); | |||||
propertyLogQ.setType(EnumPropertyLogType.INVITE.getCode()); | |||||
propertyLogQ.setExtraIds(ids); | |||||
List<UserBasicPropertyLog> propertyLogs = userBasicPropertyLogMapper.findList(propertyLogQ); | |||||
for (UserBasicPropertyLog log: propertyLogs) { | |||||
userPropertyLogMap.put(log.getExtraId(),log); | |||||
} | |||||
for (UserBasicFrom from:pageInfo.getList()) { | |||||
WxCUserBasicInfo basicInfo = cUserSimpleMap.get(from.getId()); | |||||
if(basicInfo != null){ | |||||
from.setUserPhone(basicInfo.getPhone()); | |||||
} | |||||
UserBasicPropertyLog userBasicPropertyLog = userPropertyLogMap.get(from.getId()); | |||||
if(userBasicPropertyLog != null){ | |||||
from.setGoldNum(userBasicPropertyLog.getGoldNum()); | |||||
} | |||||
} | |||||
} | |||||
return pageInfo; | |||||
} | } | ||||
@Override | @Override | ||||
@Transactional(propagation = Propagation.REQUIRED, readOnly = false, rollbackFor = {Exception.class}) | |||||
public void saveForm(UserBasicFrom from) { | public void saveForm(UserBasicFrom from) { | ||||
if(from.getId() == null){ | if(from.getId() == null){ | ||||
return; | return; | ||||
@@ -36,10 +90,13 @@ public class UserBasicFromServiceImpl implements UserBasicFromService { | |||||
try{ | try{ | ||||
int insert = userBasicFromMapper.insert(from); | int insert = userBasicFromMapper.insert(from); | ||||
if(insert == 1){ | if(insert == 1){ | ||||
logger.info("邀请加积分{}"+from.getFromUserId()); | |||||
//todo 邀请逻辑 | //todo 邀请逻辑 | ||||
} | } | ||||
}catch(Exception e){} | |||||
}catch(Exception e){ | |||||
throw new MallinkException(ErrorCode.SYS_SERVER_ERROR); | |||||
} | |||||
} | } | ||||
@@ -189,14 +189,14 @@ public class AiDigitalAvatarHelper { | |||||
// System.out.println(result); | // System.out.println(result); | ||||
// DigitalAvatarParam param = new DigitalAvatarParam(); | |||||
// param.setBg_img("style_oneface"); | |||||
// String img = Base64Util.imageUrlToBase64("https://suimang.oss-accelerate.aliyuncs.com/builtin/personmould/16760216806604820_cSHoijDX_grace_1080.jpg"); | |||||
// param.setImg_lift(img); | |||||
// param.setImg_middle("None"); | |||||
// param.setImg_right("None"); | |||||
// DigitalAvatarResult result = AiDigitalAvatarHelper.digitalAvatarPhoto(param,100001l); | |||||
// System.out.println(result); | |||||
DigitalAvatarParam param = new DigitalAvatarParam(); | |||||
param.setBg_img("style_threeface"); | |||||
String img = Base64Util.imageUrlToBase64("https://suimang.oss-accelerate.aliyuncs.com/builtin/personmould/16760216806604820_cSHoijDX_grace_1080.jpg"); | |||||
param.setImg_lift(img); | |||||
param.setImg_middle(img); | |||||
param.setImg_right(img); | |||||
DigitalAvatarResult result = AiDigitalAvatarHelper.digitalAvatarPhoto(param,100001l); | |||||
System.out.println(result); | |||||
} | } | ||||
@@ -36,6 +36,9 @@ | |||||
<if test=" null != projectType "> and `project_type` = #{projectType} </if> | <if test=" null != projectType "> and `project_type` = #{projectType} </if> | ||||
<if test=" null != type "> and `type` = #{type} </if> | <if test=" null != type "> and `type` = #{type} </if> | ||||
<if test=" null != extraId "> and `extra_id` = #{extraId} </if> | |||||
<if test=" null != startDate "> | <if test=" null != startDate "> | ||||
and `create_date` >= #{startDate} | and `create_date` >= #{startDate} | ||||
</if> | </if> | ||||
@@ -49,6 +52,13 @@ | |||||
#{idItem} | #{idItem} | ||||
</foreach> | </foreach> | ||||
</if> | </if> | ||||
<if test=" null != extraIds "> | |||||
and extra_id in | |||||
<foreach collection="extraIds" index="index" item="extIdItem" open="(" separator="," close=")"> | |||||
#{extIdItem} | |||||
</foreach> | |||||
</if> | |||||
<if test=" null != sortColumns"> order by ${sortColumns} </if> | <if test=" null != sortColumns"> order by ${sortColumns} </if> | ||||
</sql> | </sql> | ||||
@@ -46,7 +46,7 @@ | |||||
and `user_id` = #{userId} | and `user_id` = #{userId} | ||||
</if> | </if> | ||||
<if test=" null != videoStatus "> | |||||
<if test=" null != status "> | |||||
and `status` = #{status} | and `status` = #{status} | ||||
</if> | </if> | ||||
@@ -150,13 +150,10 @@ | |||||
<select id="findListPhoneAndNameByIds" parameterType="com.iformall.domain.po.WxCUserBasicInfo" resultMap="BaseResultMap"> | <select id="findListPhoneAndNameByIds" parameterType="com.iformall.domain.po.WxCUserBasicInfo" resultMap="BaseResultMap"> | ||||
select id, phone, nick_name, name, sex | select id, phone, nick_name, name, sex | ||||
from wx_c_user_basic_info wcubi | from wx_c_user_basic_info wcubi | ||||
where 1=1 | |||||
<if test=" null != ids "> | |||||
and wcubi.id in | |||||
where wcubi.id in | |||||
<foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")"> | <foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")"> | ||||
#{idItem} | #{idItem} | ||||
</foreach> | </foreach> | ||||
</if> | |||||
</select> | </select> | ||||
<select id="findIdList" parameterType="com.iformall.domain.po.WxCUserBasicInfo" resultType="Long"> | <select id="findIdList" parameterType="com.iformall.domain.po.WxCUserBasicInfo" resultType="Long"> | ||||