Commit 92b4fd71 by 郑云飞

Merge remote-tracking branch 'origin/master'

parents 9f00d60f 63f82234
......@@ -14,9 +14,9 @@ spring:
datasource:
type: com.zaxxer.hikari.HikariDataSource
driver-class-name: com.mysql.cj.jdbc.Driver
url: jdbc:mysql://127.0.0.1:3306/ry-vue?useUnicode=true&characterEncoding=UTF-8&autoReconnect=true&serverTimezone=Asia/Shanghai
username: root
password: root
url: jdbc:mysql://db1.prd.nyinhong.com:3317/xinrenli?useUnicode=true&characterEncoding=UTF-8&autoReconnect=true&serverTimezone=Asia/Shanghai
username: xinrenli
password: 27Rw2HL4h4PEEE4r
hikari:
auto-commit: true
connection-test-query: SELECT 1
......
......@@ -294,7 +294,7 @@ public class SysLoginService {
}
Date now = new Date();
List<DbCoupon> coupons = couponMapper.selectList(Wrappers.<DbCoupon>lambdaQuery()
.eq(DbCoupon::getCouponType, 1)
//.eq(DbCoupon::getCouponType, 1)
.le(DbCoupon::getEffectiveTime, now)
.ge(DbCoupon::getFailureTime, now));
for (DbCoupon coupon : coupons) {
......@@ -322,7 +322,7 @@ public class SysLoginService {
LoginUser loginUser = new LoginUser();
loginUser.setUserId(user.getUserId());
loginUser.setDeptId(user.getDeptId());
loginUser.setUsername(user.getUserName());
loginUser.setUsername(user.getNickName());
loginUser.setUserType(user.getUserType());
loginUser.setMenuPermission(permissionService.getMenuPermission(user));
loginUser.setRolePermission(permissionService.getRolePermission(user));
......
......@@ -27,7 +27,21 @@
<groupId>com.yongqi</groupId>
<artifactId>yongqi-sms</artifactId>
</dependency>
<dependency>
<groupId>org.bytedeco</groupId>
<artifactId>javacpp</artifactId>
<version>1.4.1</version>
</dependency>
<dependency>
<groupId>org.bytedeco</groupId>
<artifactId>javacv</artifactId>
<version>1.4.1</version>
</dependency>
<dependency>
<groupId>org.bytedeco.javacpp-presets</groupId>
<artifactId>ffmpeg-platform</artifactId>
<version>3.4.2-1.4.1</version>
</dependency>
<!-- 短信 用哪个导入哪个依赖 -->
<!-- <dependency>-->
<!-- <groupId>com.aliyun</groupId>-->
......
......@@ -31,7 +31,12 @@ import javax.servlet.http.HttpServletResponse;
import javax.validation.constraints.NotNull;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import static com.yongqi.xinrenli.utils.videoText.getTempPath;
/**
* 订单
......@@ -265,7 +270,6 @@ public class DbOrderController extends BaseController {
@Log(title = "报表", businessType = BusinessType.DELETE)
@PostMapping("/createPay")
public R<Void> createPay(@RequestBody DbOrderEditBo bo) {
if("2".equals(bo.getStatus())){
if(ObjectUtils.isEmpty(bo.getActualAmount())){
return R.fail("沟通金额为空");
......@@ -278,4 +282,10 @@ public class DbOrderController extends BaseController {
}
return toAjax(iDbOrderService.createPay(bo));
}
@SaCheckPermission("xinrenli:order:test")
@Log(title = "报表", businessType = BusinessType.DELETE)
@GetMapping("/test")
public String test(String url) throws Exception {
return "jenkins成功";
}
}
......@@ -20,7 +20,7 @@ public class DbArticle{
/**
* 自增id
*/
@TableId(value = "id")
@TableId(value = "id", type = IdType.AUTO)
private Long id;
/**
* 动态标题
......
......@@ -21,7 +21,7 @@ public class DbCoupon {
/**
* 自增id
*/
@TableId(value = "id")
@TableId(value = "id", type = IdType.AUTO)
private Long id;
/**
* 券类型1为新用户 0为满减卷
......
......@@ -22,7 +22,7 @@ public class DbFile {
/**
* 主键id
*/
@TableId(value = "id")
@TableId(value = "id", type = IdType.AUTO)
private Long id;
/**
* 业务类型
......@@ -64,5 +64,8 @@ public class DbFile {
* 修改人
*/
private String modifyName;
/**
* 视频第一帧
*/
private String cropImage;
}
......@@ -20,7 +20,7 @@ public class DbInviter {
/**
* 主键id
*/
@TableId(value = "id")
@TableId(value = "id", type = IdType.AUTO)
private Long id;
/**
* 邀请人id
......
......@@ -20,7 +20,7 @@ public class DbUserComment {
/**
* id自增
*/
@TableId(value = "id")
@TableId(value = "id", type = IdType.AUTO)
private Long id;
/**
* 文章id
......
......@@ -20,7 +20,7 @@ public class DbUserCoupon {
/**
* 主键id
*/
@TableId(value = "id")
@TableId(value = "id", type = IdType.AUTO)
private Long id;
/**
* 优惠券id
......
......@@ -23,7 +23,7 @@ public class DbUserDiscount {
/**
* 主键id
*/
@TableId(value = "id")
@TableId(value = "id", type = IdType.AUTO)
private Long id;
/**
* 用户id
......
......@@ -20,7 +20,7 @@ public class DbUserFeedback {
/**
* 自增id
*/
@TableId(value = "id")
@TableId(value = "id", type = IdType.AUTO)
private Long id;
/**
* 用户id
......
......@@ -21,7 +21,7 @@ public class DbWxUser {
/**
* 主键标识
*/
@TableId(value = "id")
@TableId(value = "id", type = IdType.AUTO)
private Long id;
/**
* 微信用户的唯一标识
......
......@@ -79,5 +79,8 @@ public class DbFileBo extends BaseEntity {
* 业务id
*/
private String serviceId;
/**
* 视频第一帧
*/
private String cropImage;
}
......@@ -80,6 +80,9 @@ public class DbFileVo {
*/
@ExcelProperty(value = "修改人")
private String modifyName;
/**
* 视频第一帧
*/
private String cropImage;
}
......@@ -52,6 +52,8 @@ public class DbInviterVo {
*/
@ExcelProperty(value = "状态:是否已计入折扣")
private Integer status;
/**
* 用户头像
*/
private String headImgUrl;
}
package com.yongqi.xinrenli.mapper;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yongqi.xinrenli.domain.DbInviter;
import com.yongqi.xinrenli.domain.vo.DbInviterVo;
import com.yongqi.common.core.mapper.BaseMapperPlus;
import org.apache.ibatis.annotations.Param;
/**
* 邀请Mapper接口
......@@ -13,4 +17,6 @@ import com.yongqi.common.core.mapper.BaseMapperPlus;
public interface DbInviterMapper extends BaseMapperPlus<DbInviterMapper, DbInviter, DbInviterVo> {
Integer InvitedCount(Long inviterId);
Page<DbInviterVo> selectVoPageList(@Param("page")Page<DbInviterVo> build, @Param(Constants.WRAPPER) LambdaQueryWrapper<DbInviter> lqw);
}
......@@ -11,6 +11,8 @@ import com.yongqi.xinrenli.domain.vo.DbUserCommentVo;
import com.yongqi.common.core.mapper.BaseMapperPlus;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* 用户评论Mapper接口
*
......@@ -22,4 +24,6 @@ public interface DbUserCommentMapper extends BaseMapperPlus<DbUserCommentMapper,
Page<DbUserCommentVo> selectUserPage(Page<DbUserCommentVo> page, @Param(Constants.WRAPPER) LambdaQueryWrapper<DbUserComment> queryWrapper);
List<DbUserCommentVo> selectVoPageList(@Param("id")Long id);
}
......@@ -64,6 +64,7 @@ public class DbArticleServiceImpl implements IDbArticleService {
vo.setFileVos(dbFileVo);
return vo;
}
private static final String REG_EX = "</?[^>]+>";
/**
* 查询文章列表
......@@ -75,10 +76,8 @@ public class DbArticleServiceImpl implements IDbArticleService {
pageQuery.setOrderByColumn("modifyTime");
Page<DbArticleVo> result = baseMapper.selectPageList(pageQuery.build(), lqw);
result.getRecords().forEach(record -> {
IPage<DbUserCommentVo> voPage = commentMapper.selectVoPage(new Page<DbUserComment>(0, 3), Wrappers.<DbUserComment>lambdaQuery()
.eq(DbUserComment::getArticleId, record.getId())
.eq(DbUserComment::getDeleteStatus, 0));
record.setCommentVos(voPage.getRecords());
List<DbUserCommentVo> voPage = commentMapper.selectVoPageList(record.getId());
record.setCommentVos(voPage);
List<DbFileVo> dbFileVo = fileMapper.selectVoList(Wrappers.<DbFile>lambdaQuery()
.eq(DbFile::getServiceId, record.getId())
.eq(DbFile::getServiceType, FileEnumServiceType.ARTICLE.getServiceTyp())
......@@ -88,8 +87,7 @@ public class DbArticleServiceImpl implements IDbArticleService {
for (DbArticleVo article : result.getRecords()) {
String n = article.getContent();
n = n.replace("<p>", "");
n = n.replace("</p>", "");
n = n.replaceAll(REG_EX, "");
article.setContent(n);
}
......@@ -105,8 +103,7 @@ public class DbArticleServiceImpl implements IDbArticleService {
List<DbArticleVo> list = baseMapper.selectVoList(lqw);
for (DbArticleVo article : list) {
String n = article.getContent();
n = n.replace("<p>", "");
n = n.replace("</p>", "");
n = n.replaceAll(REG_EX, "");
article.setContent(n);
}
return list;
......
......@@ -17,6 +17,7 @@ import com.yongqi.xinrenli.domain.DbCoupon;
import com.yongqi.xinrenli.mapper.DbCouponMapper;
import com.yongqi.xinrenli.service.IDbCouponService;
import java.util.Calendar;
import java.util.List;
import java.util.Map;
import java.util.Collection;
......@@ -81,6 +82,13 @@ public class DbCouponServiceImpl implements IDbCouponService {
@Override
public Boolean insertByBo(DbCouponBo bo) {
DbCoupon add = BeanUtil.toBean(bo, DbCoupon.class);
Calendar calendar = Calendar.getInstance();
calendar.setTime(add.getFailureTime());
// 将时分秒,毫秒域清零
calendar.set(Calendar.HOUR_OF_DAY, 23);
calendar.set(Calendar.MINUTE, 59);
calendar.set(Calendar.SECOND, 59);
add.setFailureTime(calendar.getTime());
validEntityBeforeSave(add);
boolean flag = baseMapper.insert(add) > 0;
if (flag) {
......@@ -97,7 +105,13 @@ public class DbCouponServiceImpl implements IDbCouponService {
*/
@Override
public Boolean updateByBo(DbCouponBo bo) {
DbCoupon update = BeanUtil.toBean(bo, DbCoupon.class);
DbCoupon update = BeanUtil.toBean(bo, DbCoupon.class); Calendar calendar = Calendar.getInstance();
calendar.setTime(update.getFailureTime());
// 将时分秒,毫秒域清零
calendar.set(Calendar.HOUR_OF_DAY, 23);
calendar.set(Calendar.MINUTE, 59);
calendar.set(Calendar.SECOND, 59);
update.setFailureTime(calendar.getTime());
validEntityBeforeSave(update);
return baseMapper.updateById(update) > 0;
}
......
......@@ -52,7 +52,8 @@ public class DbInviterServiceImpl implements IDbInviterService {
@Override
public TableDataInfo<DbInviterVo> queryPageList(DbInviterBo bo, PageQuery pageQuery) {
LambdaQueryWrapper<DbInviter> lqw = buildQueryWrapper(bo);
Page<DbInviterVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw);
Page<DbInviterVo> result = baseMapper.selectVoPageList(pageQuery.build(), lqw);
return TableDataInfo.build(result);
}
......
......@@ -41,6 +41,8 @@ import java.math.BigDecimal;
import java.util.*;
import java.util.stream.Collectors;
import static com.yongqi.xinrenli.utils.videoText.getTempPath;
/**
* 订单Service业务层处理
*
......@@ -193,6 +195,7 @@ public class DbOrderServiceImpl implements IDbOrderService {
file.setServiceType(FileEnumServiceType.ORDER.getServiceTyp());
file.setCreateName(String.valueOf(user.getUserId()));
file.setModifyName(String.valueOf(user.getUserId()));
});
fileMapper.insertBatch(files);
}
......@@ -204,6 +207,14 @@ public class DbOrderServiceImpl implements IDbOrderService {
file.setServiceType(FileEnumServiceType.ORDER.getServiceTyp());
file.setCreateName(String.valueOf(user.getUserId()));
file.setModifyName(String.valueOf(user.getUserId()));
try {
String image = "/opt/xinrenli/image/"+file.getUrl().substring(file.getUrl().lastIndexOf("/")+1);
String filename = UUID.randomUUID().toString()+".jpg";
file.setCropImage("http://xinrenli.nyinhong.com/image/"+filename);
getTempPath("/opt/xinrenli/image/"+filename,image);
} catch (Exception e) {
throw new RuntimeException(e);
}
});
fileMapper.insertBatch(files);
}
......@@ -258,6 +269,14 @@ public class DbOrderServiceImpl implements IDbOrderService {
file.setDeleteStatus(DeleteStatusEnum.OK.getCode());
file.setCreateName(String.valueOf(user.getUserId()));
file.setModifyName(String.valueOf(user.getUserId()));
try {
String image = "/opt/xinrenli/image/"+file.getUrl().substring(file.getUrl().lastIndexOf("/")+1);
String filename = UUID.randomUUID().toString()+".jpg";
file.setCropImage("http://xinrenli.nyinhong.com/image/"+filename);
getTempPath("/opt/xinrenli/image/"+filename,image);
} catch (Exception e) {
throw new RuntimeException(e);
}
});
fileMapper.insertBatch(files);
}
......@@ -302,16 +321,25 @@ public class DbOrderServiceImpl implements IDbOrderService {
pageQuery.setOrderByColumn("modifyTime");
Page<DbOrderVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw);
result.getRecords().forEach(record -> {
DbFileVo dbFileVo = fileMapper.selectVoOne(Wrappers.<DbFile>lambdaQuery()
List<DbFileVo> dbFileVo = fileMapper.selectVoList(Wrappers.<DbFile>lambdaQuery()
.eq(DbFile::getServiceId, record.getId())
.eq(DbFile::getServiceType, FileEnumServiceType.ORDER.getServiceTyp())
.eq(DbFile::getSort, 1)
.eq(DbFile::getDeleteStatus, DeleteStatusEnum.OK.getCode()));
List<DbFileVo> vos = new ArrayList<>();
if (ObjectUtils.isNotEmpty(dbFileVo)) {
vos.add(dbFileVo);
}
record.setFileVos(vos);
//文件类型分组
Map<String, List<DbFileVo>> groupMap = dbFileVo.stream().collect(Collectors.groupingBy(u -> u.getFileType()));
groupMap.forEach((k, v) -> {
if (k.equals("picture")) {
record.setPictureList(v);
}
if (k.equals("video")) {
record.setVideoList(v);
}
if (k.equals("voice")) {
record.setVoiceList(v);
}
});
record.setFileVos(dbFileVo);
});
return TableDataInfo.build(result);
}
......@@ -383,9 +411,7 @@ public class DbOrderServiceImpl implements IDbOrderService {
.eq(DbFile::getServiceId, record.getId())
.eq(DbFile::getServiceType, FileEnumServiceType.ORDER.getServiceTyp())
.eq(DbFile::getDeleteStatus, DeleteStatusEnum.OK.getCode()));
if (ObjectUtils.isEmpty(dbFileVo)) {
// throw new RuntimeException("这个订单没有文件");
}
//文件类型分组
Map<String, List<DbFileVo>> groupMap = dbFileVo.stream().collect(Collectors.groupingBy(u -> u.getFileType()));
groupMap.forEach((k, v) -> {
......
package com.yongqi.xinrenli.utils;
import org.bytedeco.javacv.FFmpegFrameGrabber;
import org.bytedeco.javacv.Frame;
import org.bytedeco.javacv.Java2DFrameConverter;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import javax.imageio.ImageIO;
import java.awt.image.BufferedImage;
import java.awt.image.RenderedImage;
import java.io.File;
public class videoText {
public static final Logger log = LoggerFactory.getLogger(videoText.class);
public static String getTempPath(String tempPath, String filePath) throws Exception {
// String tempPath=" ";//保存的目标路径
File targetFile = new File(tempPath);
if (!targetFile.getParentFile().exists()) {
targetFile.getParentFile().mkdirs();
}
File file2 = new File(filePath);
if (file2.exists()) {
log.info("文件存在,路径正确!");
FFmpegFrameGrabber ff = new FFmpegFrameGrabber(file2);
ff.start();
int ftp = ff.getLengthInFrames();
int flag=0;
Frame frame = null;
while (flag <= ftp) {
//获取帧
frame = ff.grabImage();
//过滤前3帧,避免出现全黑图片
if ((flag>3)&&(frame != null)) {
break;
}
flag++;
}
ImageIO.write(FrameToBufferedImage(frame), "jpg", targetFile);
ff.close();
ff.stop();
}
return null;
}
private static RenderedImage FrameToBufferedImage(Frame frame) {
//创建BufferedImage对象
Java2DFrameConverter converter = new Java2DFrameConverter();
BufferedImage bufferedImage = converter.getBufferedImage(frame);
return bufferedImage;
}
// public static void main(String[] args) {
// try {
//// getTempPath("http://jyt.fty.pw:8080/videos/guoyifang/a2966518-03dd-4a31-b05b-5c52db6baf73.mp4", "D:\\test.jpg");
// getTempPath("C:\\uploadFile\\test.jpg", "C:\\uploadFile\\f244965ee774152aaa8618837d24b1a6.mp4");
// } catch (Exception e) {
// e.printStackTrace();
// }
// }
}
......@@ -4,15 +4,24 @@
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.yongqi.xinrenli.mapper.DbInviterMapper">
<resultMap type="com.yongqi.xinrenli.domain.DbInviter" id="DbInviterResult">
<resultMap type="com.yongqi.xinrenli.domain.vo.DbInviterVo" id="DbInviterResult">
<result property="id" column="id"/>
<result property="inviterId" column="Inviter_id"/>
<result property="inviterName" column="Inviter_name"/>
<result property="inviteeId" column="Invitee_id"/>
<result property="inviteeName" column="Invitee_name"/>
<result property="status" column="status"/>
<result property="createTime" column="create_time"/>
<result property="headImgUrl" column="head_img_url"/>
</resultMap>
<select id="selectVoPageList" resultMap="DbInviterResult">
SELECT
i.*,
u.head_img_url
FROM
db_Inviter i
LEFT JOIN db_wx_user u ON i.Invitee_id = u.id
${ew.getCustomSqlSegment}
</select>
</mapper>
......@@ -87,7 +87,7 @@
( SELECT count(*) FROM db_order WHERE `status` = '4' ) AS accomplish,
( SELECT count(*) FROM db_order WHERE `status` = '1' ) AS reject,
( SELECT count(*) FROM db_order WHERE `status` = '6' ) AS refund,
( SELECT CONCAT(TRUNCATE(SUM( actual_amount )/10000,2),'万元') FROM db_order WHERE `status` = '4' ) AS totalMoney,
( SELECT CONCAT(TRUNCATE(SUM( pay_amount )/10000,2),'万元') FROM db_order WHERE `status` = '4' ) AS totalMoney,
CONCAT(t.m,'-',t.w) AS contrastOrder
FROM
......@@ -112,17 +112,17 @@
( SELECT count(*) FROM db_order WHERE `status` = '4' ) AS accomplish,
( SELECT count(*) FROM db_order WHERE `status` = '1' ) AS reject,
( SELECT count(*) FROM db_order WHERE `status` = '6' ) AS refund,
( SELECT TRUNCATE ( SUM( actual_amount )/ 10000, 2 ) FROM db_order WHERE `status` = '4' ) AS totalMoney,
( SELECT TRUNCATE ( SUM( pay_amount )/ 10000, 2 ) FROM db_order WHERE `status` = '4' ) AS money,
(SELECT count(*) AS w FROM db_order WHERE `status` not in (0,4)) AS NoAccomplish ,
(select count(*) from db_order) as sum
FROM
DUAL
</select>
<update id="unpaidJob" >
update db_order set status='1',modify_time=NOW() where status=2 and modify_time&lt;=DATE_SUB(SYSDATE(),INTERVAL 1 hour)
update db_order set status='1',modify_time=NOW(),reasons_for_rejection='超时未支付' where status=2 and modify_time&lt;=DATE_SUB(SYSDATE(),INTERVAL 1 hour)
</update>
<update id="completedJob">
update db_order set status='4',modify_time=NOW() where status='3' and DATE_ADD(repair_time, INTERVAL 2 DAY)>=NOW()
update db_order set status='4',modify_time=NOW() where status='3' and DATE_ADD(repair_time, INTERVAL 2 DAY)&lt;=NOW()
</update>
</mapper>
......@@ -28,4 +28,7 @@
<select id="selectUserPage" resultMap="DbUserCommentVoResult">
select c.*,w.nickname as userName from db_user_comment c INNER JOIN db_wx_user w on c.user_id=w.id ${ew.getCustomSqlSegment}
</select>
<select id="selectVoPageList" resultMap="DbUserCommentVoResult" parameterType="java.lang.Long">
select uc.*,u.nickname as userName from db_user_comment uc LEFT JOIN db_wx_user u on uc.user_id=u.id where article_id=#{id} LIMIT 3
</select>
</mapper>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment