Commit 2fd8df77 by 刘志强
2 parents f48fbcca d401c1fc
......@@ -3,7 +3,10 @@ package com.server;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.context.embedded.ConfigurableEmbeddedServletContainer;
import org.springframework.boot.context.embedded.EmbeddedServletContainerCustomizer;
import org.springframework.boot.web.servlet.ServletComponentScan;
import org.springframework.context.annotation.Bean;
import org.springframework.transaction.annotation.EnableTransactionManagement;
@SpringBootApplication
......@@ -16,4 +19,13 @@ public class Application {
SpringApplication application = new SpringApplication(Application.class);
application.run(args);
}
@Bean
public EmbeddedServletContainerCustomizer containerCustomizer(){
return new EmbeddedServletContainerCustomizer() {
@Override
public void customize(ConfigurableEmbeddedServletContainer container) {
container.setSessionTimeout(1800);//单位为S
}
};
}
}
......@@ -10,6 +10,6 @@ import org.springframework.session.data.redis.config.annotation.web.http.EnableR
@Configuration
@EnableRedisHttpSession(maxInactiveIntervalInSeconds=1800,redisNamespace = "kzy_wx")
@EnableRedisHttpSession(maxInactiveIntervalInSeconds=86400,redisNamespace = "kzy_wx")
public class ConfigRedisSession {
}
\ No newline at end of file
......@@ -11,7 +11,11 @@ import java.util.Map;
public interface InformationMapper {
List<Map<String, Object>> categoryDetail(@Param("firstId") Long id);
List<Map<String, Object>> secondClassDetailInformation(Map<String,Object> param);
List<Map<String, Object>> secondClassDetailInformation(Map<String, Object> param);
List<Map<String, Object>> secondClassDetailCourse(Map<String,Object> param);
Integer secondClassDetailInformationTotal(Map<String, Object> param);
List<Map<String, Object>> secondClassDetailCourse(Map<String, Object> param);
Integer secondClassDetailCourseTotal(Map<String, Object> param);
}
......@@ -9,5 +9,5 @@ import java.util.Map;
public interface IntegralMapper {
List<Map<String, Object>> signInList(Map<String, Object> param);
Map<String, Object> queryTodaySign(Map<String, Object> param2);
Map<String, Object> queryDaySign(Map<String, Object> param2);
}
package com.server.web.common.service.Impl;
import com.server.web.common.mapper.TBaseFirstClassMapper;
import com.server.web.common.mapper.TBaseSecondClassMapper;
import com.server.web.common.mapper.TKzyCommentMapper;
import com.server.web.common.mapper.TKzyInformationMapper;
import com.server.web.common.mapping.CommentMapper;
import com.server.web.common.mapping.InformationMapper;
import com.server.web.common.model.TBaseSecondClass;
import com.server.web.common.model.TBaseSecondClassExample;
import com.server.web.common.model.TKzyComment;
import com.server.web.common.model.TKzyInformation;
import com.server.web.common.model.*;
import com.server.web.common.service.InformationService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
......@@ -35,13 +33,19 @@ public class InformationServiceImpl implements InformationService {
private CommentMapper commentMapper;
@Autowired
private TKzyCommentMapper tKzyCommentMapper;
@Autowired
private TBaseFirstClassMapper tBaseFirstClassMapper;
@Override
public Map<String, Object> secondClassList(Long firstId) {
TBaseSecondClassExample tBaseSecondClassExample = new TBaseSecondClassExample();
tBaseSecondClassExample.createCriteria().andFirstIdEqualTo(firstId).andStatusEqualTo(1);
List<TBaseSecondClass> list = tBaseSecondClassMapper.selectByExample(tBaseSecondClassExample);
return returnMap("1", "", list);
TBaseFirstClass tBaseFirstClass = tBaseFirstClassMapper.selectByPrimaryKey(firstId);
Map<String, Object> dataMap = new HashMap<String, Object>();
dataMap.put("list", list);
dataMap.put("firstClassName", tBaseFirstClass.getClassName());
return returnMap("1", "", dataMap);
}
/**
......@@ -54,6 +58,7 @@ public class InformationServiceImpl implements InformationService {
public Map<String, Object> secondClassDetail(Long secondId, Integer pageNo, Integer pageSize) {
TBaseSecondClass tBaseSecondClass = tBaseSecondClassMapper.selectByPrimaryKey(secondId);
List<Map<String, Object>> list = null;
Integer total = 0;
Map<String, Object> param = new HashMap<String, Object>();
param.put("start", (pageNo - 1) * pageSize);
param.put("pageSize", pageSize);
......@@ -75,7 +80,21 @@ public class InformationServiceImpl implements InformationService {
@Override
public Map<String, Object> informationDetail(Long informationId) {
TKzyInformation tKzyInformation = tKzyInformationMapper.selectByPrimaryKey(informationId);
return returnMap("1", "", tKzyInformation);
if (tKzyInformation == null) {
return returnMap("0", "未查到该数据信息!", null);
}
tKzyInformation.getContent();
Map<String, Object> dataMap = new HashMap<String, Object>();
dataMap.put("id", tKzyInformation.getId());
dataMap.put("title", tKzyInformation.getTitle());
dataMap.put("author", tKzyInformation.getAuthor());
dataMap.put("picUrl", tKzyInformation.getPicUrl());
dataMap.put("iconUrl", tKzyInformation.getIconUrl());
dataMap.put("isDelete", tKzyInformation.getIsDelete());
dataMap.put("createDt", tKzyInformation.getCreateDt());
dataMap.put("updateDt", tKzyInformation.getUpdateDt());
dataMap.put("content", new String(tKzyInformation.getContent()));
return returnMap("1", "", dataMap);
}
@Override
......@@ -114,6 +133,7 @@ public class InformationServiceImpl implements InformationService {
tKzyCourseComment.setIsDelete(0);
tKzyCourseComment.setReplyContent(comment);
tKzyCourseComment.setType(1);
tKzyCourseComment.setAuthStatus(1);
tKzyCommentMapper.insertSelective(tKzyCourseComment);
return returnMap("1", "操作成功!", null);
}
......
......@@ -269,6 +269,7 @@ public class TKzyCourseServiceImpl implements TKzyCourseService {
tKzyCourseComment.setIsDelete(0);
tKzyCourseComment.setReplyContent(comment);
tKzyCourseComment.setType(2);
tKzyCourseComment.setAuthStatus(1);
tKzyCommentMapper.insertSelective(tKzyCourseComment);
resultMap.put("message", "评论成功~");
resultMap.put("status", "1");
......
......@@ -59,32 +59,49 @@ public class UserServiceImpl implements UserService {
if (loginUser.getSignInCount() == null) {
loginUser.setSignInCount(0);
}
String firstDay = simpleDateFormat.format(DateUtils.firstDayOfMonth());
Integer integral = 1;
if (firstDay.equals(simpleDateFormat.format(new Date()))) {
loginUser.setSignInCount(1);
tKzyUserIntegralFlowing.setIntegral(1);
} else {
if (loginUser.getSignInCount() <= 2) {
//判断昨天是否签到,昨天未签到,签到哦连续天数置0;
Map<String, Object> param2 = new HashMap<String, Object>();
param2.put("userId", loginUser.getId());
param2.put("today", simpleDateFormat.format(org.apache.commons.lang.time.DateUtils.addDays(new Date(), -1)));
Map<String, Object> yestoday = integralMapper.queryDaySign(param2);
if (yestoday == null || yestoday.get("id") == null) {
loginUser.setSignInCount(0);
}
if (loginUser.getSignInCount() == 5) {
loginUser.setSignInCount(1);
integral = 1;
} else if (loginUser.getSignInCount() == 3) {
} else {
if (loginUser.getSignInCount() < 2) {
integral = 1;
} else if (loginUser.getSignInCount() == 2) {
integral = 3;
} else if (loginUser.getSignInCount() == 4) {
} else if (loginUser.getSignInCount() == 3) {
integral = 1;
} else if (loginUser.getSignInCount() == 5) {
} else if (loginUser.getSignInCount() == 4) {
integral = 5;
tKzyUserIntegralFlowing.setIntegral(5);
} else {
integral = 1;
}
loginUser.setSignInCount(loginUser.getSignInCount() + 1);
}
}
loginUser.setIntegral(loginUser.getIntegral() + integral);
tKzyUserIntegralFlowing.setIntegral(integral);
loginUser.setLastSignDt(new Date());
tKzyUserMapper.updateByPrimaryKeySelective(loginUser);
tKzyUserIntegralFlowingMapper.insertSelective(tKzyUserIntegralFlowing);
Map<String, Object> dataMap = new HashMap<>();
dataMap.put("integral", integral);
dataMap.put("signInCount", loginUser.getSignInCount());
......@@ -94,7 +111,7 @@ public class UserServiceImpl implements UserService {
@Override
public Map<String, Object> signInList(TKzyUser loginUser) {
//List<String> dayList = getDayListOfMonth();
loginUser = tKzyUserMapper.selectByPrimaryKey(loginUser.getId());
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM");
SimpleDateFormat simpleDateFormat2 = new SimpleDateFormat("yyyy-MM-dd");
Map<String, Object> param = new HashMap<String, Object>();
......@@ -109,29 +126,18 @@ public class UserServiceImpl implements UserService {
hasSignDay.add(ymd);
}
/*List<Map<String, Object>> daysList = new ArrayList<>();
Map<String, Object> flag = null;
for (String everyDay : dayList) {
flag = new HashMap<>();
flag.put("day", everyDay);
if (hasSignDay.contains(everyDay)) {
flag.put("signFlag", 1);
} else {
flag.put("signFlag", 0);
}
daysList.add(flag);
}*/
Map<String, Object> param2 = new HashMap<String, Object>();
param2.put("userId", loginUser.getId());
param2.put("today", simpleDateFormat2.format(new Date()));
Map<String, Object> todaySign = integralMapper.queryTodaySign(param2);
Map<String, Object> todaySign = integralMapper.queryDaySign(param2);
Map<String, Object> dataMap = new HashMap<>();
dataMap.put("list", list);
dataMap.put("todaySign", todaySign);
dataMap.put("daysList", hasSignDay);
dataMap.put("integral", loginUser.getIntegral());
return ResultMapUtil.returnMap("1", "", dataMap);
}
......
......@@ -75,11 +75,9 @@ public class UserController extends BaseController {
if (!CollectionUtils.isEmpty(users)) {
TKzyUser user1 = users.get(0);
if (!StringUtils.isEmpty(user1.getWxOpenid()) && !wxOpenId.equals(user1.getWxOpenid())) {
return returnError("0", "该微信已绑定其他手机号", null);
return returnError("0", "该手机号已绑定其他微信", null);
}
}
user.setWxOpenid(wxOpenId);
user.setCreateDt(new Date());
user.setUserCategory(userCategory == null ? null : Integer.valueOf(userCategory));
......@@ -90,7 +88,6 @@ public class UserController extends BaseController {
user.setLastLoginDt(new Date());
userMapper.insertSelective(user);
request.getSession().setAttribute(WX_USER_SESSION_KEY, user);
return returnSuccess(user);
}
......@@ -102,6 +99,7 @@ public class UserController extends BaseController {
return returnError("0", "用户未登录", null);
}
loginUser = tKzyUserMapper.selectByPrimaryKey(loginUser.getId());
String wxOpenId = request.getParameter("wxOpenId");
String fullName = request.getParameter("fullName");
String userCategory = request.getParameter("userCategory");
......@@ -237,6 +235,11 @@ public class UserController extends BaseController {
if (loginUser == null || loginUser.getId() == null) {
return ResultMapUtil.returnMap("0", "请先登录!", null);
}
if (loginUser != null && loginUser.getId() != null) {
loginUser = tKzyUserMapper.selectByPrimaryKey(loginUser.getId());
}
//更新缓存用户信息(主要积分金额)
request.getSession().setAttribute(WX_USER_SESSION_KEY, loginUser);
return userService.signIn(loginUser);
}
......
......@@ -12,10 +12,10 @@
t_kzy_comment t
LEFT JOIN t_kzy_user u ON t.user_id = u.id AND t.type = 2
WHERE
t.is_delete = 0
t.is_delete = 0 AND t.auth_status=2 AND t.type=2
AND t.relation_id = #{courseId,jdbcType=BIGINT}
ORDER BY
t.id DESC
t.id ASC
LIMIT #{start,jdbcType=INTEGER},#{pageSize,jdbcType=INTEGER}
</select>
<select id="commentListTotal" resultType="java.lang.Integer">
......@@ -25,8 +25,35 @@
t_kzy_comment t
LEFT JOIN t_kzy_user u ON t.user_id = u.id AND t.type = 2
WHERE
t.is_delete = 0
t.is_delete = 0 AND t.auth_status=2 AND t.type=2
AND t.relation_id = #{courseId,jdbcType=BIGINT}
</select>
<select id="informationCommentList" resultType="java.util.HashMap">
SELECT
t.id,
t.create_dt AS createDt,
t.reply_content AS replyContent,
u.full_name AS fullName,
u.head_photo AS headPhoto
FROM
t_kzy_comment t
LEFT JOIN t_kzy_user u ON t.user_id = u.id AND t.type = 1
WHERE
t.is_delete = 0 AND t.auth_status=2 AND t.type=1
AND t.relation_id = #{informationId,jdbcType=BIGINT}
ORDER BY
t.id ASC
LIMIT #{start,jdbcType=INTEGER},#{pageSize,jdbcType=INTEGER}
</select>
<select id="informationCommentListTotal" resultType="java.lang.Integer">
SELECT
count(t.id)
FROM
t_kzy_comment t
LEFT JOIN t_kzy_user u ON t.user_id = u.id AND t.type = 1
WHERE
t.is_delete = 0 AND t.auth_status=2 AND t.type=1
AND t.relation_id = #{informationId,jdbcType=BIGINT}
</select>
</mapper>
\ No newline at end of file
......@@ -30,9 +30,8 @@
WHERE t.`is_delete` = 0
AND t.`is_up` = 1
AND t.`course_type`=1
AND (t.end_dt is null or date_format(t.end_dt,'%Y-%m-%d') = #{today,jdbcType=VARCHAR})
AND t.end_dt <![CDATA[ > ]]> now()
ORDER BY t.`start_dt`
</select>
......
......@@ -15,7 +15,7 @@
AND t.user_id = #{userId,jdbcType=BIGINT}
AND DATE_FORMAT(t.create_dt, '%Y-%m') = #{month,jdbcType=VARCHAR}
</select>
<select id="queryTodaySign" parameterType="java.util.HashMap" resultType="java.util.HashMap">
<select id="queryDaySign" parameterType="java.util.HashMap" resultType="java.util.HashMap">
SELECT
t.id,
t.create_dt AS createDt,
......
......@@ -26,8 +26,10 @@
t_kzy_relation_class rc
LEFT JOIN t_kzy_information i ON rc.relation_id = i.id
WHERE
i.is_delete = 0
i.is_delete = 0 AND rc.type=2
AND rc.first_class_id = #{firstId,jdbcType=BIGINT}
GROUP BY i.id
ORDER BY
i.id DESC
LIMIT 0,
......@@ -47,12 +49,24 @@
LEFT JOIN t_base_second_class sc ON rc.second_class_id = sc.id AND sc.type = 1
WHERE
i.is_delete = 0
AND sc.type = 2
AND sc.type = 1
AND rc.second_class_id = #{secondId,jdbcType=BIGINT}
ORDER BY
i.id DESC
LIMIT ${start},${pageSize}
</select>
<select id="secondClassDetailInformationTotal" resultType="java.lang.Integer">
SELECT
count(i.id)
FROM
t_kzy_relation_class rc
LEFT JOIN t_kzy_information i ON rc.relation_id = i.id
LEFT JOIN t_base_second_class sc ON rc.second_class_id = sc.id AND sc.type = 1
WHERE
i.is_delete = 0
AND sc.type = 1
AND rc.second_class_id = #{secondId,jdbcType=BIGINT}
</select>
<select id="secondClassDetailCourse" resultType="java.util.HashMap">
SELECT
......@@ -65,13 +79,27 @@
FROM
t_kzy_relation_class rc
LEFT JOIN t_kzy_course c ON rc.relation_id = c.id
LEFT JOIN t_base_second_class sc ON rc.second_class_id = sc.id AND sc.type = 2
LEFT JOIN t_base_second_class sc ON rc.second_class_id = sc.id
WHERE
c.is_delete = 0
AND sc.type = 2
AND sc.type <![CDATA[ >= ]]> 2
AND c.is_up = 1
AND rc.second_class_id = #{secondId,jdbcType=BIGINT}
ORDER BY
c.id DESC
LIMIT ${start},${pageSize}
</select>
<select id="secondClassDetailCourseTotal" resultType="java.lang.Integer">
SELECT
count(c.id)
FROM
t_kzy_relation_class rc
LEFT JOIN t_kzy_course c ON rc.relation_id = c.id
LEFT JOIN t_base_second_class sc ON rc.second_class_id = sc.id
WHERE
c.is_delete = 0
AND sc.type <![CDATA[ >= ]]> 2
AND c.is_up = 1
AND rc.second_class_id = #{secondId,jdbcType=BIGINT}
</select>
</mapper>
\ No newline at end of file
......@@ -46,7 +46,7 @@ wx.app.id=wxe37f12b1fa076c1a
wx.app.secret=57e45975dff8f558163e5e9f2ac78e87
wx.http.url=http://kzy-wx.jimijiayuan.cn
wx.http.url=http://kzy-wx-1.jimijiayuan.cn
#有拍云
remoteFileUrl = http://yxvzb.b0.upaiyun.com/
upyun.bucket=yxvzb
......
......@@ -49,7 +49,7 @@ wx.app.id=wxe37f12b1fa076c1a
wx.app.secret=57e45975dff8f558163e5e9f2ac78e87
wx.http.url=http://kzy-wx.jimijiayuan.cn
wx.http.url=http://kzy-wx-1.jimijiayuan.cn
#有拍云
remoteFileUrl = http://yxvzb.b0.upaiyun.com/
upyun.bucket=yxvzb
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!