| @@ -40,8 +40,10 @@ CREATE TABLE `user_basic_property_log` ( | |||||
| ) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '用户创建视频记录表' ROW_FORMAT = Dynamic; | ) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '用户创建视频记录表' ROW_FORMAT = Dynamic; | ||||
| user_basic_image | |||||
| product | product | ||||
| product_order | product_order | ||||
| product_order_sharing | product_order_sharing | ||||
| digital_avatar_mould | |||||
| @@ -0,0 +1,61 @@ | |||||
| package com.iformall.controller; | |||||
| import com.github.pagehelper.PageInfo; | |||||
| import com.iformall.annotation.AuthIgnore; | |||||
| import com.iformall.common.ResultData; | |||||
| import com.iformall.domain.po.base.BaseEntity; | |||||
| import com.iformall.domain.po.sm.DigitalAvatarMould; | |||||
| import com.iformall.domain.po.sm.PersonMould; | |||||
| import com.iformall.enums.EnumaMouldPatchStatus; | |||||
| import com.iformall.service.sm.DigitalAvatarMouldService; | |||||
| import com.iformall.service.sm.MouldPatchSignService; | |||||
| import com.iformall.service.sm.PersonMouldService; | |||||
| 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/digitalAvatarMould") | |||||
| @Api(description = "模板接口") | |||||
| public class DigitalAvatarMouldController extends BaseController { | |||||
| private final Logger logger = LoggerFactory.getLogger(this.getClass()); | |||||
| @Autowired | |||||
| private DigitalAvatarMouldService digitalAvatarMouldService; | |||||
| @AuthIgnore | |||||
| @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 DigitalAvatarMould record, Integer pageNum, Integer pageSize) { | |||||
| logger.debug("[" + getIpAddr() + "] DigitalAvatarMouldController::list"); | |||||
| if (record == null) record = new DigitalAvatarMould(); | |||||
| record.setStatus(EnumaMouldPatchStatus.put_on.getCode()); | |||||
| record.setSortColumns(BaseEntity.SortField.UpdateDate_DESC); | |||||
| final PageInfo<DigitalAvatarMould> page = digitalAvatarMouldService.cListAsPage(record, pageNum, pageSize); | |||||
| return new ResultData(page); | |||||
| } | |||||
| @AuthIgnore | |||||
| @ApiOperation("根据id查询接口") | |||||
| @GetMapping("/findById") | |||||
| @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) | |||||
| public ResultData findById(Long id) { | |||||
| logger.debug("[" + getIpAddr() + "] DigitalAvatarMouldController::findById"); | |||||
| DigitalAvatarMould digitalAvatarMould = digitalAvatarMouldService.getDetailById(id); | |||||
| return new ResultData(digitalAvatarMould); | |||||
| } | |||||
| } | |||||
| @@ -0,0 +1,116 @@ | |||||
| package com.iformall.domain.po.sm; | |||||
| import com.alibaba.fastjson.JSONObject; | |||||
| import com.baomidou.mybatisplus.annotation.TableField; | |||||
| import com.baomidou.mybatisplus.annotation.TableName; | |||||
| import com.iformall.common.SortColumn; | |||||
| import com.iformall.domain.po.base.TenantEntity; | |||||
| import lombok.Data; | |||||
| import lombok.EqualsAndHashCode; | |||||
| import lombok.ToString; | |||||
| import org.apache.commons.lang3.StringUtils; | |||||
| import java.math.BigDecimal; | |||||
| import java.util.Date; | |||||
| import java.util.List; | |||||
| @TableName(value = "digital_avatar_mould") | |||||
| @Data | |||||
| @ToString(callSuper = true) | |||||
| @EqualsAndHashCode(callSuper = true) | |||||
| public class DigitalAvatarMould extends TenantEntity { | |||||
| protected Long id; | |||||
| @TableField(exist = false) | |||||
| @SortColumn(column = "sale_price") | |||||
| private String salePriceStr; | |||||
| @TableField(exist = false) | |||||
| @SortColumn(column = "price") | |||||
| private String priceStr; | |||||
| @TableField(exist = false) | |||||
| @io.swagger.annotations.ApiModelProperty(value="查询-起始时间",name="startDate") | |||||
| private Date startDate; | |||||
| @TableField(exist = false) | |||||
| @io.swagger.annotations.ApiModelProperty(value="查询-结束时间",name="endDate") | |||||
| private Date endDate; | |||||
| @io.swagger.annotations.ApiModelProperty(value="封面图",name="coverImg") | |||||
| private String coverImg; | |||||
| @io.swagger.annotations.ApiModelProperty(value="多封面图",name="coverPicture") | |||||
| private String coverPicture; | |||||
| @io.swagger.annotations.ApiModelProperty(value="详情多图",name="detailPicture") | |||||
| private String detailPicture; | |||||
| @io.swagger.annotations.ApiModelProperty(value="名称",name="title") | |||||
| private String title; | |||||
| @io.swagger.annotations.ApiModelProperty(value="副标题",name="subTitle") | |||||
| private String subTitle; | |||||
| @io.swagger.annotations.ApiModelProperty(value="标签",name="sceneSign") | |||||
| private String sceneSign; | |||||
| @TableField(exist = false) | |||||
| private List<Long> sceneSignList; | |||||
| public List<Long> getSceneSignList(){ | |||||
| if(StringUtils.isNotBlank(this.getSceneSign())){ | |||||
| try{ | |||||
| List<Long> longs = JSONObject.parseArray(this.getSceneSign(), Long.class); | |||||
| if(longs != null && longs.size() > 0){ | |||||
| return longs; | |||||
| } | |||||
| }catch(Exception e){ | |||||
| } | |||||
| } | |||||
| return null; | |||||
| } | |||||
| @TableField(exist = false) | |||||
| private List<MouldPatchSign> mouldPatchSign; | |||||
| @io.swagger.annotations.ApiModelProperty(value="售价",name="salePrice") | |||||
| private Integer salePrice; | |||||
| @io.swagger.annotations.ApiModelProperty(value="须知",name="detail") | |||||
| private String detail; | |||||
| @io.swagger.annotations.ApiModelProperty(value="原价",name="price") | |||||
| private Integer price; | |||||
| @io.swagger.annotations.ApiModelProperty(value="购买须知",name="remark") | |||||
| private String remark; | |||||
| @io.swagger.annotations.ApiModelProperty(value="模板第三方Id",name="mouldSmId") | |||||
| private String mouldSmId; | |||||
| @io.swagger.annotations.ApiModelProperty(value="EnumaMouldPatchStatus 状态",name="status") | |||||
| private Integer status; | |||||
| @io.swagger.annotations.ApiModelProperty(value="上架时间",name="putonDate") | |||||
| private Date putonDate; | |||||
| @io.swagger.annotations.ApiModelProperty(value="创建时间",name="createDate") | |||||
| private Date createDate; | |||||
| @io.swagger.annotations.ApiModelProperty(value="更新时间",name="updateDate") | |||||
| private Date updateDate; | |||||
| public String getSalePriceStr() { | |||||
| if(salePrice!=null) { | |||||
| salePriceStr = new BigDecimal(salePrice).divide(new BigDecimal(100)).toString(); | |||||
| } | |||||
| return salePriceStr; | |||||
| } | |||||
| public String getPriceStr() { | |||||
| if(price!=null) { | |||||
| priceStr = new BigDecimal(price).divide(new BigDecimal(100)).toString(); | |||||
| } | |||||
| return priceStr; | |||||
| } | |||||
| } | |||||
| @@ -15,7 +15,8 @@ public enum EnumMouldPatchType { | |||||
| // body_mould(3, "身体模板"), | // body_mould(3, "身体模板"), | ||||
| background_mould(4, "背景"), | background_mould(4, "背景"), | ||||
| material_mould(5, "素材"), | material_mould(5, "素材"), | ||||
| person_photo(6, "人物照片"), | |||||
| person_photo_mould(6, "人物照片"), | |||||
| digital_avatar_mould(7, "数字人分身"), | |||||
| ; | ; | ||||
| public static EnumMouldPatchType getEnum(Integer code) { | public static EnumMouldPatchType getEnum(Integer code) { | ||||
| @@ -0,0 +1,22 @@ | |||||
| package com.iformall.mapper; | |||||
| import com.iformall.common.CommonMapper; | |||||
| import com.iformall.domain.po.sm.DigitalAvatarMould; | |||||
| import org.apache.ibatis.annotations.Param; | |||||
| import java.util.List; | |||||
| public interface DigitalAvatarMouldMapper extends CommonMapper<DigitalAvatarMould, Long> { | |||||
| List<DigitalAvatarMould> findList(DigitalAvatarMould record); | |||||
| int deleteById(@Param("id")Long id); | |||||
| /** | |||||
| * c端列表查询,尽量减少字段 | |||||
| * @param record | |||||
| * @return | |||||
| */ | |||||
| List<DigitalAvatarMould> findCList(DigitalAvatarMould record); | |||||
| } | |||||
| @@ -837,7 +837,7 @@ public class WxCUserBasicInfoServiceImpl implements WxCUserBasicInfoService,IExc | |||||
| basicInfo.setUpdateDate(basicInfoUpd.getUpdateDate()); | basicInfo.setUpdateDate(basicInfoUpd.getUpdateDate()); | ||||
| String key = Constant.tokenPrev + basicInfo.getToken(); | String key = Constant.tokenPrev + basicInfo.getToken(); | ||||
| RedisCacheUtils.cache(redisTemplate, key, basicInfo, Constant.H_EXPIRE); | |||||
| RedisCacheUtils.cache(redisTemplate, key, basicInfo, Constant.EXPIRE); | |||||
| } | } | ||||
| @Override | @Override | ||||
| @@ -852,8 +852,8 @@ public class WxCUserBasicInfoServiceImpl implements WxCUserBasicInfoService,IExc | |||||
| Long expire = RedisCacheUtils.getExpire(redisTemplate, key); | Long expire = RedisCacheUtils.getExpire(redisTemplate, key); | ||||
| if(expire != null && expire.longValue() > 60l){ | if(expire != null && expire.longValue() > 60l){ | ||||
| WxCUserBasicInfo basicInfo = RedisCacheUtils.getCacheObject(redisTemplate, key, WxCUserBasicInfo.class); | WxCUserBasicInfo basicInfo = RedisCacheUtils.getCacheObject(redisTemplate, key, WxCUserBasicInfo.class); | ||||
| if(expire.longValue() < 1800l){//小于30分钟续签一小时 | |||||
| RedisCacheUtils.cache(redisTemplate, key, basicInfo, Constant.H_EXPIRE); | |||||
| if(expire.longValue() < 36000l){//续签 10*60*60 | |||||
| RedisCacheUtils.cache(redisTemplate, key, basicInfo, Constant.EXPIRE); | |||||
| } | } | ||||
| return basicInfo; | return basicInfo; | ||||
| } | } | ||||
| @@ -0,0 +1,45 @@ | |||||
| package com.iformall.service.sm; | |||||
| import com.github.pagehelper.PageInfo; | |||||
| import com.iformall.common.ResultData; | |||||
| import com.iformall.domain.po.sm.DigitalAvatarMould; | |||||
| public interface DigitalAvatarMouldService { | |||||
| /** | |||||
| * 根据实体查询分页列表 | |||||
| * | |||||
| * @param record | |||||
| * @param pageIndex | |||||
| * @param pageSize | |||||
| * @return | |||||
| */ | |||||
| PageInfo<DigitalAvatarMould> listAsPage(DigitalAvatarMould record, Integer pageIndex, Integer pageSize); | |||||
| PageInfo<DigitalAvatarMould> cListAsPage(DigitalAvatarMould record, Integer pageIndex, Integer pageSize); | |||||
| /** | |||||
| * 根据Id获得实体 | |||||
| * | |||||
| * @param id | |||||
| * @return | |||||
| */ | |||||
| DigitalAvatarMould getById(Long id); | |||||
| DigitalAvatarMould getDetailById(Long id); | |||||
| /** | |||||
| * 保存或更新实体 | |||||
| * | |||||
| * @param record | |||||
| */ | |||||
| ResultData saveOrUpdate(DigitalAvatarMould record); | |||||
| /** | |||||
| * 根据Id删除实体 | |||||
| * | |||||
| * @param id | |||||
| */ | |||||
| void deleteById(Long id); | |||||
| void updateOnline(DigitalAvatarMould record); | |||||
| } | |||||
| @@ -0,0 +1,111 @@ | |||||
| package com.iformall.service.sm.impl; | |||||
| import com.github.pagehelper.PageHelper; | |||||
| import com.github.pagehelper.PageInfo; | |||||
| import com.iformall.common.IdWorker; | |||||
| import com.iformall.common.ResultData; | |||||
| import com.iformall.domain.po.sm.DigitalAvatarMould; | |||||
| import com.iformall.domain.po.sm.MouldPatchSign; | |||||
| import com.iformall.enums.EnumaMouldPatchStatus; | |||||
| import com.iformall.mapper.DigitalAvatarMouldMapper; | |||||
| import com.iformall.service.sm.DigitalAvatarMouldService; | |||||
| import com.iformall.service.sm.MouldPatchSignService; | |||||
| import org.apache.commons.lang3.StringUtils; | |||||
| import org.slf4j.Logger; | |||||
| import org.slf4j.LoggerFactory; | |||||
| import org.springframework.beans.factory.annotation.Autowired; | |||||
| import org.springframework.stereotype.Service; | |||||
| import java.math.BigDecimal; | |||||
| import java.util.Date; | |||||
| import java.util.List; | |||||
| @Service | |||||
| public class DigitalAvatarMouldServiceImpl implements DigitalAvatarMouldService { | |||||
| private final Logger logger = LoggerFactory.getLogger(this.getClass()); | |||||
| @Autowired | |||||
| DigitalAvatarMouldMapper digitalAvatarMouldMapper; | |||||
| @Autowired | |||||
| MouldPatchSignService mouldPatchSignService; | |||||
| @Override | |||||
| public PageInfo<DigitalAvatarMould> listAsPage(DigitalAvatarMould record, Integer pageIndex, Integer pageSize) { | |||||
| return PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> digitalAvatarMouldMapper.findList(record)); | |||||
| } | |||||
| @Override | |||||
| public PageInfo<DigitalAvatarMould> cListAsPage(DigitalAvatarMould record, Integer pageIndex, Integer pageSize) { | |||||
| return PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> digitalAvatarMouldMapper.findCList(record)); | |||||
| } | |||||
| @Override | |||||
| public DigitalAvatarMould getById(Long id) { | |||||
| return digitalAvatarMouldMapper.selectById(id); | |||||
| } | |||||
| @Override | |||||
| public DigitalAvatarMould getDetailById(Long id) { | |||||
| DigitalAvatarMould digitalAvatarMould = getById(id); | |||||
| if(digitalAvatarMould == null){ | |||||
| return null; | |||||
| } | |||||
| if(digitalAvatarMould.getSceneSignList() != null && !digitalAvatarMould.getSceneSignList().isEmpty()){ | |||||
| MouldPatchSign signQ = new MouldPatchSign(); | |||||
| signQ.setIds(digitalAvatarMould.getSceneSignList()); | |||||
| List<MouldPatchSign> signList = mouldPatchSignService.getList(signQ); | |||||
| digitalAvatarMould.setMouldPatchSign(signList); | |||||
| } | |||||
| return digitalAvatarMould; | |||||
| } | |||||
| @Override | |||||
| public ResultData saveOrUpdate(DigitalAvatarMould record) { | |||||
| //金额处理 | |||||
| if (StringUtils.isNotEmpty(record.getSalePriceStr())) { | |||||
| record.setSalePrice(new BigDecimal(record.getSalePriceStr()).multiply(new BigDecimal(100)).intValue()); | |||||
| } | |||||
| if (StringUtils.isNotEmpty(record.getPriceStr())) { | |||||
| record.setPrice(new BigDecimal(record.getPriceStr()).multiply(new BigDecimal(100)).intValue()); | |||||
| } | |||||
| Date now = new Date(); | |||||
| if (record.getId() == null) { | |||||
| //record.setId(UUID.randomUUID().toString().replaceAll("-", "")); | |||||
| final IdWorker idWorker = IdWorker.get(); | |||||
| record.setId(idWorker.nextId()); | |||||
| if(record.getStatus() == null){ | |||||
| record.setStatus(EnumaMouldPatchStatus.draft.getCode()); | |||||
| } | |||||
| record.setCreateDate(now); | |||||
| record.setUpdateDate(now); | |||||
| digitalAvatarMouldMapper.insert(record); | |||||
| } else { | |||||
| record.setUpdateDate(now); | |||||
| digitalAvatarMouldMapper.updateById(record); | |||||
| } | |||||
| return new ResultData(); | |||||
| } | |||||
| @Override | |||||
| public void deleteById(Long id) { | |||||
| digitalAvatarMouldMapper.deleteById(id); | |||||
| } | |||||
| @Override | |||||
| public void updateOnline(DigitalAvatarMould record) { | |||||
| Date now = new Date(); | |||||
| DigitalAvatarMould digitalAvatarMouldUpd = new DigitalAvatarMould(); | |||||
| digitalAvatarMouldUpd.setId(record.getId()); | |||||
| digitalAvatarMouldUpd.setStatus(record.getStatus()); | |||||
| if(EnumaMouldPatchStatus.put_on.getCode().equals(digitalAvatarMouldUpd.getStatus())){ | |||||
| digitalAvatarMouldUpd.setPutonDate(now); | |||||
| } | |||||
| digitalAvatarMouldUpd.setUpdateDate(now); | |||||
| digitalAvatarMouldMapper.updateById(digitalAvatarMouldUpd); | |||||
| } | |||||
| } | |||||
| @@ -0,0 +1,108 @@ | |||||
| <?xml version="1.0" encoding="UTF-8"?> | |||||
| <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | |||||
| <mapper namespace="com.iformall.mapper.DigitalAvatarMouldMapper"> | |||||
| <resultMap id="BaseResultMap" type="com.iformall.domain.po.sm.DigitalAvatarMould"> | |||||
| <id column="id" jdbcType="BIGINT" property="id"/> | |||||
| <result column="tenant_id" jdbcType="VARCHAR" property="tenantId"/> | |||||
| <result column="parent_tenant_id" jdbcType="VARCHAR" property="parentTenantId" /> | |||||
| <result column="cover_img" jdbcType="VARCHAR" property="coverImg"/> | |||||
| <result column="cover_picture" jdbcType="VARCHAR" property="coverPicture"/> | |||||
| <result column="detail_picture" jdbcType="VARCHAR" property="detailPicture"/> | |||||
| <result column="title" jdbcType="VARCHAR" property="title"/> | |||||
| <result column="sub_title" jdbcType="VARCHAR" property="subTitle"/> | |||||
| <result column="scene_sign" jdbcType="VARCHAR" property="sceneSign"/> | |||||
| <result column="sale_price" jdbcType="INTEGER" property="salePrice"/> | |||||
| <result column="price" jdbcType="INTEGER" property="price"/> | |||||
| <result column="detail" jdbcType="VARCHAR" property="detail"/> | |||||
| <result column="remark" jdbcType="VARCHAR" property="remark"/> | |||||
| <result column="mould_sm_id" jdbcType="VARCHAR" property="mouldSmId"/> | |||||
| <result column="status" jdbcType="INTEGER" property="status"/> | |||||
| <result column="puton_date" jdbcType="TIMESTAMP" property="putonDate"/> | |||||
| <result column="create_date" jdbcType="TIMESTAMP" property="createDate"/> | |||||
| <result column="update_date" jdbcType="TIMESTAMP" property="updateDate"/> | |||||
| </resultMap> | |||||
| <sql id="allColumns"> | |||||
| `id`, `tenant_id`, `parent_tenant_id`, `cover_img`, `cover_picture`, `detail_picture`, | |||||
| `title`, `sub_title`, `scene_sign`, `sale_price`, `price`, | |||||
| `detail`, `remark`, `mould_sm_id`, | |||||
| `status`, `puton_date`, `create_date`, `update_date` | |||||
| </sql> | |||||
| <sql id="dynamicWhereConditions"> | |||||
| where `is_del` = 0 | |||||
| <if test=" null != id "> | |||||
| and `id` = #{id} | |||||
| </if> | |||||
| <if test=" null != tenantId and '' != tenantId"> | |||||
| and `tenant_id` = #{tenantId} | |||||
| </if> | |||||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||||
| and `parent_tenant_id` = #{parentTenantId} | |||||
| </if> | |||||
| <if test=" null != title and ''!=title"> | |||||
| and `title` like concat('%', #{title},'%') | |||||
| </if> | |||||
| <if test=" null != subTitle "> | |||||
| and `sub_title` like concat('%', #{subTitle},'%') | |||||
| </if> | |||||
| <if test=" null != sceneSign and '' != sceneSign"> | |||||
| and JSON_CONTAINS(scene_sign,json_array(#{sceneSign})) | |||||
| </if> | |||||
| <if test=" null != salePrice "> | |||||
| and `sale_price` = #{salePrice} | |||||
| </if> | |||||
| <if test=" null != price "> | |||||
| and `price` = #{price} | |||||
| </if> | |||||
| <if test=" null != status"> | |||||
| and `status` = #{status} | |||||
| </if> | |||||
| <if test=" null != startDate "> | |||||
| and create_date >= #{startDate} | |||||
| </if> | |||||
| <if test=" null != endDate"> | |||||
| and create_date < #{endDate} | |||||
| </if> | |||||
| <if test=" null != ids "> | |||||
| and id in | |||||
| <foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")"> | |||||
| #{idItem} | |||||
| </foreach> | |||||
| </if> | |||||
| <if test=" null != sortColumns">order by ${sortColumns}</if> | |||||
| </sql> | |||||
| <select id="findList" parameterType="com.iformall.domain.po.sm.DigitalAvatarMould" resultMap="BaseResultMap"> | |||||
| select | |||||
| <include refid="allColumns"/> | |||||
| from digital_avatar_mould | |||||
| <include refid="dynamicWhereConditions"/> | |||||
| </select> | |||||
| <delete id="deleteById" parameterType="java.util.HashMap"> | |||||
| update digital_avatar_mould set is_del = 1,update_date = now() where id = #{id} | |||||
| </delete> | |||||
| <select id="findCList" parameterType="com.iformall.domain.po.sm.DigitalAvatarMould" resultMap="BaseResultMap"> | |||||
| select | |||||
| `id`, `cover_img`, `cover_picture`, | |||||
| `title`, `sub_title`, `scene_sign`, `sale_price`, `price`, | |||||
| `mould_sm_id`, | |||||
| `status`, `create_date`, `update_date` | |||||
| from digital_avatar_mould | |||||
| <include refid="dynamicWhereConditions"/> | |||||
| </select> | |||||
| </mapper> | |||||