| | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.dsh.course.feignClient.account.model.TAppUser; |
| | | import com.dsh.course.feignClient.competition.CompetitionClient; |
| | | import com.dsh.course.feignClient.competition.model.*; |
| | | import com.dsh.guns.config.UserExt; |
| | |
| | | import com.dsh.guns.modular.system.service.IStoreService; |
| | | import com.dsh.guns.modular.system.service.TOperatorCityService; |
| | | import com.dsh.guns.modular.system.service.TOperatorService; |
| | | import com.dsh.guns.modular.system.util.ExcelUtil; |
| | | import com.dsh.guns.modular.system.util.OBSUploadUtil; |
| | | import org.apache.poi.hssf.usermodel.HSSFWorkbook; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Controller; |
| | | import org.springframework.ui.Model; |
| | |
| | | import org.springframework.web.bind.annotation.ResponseBody; |
| | | import sun.rmi.runtime.Log; |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.io.OutputStream; |
| | | import java.text.DateFormat; |
| | | import java.text.ParseException; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.ArrayList; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.Objects; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | |
| | | @Autowired |
| | | private ICityService cityService; |
| | | |
| | | /** |
| | | * 导出赛事已报名用户列表 |
| | | */ |
| | | |
| | | @RequestMapping(value = "/export") |
| | | @ResponseBody |
| | | public void exportUserInfo(Integer id, Integer state, HttpServletResponse response) { |
| | | try { |
| | | Competition byId = competitionClient.queryById(id); |
| | | String name = byId.getName(); |
| | | Date date = new Date(); |
| | | DateFormat format = new SimpleDateFormat("yyyyMMdd"); |
| | | String time1 = format.format(date); |
| | | String fileName =name+"报名信息.xls"; |
| | | String[] title = new String[] {"姓名","性别","联系电话","身份证号","状态"}; |
| | | GetPeopleQuery query = new GetPeopleQuery(); |
| | | query.setId(id); |
| | | query.setState(state); |
| | | List<CompetitionUser> list = competitionClient.getPeoples(query); |
| | | String[][] values = new String[list.size()][]; |
| | | for (int i = 0; i < list.size(); i++) { |
| | | CompetitionUser d = list.get(i); |
| | | values[i] = new String[title.length]; |
| | | values[i][0] = d.getName(); |
| | | Integer sex = d.getSex(); |
| | | if(Objects.nonNull(sex)){ |
| | | if(1 == sex){ |
| | | values[i][1] = "男"; |
| | | }else if(2 == sex){ |
| | | values[i][1] = "女"; |
| | | } |
| | | }else { |
| | | values[i][1] = "未知"; |
| | | } |
| | | values[i][2] = d.getPhone(); |
| | | values[i][3] = d.getIdCard(); |
| | | Integer state1 = d.getState(); |
| | | if(1 == state1){ |
| | | values[i][4] = "正常"; |
| | | }else if(2 == state1){ |
| | | values[i][4] = "冻结"; |
| | | }else { |
| | | values[i][4] = "删除"; |
| | | } |
| | | } |
| | | HSSFWorkbook wb = ExcelUtil.getHSSFWorkbook("Variance"+time1, title, values, null); |
| | | ExcelUtil.setResponseHeader(response, fileName); |
| | | OutputStream os = response.getOutputStream(); |
| | | wb.write(os); |
| | | os.flush(); |
| | | os.close(); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | |
| | | public Object listUser(@PathVariable Integer id,Integer state) { |
| | | try { |
| | | Page<Object> page = new PageFactory<>().defaultPage(); |
| | | Page<CompetitionUser> data = competitionClient.getPeopleFromId(new GetPeopleQuery(page.getSize(),page.getCurrent(),id,state)); |
| | | Page<CompetitionUser> data = competitionClient.getPeopleFromId |
| | | (new GetPeopleQuery(page.getSize(),page.getCurrent(),id,state)); |
| | | return super.packForBT(data); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |