| | |
| | | import org.springblade.modules.taskqd.service.impl.TaskqdServiceImpl; |
| | | import org.springblade.modules.taskqd.vo.TaskqdVO; |
| | | import org.springblade.modules.taskqd.wrapper.TaskqdWrapper; |
| | | import org.springblade.modules.webscoket.service.IPushMsgService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import javax.validation.Valid; |
| | | import java.util.Date; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * 控制器 |
| | |
| | | public class TaskqdController extends BladeController { |
| | | |
| | | private final TaskqdServiceImpl taskqdService; |
| | | |
| | | @Autowired |
| | | private IPushMsgService pushMsgService; |
| | | |
| | | /** |
| | | * 详情 |
| | |
| | | //String serid2 = list.get(0).getSerid(); |
| | | //String substring = serid2.substring(0, serid.length() - 1); |
| | | //String s = serid + substring; |
| | | System.out.println("用户id:"+serid); |
| | | taskqdService.updatet(taskqd.getId(), i, serid, null, null); |
| | | return R.success("抢单成功"); |
| | | } else { |
| | | String ser = taskqd.getSerid(); |
| | | String ser2 = list.get(0).getSerid(); |
| | | String sub = ser.substring(0, serid.length() - 1); |
| | | String ss = ser2 + sub ; |
| | | //String sub = ser.substring(0, serid.length() - 1); |
| | | String ss = ser2 + ser; |
| | | |
| | | String team = taskqd.getCaptain(); |
| | | boolean isteam = StringUtil.isEmpty(list.get(0).getTeam()); |
| | |
| | | * @return |
| | | */ |
| | | @PostMapping("/selectLi") |
| | | public R selectLi(String type, String serid,String jurisdiction) { |
| | | List<TaskqdVO> list = taskqdService.selectLi(type, serid,jurisdiction); |
| | | public R selectLi(String type, String serid, String jurisdiction, String workjurisdiction, String tasktype) { |
| | | List<TaskqdVO> list = taskqdService.selectLi(type, serid, jurisdiction, workjurisdiction, tasktype); |
| | | for (int i = 0; i < list.size(); i++) { |
| | | Integer nums = list.get(i).getNums(); |
| | | |
| | |
| | | |
| | | /** |
| | | * 查询可参与任务 |
| | | * |
| | | * @param serid |
| | | * @param jurisdiction |
| | | * @return |
| | | */ |
| | | @GetMapping("/selectNum") |
| | | public R selectNum(String serid,String jurisdiction) { |
| | | return R.data(taskqdService.selectNum(serid, jurisdiction)); |
| | | public R selectNum(String serid, String jurisdiction, String workjurisdiction) { |
| | | List<Map<String, Object>> maps = taskqdService.selectNum(serid, jurisdiction, workjurisdiction); |
| | | //0:治安巡查 |
| | | Map map = new HashMap(); |
| | | int a = 0; |
| | | int b = 0; |
| | | int c = 0; |
| | | for (int i = 0; i < maps.size(); i++) { |
| | | String tasktype = maps.get(i).get("tasktype").toString(); |
| | | if (tasktype.equals("0")) { |
| | | map.put("xcha", maps.get(i).get("num")); |
| | | a = 1; |
| | | } else if (tasktype.equals("1")) { |
| | | map.put("xchuan", maps.get(i).get("num")); |
| | | b = 1; |
| | | } else if (tasktype.equals("2")) { |
| | | map.put("px", maps.get(i).get("num")); |
| | | c = 1; |
| | | } |
| | | } |
| | | if (a == 0) { |
| | | map.put("xcha", 0); |
| | | } |
| | | if (b == 0) { |
| | | map.put("xchuan", 0); |
| | | } |
| | | if (c == 0) { |
| | | map.put("px", 0); |
| | | } |
| | | return R.data(map); |
| | | } |
| | | |
| | | @GetMapping("/startTask") |
| | | public R<Map> startTask(String rid, String serid, String type, String data) { |
| | | //获取组员id并进行通知 |
| | | Map<String, Object> map = new HashMap<>(); |
| | | |
| | | serid = taskqdService.querySerid(rid); |
| | | |
| | | int msg = pushMsgService.startTask(serid, rid, type, data); |
| | | map.put("res", msg); |
| | | map.put("type", type); |
| | | map.put("data", data); |
| | | if (!type.equals("stop")) { |
| | | taskqdService.updateRtype("0", rid); |
| | | } |
| | | return R.data(map); |
| | | } |
| | | |
| | | @GetMapping("/cancelTask") |
| | | public R cancelTask(String rid, String serid) { |
| | | //获取当前成员id |
| | | String id = taskqdService.querySerid(rid); |
| | | |
| | | String captain[] = id.split(","); |
| | | if(captain[0].equals(serid)){ |
| | | return R.status(taskqdService.removeByIds(Func.toLongList(rid))); |
| | | } |
| | | |
| | | //成员id拼接逗号方便删除 |
| | | String delid = "," + serid; |
| | | //将指定成员删除 |
| | | String resid = id.replaceAll(delid,""); |
| | | |
| | | return R.status(taskqdService.updateSerid(rid,resid)); |
| | | } |
| | | |
| | | } |