|
|
@@ -4,6 +4,7 @@ import cn.hutool.core.util.IdUtil;
|
|
|
import cn.hutool.core.util.RandomUtil;
|
|
|
import cn.hutool.core.util.StrUtil;
|
|
|
import com.ytpm.agent.enums.UserStatusEnum;
|
|
|
+import com.ytpm.app.model.YtDyzAnswerRecord;
|
|
|
import com.ytpm.app.model.YtDyzLoginRecord;
|
|
|
import com.ytpm.app.model.YtDyzUser;
|
|
|
import com.ytpm.app.param.IosLoginParam;
|
|
|
@@ -26,7 +27,11 @@ import org.springframework.transaction.annotation.Propagation;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
import java.math.BigDecimal;
|
|
|
+import java.text.SimpleDateFormat;
|
|
|
+import java.util.ArrayList;
|
|
|
+import java.util.Collections;
|
|
|
import java.util.Date;
|
|
|
+import java.util.List;
|
|
|
import java.util.Objects;
|
|
|
|
|
|
@Service
|
|
|
@@ -80,11 +85,9 @@ public class AppUserServiceImpl implements AppUserService {
|
|
|
deadWithUserCrudForIos(old,userInfo,param);
|
|
|
}
|
|
|
//设置最后一次答题问题ID、今日答题数、历史答题数
|
|
|
- setExtInfo(old, userInfo.getHeadimgurl());
|
|
|
+ setExtInfoForIos(old, userInfo.getHeadimgurl());
|
|
|
// 添加用户登录记录
|
|
|
addLoginRecordForIos(param,old.getUserId());
|
|
|
- // 设置用户答题记录列表
|
|
|
- setAnswerRecordList(old);
|
|
|
return old;
|
|
|
}
|
|
|
|
|
|
@@ -100,6 +103,29 @@ public class AppUserServiceImpl implements AppUserService {
|
|
|
old.setLoginRecordList(loginRecordMapper.getLoginRecords(old.getUserId()));
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 设置扩展信息
|
|
|
+ */
|
|
|
+ private void setExtInfoForIos(YtDyzUser old, String headimgurl) {
|
|
|
+ old.setHeadImg(headimgurl);
|
|
|
+ old.setLastQuestionId(questionMapper.getLastQuestionId(old.getUserId()));
|
|
|
+ old.setTodayAnswerCount(questionMapper.getAnswerCount(old.getUserId(),1));
|
|
|
+ old.setHistoryAnswerCount(questionMapper.getAnswerCount(old.getUserId(),2));
|
|
|
+ List<YtDyzAnswerRecord> reversedList = new ArrayList<>(questionMapper.getAnswerRecords(old.getUserId()));
|
|
|
+ Collections.reverse(reversedList);
|
|
|
+ List<String> viewList = new ArrayList<>();
|
|
|
+ int count = 1;
|
|
|
+ for (YtDyzAnswerRecord ytDyzAnswerRecord : reversedList) {
|
|
|
+ SimpleDateFormat sdf = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss");
|
|
|
+ String timeStr = count + ":" + sdf.format(ytDyzAnswerRecord.getAnswerTime());
|
|
|
+ count++;
|
|
|
+ viewList.add(timeStr);
|
|
|
+ }
|
|
|
+ old.setAnswerRecordTimeList(viewList);
|
|
|
+ old.setAnswerRecordList(questionMapper.getAnswerRecords(old.getUserId()));
|
|
|
+ old.setLoginRecordList(loginRecordMapper.getLoginRecords(old.getUserId()));
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 增加用户登录记录
|
|
|
*/
|
|
|
@@ -243,8 +269,4 @@ public class AppUserServiceImpl implements AppUserService {
|
|
|
(StrConstant.PLATFORM_ID_PREFIX + IdUtil.getSnowflakeNextIdStr()):platformId);
|
|
|
appUserMapper.addOne(old);
|
|
|
}
|
|
|
-
|
|
|
- private void setAnswerRecordList(YtDyzUser old){
|
|
|
-
|
|
|
- }
|
|
|
}
|