Commit da456737 authored by licc's avatar licc

方案优化

parent e60a875c
......@@ -18,4 +18,6 @@ public interface UserVolunteerMapper extends BaseMapper<UserVolunteer> {
int delById(@Param("id") Integer id);
int creates(@Param("list") List<UserVolunteer> list);
List<UserVolunteer> listById(Integer schemeRecordId);
}
......@@ -80,4 +80,10 @@
where id = #{id}
</delete>
<select id="listById" resultType="cn.wisenergy.model.app.UserVolunteer">
select * from
<include refid="table"/>
where scheme_record_id = #{schemeRecordId}
</select>
</mapper>
......@@ -7,6 +7,8 @@ import cn.wisenergy.model.vo.SchemeVo;
import cn.wisenergy.model.vo.VolunteerVo;
import com.github.pagehelper.PageInfo;
import java.util.List;
/**
* @ Description: 方案接口定义
......@@ -46,4 +48,6 @@ public interface SchemeService {
* @return 方案下载路径
*/
R<String> download(Integer schemeId);
List<Integer> ceishi(Integer id);
}
......@@ -249,7 +249,7 @@ public class SchemeServiceImpl extends ServiceImpl<SchemeMapper, SchemeInfo> imp
//6保存用户方案记录、志愿之间的关联关系,扣减查询次数
R<Integer> bool = volunteerManager.saveUserVolunteer(user, list, scoreInfo, queryVo.getBigMajorNames());
if (null != bool && bool.getCode() == 500) {
return R.error("保存方案查询记录失败!");
return R.error(bool.getMessage());
}
//排序
......@@ -327,6 +327,23 @@ public class SchemeServiceImpl extends ServiceImpl<SchemeMapper, SchemeInfo> imp
return R.ok(schemeInfo.getFileUrl());
}
@Override
public List<Integer> ceishi(Integer id) {
List<UserVolunteer> list = userVolunteerMapper.listById(id);
List<Integer> ids = list.stream().map(UserVolunteer::getVolunteerId).collect(Collectors.toList());
List<Integer> integerList = new ArrayList<>();
List<Integer> result = new ArrayList<>();
for (Integer vid : ids) {
if (integerList.contains(vid)) {
result.add(vid);
} else {
integerList.add(vid);
}
}
return result;
}
/**
* 获取文化生志愿列表
......@@ -725,11 +742,11 @@ public class SchemeServiceImpl extends ServiceImpl<SchemeMapper, SchemeInfo> imp
Random mRandom = new Random();
int count = mRandom.nextInt(otherList.size());
if (result.contains(otherList.get(count))) {
otherList.remove(number);
otherList.remove(count);
continue;
}
volunteers.add(otherList.get(count));
otherList.remove(number);
otherList.remove(count);
}
result.addAll(volunteers);
}
......
......@@ -20,6 +20,7 @@ import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.List;
/**
* @author 86187
......@@ -109,4 +110,12 @@ public class SchemeController {
return schemeService.download(schemeId);
}
@ApiOperation(value = "测试重复数据", notes = "测试重复数据", httpMethod = "GET")
@ApiImplicitParam(name = "schemeId", value = "方案id", dataType = "int")
@GetMapping("/ceishi")
public List<Integer> ceishi(Integer schemeId) {
return schemeService.ceishi(schemeId);
}
}
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