@@ -1,144 +1,144 @@ | |||
package com.iformall.controller.sm; | |||
import com.alibaba.fastjson.JSONArray; | |||
import com.github.pagehelper.PageInfo; | |||
import com.iformall.annotation.SystemControllerLog; | |||
import com.iformall.common.ErrorCode; | |||
import com.iformall.common.Result; | |||
import com.iformall.common.ResultData; | |||
import com.iformall.controller.base.BaseController; | |||
import com.iformall.domain.po.WxCouponChannel; | |||
import com.iformall.domain.po.WxGame; | |||
import com.iformall.domain.po.base.BaseEntity; | |||
import com.iformall.domain.po.sm.MouldPatch; | |||
import com.iformall.domain.po.sm.MouldPatchSign; | |||
import com.iformall.enums.EnumGameStatus; | |||
import com.iformall.service.sm.MouldPatchService; | |||
import com.iformall.service.sm.MouldPatchSignService; | |||
import com.iformall.service.util.CouponCacheUtils; | |||
import io.swagger.annotations.Api; | |||
import io.swagger.annotations.ApiImplicitParam; | |||
import io.swagger.annotations.ApiImplicitParams; | |||
import io.swagger.annotations.ApiOperation; | |||
import org.apache.commons.lang3.StringUtils; | |||
import org.slf4j.Logger; | |||
import org.slf4j.LoggerFactory; | |||
import org.springframework.beans.factory.annotation.Autowired; | |||
import org.springframework.web.bind.annotation.*; | |||
import java.util.List; | |||
@RestController | |||
@RequestMapping("mouldPatch") | |||
@Api(description = "模板接口") | |||
public class MouldPatchController extends BaseController { | |||
private final Logger logger = LoggerFactory.getLogger(this.getClass()); | |||
@Autowired | |||
private MouldPatchService mouldPatchService; | |||
@Autowired | |||
private MouldPatchSignService mouldPatchSignService; | |||
@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 MouldPatch record, Integer pageNum, Integer pageSize) { | |||
logger.debug("[" + getIpAddr() + "] MouldPatchController::list"); | |||
if (record == null) record = new MouldPatch(); | |||
record.setSortColumns(BaseEntity.SortField.UpdateDate_DESC); | |||
final PageInfo<MouldPatch> page = mouldPatchService.listAsPage(record, pageNum, pageSize); | |||
return new ResultData(page); | |||
} | |||
@ApiOperation("新增接口") | |||
@PostMapping("saveOrUpdate") | |||
@SystemControllerLog(description = "-新增") | |||
public ResultData saveOrUpdate(@RequestBody MouldPatch record) { | |||
logger.debug("[" + getIpAddr() + "] MouldPatchController::saveOrUpdate"); | |||
record.updateTenantInfo(getTenantInfo()); | |||
if(record.getType() == null){ | |||
return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(),"模板类型为空"); | |||
} | |||
mouldPatchService.saveOrUpdate(record); | |||
return new ResultData(); | |||
} | |||
@ApiOperation("上/下架") | |||
@PostMapping("updateOnline") | |||
@SystemControllerLog(description = "上/下架") | |||
public ResultData updateOnline(@RequestBody MouldPatch record) { | |||
logger.debug("[" + getIpAddr() + "] MouldPatchController::updateOnline"); | |||
if(record.getId() == null){ | |||
return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(),"ID为空"); | |||
} | |||
if(record.getStatus() == null){ | |||
return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(),"状态为空"); | |||
} | |||
mouldPatchService.updateOnline(record); | |||
return new ResultData(); | |||
} | |||
@ApiOperation("根据id删除接口") | |||
@GetMapping("/del") | |||
@ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) | |||
@SystemControllerLog(description = "删除") | |||
public ResultData delete(Long id) { | |||
logger.debug("[" + getIpAddr() + "] MouldPatchController::delete"); | |||
mouldPatchService.deleteById(id); | |||
return new ResultData(); | |||
} | |||
@ApiOperation("根据id查询接口") | |||
@GetMapping("/findById") | |||
@ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) | |||
@SystemControllerLog(description = "查询") | |||
public ResultData findById(Long id) { | |||
logger.debug("[" + getIpAddr() + "] MouldPatchController::findById"); | |||
MouldPatch mouldPatch = mouldPatchService.getById(id); | |||
if(mouldPatch.getSceneSignList() != null && !mouldPatch.getSceneSignList().isEmpty()){ | |||
MouldPatchSign signQ = new MouldPatchSign(); | |||
signQ.setIds(mouldPatch.getSceneSignList()); | |||
List<MouldPatchSign> signList = mouldPatchSignService.getList(signQ); | |||
mouldPatch.setMouldPatchSign(signList); | |||
} | |||
return new ResultData(mouldPatch); | |||
} | |||
@ApiOperation("列表接口") | |||
@GetMapping("signlist") | |||
@ApiImplicitParams({}) | |||
public ResultData signlist(@ModelAttribute MouldPatchSign record, Integer pageNum, Integer pageSize) { | |||
logger.debug("[" + getIpAddr() + "] MouldPatchController::signlist"); | |||
if (record == null) record = new MouldPatchSign(); | |||
record.setSortColumns(BaseEntity.SortField.UpdateDate_DESC); | |||
final PageInfo<MouldPatchSign> page = mouldPatchSignService.listAsPage(record, pageNum, pageSize); | |||
return new ResultData(page); | |||
} | |||
@ApiOperation("新增接口") | |||
@PostMapping("saveOrUpdateSign") | |||
@SystemControllerLog(description = "-新增") | |||
public ResultData saveOrUpdateSign(@RequestBody MouldPatchSign record) { | |||
logger.debug("[" + getIpAddr() + "] MouldPatchController::saveOrUpdateSign"); | |||
if(StringUtils.isBlank(record.getTitle())){ | |||
return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(),"标签为空"); | |||
} | |||
mouldPatchSignService.saveOrUpdate(record); | |||
return new ResultData(); | |||
} | |||
@ApiOperation("根据id删除接口") | |||
@GetMapping("/signDel") | |||
@ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) | |||
@SystemControllerLog(description = "删除") | |||
public ResultData signDel(Long id) { | |||
logger.debug("[" + getIpAddr() + "] MouldPatchController::signDel"); | |||
mouldPatchSignService.deleteById(id); | |||
return new ResultData(); | |||
} | |||
} | |||
//package com.iformall.controller.sm; | |||
// | |||
//import com.alibaba.fastjson.JSONArray; | |||
//import com.github.pagehelper.PageInfo; | |||
//import com.iformall.annotation.SystemControllerLog; | |||
//import com.iformall.common.ErrorCode; | |||
//import com.iformall.common.Result; | |||
//import com.iformall.common.ResultData; | |||
//import com.iformall.controller.base.BaseController; | |||
//import com.iformall.domain.po.WxCouponChannel; | |||
//import com.iformall.domain.po.WxGame; | |||
//import com.iformall.domain.po.base.BaseEntity; | |||
//import com.iformall.domain.po.sm.MouldPatch; | |||
//import com.iformall.domain.po.sm.MouldPatchSign; | |||
//import com.iformall.enums.EnumGameStatus; | |||
//import com.iformall.service.sm.MouldPatchService; | |||
//import com.iformall.service.sm.MouldPatchSignService; | |||
//import com.iformall.service.util.CouponCacheUtils; | |||
//import io.swagger.annotations.Api; | |||
//import io.swagger.annotations.ApiImplicitParam; | |||
//import io.swagger.annotations.ApiImplicitParams; | |||
//import io.swagger.annotations.ApiOperation; | |||
//import org.apache.commons.lang3.StringUtils; | |||
//import org.slf4j.Logger; | |||
//import org.slf4j.LoggerFactory; | |||
//import org.springframework.beans.factory.annotation.Autowired; | |||
//import org.springframework.web.bind.annotation.*; | |||
// | |||
//import java.util.List; | |||
// | |||
// | |||
//@RestController | |||
//@RequestMapping("mouldPatch") | |||
//@Api(description = "模板接口") | |||
//public class MouldPatchController extends BaseController { | |||
// private final Logger logger = LoggerFactory.getLogger(this.getClass()); | |||
// | |||
// @Autowired | |||
// private MouldPatchService mouldPatchService; | |||
// | |||
// @Autowired | |||
// private MouldPatchSignService mouldPatchSignService; | |||
// | |||
// @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 MouldPatch record, Integer pageNum, Integer pageSize) { | |||
// logger.debug("[" + getIpAddr() + "] MouldPatchController::list"); | |||
// if (record == null) record = new MouldPatch(); | |||
// record.setSortColumns(BaseEntity.SortField.UpdateDate_DESC); | |||
// final PageInfo<MouldPatch> page = mouldPatchService.listAsPage(record, pageNum, pageSize); | |||
// return new ResultData(page); | |||
// } | |||
// | |||
// @ApiOperation("新增接口") | |||
// @PostMapping("saveOrUpdate") | |||
// @SystemControllerLog(description = "-新增") | |||
// public ResultData saveOrUpdate(@RequestBody MouldPatch record) { | |||
// logger.debug("[" + getIpAddr() + "] MouldPatchController::saveOrUpdate"); | |||
// record.updateTenantInfo(getTenantInfo()); | |||
// if(record.getType() == null){ | |||
// return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(),"模板类型为空"); | |||
// } | |||
// mouldPatchService.saveOrUpdate(record); | |||
// return new ResultData(); | |||
// } | |||
// | |||
// @ApiOperation("上/下架") | |||
// @PostMapping("updateOnline") | |||
// @SystemControllerLog(description = "上/下架") | |||
// public ResultData updateOnline(@RequestBody MouldPatch record) { | |||
// logger.debug("[" + getIpAddr() + "] MouldPatchController::updateOnline"); | |||
// if(record.getId() == null){ | |||
// return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(),"ID为空"); | |||
// } | |||
// if(record.getStatus() == null){ | |||
// return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(),"状态为空"); | |||
// } | |||
// mouldPatchService.updateOnline(record); | |||
// return new ResultData(); | |||
// } | |||
// | |||
// @ApiOperation("根据id删除接口") | |||
// @GetMapping("/del") | |||
// @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) | |||
// @SystemControllerLog(description = "删除") | |||
// public ResultData delete(Long id) { | |||
// logger.debug("[" + getIpAddr() + "] MouldPatchController::delete"); | |||
// mouldPatchService.deleteById(id); | |||
// return new ResultData(); | |||
// } | |||
// | |||
// @ApiOperation("根据id查询接口") | |||
// @GetMapping("/findById") | |||
// @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) | |||
// @SystemControllerLog(description = "查询") | |||
// public ResultData findById(Long id) { | |||
// logger.debug("[" + getIpAddr() + "] MouldPatchController::findById"); | |||
// MouldPatch mouldPatch = mouldPatchService.getById(id); | |||
// if(mouldPatch.getSceneSignList() != null && !mouldPatch.getSceneSignList().isEmpty()){ | |||
// MouldPatchSign signQ = new MouldPatchSign(); | |||
// signQ.setIds(mouldPatch.getSceneSignList()); | |||
// List<MouldPatchSign> signList = mouldPatchSignService.getList(signQ); | |||
// mouldPatch.setMouldPatchSign(signList); | |||
// } | |||
// return new ResultData(mouldPatch); | |||
// } | |||
// | |||
// @ApiOperation("列表接口") | |||
// @GetMapping("signlist") | |||
// @ApiImplicitParams({}) | |||
// public ResultData signlist(@ModelAttribute MouldPatchSign record, Integer pageNum, Integer pageSize) { | |||
// logger.debug("[" + getIpAddr() + "] MouldPatchController::signlist"); | |||
// if (record == null) record = new MouldPatchSign(); | |||
// record.setSortColumns(BaseEntity.SortField.UpdateDate_DESC); | |||
// final PageInfo<MouldPatchSign> page = mouldPatchSignService.listAsPage(record, pageNum, pageSize); | |||
// return new ResultData(page); | |||
// } | |||
// | |||
// @ApiOperation("新增接口") | |||
// @PostMapping("saveOrUpdateSign") | |||
// @SystemControllerLog(description = "-新增") | |||
// public ResultData saveOrUpdateSign(@RequestBody MouldPatchSign record) { | |||
// logger.debug("[" + getIpAddr() + "] MouldPatchController::saveOrUpdateSign"); | |||
// if(StringUtils.isBlank(record.getTitle())){ | |||
// return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(),"标签为空"); | |||
// } | |||
// mouldPatchSignService.saveOrUpdate(record); | |||
// return new ResultData(); | |||
// } | |||
// | |||
// @ApiOperation("根据id删除接口") | |||
// @GetMapping("/signDel") | |||
// @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) | |||
// @SystemControllerLog(description = "删除") | |||
// public ResultData signDel(Long id) { | |||
// logger.debug("[" + getIpAddr() + "] MouldPatchController::signDel"); | |||
// mouldPatchSignService.deleteById(id); | |||
// return new ResultData(); | |||
// } | |||
// | |||
//} |
@@ -1,102 +1,102 @@ | |||
package com.iformall.controller; | |||
import com.github.pagehelper.PageInfo; | |||
import com.iformall.common.ErrorCode; | |||
import com.iformall.common.ResultData; | |||
import com.iformall.domain.po.base.BaseEntity; | |||
import com.iformall.domain.po.sm.MouldPatch; | |||
import com.iformall.domain.po.sm.MouldPatchSign; | |||
import com.iformall.domain.po.sm.UserMouldVideo; | |||
import com.iformall.enums.*; | |||
import com.iformall.language.LanguageDetect; | |||
import com.iformall.service.sm.MouldPatchService; | |||
import com.iformall.service.sm.MouldPatchSignService; | |||
import io.swagger.annotations.Api; | |||
import io.swagger.annotations.ApiImplicitParam; | |||
import io.swagger.annotations.ApiImplicitParams; | |||
import io.swagger.annotations.ApiOperation; | |||
import org.apache.commons.lang3.StringUtils; | |||
import org.slf4j.Logger; | |||
import org.slf4j.LoggerFactory; | |||
import org.springframework.beans.factory.annotation.Autowired; | |||
import org.springframework.web.bind.annotation.*; | |||
import java.util.List; | |||
@RestController | |||
@RequestMapping("/api/mouldPatch") | |||
@Api(description = "模板接口") | |||
public class MouldPatchController extends BaseController { | |||
private final Logger logger = LoggerFactory.getLogger(this.getClass()); | |||
@Autowired | |||
private MouldPatchService mouldPatchService; | |||
@Autowired | |||
private MouldPatchSignService mouldPatchSignService; | |||
@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 MouldPatch record, Integer pageNum, Integer pageSize) { | |||
logger.debug("[" + getIpAddr() + "] MouldPatchController::list"); | |||
if (record == null) record = new MouldPatch(); | |||
record.setSendType(EnumMouldSendType.auto.getCode()); | |||
record.setStatus(EnumaMouldPatchStatus.put_on.getCode()); | |||
record.setSortColumns(BaseEntity.SortField.UpdateDate_DESC); | |||
final PageInfo<MouldPatch> page = mouldPatchService.cListAsPage(record, pageNum, pageSize); | |||
return new ResultData(page); | |||
} | |||
@ApiOperation("根据id查询接口") | |||
@GetMapping("/findById") | |||
@ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) | |||
public ResultData findById(Long id) { | |||
logger.debug("[" + getIpAddr() + "] MouldPatchController::findById"); | |||
MouldPatch mouldPatch = mouldPatchService.getDetailById(id); | |||
return new ResultData(mouldPatch); | |||
} | |||
@ApiOperation("根据输入文案获取音色") | |||
@PostMapping("voiceList") | |||
@ApiImplicitParams({ | |||
@ApiImplicitParam(name = "pageNum", value = "页数", dataType = "int", paramType = "query", required = true), | |||
@ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "int", paramType = "query", required = true)}) | |||
public ResultData voiceList(@RequestBody UserMouldVideo record, Integer pageNum, Integer pageSize) { | |||
logger.debug("[" + getIpAddr() + "] MouldPatchController::voiceList"); | |||
if (record == null || StringUtils.isBlank(record.getPaperwork())) { | |||
return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL); | |||
} | |||
Integer sex = null; | |||
if(record.getPersonMouldId() != null){ | |||
MouldPatch personMode = mouldPatchService.getDetailById(record.getPersonMouldId()); | |||
if(personMode == null){ | |||
return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(),"选择模板不存在"); | |||
} | |||
sex = personMode.getSex(); | |||
} | |||
String detect = LanguageDetect.detect(record.getPaperwork()); | |||
if(StringUtils.isBlank(detect)){ | |||
return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(),"语种识别失败"); | |||
} | |||
EnumLanguages anEnum = EnumLanguages.getEnum(detect); | |||
if(anEnum == null){ | |||
return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(),"暂不支持该语种"); | |||
} | |||
MouldPatch mouldPatch = new MouldPatch(); | |||
mouldPatch.setSex(sex); | |||
mouldPatch.setType(EnumMouldPatchType.voice_mould.getCode()); | |||
mouldPatch.setSendType(EnumMouldSendType.auto.getCode()); | |||
mouldPatch.setStatus(EnumaMouldPatchStatus.put_on.getCode()); | |||
mouldPatch.setLanguages(anEnum.getCode()); | |||
mouldPatch.setSortColumns(BaseEntity.SortField.UpdateDate_DESC); | |||
final PageInfo<MouldPatch> page = mouldPatchService.cListAsPage(mouldPatch, pageNum, pageSize); | |||
return new ResultData(page); | |||
} | |||
} | |||
//package com.iformall.controller; | |||
// | |||
//import com.github.pagehelper.PageInfo; | |||
//import com.iformall.common.ErrorCode; | |||
//import com.iformall.common.ResultData; | |||
//import com.iformall.domain.po.base.BaseEntity; | |||
//import com.iformall.domain.po.sm.MouldPatch; | |||
//import com.iformall.domain.po.sm.MouldPatchSign; | |||
//import com.iformall.domain.po.sm.UserMouldVideo; | |||
//import com.iformall.enums.*; | |||
//import com.iformall.language.LanguageDetect; | |||
//import com.iformall.service.sm.MouldPatchService; | |||
//import com.iformall.service.sm.MouldPatchSignService; | |||
//import io.swagger.annotations.Api; | |||
//import io.swagger.annotations.ApiImplicitParam; | |||
//import io.swagger.annotations.ApiImplicitParams; | |||
//import io.swagger.annotations.ApiOperation; | |||
//import org.apache.commons.lang3.StringUtils; | |||
//import org.slf4j.Logger; | |||
//import org.slf4j.LoggerFactory; | |||
//import org.springframework.beans.factory.annotation.Autowired; | |||
//import org.springframework.web.bind.annotation.*; | |||
// | |||
//import java.util.List; | |||
// | |||
// | |||
//@RestController | |||
//@RequestMapping("/api/mouldPatch") | |||
//@Api(description = "模板接口") | |||
//public class MouldPatchController extends BaseController { | |||
// private final Logger logger = LoggerFactory.getLogger(this.getClass()); | |||
// | |||
// @Autowired | |||
// private MouldPatchService mouldPatchService; | |||
// | |||
// @Autowired | |||
// private MouldPatchSignService mouldPatchSignService; | |||
// | |||
// @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 MouldPatch record, Integer pageNum, Integer pageSize) { | |||
// logger.debug("[" + getIpAddr() + "] MouldPatchController::list"); | |||
// if (record == null) record = new MouldPatch(); | |||
// record.setSendType(EnumMouldSendType.auto.getCode()); | |||
// record.setStatus(EnumaMouldPatchStatus.put_on.getCode()); | |||
// record.setSortColumns(BaseEntity.SortField.UpdateDate_DESC); | |||
// final PageInfo<MouldPatch> page = mouldPatchService.cListAsPage(record, pageNum, pageSize); | |||
// return new ResultData(page); | |||
// } | |||
// | |||
// @ApiOperation("根据id查询接口") | |||
// @GetMapping("/findById") | |||
// @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) | |||
// public ResultData findById(Long id) { | |||
// logger.debug("[" + getIpAddr() + "] MouldPatchController::findById"); | |||
// MouldPatch mouldPatch = mouldPatchService.getDetailById(id); | |||
// | |||
// return new ResultData(mouldPatch); | |||
// } | |||
// | |||
// @ApiOperation("根据输入文案获取音色") | |||
// @PostMapping("voiceList") | |||
// @ApiImplicitParams({ | |||
// @ApiImplicitParam(name = "pageNum", value = "页数", dataType = "int", paramType = "query", required = true), | |||
// @ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "int", paramType = "query", required = true)}) | |||
// public ResultData voiceList(@RequestBody UserMouldVideo record, Integer pageNum, Integer pageSize) { | |||
// logger.debug("[" + getIpAddr() + "] MouldPatchController::voiceList"); | |||
// if (record == null || StringUtils.isBlank(record.getPaperwork())) { | |||
// return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL); | |||
// } | |||
// Integer sex = null; | |||
// if(record.getPersonMouldId() != null){ | |||
// MouldPatch personMode = mouldPatchService.getDetailById(record.getPersonMouldId()); | |||
// if(personMode == null){ | |||
// return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(),"选择模板不存在"); | |||
// } | |||
// sex = personMode.getSex(); | |||
// } | |||
// String detect = LanguageDetect.detect(record.getPaperwork()); | |||
// if(StringUtils.isBlank(detect)){ | |||
// return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(),"语种识别失败"); | |||
// } | |||
// EnumLanguages anEnum = EnumLanguages.getEnum(detect); | |||
// if(anEnum == null){ | |||
// return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(),"暂不支持该语种"); | |||
// } | |||
// | |||
// MouldPatch mouldPatch = new MouldPatch(); | |||
// mouldPatch.setSex(sex); | |||
// mouldPatch.setType(EnumMouldPatchType.voice_mould.getCode()); | |||
// mouldPatch.setSendType(EnumMouldSendType.auto.getCode()); | |||
// mouldPatch.setStatus(EnumaMouldPatchStatus.put_on.getCode()); | |||
// mouldPatch.setLanguages(anEnum.getCode()); | |||
// mouldPatch.setSortColumns(BaseEntity.SortField.UpdateDate_DESC); | |||
// final PageInfo<MouldPatch> page = mouldPatchService.cListAsPage(mouldPatch, pageNum, pageSize); | |||
// return new ResultData(page); | |||
// } | |||
// | |||
//} |
@@ -0,0 +1,120 @@ | |||
package com.iformall.controller; | |||
import com.github.pagehelper.PageInfo; | |||
import com.iformall.annotation.AuthIgnore; | |||
import com.iformall.common.ErrorCode; | |||
import com.iformall.common.ResultData; | |||
import com.iformall.domain.po.base.BaseEntity; | |||
import com.iformall.domain.po.sm.MaterialMould; | |||
import com.iformall.domain.po.sm.PersonPhoto; | |||
import com.iformall.enums.EnumMouldPatchType; | |||
import com.iformall.enums.EnumMouldSendType; | |||
import com.iformall.enums.EnumaMouldPatchStatus; | |||
import com.iformall.service.sm.MaterialMouldService; | |||
import com.iformall.service.sm.MouldPatchSignService; | |||
import com.iformall.service.sm.PersonPhotoService; | |||
import io.swagger.annotations.Api; | |||
import io.swagger.annotations.ApiImplicitParam; | |||
import io.swagger.annotations.ApiImplicitParams; | |||
import io.swagger.annotations.ApiOperation; | |||
import org.apache.commons.lang3.StringUtils; | |||
import org.slf4j.Logger; | |||
import org.slf4j.LoggerFactory; | |||
import org.springframework.beans.factory.annotation.Autowired; | |||
import org.springframework.web.bind.annotation.*; | |||
@RestController | |||
@RequestMapping("/api/personPhoto") | |||
@Api(description = "模板接口") | |||
public class PersonPhotoController extends BaseController { | |||
private final Logger logger = LoggerFactory.getLogger(this.getClass()); | |||
@Autowired | |||
private PersonPhotoService personPhotoService; | |||
@Autowired | |||
private MouldPatchSignService mouldPatchSignService; | |||
@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 PersonPhoto record, Integer pageNum, Integer pageSize) { | |||
logger.debug("[" + getIpAddr() + "] PersonPhotoController::list"); | |||
if (record == null) record = new PersonPhoto(); | |||
record.setStatus(EnumaMouldPatchStatus.put_on.getCode()); | |||
record.setSortColumns(BaseEntity.SortField.UpdateDate_DESC); | |||
final PageInfo<PersonPhoto> page = personPhotoService.cListAsPage(record, pageNum, pageSize); | |||
return new ResultData(page); | |||
} | |||
@ApiOperation("分页列表接口") | |||
@GetMapping("userList") | |||
@ApiImplicitParams({ | |||
@ApiImplicitParam(name = "pageNum", value = "页数", dataType = "int", paramType = "query", required = true), | |||
@ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "int", paramType = "query", required = true)}) | |||
public ResultData userList(@ModelAttribute PersonPhoto record, Integer pageNum, Integer pageSize) { | |||
logger.debug("[" + getIpAddr() + "] PersonPhotoController::userList"); | |||
if (record == null) record = new PersonPhoto(); | |||
record.setUserId(getMemberId()); | |||
record.setSortColumns(BaseEntity.SortField.UpdateDate_DESC); | |||
final PageInfo<PersonPhoto> page = personPhotoService.cListAsPage(record, pageNum, pageSize); | |||
return new ResultData(page); | |||
} | |||
@ApiOperation("新增接口") | |||
@PostMapping("save") | |||
public ResultData save(@RequestBody PersonPhoto record) { | |||
logger.debug("[" + getIpAddr() + "] PersonPhotoController::save"); | |||
if(record == null)record = new PersonPhoto(); | |||
record.setSendType(EnumMouldSendType.build.getCode()); | |||
record.setUserId(getMemberId()); | |||
if(StringUtils.isBlank(record.getMaterial())){ | |||
return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(),"素材为空"); | |||
} | |||
//todo 掉第三方接口判断图片是否符合规范 | |||
if(record.getTitle() == null){ | |||
record.setTitle("用户自建"); | |||
} | |||
record.setPrice(0); | |||
record.setSalePrice(0); | |||
personPhotoService.saveOrUpdate(record); | |||
return new ResultData(); | |||
} | |||
@ApiOperation("根据id查询接口") | |||
@GetMapping("/findById") | |||
@ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) | |||
public ResultData findById(Long id) { | |||
logger.debug("[" + getIpAddr() + "] PersonPhotoController::findById"); | |||
PersonPhoto personPhoto = personPhotoService.getDetailById(id); | |||
return new ResultData(personPhoto); | |||
} | |||
@ApiOperation("根据id删除接口") | |||
@GetMapping("/del") | |||
@ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) | |||
public ResultData del(Long id) { | |||
logger.debug("[" + getIpAddr() + "] PersonPhotoController::del"); | |||
if(id == null){ | |||
return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(),"参数为空"); | |||
} | |||
PersonPhoto personPhoto = personPhotoService.getById(id); | |||
if(personPhoto == null){ | |||
return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(),"未找到数据"); | |||
} | |||
if(!personPhoto.getUserId().equals(getMemberId())){ | |||
return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(),"未找到用户数据"); | |||
} | |||
personPhotoService.deleteById(id); | |||
return new ResultData(); | |||
} | |||
} |
@@ -0,0 +1,119 @@ | |||
package com.iformall.controller; | |||
import com.github.pagehelper.PageInfo; | |||
import com.iformall.annotation.AuthIgnore; | |||
import com.iformall.common.ErrorCode; | |||
import com.iformall.common.ResultData; | |||
import com.iformall.domain.po.base.BaseEntity; | |||
import com.iformall.domain.po.sm.PersonPhoto; | |||
import com.iformall.domain.po.sm.VoiceMaterial; | |||
import com.iformall.enums.EnumMouldSendType; | |||
import com.iformall.enums.EnumaMouldPatchStatus; | |||
import com.iformall.service.sm.MouldPatchSignService; | |||
import com.iformall.service.sm.PersonPhotoService; | |||
import com.iformall.service.sm.VoiceMaterialService; | |||
import io.swagger.annotations.Api; | |||
import io.swagger.annotations.ApiImplicitParam; | |||
import io.swagger.annotations.ApiImplicitParams; | |||
import io.swagger.annotations.ApiOperation; | |||
import org.apache.commons.lang3.StringUtils; | |||
import org.slf4j.Logger; | |||
import org.slf4j.LoggerFactory; | |||
import org.springframework.beans.factory.annotation.Autowired; | |||
import org.springframework.web.bind.annotation.*; | |||
@RestController | |||
@RequestMapping("/api/voiceMaterial") | |||
@Api(description = "模板接口") | |||
public class VoiceMaterialController extends BaseController { | |||
private final Logger logger = LoggerFactory.getLogger(this.getClass()); | |||
@Autowired | |||
private VoiceMaterialService voiceMaterialService; | |||
@Autowired | |||
private MouldPatchSignService mouldPatchSignService; | |||
@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 VoiceMaterial record, Integer pageNum, Integer pageSize) { | |||
logger.debug("[" + getIpAddr() + "] VoiceMaterialController::list"); | |||
if (record == null) record = new VoiceMaterial(); | |||
record.setStatus(EnumaMouldPatchStatus.put_on.getCode()); | |||
record.setSortColumns(BaseEntity.SortField.UpdateDate_DESC); | |||
final PageInfo<VoiceMaterial> page = voiceMaterialService.cListAsPage(record, pageNum, pageSize); | |||
return new ResultData(page); | |||
} | |||
@ApiOperation("分页列表接口") | |||
@GetMapping("userList") | |||
@ApiImplicitParams({ | |||
@ApiImplicitParam(name = "pageNum", value = "页数", dataType = "int", paramType = "query", required = true), | |||
@ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "int", paramType = "query", required = true)}) | |||
public ResultData userList(@ModelAttribute VoiceMaterial record, Integer pageNum, Integer pageSize) { | |||
logger.debug("[" + getIpAddr() + "] VoiceMaterialController::userList"); | |||
if (record == null) record = new VoiceMaterial(); | |||
record.setUserId(getMemberId()); | |||
record.setSortColumns(BaseEntity.SortField.UpdateDate_DESC); | |||
final PageInfo<VoiceMaterial> page = voiceMaterialService.cListAsPage(record, pageNum, pageSize); | |||
return new ResultData(page); | |||
} | |||
@ApiOperation("新增接口") | |||
@PostMapping("save") | |||
public ResultData save(@RequestBody VoiceMaterial record) { | |||
logger.debug("[" + getIpAddr() + "] VoiceMaterialController::save"); | |||
if(record == null)record = new VoiceMaterial(); | |||
record.setSendType(EnumMouldSendType.build.getCode()); | |||
record.setUserId(getMemberId()); | |||
if(StringUtils.isBlank(record.getMaterial())){ | |||
return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(),"素材为空"); | |||
} | |||
//todo 掉第三方接口判断声音是否符合规范 | |||
if(record.getTitle() == null){ | |||
record.setTitle("用户自建"); | |||
} | |||
record.setPrice(0); | |||
record.setSalePrice(0); | |||
voiceMaterialService.saveOrUpdate(record); | |||
return new ResultData(); | |||
} | |||
@ApiOperation("根据id查询接口") | |||
@GetMapping("/findById") | |||
@ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) | |||
public ResultData findById(Long id) { | |||
logger.debug("[" + getIpAddr() + "] VoiceMaterialController::findById"); | |||
VoiceMaterial voiceMaterial = voiceMaterialService.getDetailById(id); | |||
return new ResultData(voiceMaterial); | |||
} | |||
@ApiOperation("根据id删除接口") | |||
@GetMapping("/del") | |||
@ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) | |||
public ResultData del(Long id) { | |||
logger.debug("[" + getIpAddr() + "] VoiceMaterialController::del"); | |||
if(id == null){ | |||
return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(),"参数为空"); | |||
} | |||
VoiceMaterial voiceMaterial = voiceMaterialService.getById(id); | |||
if(voiceMaterial == null){ | |||
return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(),"未找到数据"); | |||
} | |||
if(!voiceMaterial.getUserId().equals(getMemberId())){ | |||
return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(),"未找到用户数据"); | |||
} | |||
voiceMaterialService.deleteById(id); | |||
return new ResultData(); | |||
} | |||
} |
@@ -244,6 +244,16 @@ public class WxUserGrantController extends BaseController { | |||
} | |||
} | |||
@PostMapping("/getBasicInfo") | |||
@ApiOperation(value = "用户登录", notes = "") | |||
public ResultData getBasicInfo() { | |||
logger.debug("[" + getIpAddr() + "] WxUserGrantController::getBasicInfo"); | |||
WxCUserBasicInfo basicInfo = getCUser(); | |||
basicInfo.setPassword(null); | |||
basicInfo.setIdCard(null); | |||
return new ResultData(basicInfo); | |||
} | |||
@AuthIgnore | |||
@ApiOperation("发送手机验证码") | |||
@GetMapping("sendLoginPhoneCode") | |||
@@ -324,7 +334,7 @@ public class WxUserGrantController extends BaseController { | |||
// } | |||
WxCUserBasicInfo basicInfo = wxCUserBasicInfoService.findInfoByPhone(getTenantInfo(), phone); | |||
if(basicInfo != null){ | |||
return new ResultData(ErrorCode.USER_PHONE_IS_FOUND); | |||
return new ResultData(ErrorCode.MEMBER_IS_FOUND); | |||
} | |||
@@ -368,7 +378,7 @@ public class WxUserGrantController extends BaseController { | |||
WxCUserBasicInfo basicInfo = wxCUserBasicInfoService.findInfoByEmail(getTenantInfo(), email); | |||
if(basicInfo != null){ | |||
return new ResultData(ErrorCode.USER_PHONE_IS_FOUND); | |||
return new ResultData(ErrorCode.MEMBER_IS_FOUND); | |||
} | |||
@@ -442,13 +452,13 @@ public class WxUserGrantController extends BaseController { | |||
if(userId == null){ | |||
return new ResultData(ErrorCode.NET_TICKET_INVALID.getCode(),"ticket已过期"); | |||
} | |||
WxCUserBasicInfo basicInfo = wxCUserBasicInfoService.getById(userId, getTenantInfo().getFinalTenantId()); | |||
WxCUserBasicInfo basicInfo = wxCUserBasicInfoService.getById(userId); | |||
if(basicInfo == null){ | |||
return new ResultData(ErrorCode.USER_IS_EMPTY); | |||
} | |||
if(!EnumCUserBasicInfoStatus.NOT_ACTIVE.getCode().equals(basicInfo.getStatus())){ | |||
return new ResultData(ErrorCode.MEMBER_IS_ACTIVE); | |||
} | |||
// if(!EnumCUserBasicInfoStatus.NOT_ACTIVE.getCode().equals(basicInfo.getStatus())){ | |||
// return new ResultData(ErrorCode.MEMBER_IS_ACTIVE); | |||
// } | |||
wxCUserBasicInfoService.handleLoginUser(basicInfo); | |||
Map resultMap = new HashMap(); | |||
@@ -604,7 +614,7 @@ public class WxUserGrantController extends BaseController { | |||
if(userId == null){ | |||
return new ResultData(ErrorCode.NET_TICKET_INVALID.getCode(),"已过期"); | |||
} | |||
WxCUserBasicInfo basicInfo = wxCUserBasicInfoService.getById(userId, getTenantInfo().getFinalTenantId()); | |||
WxCUserBasicInfo basicInfo = wxCUserBasicInfoService.getById(userId); | |||
if(basicInfo == null){ | |||
return new ResultData(ErrorCode.USER_IS_EMPTY); | |||
} | |||
@@ -102,6 +102,7 @@ public enum ErrorCode{ | |||
USER_APPINFO_NOFUND_PAYACCOUNT(2111,"当前app找不到payAccount"), | |||
MEMBER_IS_NOT_ACTIVE(2112, "当前会员未激活"), | |||
MEMBER_IS_ACTIVE(2113, "当前会员已激活"), | |||
MEMBER_IS_FOUND(2114, "当前会员已存在"), | |||
/** | |||
* 商场/商户 | |||
@@ -0,0 +1,119 @@ | |||
package com.iformall.domain.po.sm; | |||
import cn.afterturn.easypoi.excel.annotation.Excel; | |||
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 = "person_photo") | |||
@Data | |||
@ToString(callSuper = true) | |||
@EqualsAndHashCode(callSuper = true) | |||
public class PersonPhoto 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="title") | |||
@Excel(name="名称",width = 20,orderNum = "1") | |||
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") | |||
@Excel(name="售价(分)",width = 20,orderNum = "3") | |||
private Integer salePrice; | |||
@io.swagger.annotations.ApiModelProperty(value="须知",name="detail") | |||
private String detail; | |||
@io.swagger.annotations.ApiModelProperty(value="原价",name="price") | |||
@Excel(name="原价(分)",width = 20,orderNum = "2") | |||
private Integer price; | |||
@io.swagger.annotations.ApiModelProperty(value="EnumMouldSendType ",name="sendType") | |||
private Integer sendType; | |||
@io.swagger.annotations.ApiModelProperty(value="购买须知",name="remark") | |||
private String remark; | |||
@io.swagger.annotations.ApiModelProperty(value="素材地址",name="material") | |||
private String material; | |||
@io.swagger.annotations.ApiModelProperty(value="用户id",name="userId") | |||
private Long userId; | |||
@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; | |||
} | |||
@TableField(exist = false) | |||
private List<Integer> sendTypes; | |||
} |
@@ -0,0 +1,130 @@ | |||
package com.iformall.domain.po.sm; | |||
import com.baomidou.mybatisplus.annotation.TableField; | |||
import com.baomidou.mybatisplus.annotation.TableName; | |||
import com.iformall.domain.po.base.TenantEntity; | |||
import com.iformall.sm.AiVideoHelper; | |||
import lombok.Data; | |||
import lombok.EqualsAndHashCode; | |||
import lombok.ToString; | |||
import org.apache.commons.lang3.StringUtils; | |||
import java.util.Date; | |||
import java.util.List; | |||
@TableName(value = "photo_speak_video") | |||
@Data | |||
@ToString(callSuper = true) | |||
@EqualsAndHashCode(callSuper = true) | |||
public class PhotoSpeakVideo extends TenantEntity { | |||
protected Long id; | |||
@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; | |||
@TableField(exist = false) | |||
@io.swagger.annotations.ApiModelProperty(value="查询-生成视频起始时间",name="videoStartDate") | |||
private Date videoStartDate; | |||
@TableField(exist = false) | |||
@io.swagger.annotations.ApiModelProperty(value="查询-生成视频结束时间",name="videoEndDate") | |||
private Date videoEndDate; | |||
@io.swagger.annotations.ApiModelProperty(value="用户Id",name="userId") | |||
private Long userId; | |||
@io.swagger.annotations.ApiModelProperty(value="照片ID",name="personPhotoId") | |||
private Long personPhotoId; | |||
@io.swagger.annotations.ApiModelProperty(value="照片",name="personPhotoUrl") | |||
private String personPhotoUrl; | |||
@TableField(exist = false) | |||
private PersonPhoto personPhoto; | |||
@io.swagger.annotations.ApiModelProperty(value="EnumVoiceFrom 声音来源",name="voiceFrom") | |||
private Integer voiceFrom; | |||
@TableField(exist = false) | |||
private List<Long> voiceMouldIds; | |||
@io.swagger.annotations.ApiModelProperty(value="声音模板ID",name="voiceMouldId") | |||
private Long voiceMouldId; | |||
/** | |||
* { | |||
* "title":, | |||
* "languages":, | |||
* "mouldSmId":, | |||
* "personId":, | |||
* "personType":, | |||
* "personTypeStr":, | |||
* "speakId":, | |||
* "speakType":, | |||
* "speakTypeStr": | |||
* } | |||
*/ | |||
@io.swagger.annotations.ApiModelProperty(value="声音模板",name="voiceMouldSm") | |||
private String voiceMouldSm; | |||
@TableField(exist = false) | |||
private VoiceMould voiceMould; | |||
@io.swagger.annotations.ApiModelProperty(value="文案",name="paperwork") | |||
private String paperwork; | |||
@io.swagger.annotations.ApiModelProperty(value="用户上传的声音素材",name="voiceMaterialId") | |||
private Long voiceMaterialId; | |||
@io.swagger.annotations.ApiModelProperty(value="用户上传的声音素材",name="voiceMaterialUrl") | |||
private String voiceMaterialUrl; | |||
@TableField(exist = false) | |||
private VoiceMaterial voiceMaterial; | |||
@io.swagger.annotations.ApiModelProperty(value="名称",name="title") | |||
private String title; | |||
@io.swagger.annotations.ApiModelProperty(value="封面图",name="coverImg") | |||
private String coverImg; | |||
@io.swagger.annotations.ApiModelProperty(value="备注",name="remark") | |||
private String remark; | |||
@io.swagger.annotations.ApiModelProperty(value="视频文件",name="videoId") | |||
private String videoId; | |||
@TableField(exist = false) | |||
private String videoPathUri; | |||
public String getVideoPathUri(){ | |||
if(StringUtils.isNotBlank(this.videoPath)){ | |||
videoPathUri = AiVideoHelper.uri; | |||
} | |||
return videoPathUri; | |||
} | |||
@io.swagger.annotations.ApiModelProperty(value="",name="videoPath") | |||
private String videoPath; | |||
@io.swagger.annotations.ApiModelProperty(value="播放地址",name="videoPlayUrl") | |||
private String videoPlayUrl; | |||
@io.swagger.annotations.ApiModelProperty(value="视频时长(秒)",name="videoTime") | |||
private String videoTime; | |||
@io.swagger.annotations.ApiModelProperty(value="视频大小(byte)",name="videoSize") | |||
private Long videoSize; | |||
@io.swagger.annotations.ApiModelProperty(value="EnumVideoStatus 视频状态",name="videoStatus") | |||
private Integer videoStatus; | |||
@io.swagger.annotations.ApiModelProperty(value="生成视频信息",name="videoMsg") | |||
private String videoMsg; | |||
@io.swagger.annotations.ApiModelProperty(value="生成视频时间",name="createVideoDate") | |||
private Date createVideoDate; | |||
@io.swagger.annotations.ApiModelProperty(value="创建时间",name="createDate") | |||
private Date createDate; | |||
@io.swagger.annotations.ApiModelProperty(value="更新时间",name="updateDate") | |||
private Date updateDate; | |||
@TableField(exist = false) | |||
private List<Integer> videoStatuss; | |||
} |
@@ -0,0 +1,119 @@ | |||
package com.iformall.domain.po.sm; | |||
import cn.afterturn.easypoi.excel.annotation.Excel; | |||
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 = "voice_material") | |||
@Data | |||
@ToString(callSuper = true) | |||
@EqualsAndHashCode(callSuper = true) | |||
public class VoiceMaterial 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="title") | |||
@Excel(name="名称",width = 20,orderNum = "1") | |||
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") | |||
@Excel(name="售价(分)",width = 20,orderNum = "3") | |||
private Integer salePrice; | |||
@io.swagger.annotations.ApiModelProperty(value="须知",name="detail") | |||
private String detail; | |||
@io.swagger.annotations.ApiModelProperty(value="原价",name="price") | |||
@Excel(name="原价(分)",width = 20,orderNum = "2") | |||
private Integer price; | |||
@io.swagger.annotations.ApiModelProperty(value="EnumMouldSendType ",name="sendType") | |||
private Integer sendType; | |||
@io.swagger.annotations.ApiModelProperty(value="购买须知",name="remark") | |||
private String remark; | |||
@io.swagger.annotations.ApiModelProperty(value="素材地址",name="material") | |||
private String material; | |||
@io.swagger.annotations.ApiModelProperty(value="用户id",name="userId") | |||
private Long userId; | |||
@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; | |||
} | |||
@TableField(exist = false) | |||
private List<Integer> sendTypes; | |||
} |
@@ -15,6 +15,7 @@ public enum EnumMouldPatchType { | |||
// body_mould(3, "身体模板"), | |||
background_mould(4, "背景"), | |||
material_mould(5, "素材"), | |||
person_photo(6, "人物照片"), | |||
; | |||
public static EnumMouldPatchType getEnum(Integer code) { | |||
@@ -9,7 +9,7 @@ import java.util.List; | |||
public enum EnumMouldSendType { | |||
auto(1,"系统免费"), | |||
buy(2, "系统收费"), | |||
// buy(2, "系统收费"), | |||
build(3, "用户自建"), | |||
; | |||
@@ -41,7 +41,7 @@ public enum EnumMouldSendType { | |||
public static List<Integer> getSysSendTypes(){ | |||
List<Integer> sendTypes = new ArrayList<>(); | |||
sendTypes.add(EnumMouldSendType.auto.getCode()); | |||
sendTypes.add(EnumMouldSendType.buy.getCode()); | |||
// sendTypes.add(EnumMouldSendType.buy.getCode()); | |||
return sendTypes; | |||
} | |||
} |
@@ -0,0 +1,36 @@ | |||
package com.iformall.enums; | |||
/** | |||
* | |||
*/ | |||
public enum EnumVoiceFrom { | |||
FROM_MOULD(1, "模板"), | |||
FROM_UPD(2,"用户上传"), | |||
; | |||
public static EnumVoiceFrom getEnum(Integer code) { | |||
for (EnumVoiceFrom value : values()) { | |||
if (value.getCode().equals(code)) { | |||
return value; | |||
} | |||
} | |||
return null; | |||
} | |||
private Integer code; | |||
private String message; | |||
EnumVoiceFrom(Integer code, String message) { | |||
this.code = code; | |||
this.message = message; | |||
} | |||
public Integer getCode() { | |||
return code; | |||
} | |||
public String getMessage() { | |||
return message; | |||
} | |||
} |
@@ -0,0 +1,22 @@ | |||
package com.iformall.mapper; | |||
import com.iformall.common.CommonMapper; | |||
import com.iformall.domain.po.sm.PersonPhoto; | |||
import org.apache.ibatis.annotations.Param; | |||
import java.util.List; | |||
public interface PersonPhotoMapper extends CommonMapper<PersonPhoto, Long> { | |||
List<PersonPhoto> findList(PersonPhoto record); | |||
int deleteById(@Param("id")Long id); | |||
/** | |||
* c端列表查询,尽量减少字段 | |||
* @param record | |||
* @return | |||
*/ | |||
List<PersonPhoto> findCList(PersonPhoto record); | |||
} |
@@ -0,0 +1,26 @@ | |||
package com.iformall.mapper; | |||
import com.iformall.common.CommonMapper; | |||
import com.iformall.domain.po.sm.PhotoSpeakVideo; | |||
import org.apache.ibatis.annotations.Param; | |||
import java.util.List; | |||
public interface PhotoSpeakVideoMapper extends CommonMapper<PhotoSpeakVideo, Long> { | |||
List<PhotoSpeakVideo> findList(PhotoSpeakVideo record); | |||
int deleteById(@Param("id")Long id); | |||
/** | |||
* c端列表查询,尽量减少字段 | |||
* @param record | |||
* @return | |||
*/ | |||
List<PhotoSpeakVideo> findCList(PhotoSpeakVideo record); | |||
PhotoSpeakVideo findVideo(@Param("id")Long id); | |||
List<PhotoSpeakVideo> getSortList(PhotoSpeakVideo record); | |||
} |
@@ -0,0 +1,22 @@ | |||
package com.iformall.mapper; | |||
import com.iformall.common.CommonMapper; | |||
import com.iformall.domain.po.sm.VoiceMaterial; | |||
import org.apache.ibatis.annotations.Param; | |||
import java.util.List; | |||
public interface VoiceMaterialMapper extends CommonMapper<VoiceMaterial, Long> { | |||
List<VoiceMaterial> findList(VoiceMaterial record); | |||
int deleteById(@Param("id")Long id); | |||
/** | |||
* c端列表查询,尽量减少字段 | |||
* @param record | |||
* @return | |||
*/ | |||
List<VoiceMaterial> findCList(VoiceMaterial record); | |||
} |
@@ -64,6 +64,8 @@ public interface WxCUserBasicInfoService { | |||
*/ | |||
WxCUserBasicInfo getById(Long id,String finalTenantId); | |||
WxCUserBasicInfo getById(Long id); | |||
/** | |||
* 保存实体 | |||
* | |||
@@ -928,6 +928,7 @@ public class WxCUserBasicInfoServiceImpl implements WxCUserBasicInfoService,IExc | |||
String msg = wxMsgValidationcodeModel.getContent(); | |||
msg = msg.replace("{ticket}", ticket);// | |||
msg = msg.replace("{email}", basicInfo.getEmail());// | |||
// msg = msg.replace("{bg}", wxMsgValidationcodeModel.getEmailBgImg()); | |||
try{ | |||
@@ -951,6 +952,11 @@ public class WxCUserBasicInfoServiceImpl implements WxCUserBasicInfoService,IExc | |||
return wxCUserBasicInfoMapper.selectById(id,finalTenantId); | |||
} | |||
@Override | |||
public WxCUserBasicInfo getById(Long id) { | |||
return wxCUserBasicInfoMapper.selectById(id); | |||
} | |||
@Override | |||
public void save(WxCUserBasicInfo record) { | |||
Date cur = new Date(); | |||
@@ -0,0 +1,46 @@ | |||
package com.iformall.service.sm; | |||
import com.github.pagehelper.PageInfo; | |||
import com.iformall.common.ResultData; | |||
import com.iformall.domain.po.sm.MaterialMould; | |||
import com.iformall.domain.po.sm.PersonPhoto; | |||
public interface PersonPhotoService { | |||
/** | |||
* 根据实体查询分页列表 | |||
* | |||
* @param record | |||
* @param pageIndex | |||
* @param pageSize | |||
* @return | |||
*/ | |||
PageInfo<PersonPhoto> listAsPage(PersonPhoto record, Integer pageIndex, Integer pageSize); | |||
PageInfo<PersonPhoto> cListAsPage(PersonPhoto record, Integer pageIndex, Integer pageSize); | |||
/** | |||
* 根据Id获得实体 | |||
* | |||
* @param id | |||
* @return | |||
*/ | |||
PersonPhoto getById(Long id); | |||
PersonPhoto getDetailById(Long id); | |||
/** | |||
* 保存或更新实体 | |||
* | |||
* @param record | |||
*/ | |||
ResultData saveOrUpdate(PersonPhoto record); | |||
/** | |||
* 根据Id删除实体 | |||
* | |||
* @param id | |||
*/ | |||
void deleteById(Long id); | |||
void updateOnline(PersonPhoto record); | |||
} |
@@ -0,0 +1,60 @@ | |||
package com.iformall.service.sm; | |||
import com.github.pagehelper.PageInfo; | |||
import com.iformall.common.ResultData; | |||
import com.iformall.domain.po.sm.PhotoSpeakVideo; | |||
import com.iformall.domain.po.sm.UserMouldVideo; | |||
import java.util.List; | |||
import java.util.concurrent.Future; | |||
public interface PhotoSpeakVideoService { | |||
/** | |||
* 根据实体查询分页列表 | |||
* | |||
* @param record | |||
* @param pageIndex | |||
* @param pageSize | |||
* @return | |||
*/ | |||
PageInfo<PhotoSpeakVideo> listAsPage(PhotoSpeakVideo record, Integer pageIndex, Integer pageSize); | |||
PageInfo<PhotoSpeakVideo> cListAsPage(PhotoSpeakVideo record, Integer pageIndex, Integer pageSize); | |||
List<PhotoSpeakVideo> findList(PhotoSpeakVideo record); | |||
/** | |||
* 根据Id获得实体 | |||
* | |||
* @param id | |||
* @return | |||
*/ | |||
PhotoSpeakVideo getById(Long id); | |||
/** | |||
* 保存或更新实体 | |||
* | |||
* @param record | |||
*/ | |||
ResultData saveOrUpdate(PhotoSpeakVideo record); | |||
/** | |||
* 根据Id删除实体 | |||
* | |||
* @param id | |||
*/ | |||
void deleteById(Long id); | |||
Future createVideo(PhotoSpeakVideo mouldVideo); | |||
void uploadVideo(PhotoSpeakVideo mouldVideo); | |||
PhotoSpeakVideo findVideo(Long id); | |||
List<PhotoSpeakVideo> getNotUploadList(); | |||
List<PhotoSpeakVideo> getUpLoadIngList(); | |||
int updateById(PhotoSpeakVideo video); | |||
} |
@@ -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.VoiceMaterial; | |||
public interface VoiceMaterialService { | |||
/** | |||
* 根据实体查询分页列表 | |||
* | |||
* @param record | |||
* @param pageIndex | |||
* @param pageSize | |||
* @return | |||
*/ | |||
PageInfo<VoiceMaterial> listAsPage(VoiceMaterial record, Integer pageIndex, Integer pageSize); | |||
PageInfo<VoiceMaterial> cListAsPage(VoiceMaterial record, Integer pageIndex, Integer pageSize); | |||
/** | |||
* 根据Id获得实体 | |||
* | |||
* @param id | |||
* @return | |||
*/ | |||
VoiceMaterial getById(Long id); | |||
VoiceMaterial getDetailById(Long id); | |||
/** | |||
* 保存或更新实体 | |||
* | |||
* @param record | |||
*/ | |||
ResultData saveOrUpdate(VoiceMaterial record); | |||
/** | |||
* 根据Id删除实体 | |||
* | |||
* @param id | |||
*/ | |||
void deleteById(Long id); | |||
void updateOnline(VoiceMaterial record); | |||
} |
@@ -0,0 +1,126 @@ | |||
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.MaterialMould; | |||
import com.iformall.domain.po.sm.MouldPatchSign; | |||
import com.iformall.domain.po.sm.PersonPhoto; | |||
import com.iformall.enums.EnumMouldSendType; | |||
import com.iformall.enums.EnumaMouldPatchStatus; | |||
import com.iformall.mapper.MaterialMouldMapper; | |||
import com.iformall.mapper.PersonPhotoMapper; | |||
import com.iformall.service.sm.MaterialMouldService; | |||
import com.iformall.service.sm.MouldPatchSignService; | |||
import com.iformall.service.sm.PersonPhotoService; | |||
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 PersonPhotoServiceImpl implements PersonPhotoService { | |||
private final Logger logger = LoggerFactory.getLogger(this.getClass()); | |||
@Autowired | |||
PersonPhotoMapper personPhotoMapper; | |||
@Autowired | |||
MouldPatchSignService mouldPatchSignService; | |||
private void handleSendType(PersonPhoto record){ | |||
// | |||
if(record.getUserId() != null){ | |||
record.setSendType(EnumMouldSendType.build.getCode()); | |||
}else if(record.getSendType() == null){ | |||
record.setSendTypes(EnumMouldSendType.getSysSendTypes()); | |||
} | |||
} | |||
@Override | |||
public PageInfo<PersonPhoto> listAsPage(PersonPhoto record, Integer pageIndex, Integer pageSize) { | |||
handleSendType(record); | |||
return PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> personPhotoMapper.findList(record)); | |||
} | |||
@Override | |||
public PageInfo<PersonPhoto> cListAsPage(PersonPhoto record, Integer pageIndex, Integer pageSize) { | |||
handleSendType(record); | |||
return PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> personPhotoMapper.findCList(record)); | |||
} | |||
@Override | |||
public PersonPhoto getById(Long id) { | |||
return personPhotoMapper.selectById(id); | |||
} | |||
@Override | |||
public PersonPhoto getDetailById(Long id) { | |||
PersonPhoto personPhoto = getById(id); | |||
if(personPhoto == null){ | |||
return null; | |||
} | |||
if(personPhoto.getSceneSignList() != null && !personPhoto.getSceneSignList().isEmpty()){ | |||
MouldPatchSign signQ = new MouldPatchSign(); | |||
signQ.setIds(personPhoto.getSceneSignList()); | |||
List<MouldPatchSign> signList = mouldPatchSignService.getList(signQ); | |||
personPhoto.setMouldPatchSign(signList); | |||
} | |||
return personPhoto; | |||
} | |||
@Override | |||
public ResultData saveOrUpdate(PersonPhoto 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); | |||
personPhotoMapper.insert(record); | |||
} else { | |||
record.setUpdateDate(now); | |||
personPhotoMapper.updateById(record); | |||
} | |||
return new ResultData(); | |||
} | |||
@Override | |||
public void deleteById(Long id) { | |||
personPhotoMapper.deleteById(id); | |||
} | |||
@Override | |||
public void updateOnline(PersonPhoto record) { | |||
Date now = new Date(); | |||
PersonPhoto personPhotoUpd = new PersonPhoto(); | |||
personPhotoUpd.setId(record.getId()); | |||
personPhotoUpd.setStatus(record.getStatus()); | |||
if(EnumaMouldPatchStatus.put_on.getCode().equals(personPhotoUpd.getStatus())){ | |||
personPhotoUpd.setPutonDate(now); | |||
} | |||
personPhotoUpd.setUpdateDate(now); | |||
personPhotoMapper.updateById(personPhotoUpd); | |||
} | |||
} |
@@ -0,0 +1,339 @@ | |||
package com.iformall.service.sm.impl; | |||
import com.alibaba.fastjson.JSONObject; | |||
import com.github.pagehelper.PageHelper; | |||
import com.github.pagehelper.PageInfo; | |||
import com.iformall.common.ErrorCode; | |||
import com.iformall.common.IdWorker; | |||
import com.iformall.common.ResultData; | |||
import com.iformall.domain.po.sm.*; | |||
import com.iformall.enums.*; | |||
import com.iformall.mapper.PhotoSpeakVideoMapper; | |||
import com.iformall.service.sm.*; | |||
import com.iformall.video.VideoFactory; | |||
import com.iformall.video.entity.VideUploadResult; | |||
import org.apache.commons.lang3.StringUtils; | |||
import org.slf4j.Logger; | |||
import org.slf4j.LoggerFactory; | |||
import org.springframework.beans.factory.annotation.Autowired; | |||
import org.springframework.scheduling.annotation.Async; | |||
import org.springframework.scheduling.annotation.AsyncResult; | |||
import org.springframework.stereotype.Service; | |||
import java.util.ArrayList; | |||
import java.util.Date; | |||
import java.util.List; | |||
import java.util.concurrent.Future; | |||
@Service | |||
public class PhotoSpeakVideoServiceImpl implements PhotoSpeakVideoService { | |||
private final Logger logger = LoggerFactory.getLogger(this.getClass()); | |||
@Autowired | |||
PhotoSpeakVideoMapper photoSpeakVideoMapper; | |||
@Autowired | |||
PersonPhotoService personPhotoService; | |||
@Autowired | |||
VoiceMouldService voiceMouldService; | |||
@Autowired | |||
VoiceMaterialService voiceMaterialService; | |||
@Autowired | |||
MaterialMouldService materialMouldService; | |||
@Autowired | |||
VideoFactory videoFactory; | |||
@Autowired | |||
String videoType; | |||
@Override | |||
public PageInfo<PhotoSpeakVideo> listAsPage(PhotoSpeakVideo record, Integer pageIndex, Integer pageSize) { | |||
return PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> photoSpeakVideoMapper.findList(record)); | |||
} | |||
@Override | |||
public PageInfo<PhotoSpeakVideo> cListAsPage(PhotoSpeakVideo record, Integer pageIndex, Integer pageSize) { | |||
return PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> photoSpeakVideoMapper.findCList(record)); | |||
} | |||
@Override | |||
public List<PhotoSpeakVideo> findList(PhotoSpeakVideo record) { | |||
return photoSpeakVideoMapper.findList(record); | |||
} | |||
@Override | |||
public PhotoSpeakVideo getById(Long id) { | |||
return photoSpeakVideoMapper.selectById(id); | |||
} | |||
@Override | |||
public ResultData saveOrUpdate(PhotoSpeakVideo record) { | |||
if(record.getPersonPhotoId() != null){ | |||
PersonPhoto personPhoto = personPhotoService.getById(record.getPersonPhotoId()); | |||
if(personPhoto == null){ | |||
return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(),"未查询到人物照片"); | |||
} | |||
record.setPersonPhotoUrl(personPhoto.getMaterial()); | |||
} | |||
if(record.getVoiceFrom() != null){ | |||
if(EnumVoiceFrom.FROM_MOULD.getCode().equals(record.getVoiceFrom())){ | |||
if(record.getVoiceMouldIds() == null || record.getVoiceMouldIds().isEmpty()){ | |||
return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(),"未选择声音模板信息"); | |||
} | |||
if(record.getVoiceMouldIds().size() > 1){ | |||
return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(),"暂不支持声音模板交叉选择"); | |||
} | |||
Long voiceMouldId = record.getVoiceMouldIds().get(0); | |||
if(voiceMouldId == null){ | |||
return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(),"未选择声音模板信息"); | |||
} | |||
VoiceMould voiceMould = voiceMouldService.getById(voiceMouldId); | |||
if(voiceMould == null){ | |||
return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(),"未查询到声音模板信息"); | |||
} | |||
if(voiceMould.getParentId().equals(0L)){ | |||
record.setVoiceMouldId(voiceMould.getId()); | |||
}else{ | |||
record.setVoiceMouldId(voiceMould.getParentId()); | |||
} | |||
JSONObject voiceMouldObject = new JSONObject(); | |||
voiceMouldObject.put("title",voiceMould.getTitle()); | |||
voiceMouldObject.put("languages",voiceMould.getLanguages()); | |||
voiceMouldObject.put("mouldSmId",voiceMould.getMouldSmId()); | |||
voiceMouldObject.put("personId",0l); | |||
voiceMouldObject.put("personType",0); | |||
voiceMouldObject.put("personTypeStr","默认"); | |||
voiceMouldObject.put("speakId",0l); | |||
voiceMouldObject.put("speakType",0); | |||
voiceMouldObject.put("speakTypeStr","默认"); | |||
if(EnumVoiceType.person.getCode().equals(voiceMould.getVoiceType())){ | |||
voiceMouldObject.put("personId",voiceMould.getId()); | |||
voiceMouldObject.put("personType",voiceMould.getPersonType()); | |||
voiceMouldObject.put("personTypeStr",voiceMould.getPersonTypeStr()); | |||
}else if(EnumVoiceType.speak.getCode().equals(voiceMould.getVoiceType())){ | |||
voiceMouldObject.put("speakId",voiceMould.getId()); | |||
voiceMouldObject.put("speakType",voiceMould.getPersonType()); | |||
voiceMouldObject.put("speakTypeStr",voiceMould.getSpeakTypeStr()); | |||
} | |||
record.setVoiceMouldSm(voiceMouldObject.toJSONString()); | |||
}else if(EnumVoiceFrom.FROM_UPD.getCode().equals(record.getVoiceFrom())){ | |||
if(record.getVoiceMaterialId() == null){ | |||
return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(),"未上传声音文件"); | |||
} | |||
VoiceMaterial voiceMaterial = voiceMaterialService.getById(record.getVoiceMaterialId()); | |||
if(voiceMaterial == null){ | |||
return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(),"未查询到声音文件"); | |||
} | |||
record.setVoiceMaterialUrl(voiceMaterial.getMaterial()); | |||
} | |||
} | |||
Date now = new Date(); | |||
if (record.getId() == null) { | |||
//record.setId(UUID.randomUUID().toString().replaceAll("-", "")); | |||
final IdWorker idWorker = IdWorker.get(); | |||
record.setId(idWorker.nextId()); | |||
record.setCreateDate(now); | |||
record.setUpdateDate(now); | |||
photoSpeakVideoMapper.insert(record); | |||
} else { | |||
record.setUpdateDate(now); | |||
photoSpeakVideoMapper.updateById(record); | |||
} | |||
return new ResultData(record); | |||
} | |||
@Override | |||
public void deleteById(Long id) { | |||
photoSpeakVideoMapper.deleteById(id); | |||
} | |||
@Async | |||
@Override | |||
public Future createVideo(PhotoSpeakVideo photoSpeakVideo) { | |||
boolean isCreate = false; | |||
String msg = ""; | |||
PhotoSpeakVideo videoUpd = new PhotoSpeakVideo(); | |||
videoUpd.setId(photoSpeakVideo.getId()); | |||
String personPhotoUrl = null; | |||
if(photoSpeakVideo.getPersonPhotoId() == null){ | |||
msg = "未查询到人物照片"; | |||
}else{ | |||
personPhotoUrl = photoSpeakVideo.getPersonPhotoUrl(); | |||
} | |||
if(StringUtils.isBlank(personPhotoUrl)){ | |||
videoUpd.setVideoStatus(EnumVideoStatus.fail.getCode()); | |||
videoUpd.setVideoMsg(msg); | |||
this.saveOrUpdate(videoUpd); | |||
return new AsyncResult<>(0); | |||
} | |||
Integer voiceFrom = photoSpeakVideo.getVoiceFrom(); | |||
String voiceMouldSmId = null; | |||
String voiceType = "default";//默认 | |||
String voiceMaterialUrl = null; | |||
if(EnumVoiceFrom.FROM_MOULD.getCode().equals(voiceFrom)){ | |||
try{ | |||
JSONObject personMouldObject = JSONObject.parseObject(photoSpeakVideo.getVoiceMouldSm()); | |||
voiceMouldSmId = personMouldObject.getString("mouldSmId"); | |||
Integer speakType = personMouldObject.getInteger("speakType"); | |||
Integer personType = personMouldObject.getInteger("personType"); | |||
if(speakType != null && speakType > 0){ | |||
voiceType = EnumSpeakType.getEnum(speakType).getMessage(); | |||
}else if(personType != null && personType > 0){ | |||
voiceType = EnumPersonType.getEnum(personType).getMessage(); | |||
} | |||
}catch(Exception e){} | |||
if(StringUtils.isBlank(voiceMouldSmId)){ | |||
msg = "参数错误,未找到声音模板数据"; | |||
} | |||
}else if(EnumVoiceFrom.FROM_UPD.getCode().equals(voiceFrom)){ | |||
voiceMaterialUrl = photoSpeakVideo.getVoiceMaterialUrl(); | |||
if(StringUtils.isBlank(voiceMaterialUrl)){ | |||
msg = "未找到上传声音文件"; | |||
} | |||
} else{ | |||
msg = "声音数据异常"; | |||
} | |||
if(StringUtils.isBlank(voiceMouldSmId) || StringUtils.isBlank(voiceMaterialUrl)){ | |||
videoUpd.setVideoStatus(EnumVideoStatus.fail.getCode()); | |||
videoUpd.setVideoMsg(msg); | |||
this.saveOrUpdate(videoUpd); | |||
return new AsyncResult<>(0); | |||
} | |||
String paperwork = photoSpeakVideo.getPaperwork(); | |||
if(EnumVoiceFrom.FROM_MOULD.getCode().equals(voiceFrom) && StringUtils.isBlank(paperwork)){ | |||
videoUpd.setVideoStatus(EnumVideoStatus.fail.getCode()); | |||
videoUpd.setVideoMsg("未填写视频文案数据"); | |||
this.saveOrUpdate(videoUpd); | |||
return new AsyncResult<>(0); | |||
} | |||
try{ | |||
// AiVideoParam videoParam = new AiVideoParam(); | |||
// videoParam.setGen_txt(paperwork); | |||
// videoParam.setVideo_template_id(personMouldSmId); | |||
// videoParam.setVoice_id(voiceMouldSmId); | |||
// videoParam.setVoice_style(voiceType); | |||
// AiVideoParam.VideoFiles videoFiles = new AiVideoParam.VideoFiles(); | |||
// AiVideoParam.BackGround backGround = new AiVideoParam.BackGround(); | |||
// backGround.setType(EnumVideoType.getEnum(mouldVideo.getVideoType()).getType()); | |||
// JSONObject backgroundObject = JSONObject.parseObject(mouldVideo.getBackgroundSm()); | |||
// backGround.setImage(Base64Util.imageUrlToBase64(backgroundObject.getString("material"))); | |||
// videoFiles.setBack_ground(backGround); | |||
// AiVideoParam.Material digitalHuman = new AiVideoParam.Material(); | |||
// JSONObject personObject = JSONObject.parseObject(mouldVideo.getPersonJson()); | |||
// int[] digitalHumanCoord = new int[]{personObject.getIntValue("x"),personObject.getIntValue("y")}; | |||
// digitalHuman.setCoord(digitalHumanCoord); | |||
// digitalHuman.setLevel(personObject.getIntValue("z")); | |||
// digitalHuman.setRatio(personObject.getFloatValue("w")); | |||
// videoFiles.setDigital_human(digitalHuman); | |||
// | |||
// if(StringUtils.isNotBlank(mouldVideo.getMaterialAllJson())){ | |||
// JSONArray materialAllArray = JSONArray.parseArray(mouldVideo.getMaterialAllJson()); | |||
// if(materialAllArray != null && !materialAllArray.isEmpty()){ | |||
// List<AiVideoParam.Material> materialList = new ArrayList<>(); | |||
// for(int i = 0;i < materialAllArray.size();i++) { | |||
// JSONObject materialObject = materialAllArray.getJSONObject(i); | |||
// if(EnumMouldPatchType.material_mould.getCode().equals(materialObject.getInteger("type"))){ | |||
// AiVideoParam.Material material = new AiVideoParam.Material(); | |||
// int[] materialCoord = new int[]{materialObject.getIntValue("x"),materialObject.getIntValue("y")}; | |||
// material.setCoord(materialCoord); | |||
// material.setImage(Base64Util.imageUrlToBase64(materialObject.getString("material"))); | |||
// material.setLevel(materialObject.getIntValue("z")); | |||
// material.setRatio(materialObject.getFloatValue("w")); | |||
// materialList.add(material); | |||
// } | |||
// } | |||
// if(materialList.size() > 0){ | |||
// videoFiles.setMaterial(materialList); | |||
// } | |||
// } | |||
// } | |||
// videoParam.setVideo_files(videoFiles); | |||
// | |||
// AiVideoResult video = AiVideoHelper.createVideo(videoParam); | |||
// if(video.isSuccess()){ | |||
// videoUpd.setVideoPath(video.getUrl()); | |||
//// videoUpd.setVideoTime(video.getDuration()+""); | |||
// videoUpd.setVideoStatus(EnumVideoStatus.success.getCode()); | |||
// videoUpd.setVideoMsg("success"); | |||
// videoUpd.setCreateVideoDate(new Date()); | |||
// this.saveOrUpdate(videoUpd); | |||
// | |||
// videoUpd.setTitle(mouldVideo.getTitle()); | |||
// this.uploadVideo(videoUpd); | |||
// | |||
// return new AsyncResult<>(1); | |||
// } | |||
videoUpd.setVideoStatus(EnumVideoStatus.fail.getCode()); | |||
videoUpd.setVideoMsg("fail"); | |||
this.saveOrUpdate(videoUpd); | |||
return new AsyncResult<>(0); | |||
}catch(Exception e){ | |||
e.printStackTrace(); | |||
videoUpd.setVideoStatus(EnumVideoStatus.fail.getCode()); | |||
videoUpd.setVideoMsg("请求异常"); | |||
this.saveOrUpdate(videoUpd); | |||
return new AsyncResult<>(0); | |||
} | |||
} | |||
@Override | |||
public void uploadVideo(PhotoSpeakVideo mouldVideo){ | |||
if(EnumVideoStatus.success.getCode().equals(mouldVideo.getVideoStatus()) | |||
|| EnumVideoStatus.upload_fail.getCode().equals(mouldVideo.getVideoStatus())){ | |||
String url = mouldVideo.getVideoPathUri() + mouldVideo.getVideoPath(); | |||
VideUploadResult result = videoFactory.getExcutor(videoType).uploadVideoPath(mouldVideo.getTitle(), url); | |||
if(result.isSuccess()){ | |||
PhotoSpeakVideo videoUpd = new PhotoSpeakVideo(); | |||
videoUpd.setId(mouldVideo.getId()); | |||
videoUpd.setVideoId(result.getVideoId()); | |||
videoUpd.setVideoStatus(EnumVideoStatus.upload_ing.getCode()); | |||
this.saveOrUpdate(videoUpd); | |||
} | |||
} | |||
} | |||
@Override | |||
public PhotoSpeakVideo findVideo(Long id) { | |||
return photoSpeakVideoMapper.findVideo(id); | |||
} | |||
@Override | |||
public List<PhotoSpeakVideo> getNotUploadList() { | |||
PhotoSpeakVideo umVideoQ = new PhotoSpeakVideo(); | |||
List<Integer> videoStatuss = new ArrayList<>(); | |||
videoStatuss.add(EnumVideoStatus.success.getCode()); | |||
videoStatuss.add(EnumVideoStatus.upload_fail.getCode()); | |||
umVideoQ.setVideoStatuss(videoStatuss); | |||
return photoSpeakVideoMapper.getSortList(umVideoQ); | |||
} | |||
@Override | |||
public List<PhotoSpeakVideo> getUpLoadIngList() { | |||
PhotoSpeakVideo umVideoQ = new PhotoSpeakVideo(); | |||
umVideoQ.setVideoStatus(EnumVideoStatus.upload_ing.getCode()); | |||
return photoSpeakVideoMapper.getSortList(umVideoQ); | |||
} | |||
@Override | |||
public int updateById(PhotoSpeakVideo video) { | |||
return photoSpeakVideoMapper.updateById(video); | |||
} | |||
} |
@@ -0,0 +1,124 @@ | |||
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.MouldPatchSign; | |||
import com.iformall.domain.po.sm.PersonPhoto; | |||
import com.iformall.domain.po.sm.VoiceMaterial; | |||
import com.iformall.enums.EnumMouldSendType; | |||
import com.iformall.enums.EnumaMouldPatchStatus; | |||
import com.iformall.mapper.VoiceMaterialMapper; | |||
import com.iformall.service.sm.MouldPatchSignService; | |||
import com.iformall.service.sm.VoiceMaterialService; | |||
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 VoiceMaterialServiceImpl implements VoiceMaterialService { | |||
private final Logger logger = LoggerFactory.getLogger(this.getClass()); | |||
@Autowired | |||
VoiceMaterialMapper voiceMaterialMapper; | |||
@Autowired | |||
MouldPatchSignService mouldPatchSignService; | |||
private void handleSendType(VoiceMaterial record){ | |||
// | |||
if(record.getUserId() != null){ | |||
record.setSendType(EnumMouldSendType.build.getCode()); | |||
}else if(record.getSendType() == null){ | |||
record.setSendTypes(EnumMouldSendType.getSysSendTypes()); | |||
} | |||
} | |||
@Override | |||
public PageInfo<VoiceMaterial> listAsPage(VoiceMaterial record, Integer pageIndex, Integer pageSize) { | |||
handleSendType(record); | |||
return PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> voiceMaterialMapper.findList(record)); | |||
} | |||
@Override | |||
public PageInfo<VoiceMaterial> cListAsPage(VoiceMaterial record, Integer pageIndex, Integer pageSize) { | |||
handleSendType(record); | |||
return PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> voiceMaterialMapper.findCList(record)); | |||
} | |||
@Override | |||
public VoiceMaterial getById(Long id) { | |||
return voiceMaterialMapper.selectById(id); | |||
} | |||
@Override | |||
public VoiceMaterial getDetailById(Long id) { | |||
VoiceMaterial voiceMaterial = getById(id); | |||
if(voiceMaterial == null){ | |||
return null; | |||
} | |||
if(voiceMaterial.getSceneSignList() != null && !voiceMaterial.getSceneSignList().isEmpty()){ | |||
MouldPatchSign signQ = new MouldPatchSign(); | |||
signQ.setIds(voiceMaterial.getSceneSignList()); | |||
List<MouldPatchSign> signList = mouldPatchSignService.getList(signQ); | |||
voiceMaterial.setMouldPatchSign(signList); | |||
} | |||
return voiceMaterial; | |||
} | |||
@Override | |||
public ResultData saveOrUpdate(VoiceMaterial 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); | |||
voiceMaterialMapper.insert(record); | |||
} else { | |||
record.setUpdateDate(now); | |||
voiceMaterialMapper.updateById(record); | |||
} | |||
return new ResultData(); | |||
} | |||
@Override | |||
public void deleteById(Long id) { | |||
voiceMaterialMapper.deleteById(id); | |||
} | |||
@Override | |||
public void updateOnline(VoiceMaterial record) { | |||
Date now = new Date(); | |||
VoiceMaterial voiceMaterialUpd = new VoiceMaterial(); | |||
voiceMaterialUpd.setId(record.getId()); | |||
voiceMaterialUpd.setStatus(record.getStatus()); | |||
if(EnumaMouldPatchStatus.put_on.getCode().equals(voiceMaterialUpd.getStatus())){ | |||
voiceMaterialUpd.setPutonDate(now); | |||
} | |||
voiceMaterialUpd.setUpdateDate(now); | |||
voiceMaterialMapper.updateById(voiceMaterialUpd); | |||
} | |||
} |
@@ -0,0 +1,120 @@ | |||
<?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.PersonPhotoMapper"> | |||
<resultMap id="BaseResultMap" type="com.iformall.domain.po.sm.PersonPhoto"> | |||
<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="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="send_type" jdbcType="INTEGER" property="sendType"/> | |||
<result column="detail" jdbcType="VARCHAR" property="detail"/> | |||
<result column="remark" jdbcType="VARCHAR" property="remark"/> | |||
<result column="material" jdbcType="VARCHAR" property="material"/> | |||
<result column="user_id" jdbcType="BIGINT" property="userId"/> | |||
<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`, | |||
`title`, `sub_title`, `scene_sign`, `sale_price`, `price`, | |||
`send_type`, `detail`, `remark`, `material`, `user_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 != sendType "> | |||
and `send_type` = #{sendType} | |||
</if> | |||
<if test=" null != price "> | |||
and `price` = #{price} | |||
</if> | |||
<if test=" null != status"> | |||
and `status` = #{status} | |||
</if> | |||
<if test=" null != userId"> | |||
and `user_id` = #{userId} | |||
</if> | |||
<if test=" null != startDate "> | |||
and create_date >= #{startDate} | |||
</if> | |||
<if test=" null != endDate"> | |||
and create_date < #{endDate} | |||
</if> | |||
<if test=" null != sendTypes "> | |||
and send_type in | |||
<foreach collection="sendTypes" index="index" item="sendTypeItem" open="(" separator="," close=")"> | |||
#{sendTypeItem} | |||
</foreach> | |||
</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.PersonPhoto" resultMap="BaseResultMap"> | |||
select | |||
<include refid="allColumns"/> | |||
from person_photo | |||
<include refid="dynamicWhereConditions"/> | |||
</select> | |||
<delete id="deleteById" parameterType="java.util.HashMap"> | |||
update person_photo set is_del = 1,update_date = now() where id = #{id} | |||
</delete> | |||
<select id="findCList" parameterType="com.iformall.domain.po.sm.PersonPhoto" resultMap="BaseResultMap"> | |||
select | |||
`id`, | |||
`title`, `sub_title`, `scene_sign`, `sale_price`, `price`, | |||
`send_type`, `material`, `status`, `create_date`, `update_date` | |||
from person_photo | |||
<include refid="dynamicWhereConditions"/> | |||
</select> | |||
</mapper> |
@@ -0,0 +1,142 @@ | |||
<?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.PhotoSpeakVideoMapper"> | |||
<resultMap id="BaseResultMap" type="com.iformall.domain.po.sm.PhotoSpeakVideo"> | |||
<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="user_id" jdbcType="BIGINT" property="userId"/> | |||
<result column="person_photo_id" jdbcType="BIGINT" property="personPhotoId"/> | |||
<result column="person_photo_url" jdbcType="VARCHAR" property="personPhotoUrl"/> | |||
<result column="voice_from" jdbcType="INTEGER" property="voiceFrom"/> | |||
<result column="voice_mould_id" jdbcType="BIGINT" property="voiceMouldId"/> | |||
<result column="voice_mould_sm" jdbcType="VARCHAR" property="voiceMouldSm"/> | |||
<result column="paperwork" jdbcType="VARCHAR" property="paperwork"/> | |||
<result column="voice_material_id" jdbcType="BIGINT" property="voiceMaterialId"/> | |||
<result column="voice_material_url" jdbcType="VARCHAR" property="voiceMaterialUrl"/> | |||
<result column="title" jdbcType="VARCHAR" property="title"/> | |||
<result column="cover_img" jdbcType="VARCHAR" property="coverImg"/> | |||
<result column="remark" jdbcType="VARCHAR" property="remark"/> | |||
<result column="video_id" jdbcType="VARCHAR" property="videoId"/> | |||
<result column="video_path" jdbcType="VARCHAR" property="videoPath"/> | |||
<result column="video_play_url" jdbcType="VARCHAR" property="videoPlayUrl"/> | |||
<result column="video_time" jdbcType="VARCHAR" property="videoTime"/> | |||
<result column="video_size" jdbcType="BIGINT" property="videoSize"/> | |||
<result column="video_status" jdbcType="INTEGER" property="videoStatus"/> | |||
<result column="video_msg" jdbcType="VARCHAR" property="videoMsg"/> | |||
<result column="create_video_date" jdbcType="TIMESTAMP" property="createVideoDate"/> | |||
<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`, `user_id`, | |||
`person_photo_id`, `person_photo_url`, `voice_from`, `voice_mould_id`, `voice_mould_sm`, `paperwork`, `voice_material_id`, `voice_material_url`, | |||
`title`, `cover_img`, `remark`, `video_id`, `video_path`, `video_play_url`, `video_time`, `video_size`, `video_status`, `video_msg`, `create_video_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 != userId "> | |||
and `user_id` = #{userId} | |||
</if> | |||
<if test=" null != voiceFrom "> | |||
and `voice_from` = #{voiceFrom} | |||
</if> | |||
<if test=" null != voiceMouldId "> | |||
and `voice_mould_id` = #{voiceMouldId} | |||
</if> | |||
<if test=" null != title and ''!=title"> | |||
and `title` like concat('%', #{title},'%') | |||
</if> | |||
<if test=" null != videoStatus "> | |||
and `video_status` = #{videoStatus} | |||
</if> | |||
<if test=" null != startDate "> | |||
and create_date >= #{startDate} | |||
</if> | |||
<if test=" null != endDate"> | |||
and create_date < #{endDate} | |||
</if> | |||
<if test=" null != videoStartDate "> | |||
and create_video_date >= #{videoStartDate} | |||
</if> | |||
<if test=" null != videoEndDate"> | |||
and create_video_date < #{videoEndDate} | |||
</if> | |||
<if test=" null != videoStatuss "> | |||
and video_status in | |||
<foreach collection="videoStatuss" index="index" item="videoStatusItem" open="(" separator="," close=")"> | |||
#{videoStatusItem} | |||
</foreach> | |||
</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.UserMouldVideo" resultMap="BaseResultMap"> | |||
select | |||
<include refid="allColumns"/> | |||
from photo_speak_video | |||
<include refid="dynamicWhereConditions"/> | |||
</select> | |||
<delete id="deleteById" parameterType="java.util.HashMap"> | |||
update photo_speak_video set is_del = 1,update_date = now() where id = #{id} | |||
</delete> | |||
<select id="findCList" parameterType="com.iformall.domain.po.sm.UserMouldVideo" resultMap="BaseResultMap"> | |||
select | |||
`id`, | |||
`paperwork`, | |||
`title`, `cover_img`, `remark`, `video_id`, `video_path`, `video_play_url`, `video_time`, `video_size`, `video_status`, | |||
`create_video_date`, `create_date`, `update_date` | |||
from photo_speak_video | |||
<include refid="dynamicWhereConditions"/> | |||
</select> | |||
<select id="findVideo" parameterType="java.util.HashMap" resultMap="BaseResultMap"> | |||
select | |||
`video_id`, `video_path`, `video_play_url`, `video_time`, `video_size`, `video_status`, `video_msg` | |||
from photo_speak_video | |||
where `id` = #{id} | |||
</select> | |||
<select id="getSortList" parameterType="com.iformall.domain.po.sm.UserMouldVideo" resultMap="BaseResultMap"> | |||
select id,title,video_id,video_path, video_play_url,video_status | |||
from photo_speak_video | |||
<include refid="dynamicWhereConditions"/> | |||
</select> | |||
</mapper> |
@@ -0,0 +1,120 @@ | |||
<?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.VoiceMaterialMapper"> | |||
<resultMap id="BaseResultMap" type="com.iformall.domain.po.sm.VoiceMaterial"> | |||
<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="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="send_type" jdbcType="INTEGER" property="sendType"/> | |||
<result column="detail" jdbcType="VARCHAR" property="detail"/> | |||
<result column="remark" jdbcType="VARCHAR" property="remark"/> | |||
<result column="material" jdbcType="VARCHAR" property="material"/> | |||
<result column="user_id" jdbcType="BIGINT" property="userId"/> | |||
<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`, | |||
`title`, `sub_title`, `scene_sign`, `sale_price`, `price`, | |||
`send_type`, `detail`, `remark`, `material`, `user_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 != sendType "> | |||
and `send_type` = #{sendType} | |||
</if> | |||
<if test=" null != price "> | |||
and `price` = #{price} | |||
</if> | |||
<if test=" null != status"> | |||
and `status` = #{status} | |||
</if> | |||
<if test=" null != userId"> | |||
and `user_id` = #{userId} | |||
</if> | |||
<if test=" null != startDate "> | |||
and create_date >= #{startDate} | |||
</if> | |||
<if test=" null != endDate"> | |||
and create_date < #{endDate} | |||
</if> | |||
<if test=" null != sendTypes "> | |||
and send_type in | |||
<foreach collection="sendTypes" index="index" item="sendTypeItem" open="(" separator="," close=")"> | |||
#{sendTypeItem} | |||
</foreach> | |||
</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.VoiceMaterial" resultMap="BaseResultMap"> | |||
select | |||
<include refid="allColumns"/> | |||
from voice_material | |||
<include refid="dynamicWhereConditions"/> | |||
</select> | |||
<delete id="deleteById" parameterType="java.util.HashMap"> | |||
update voice_material set is_del = 1,update_date = now() where id = #{id} | |||
</delete> | |||
<select id="findCList" parameterType="com.iformall.domain.po.sm.VoiceMaterial" resultMap="BaseResultMap"> | |||
select | |||
`id`, | |||
`title`, `sub_title`, `scene_sign`, `sale_price`, `price`, | |||
`send_type`, `material`, `status`, `create_date`, `update_date` | |||
from voice_material | |||
<include refid="dynamicWhereConditions"/> | |||
</select> | |||
</mapper> |