Просмотр исходного кода

[问券][修复]:不回答记录,不回答重复问答

release_toaliyun_real
hupeng 7 лет назад
Родитель
Сommit
31c60dfbfc
4 измененных файлов: 14 добавлений и 9 удалений
  1. +10
    -6
      mallinkCApi/src/main/java/com/iformall/controller/WxQuestionController.java
  2. +1
    -1
      mallinkService/src/main/java/com/iformall/mapper/WxQuestionLogMapper.java
  3. +1
    -1
      mallinkService/src/main/java/com/iformall/service/impl/WxQuestionServiceImpl.java
  4. +2
    -1
      mallinkService/src/main/resources/mapper/WxQuestionLogMapper.xml

+ 10
- 6
mallinkCApi/src/main/java/com/iformall/controller/WxQuestionController.java Просмотреть файл

@@ -73,20 +73,24 @@ public class WxQuestionController extends BaseController {
@ApiOperation("设置问券配置")
@PostMapping("/api/answerQuestion")
public Result answerQuestion(@RequestBody WxQuestionLog wxQuestionLog) {
if (wxQuestionLog == null)
if (wxQuestionLog == null)
return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL);
if (wxQuestionLog.getQuestionId() == null)
return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL);
if (wxQuestionLog.getAnswer() == null)
return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL);

String[] arys1 = wxQuestionLog.getAnswer().split(",");
List<Long> as = new ArrayList<>();
for (int i = 0; i < arys1.length; i++) {
as.add(Long.parseLong(arys1[i]));
if (wxQuestionLog.getAnswer().isEmpty()) {
wxQuestionLog.setAnswer(null);
} else {
String[] arys1 = wxQuestionLog.getAnswer().split(",");
List<Long> as = new ArrayList<>();
for (int i = 0; i < arys1.length; i++) {
as.add(Long.parseLong(arys1[i]));
}
wxQuestionLog.setAnswer(JSONObject.toJSONString(as));
}

wxQuestionLog.setAnswer(JSONObject.toJSONString(as));
wxQuestionLog.setUserId(getUserId());

wxQuestionService.saveOrUpdateLog(wxQuestionLog);


+ 1
- 1
mallinkService/src/main/java/com/iformall/mapper/WxQuestionLogMapper.java Просмотреть файл

@@ -7,5 +7,5 @@ import java.util.List;

public interface WxQuestionLogMapper extends CommonMapper<WxQuestionLog, String> {

List<WxQuestionLog> findList(WxQuestionLog wxQuestionLog);
List<WxQuestionLog> findListWithAnswer(WxQuestionLog wxQuestionLog);
}

+ 1
- 1
mallinkService/src/main/java/com/iformall/service/impl/WxQuestionServiceImpl.java Просмотреть файл

@@ -70,7 +70,7 @@ public class WxQuestionServiceImpl implements WxQuestionService {

@Override
public List<WxQuestionLog> findLogList(WxQuestionLog wxQuestionLog) {
return wxQuestionLogMapper.findList(wxQuestionLog);
return wxQuestionLogMapper.findListWithAnswer(wxQuestionLog);
}

@Override


+ 2
- 1
mallinkService/src/main/resources/mapper/WxQuestionLogMapper.xml Просмотреть файл

@@ -60,11 +60,12 @@
<if test=" null != sortColumns">order by ${sortColumns}</if>
</sql>

<select id="findList" parameterType="com.iformall.domain.po.WxQuestionLog" resultMap="BaseResultMap">
<select id="findListWithAnswer" parameterType="com.iformall.domain.po.WxQuestionLog" resultMap="BaseResultMap">
select
<include refid="allColumns"/>
from wx_question_log
<include refid="dynamicWhereConditions"/>
and `answer` is not null
</select>

</mapper>

Загрузка…
Отмена
Сохранить