| @@ -43,5 +43,13 @@ public class ApiServiceInfoController extends BaseController { | |||
| svr.setServiceId(getServiceId()); | |||
| return new ResultData(serviceVideoRecordService.listAsPage(svr, dto.getPageNum(), dto.getPageSize())); | |||
| } | |||
| @ApiOperation("当前接入方生成视频记录") | |||
| @GetMapping("currentVideoTotals") | |||
| public ResultData currentVideoTotals(PageServiceVideoRecordDTO dto) { | |||
| ServiceVideoRecord svr = new ServiceVideoRecord(); | |||
| svr.setServiceId(getServiceId()); | |||
| return new ResultData(serviceVideoRecordService.totalTimes(svr)); | |||
| } | |||
| } | |||
| @@ -0,0 +1,173 @@ | |||
| package com.iformall.controller.sm; | |||
| import com.github.pagehelper.PageInfo; | |||
| import com.iformall.common.ErrorCode; | |||
| import com.iformall.common.ResultData; | |||
| import com.iformall.controller.base.BaseController; | |||
| import com.iformall.domain.po.*; | |||
| import com.iformall.domain.po.base.BaseEntity; | |||
| import com.iformall.domain.po.sm.PersonMould; | |||
| import com.iformall.enums.*; | |||
| import com.iformall.service.*; | |||
| import com.iformall.service.pay.PayServiceFactory; | |||
| import com.iformall.service.pay.service.pay.PayAdapterService; | |||
| import io.swagger.annotations.Api; | |||
| import io.swagger.annotations.ApiImplicitParam; | |||
| import io.swagger.annotations.ApiImplicitParams; | |||
| import io.swagger.annotations.ApiOperation; | |||
| import java.util.List; | |||
| 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("/productOrder") | |||
| @Api(description = "模板接口") | |||
| public class ProductOrderController extends BaseController { | |||
| private final Logger logger = LoggerFactory.getLogger(this.getClass()); | |||
| @Autowired | |||
| private ProductOrderService productOrderService; | |||
| @Autowired | |||
| private WxCUserBasicInfoService wxCUserBasicInfoService; | |||
| @ApiOperation("根据id查询接口") | |||
| @GetMapping("/paiedOrders") | |||
| @ApiImplicitParams({ | |||
| @ApiImplicitParam(name = "projectType", value = "projectType", dataType = "String", paramType = "query", required = true), | |||
| @ApiImplicitParam(name = "pageNum", value = "页数", dataType = "int", paramType = "query", required = true), | |||
| @ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "int", paramType = "query", required = true)}) | |||
| public ResultData myPaiedOrders(@ModelAttribute ProductOrder record,Integer pageNum,Integer pageSize) { | |||
| if(record.getProjectType() == null){ | |||
| return new ResultData(ErrorCode.SYS_PARAMETER_TYPE_ERROR.getCode(),"projectType参数错误"); | |||
| } | |||
| EnumProject projectTypeEnum = EnumProject.getEnum(record.getProjectType()); | |||
| if(projectTypeEnum == null){ | |||
| return new ResultData(ErrorCode.SYS_PARAMETER_TYPE_ERROR.getCode(),"projectType参数错误"); | |||
| } | |||
| if (StringUtils.isNotBlank(record.getPhone())) { | |||
| List<Long> cUserIds = wxCUserBasicInfoService.findIdsListByPhone(null, record.getPhone()); | |||
| if (null == cUserIds || cUserIds.size() <= 0 ) { | |||
| record.setId(-1L); | |||
| }else { | |||
| record.setCUserIds(cUserIds); | |||
| } | |||
| } | |||
| record.setOrderStatus(EnumProductOrderStatus.ORDER_STATUS_PAYMENT_SUCCESS.getCode()); | |||
| PageInfo<ProductOrder> page =productOrderService.listAsPage(record, pageNum, pageSize); | |||
| if (null != page && null != page.getList() && page.getList().size() > 0 ) { | |||
| for (int i = 0 ; i < page.getList().size(); i++) { | |||
| ProductOrder pm = page.getList().get(i); | |||
| pm.setCUserInfo(wxCUserBasicInfoService.getById(pm.getUserId())); | |||
| } | |||
| } | |||
| return new ResultData(page); | |||
| } | |||
| // @AuthIgnore | |||
| // @ApiOperation(value = "获取详情链接", notes = "") | |||
| // @PostMapping("getPayUrl") | |||
| // public ResultData getPayUrl(@RequestBody ProductOrder record) { | |||
| // logger.debug("[" + getIpAddr() + "] ProductOrderController::getPayUrl"); | |||
| // if(StringUtils.isBlank(record.getAppId())){ | |||
| // return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "appId 不能为空"); | |||
| // } | |||
| // WxAppinfo wxAppinfo = wxAppinfoService.getOnlyByAppIdFromRedis(record.getAppId()); | |||
| // if(wxAppinfo == null){ | |||
| // return new ResultData(ErrorCode.APP_ID_NOT_FOUND); | |||
| // } | |||
| // | |||
| // if(record.getUserId() == null){ | |||
| // return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(),"用户编号为空"); | |||
| // } | |||
| // WxCUserBasicInfo basicUser = wxCUserBasicInfoService.getById(record.getUserId()); | |||
| // if(basicUser == null){ | |||
| // return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(),"未查询到用户"); | |||
| // } | |||
| // | |||
| // if(record.getProductId() == null){ | |||
| // return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(),"商品编号为空"); | |||
| // } | |||
| // Product product = productService.getById(record.getProductId()); | |||
| // if(product == null){ | |||
| // return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(),"未查询到商品"); | |||
| // } | |||
| // | |||
| // if(!wxAppinfo.getProjectType().equals(product.getProjectType())){ | |||
| // return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(),"商品数据异常"); | |||
| // } | |||
| // | |||
| // try { | |||
| // EnumProject project = EnumProject.getEnum(wxAppinfo.getProjectType()); | |||
| // EnumAppPlat plat = EnumAppPlat.getByCode(wxAppinfo.getPlat()); | |||
| // String productScheme = Constant.mainPageUrl; | |||
| // String sceneParam = "t:dt_p:"+record.getProductId()+"_u:"+record.getUserId(); | |||
| // Date timeAfterDays = DateUtils.getTimeAfterDays(1, new Date()); | |||
| // Long expireTime = timeAfterDays.getTime()/1000; | |||
| // return schemeService.generateScheme(project,plat,productScheme,sceneParam,expireTime); | |||
| // } catch (MallinkException e) { | |||
| // return new ResultData(e.getErrorCode(), e.getMessage()); | |||
| // }catch (Exception e) { | |||
| // this.logger.error(e.getMessage(), e); | |||
| // return new ResultData(ErrorCode.SYS_SERVER_ERROR); | |||
| // } | |||
| // } | |||
| // @AuthIgnore | |||
| // @ApiOperation(value = "创建支付(不验证用户)", notes = "") | |||
| // @PostMapping("pay") | |||
| // public ResultData pay(@RequestBody ProductOrder record) { | |||
| // logger.debug("[" + getIpAddr() + "] ProductOrderController::pay"); | |||
| // if(record.getPayVendor() == null){ | |||
| // return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(),"支付方式为空"); | |||
| // } | |||
| // EnumProductOrderPayVendor payVendorEnum = EnumProductOrderPayVendor.getEnum(record.getPayVendor()); | |||
| // if(payVendorEnum == null){ | |||
| // return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(),"支付方式参数错误"); | |||
| // } | |||
| // | |||
| // if(EnumProductOrderPayVendor.PAY_WAY_WECHAT.getCode().equals(record.getPayVendor())){ | |||
| // if(StringUtils.isBlank(record.getOpenId())){ | |||
| // return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(),"openId为空"); | |||
| // } | |||
| // } | |||
| //// record.setProfitSharing(payVendorEnum.getProfitSharing()); | |||
| // | |||
| // if(record.getUserId() == null){ | |||
| // return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(),"用户编号为空"); | |||
| // } | |||
| // WxCUserBasicInfo basicUser = wxCUserBasicInfoService.getById(record.getUserId()); | |||
| // if(basicUser == null){ | |||
| // return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(),"未查询到用户"); | |||
| // } | |||
| // | |||
| // if(record.getProductId() == null){ | |||
| // return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(),"商品编号为空"); | |||
| // } | |||
| // Product product = productService.getById(record.getProductId()); | |||
| // if(product == null){ | |||
| // return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(),"未查询到商品"); | |||
| // } | |||
| // | |||
| // record.setProductTitle(product.getTitle()); | |||
| // record.setProductEnTitle(product.getEnTitle()); | |||
| // record.setOrderStatus(EnumProductOrderStatus.ORDER_STATUS_PENDING_PAYMENT.getCode()); | |||
| // record.setProjectType(product.getProjectType()); | |||
| // record.setOrderPrice(product.getSellPriceRmb()); | |||
| // productOrderService.saveOrUpdate(record); | |||
| // | |||
| // return productOrderService.createPay(record); | |||
| // } | |||
| } | |||
| @@ -214,6 +214,16 @@ public class ServiceInfoController extends MallUserInfoBaseController{ | |||
| return new ResultData(personMouldPage); | |||
| } | |||
| @ApiOperation("当前视频生成记录总时长") | |||
| @GetMapping("/currentVideoToal") | |||
| public ResultData currentVideoToal() { | |||
| MallUserInfo user = this.getUser(); | |||
| ServiceInfo si = serviceInfoService.getServiceInfoByMallUserInfo(user.getId()); | |||
| ServiceVideoRecord svr = new ServiceVideoRecord(); | |||
| svr.setServiceId(si.getId()); | |||
| return new ResultData(serviceVideoRecordService.totalTimes(svr)); | |||
| } | |||
| @ApiVersion(group = SwaggerConstant.V_1_0_0) | |||
| @ApiOperation("私有化部署管理员当前") | |||
| @GetMapping("/privateDeployAdminCurrent") | |||
| @@ -240,4 +250,16 @@ public class ServiceInfoController extends MallUserInfoBaseController{ | |||
| return new ResultData(Result.ERROR,"当前访问非法"); | |||
| } | |||
| } | |||
| @ApiVersion(group = SwaggerConstant.V_1_0_0) | |||
| @ApiOperation("私有化部署管理员当前视频生成记录总时长") | |||
| @GetMapping("/privateDeployAdminCurrentVideoTotal") | |||
| public ResultData privateDeployAdminCurrentVideoTotal() { | |||
| MallUserInfo user = this.getUser(); | |||
| if (AiVideoHelper.localDeploy && user.checkAdmin()) { | |||
| return new ResultData(SmSdkUtils.currentVideoTotals()); | |||
| }else { | |||
| return new ResultData(Result.ERROR,"当前访问非法"); | |||
| } | |||
| } | |||
| } | |||
| @@ -9,6 +9,7 @@ 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.service.WxCUserBasicInfoService; | |||
| import com.iformall.service.sm.MouldPatchService; | |||
| import com.iformall.service.sm.MouldPatchSignService; | |||
| import com.iformall.service.sm.UserMouldVideoService; | |||
| @@ -33,6 +34,9 @@ public class UserMouldVideoController extends BaseController { | |||
| @Autowired | |||
| private UserMouldVideoService userMouldVideoService; | |||
| @Autowired | |||
| private WxCUserBasicInfoService wxCUserBasicInfoService; | |||
| @ApiOperation("分页列表接口") | |||
| @GetMapping("list") | |||
| @@ -42,6 +46,16 @@ public class UserMouldVideoController extends BaseController { | |||
| public ResultData list(@ModelAttribute UserMouldVideo record, Integer pageNum, Integer pageSize) { | |||
| logger.debug("[" + getIpAddr() + "] UserMouldVideoController::list"); | |||
| if (record == null) record = new UserMouldVideo(); | |||
| if (StringUtils.isNotBlank(record.getPhone())) { | |||
| List<Long> cUserIds = wxCUserBasicInfoService.findIdsListByPhone(null, record.getPhone()); | |||
| if (null == cUserIds || cUserIds.size() <= 0 ) { | |||
| record.setId(-1L); | |||
| }else { | |||
| record.setCUserIds(cUserIds); | |||
| } | |||
| } | |||
| record.setSortColumns(BaseEntity.SortField.UpdateDate_DESC); | |||
| final PageInfo<UserMouldVideo> page = userMouldVideoService.listAsPage(record, pageNum, pageSize); | |||
| return new ResultData(page); | |||
| @@ -5,6 +5,7 @@ import com.iformall.domain.po.sm.UserMouldVideo; | |||
| import com.iformall.domain.po.sm.VideoTrans; | |||
| import com.iformall.enums.EnumProject; | |||
| import com.iformall.enums.EnumVideoStatus; | |||
| import com.iformall.enums.EnumYesOrNo; | |||
| import com.iformall.enums.EnumaVideoTransStatus; | |||
| import com.iformall.mapper.VideoTransMapper; | |||
| import com.iformall.service.project.ProjectFactory; | |||
| @@ -55,6 +56,7 @@ public class VideoSchedule { | |||
| UserMouldVideo userVideo = new UserMouldVideo(); | |||
| userVideo.setVideoStartDate(DateUtils.getHourDateBefore(2,new Date())); | |||
| userVideo.setVideoStatus(EnumVideoStatus.fail.getCode()); | |||
| userVideo.setIsDel(EnumYesOrNo.NO.getCode()); | |||
| List<UserMouldVideo> list = userMouldVideoService.findList(userVideo); | |||
| if (list != null && list.size() > 0) { | |||
| for (UserMouldVideo video : list) { | |||
| @@ -97,5 +97,14 @@ public class ProductOrder extends TenantEntity { | |||
| @TableField(exist = false) | |||
| private Integer isOrderStatus; | |||
| @TableField(exist = false) | |||
| private String phone; | |||
| @TableField(exist = false) | |||
| private List<Long> cUserIds; | |||
| @TableField(exist = false) | |||
| private WxCUserBasicInfo cUserInfo; | |||
| } | |||
| @@ -202,8 +202,15 @@ public class UserMouldVideo extends TenantEntity { | |||
| private Integer costPoints; | |||
| @io.swagger.annotations.ApiModelProperty(value="消耗金币明细",name="costPointsDetail") | |||
| private String costPointsDetail; | |||
| @io.swagger.annotations.ApiModelProperty(value="isDel",name="isDel") | |||
| private Integer isDel; | |||
| @TableField(exist = false) | |||
| private List<Integer> videoStatuss; | |||
| @TableField(exist = false) | |||
| private String phone; | |||
| @TableField(exist = false) | |||
| private List<Long> cUserIds; | |||
| } | |||
| @@ -6,4 +6,6 @@ import com.iformall.domain.po.sm.ServiceVideoRecord; | |||
| public interface ServiceVideoRecordMapper extends CommonMapper<ServiceVideoRecord, Long> { | |||
| String totalTimes(ServiceVideoRecord record); | |||
| } | |||
| @@ -17,5 +17,7 @@ public interface ServiceVideoRecordService { | |||
| PageInfo<ServiceVideoRecord> listAsPage(ServiceVideoRecord record, Integer pageIndex, Integer pageSize); | |||
| String totalTimes(ServiceVideoRecord record); | |||
| } | |||
| @@ -26,4 +26,9 @@ public class ServiceVideoRecordServiceImpl implements ServiceVideoRecordService | |||
| return PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> serviceVideoRecordMapper | |||
| .selectList(new LambdaQueryWrapper<ServiceVideoRecord>().eq(ServiceVideoRecord::getServiceId, record.getServiceId()).orderByDesc(ServiceVideoRecord::getCreateTime))); | |||
| } | |||
| @Override | |||
| public String totalTimes(ServiceVideoRecord record) { | |||
| return serviceVideoRecordMapper.totalTimes(record); | |||
| } | |||
| } | |||
| @@ -83,6 +83,7 @@ public class UserMouldVideoServiceImpl implements UserMouldVideoService { | |||
| @Override | |||
| public PageInfo<UserMouldVideo> cListAsPage(UserMouldVideo record, Integer pageIndex, Integer pageSize) { | |||
| record.setIsDel(EnumYesOrNo.NO.getCode()); | |||
| return PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> userMouldVideoMapper.findCList(record)); | |||
| } | |||
| @@ -517,6 +518,7 @@ public class UserMouldVideoServiceImpl implements UserMouldVideoService { | |||
| videoStatuss.add(EnumVideoStatus.success.getCode()); | |||
| videoStatuss.add(EnumVideoStatus.upload_fail.getCode()); | |||
| umVideoQ.setVideoStatuss(videoStatuss); | |||
| umVideoQ.setIsDel(EnumYesOrNo.NO.getCode()); | |||
| return userMouldVideoMapper.getSortList(umVideoQ); | |||
| } | |||
| @@ -524,6 +526,7 @@ public class UserMouldVideoServiceImpl implements UserMouldVideoService { | |||
| public List<UserMouldVideo> getUpLoadIngList() { | |||
| UserMouldVideo umVideoQ = new UserMouldVideo(); | |||
| umVideoQ.setVideoStatus(EnumVideoStatus.upload_ing.getCode()); | |||
| umVideoQ.setIsDel(EnumYesOrNo.NO.getCode()); | |||
| return userMouldVideoMapper.getSortList(umVideoQ); | |||
| } | |||
| @@ -39,4 +39,9 @@ public interface SmSdkConstant { | |||
| * 当前接入方生成视频记录 | |||
| */ | |||
| String CURRENT_SERVICE_VIDEO_RECORDS = "/api/serviceInfo/currentVideoRecords"; | |||
| /** | |||
| * 当前接入方生成视频记录 | |||
| */ | |||
| String CURRENT_SERVICE_VIDEO_TOTALS = "/api/serviceInfo/currentVideoTotals"; | |||
| } | |||
| @@ -95,4 +95,15 @@ public class SmSdkUtils { | |||
| String data = resultObject.getString("data"); | |||
| return StringUtils.isNotBlank(data) ? JSON.parseObject(data, PageInfo.class) : new PageInfo<ServiceVideoRecord>(); | |||
| } | |||
| public static PageInfo<ServiceVideoRecord> currentVideoTotals() { | |||
| Map parm = new HashMap(); | |||
| HttpEntity<MultiValueMap<String, Object>> httEntity = SmUtils.getHttpEntity(parm); | |||
| String url = smSdkUtils.smSdkProperties.getBaseUrl() + SmSdkConstant.CURRENT_SERVICE_VIDEO_TOTALS; | |||
| ResponseEntity<String> response = smSdkUtils.restTemplate.exchange(url, HttpMethod.GET, httEntity, String.class); | |||
| log.info("(遂芒api)【查询当前接入方】接口的响应数据:{}", JSON.toJSON(response.getBody())); | |||
| JSONObject resultObject = JSON.parseObject(response.getBody()); | |||
| String data = resultObject.getString("data"); | |||
| return StringUtils.isNotBlank(data) ? JSON.parseObject(data, PageInfo.class) : new PageInfo<ServiceVideoRecord>(); | |||
| } | |||
| } | |||
| @@ -96,6 +96,13 @@ | |||
| #{sItem} | |||
| </foreach> | |||
| </if> | |||
| <if test=" null != cUserIds "> | |||
| and user_id in | |||
| <foreach collection="cUserIds" index="index" item="uidItem" open="(" separator="," close=")"> | |||
| #{uidItem} | |||
| </foreach> | |||
| </if> | |||
| <if test=" null != ids "> | |||
| and id in | |||
| @@ -0,0 +1,11 @@ | |||
| <?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.ServiceVideoRecordMapper"> | |||
| <select id="totalTimes" parameterType="com.iformall.domain.po.sm.PersonMould" resultType="String"> | |||
| select sum(video_time) | |||
| from person_mould | |||
| where service_id = #{serviceId} | |||
| </select> | |||
| </mapper> | |||
| @@ -49,12 +49,16 @@ | |||
| </sql> | |||
| <sql id="dynamicWhereConditions"> | |||
| where `is_del` = 0 | |||
| where 1 = 1 | |||
| <if test=" null != id "> | |||
| and `id` = #{id} | |||
| </if> | |||
| <if test=" null != isDel "> | |||
| and `is_del` = #{isDel} | |||
| </if> | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and `tenant_id` = #{tenantId} | |||
| </if> | |||
| @@ -85,6 +89,10 @@ | |||
| <if test=" null != title and ''!=title"> | |||
| and `title` like concat('%', #{title},'%') | |||
| </if> | |||
| <if test=" null != paperwork and ''!=paperwork"> | |||
| and `paperwork` like concat('%', #{paperwork},'%') | |||
| </if> | |||
| <if test=" null != videoStatus "> | |||
| and `video_status` = #{videoStatus} | |||
| @@ -110,6 +118,13 @@ | |||
| #{videoStatusItem} | |||
| </foreach> | |||
| </if> | |||
| <if test=" null != cUserIds "> | |||
| and user_id in | |||
| <foreach collection="cUserIds" index="index" item="cidItem" open="(" separator="," close=")"> | |||
| #{cidItem} | |||
| </foreach> | |||
| </if> | |||
| <if test=" null != ids "> | |||
| and id in | |||