Skip to content

Commit

Permalink
评分
Browse files Browse the repository at this point in the history
  • Loading branch information
wjinliang committed Mar 1, 2018
1 parent 1c09129 commit 34d37c6
Show file tree
Hide file tree
Showing 7 changed files with 157 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import java.io.IOException;
import java.io.OutputStream;
import java.math.BigDecimal;
import java.net.URLEncoder;
import java.util.ArrayList;
import java.util.HashMap;
Expand All @@ -23,6 +24,7 @@
import org.springframework.web.bind.annotation.ResponseBody;

import tk.mybatis.mapper.entity.Example;
import tk.mybatis.mapper.entity.Example.Criteria;

import com.alibaba.fastjson.JSONObject;
import com.github.pagehelper.PageInfo;
Expand Down Expand Up @@ -303,6 +305,21 @@ public Result reportContentCheck(int id, short result,
iScorePagerUserService.check(id, result,feedback);
return ResponseUtil.success("操作完成!");
}

/**
* 中科协特殊渠道退回到填报员
*
* @param id
* @param result
* @return
*/
@RequestMapping(value = "/reportBack", method = RequestMethod.GET)
@ResponseBody
public Result reportContentCheck(int id, int userId,
@RequestParam(value="feedback",required=false)String feedback) {
iScorePagerUserService.check(id,new Short("0") ,userId,feedback);
return ResponseUtil.success("操作完成!");
}

/**
* 填報用户评价表 列表
Expand Down Expand Up @@ -428,5 +445,68 @@ public Result getPaperOptions() {
}
return ResponseUtil.success(maps);
}

/**
* 获取所有答题不真实的item
*
* @return
*/
@RequestMapping(value = "/getPaperAnswerReal", method = RequestMethod.GET)
@ResponseBody
public Result getPaperAnswerReal(Integer paperId,Integer userId) {
Example example = new Example(ScoreAnswer.class);
Criteria c = example.createCriteria();
c.andEqualTo("paperId", paperId);
c.andEqualTo("userId", userId);
c.andEqualTo("answerReal", false);
List<ScoreAnswer> list = iScoreAnswerService.selectByExample(example);
return ResponseUtil.success(list);
}
/**
* 更新答题的真实情况
*
* @return
*/
@RequestMapping(value = "/updateAnswerReal", method = RequestMethod.POST)
@ResponseBody
public Result updateAnswerReal(Integer paperId,Integer userId,Integer itemId,Boolean answerReal) {
Example example = new Example(ScoreAnswer.class);
Criteria c = example.createCriteria();
c.andEqualTo("paperId", paperId);
c.andEqualTo("userId", userId);
c.andEqualTo("itemId", itemId);
List<ScoreAnswer> list = iScoreAnswerService.selectByExample(example);
if(list.size()>0){
ScoreAnswer one = list.get(0);
one.setAnswerReal(answerReal);
iScoreAnswerService.updateAll(one);
return ResponseUtil.success();
}
return ResponseUtil.error();
}

/**
* 更新答题的分数
*
* @return
*/
@RequestMapping(value = "/updateAnswerScore", method = RequestMethod.POST)
@ResponseBody
public Result updateAnswerScore(Integer paperId,Integer userId,Integer itemId,BigDecimal answerScore) {
Example example = new Example(ScoreAnswer.class);
Criteria c = example.createCriteria();
c.andEqualTo("paperId", paperId);
c.andEqualTo("userId", userId);
c.andEqualTo("itemId", itemId);
List<ScoreAnswer> list = iScoreAnswerService.selectByExample(example);
if(list.size()>0){
ScoreAnswer one = list.get(0);
one.setAnswerScore(answerScore);
iScoreAnswerService.updateAll(one);
return ResponseUtil.success();
}
return ResponseUtil.error();
}


}
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,13 @@ public interface IScorePagerUserService extends IService<ScorePaperUser>{
* @param feedback
*/
void check(int id, short result,String feedback);
/**
* 学会提交答案后审核
* @param id
* @param result
* @param feedback
*/
void check(int id, short result,int userId,String feedback);
/**
* 获取当前学会 对应得填报员得填报信息
* @param scorePaper
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,28 @@ public void check(int id, short result,String feedback) {
getMapper().insert(scorePagerUser);
}
}
@Override
public void check(int id, short result,int userId ,String feedback) {
ScorePaperUser scorePagerUser = new ScorePaperUser();
scorePagerUser.setUserId(userId);
scorePagerUser.setPaperId(id);
ScorePaperUser su = getMapper().selectOne(scorePagerUser);
if(su!=null)
{
scorePagerUser.setStatus(result);
scorePagerUser.setFeedback(feedback);
getMapper().updateByPrimaryKey(scorePagerUser);
}
else
{
scorePagerUser = new ScorePaperUser();
scorePagerUser.setUserId(userId);
scorePagerUser.setPaperId(id);
scorePagerUser.setStatus(result);
scorePagerUser.setFeedback(feedback);
getMapper().insert(scorePagerUser);
}
}

@Override
public PageInfo<ScorePaper> selectByFilterAndPage(ScorePaper scorePaper, int pageNum, int pageSize) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,13 @@
import com.topie.zhongkexie.common.exception.DefaultBusinessException;
import com.topie.zhongkexie.common.utils.ExcelReader;
import com.topie.zhongkexie.core.service.IScoreIndexService;
import com.topie.zhongkexie.core.service.IScoreItemOptionService;
import com.topie.zhongkexie.core.service.IScoreItemService;
import com.topie.zhongkexie.core.service.IScorePaperImportConfigService;
import com.topie.zhongkexie.database.core.model.Attachment;
import com.topie.zhongkexie.database.core.model.ScoreIndex;
import com.topie.zhongkexie.database.core.model.ScoreItem;
import com.topie.zhongkexie.database.core.model.ScoreItemOption;
import com.topie.zhongkexie.database.core.model.ScorePaperImportConf;
import com.topie.zhongkexie.system.service.IAttachmentService;

Expand All @@ -41,6 +43,8 @@ public class ScorePaperImportConfServiceImpl extends BaseService<ScorePaperImpor
private IScoreIndexService iScoreIndexService;
@Autowired
private IScoreItemService iScoreItemService;
@Autowired
private IScoreItemOptionService iScoreItemOptionService;
@Override
public PageInfo<ScorePaperImportConf> selectByFilterAndPage(ScorePaperImportConf searchModel, int pageNum,
int pageSize) {
Expand Down Expand Up @@ -171,7 +175,10 @@ public List<Map> insertImports(ScorePaperImportConf conf, boolean isTest) {
if(StringUtils.isEmpty(title)){
throw new DefaultBusinessException("第"+i+"行,第"+(char)('A'+jsonItem.getIntValue("title"))+"列,题目名称为空");
}
entity.setType(0);
entity.setType(0);//填空
if(title.contains("是否")){
entity.setType(1);//单选
}
entity.setOptionLogic(desc);
try {
entity.setScore(BigDecimal.valueOf(Long.valueOf(score)));
Expand All @@ -181,6 +188,19 @@ public List<Map> insertImports(ScorePaperImportConf conf, boolean isTest) {
entity.setSort(0);
entity.setResponsibleDepartment(org);
this.iScoreItemService.saveNotNull(entity);
if(title.contains("是否")){
int itemId = entity.getId();
ScoreItemOption option = new ScoreItemOption();
option.setItemId(itemId);
option.setOptionTitle("是");
option.setOptionRate(BigDecimal.valueOf(Long.valueOf(score)));
iScoreItemOptionService.saveNotNull(option);
ScoreItemOption option1 = new ScoreItemOption();
option.setItemId(itemId);
option.setOptionTitle("否");
option.setOptionRate(BigDecimal.valueOf(0l));
iScoreItemOptionService.saveNotNull(option1);
}
}catch(Exception e){
e.printStackTrace();
Map m = new HashMap();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
package com.topie.zhongkexie.database.core.model;

import com.topie.zhongkexie.common.handler.Sortable;

import javax.persistence.*;
import java.math.BigDecimal;

import javax.persistence.Column;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;

import com.topie.zhongkexie.common.handler.Sortable;

@Table(name = "d_score_answer")
public class ScoreAnswer extends Sortable {

Expand Down Expand Up @@ -64,6 +69,12 @@ public class ScoreAnswer extends Sortable {
*/
@Column(name = "answer_reason")
private String answerReason;

/**
* 答题是否真实
*/
@Column(name = "answer_real")
private Boolean answerReal;

/**
* 获取ID
Expand Down Expand Up @@ -226,4 +237,13 @@ public String getAnswerReason() {
public void setAnswerReason(String answerReason) {
this.answerReason = answerReason;
}

public Boolean getAnswerReal() {
return answerReal;
}

public void setAnswerReal(Boolean answerReal) {
this.answerReal = answerReal;
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
ALTER TABLE d_score_answer add answer_real bit(1) DEFAULT b'1' COMMENT '答题真实性';
UPDATE `d_score_answer` SET `answer_real`=true ;

1 change: 1 addition & 0 deletions src/main/resources/mapper/core/ScoreAnswerMapper.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,6 @@
<result column="answer_value" property="answerValue" jdbcType="VARCHAR" />
<result column="answer_score" property="answerScore" jdbcType="DECIMAL" />
<result column="answer_reason" property="answerReason" jdbcType="VARCHAR" />
<result column="answer_real" property="answerReal" jdbcType="BIT" />
</resultMap>
</mapper>

0 comments on commit 34d37c6

Please sign in to comment.