diff --git a/src/main/java/com/gszc/controller/LoginController.java b/src/main/java/com/gszc/controller/LoginController.java index 32db5fb..158a35f 100644 --- a/src/main/java/com/gszc/controller/LoginController.java +++ b/src/main/java/com/gszc/controller/LoginController.java @@ -52,7 +52,9 @@ public class LoginController { @ApiImplicitParam(name = "code", value = "code", dataType = "string", paramType = "query"), }) public Result isNewUserLogin(String code,HttpServletResponse response){ + System.out.println("code------------"+code); JSONObject result = miniAppService.isNewUser(code); + System.out.println("result ---------------"+result.toJSONString()); Cookie cookie = new Cookie("username", result.getString("openId")); cookie.setMaxAge(60 * 60); cookie.setPath("/"); diff --git a/src/main/java/com/gszc/service/MiniAppService.java b/src/main/java/com/gszc/service/MiniAppService.java index b67f494..8d23589 100644 --- a/src/main/java/com/gszc/service/MiniAppService.java +++ b/src/main/java/com/gszc/service/MiniAppService.java @@ -77,12 +77,14 @@ public class MiniAppService { try { sessionInfo = wxService.getUserService().getSessionInfo(code); } catch (WxErrorException e) { + System.out.println("出错了--------------"+e.getMessage()); throw new RuntimeException("获取openid失败", e); } String sessionKey = sessionInfo.getSessionKey(); String openid = sessionInfo.getOpenid(); String unionid = sessionInfo.getUnionid(); + System.out.println("openid-----------------"+sessionInfo.getOpenid()); //todo 根据openid去数据库查 该用户 存在 更新一下sessionkey字段 isNew=false sessionkeyid=xx 不存在放并把以上3个字段新建一个用户(外加生成sessionkeyid) 返回结果 isNew=true sessionkeyid=xx Map columnMap = new HashMap<>(); columnMap.put("open_id", openid); diff --git a/src/main/java/com/gszc/service/impl/CustomServiceImpl.java b/src/main/java/com/gszc/service/impl/CustomServiceImpl.java index 2563c5b..af2a3af 100644 --- a/src/main/java/com/gszc/service/impl/CustomServiceImpl.java +++ b/src/main/java/com/gszc/service/impl/CustomServiceImpl.java @@ -91,7 +91,7 @@ public class CustomServiceImpl extends ServiceImpl impleme List customs = customMapper.selectList(new EntityWrapper().eq("mini_user_id", userId).eq("status_code","enable")); for(Custom custom:customs){ - List customSupports = customSupportMapper.selectList(new EntityWrapper().eq("custom_id", custom.getId())); + List customSupports = customSupportMapper.selectList(new EntityWrapper().eq("custom_id", custom.getId()).orderBy("create_date", false)); JSONObject jsonObject = new JSONObject(); jsonObject.put("custom",custom); jsonObject.put("customSupports",customSupports); @@ -113,6 +113,7 @@ public class CustomServiceImpl extends ServiceImpl impleme }else if(type.equals("enable")){ miniUserId.eq("status_code","enable"); } + miniUserId.orderBy("create_date", false); List customs = customMapper.selectList(miniUserId); for(Custom custom:customs){ List customSupports = customSupportMapper.selectList(new EntityWrapper().eq("custom_id", custom.getId())); @@ -168,7 +169,7 @@ public class CustomServiceImpl extends ServiceImpl impleme public JSONObject pcTodoCustomList(Integer pageNum,Integer pageSize){ Integer count = customMapper.selectCount(new EntityWrapper().eq("status_code", "todo")); - List customs = customMapper.selectPage(new RowBounds((pageNum-1)*pageSize,pageSize),new EntityWrapper().eq("status_code", "todo")); + List customs = customMapper.selectPage(new RowBounds((pageNum-1)*pageSize,pageSize),new EntityWrapper().eq("status_code", "todo").orderBy("create_date", false)); JSONObject jsonObject = new JSONObject(); jsonObject.put("count",count); @@ -188,10 +189,10 @@ public class CustomServiceImpl extends ServiceImpl impleme List customs; if(null==copycatId){ count = customMapper.selectCount(new EntityWrapper().eq("status_code", "disable")); - customs = customMapper.selectPage(new RowBounds((pageNum-1)*pageSize,pageSize),new EntityWrapper().eq("status_code", "disable")); + customs = customMapper.selectPage(new RowBounds((pageNum-1)*pageSize,pageSize),new EntityWrapper().eq("status_code", "disable").orderBy("create_date", false)); }else { count = customMapper.selectCount(new EntityWrapper().eq("status_code", "disable").eq("copycat_id",copycatId)); - customs = customMapper.selectPage(new RowBounds((pageNum-1)*pageSize,pageSize),new EntityWrapper().eq("status_code", "disable").eq("copycat_id",copycatId)); + customs = customMapper.selectPage(new RowBounds((pageNum-1)*pageSize,pageSize),new EntityWrapper().eq("status_code", "disable").eq("copycat_id",copycatId).orderBy("create_date", false)); } for(Custom custom:customs){ String copycat = custom.getCopycatId(); @@ -216,10 +217,10 @@ public class CustomServiceImpl extends ServiceImpl impleme List customs; if(null==copycatId){ count = customMapper.selectCount(new EntityWrapper().eq("status_code", "enable")); - customs = customMapper.selectPage(new RowBounds((pageNum-1)*pageSize,pageSize),new EntityWrapper().eq("status_code", "enable")); + customs = customMapper.selectPage(new RowBounds((pageNum-1)*pageSize,pageSize),new EntityWrapper().eq("status_code", "enable").orderBy("create_date", false)); }else { count = customMapper.selectCount(new EntityWrapper().eq("status_code", "enable").eq("copycat_id",copycatId)); - customs = customMapper.selectPage(new RowBounds((pageNum-1)*pageSize,pageSize),new EntityWrapper().eq("status_code", "enable").eq("copycat_id",copycatId)); + customs = customMapper.selectPage(new RowBounds((pageNum-1)*pageSize,pageSize),new EntityWrapper().eq("status_code", "enable").eq("copycat_id",copycatId).orderBy("create_date", false)); }for(Custom custom:customs){ String copycat = custom.getCopycatId(); PcUser pcUser = pcUserService.pcUserDetail(copycat); @@ -340,7 +341,7 @@ public class CustomServiceImpl extends ServiceImpl impleme public JSONObject enableCustomDetailInvoiceList(String customId,Integer pageNum,Integer pageSize){ Integer count = invoiceMapper.selectCount(new EntityWrapper().eq("custom_id", customId)); - List invoiceList = invoiceMapper.selectPage(new RowBounds((pageNum-1)*pageSize,pageSize),new EntityWrapper().eq("custom_id", customId)); + List invoiceList = invoiceMapper.selectPage(new RowBounds((pageNum-1)*pageSize,pageSize),new EntityWrapper().eq("custom_id", customId).orderBy("create_date", false)); JSONObject jsonObject = new JSONObject(); jsonObject.put("count",count); jsonObject.put("invoiceList",invoiceList); @@ -366,7 +367,7 @@ public class CustomServiceImpl extends ServiceImpl impleme public JSONObject pcMessage(String copycatId){ JSONObject jsonObject = new JSONObject(); Integer count = customMapper.selectCount(new EntityWrapper().eq("status_code", "disable").eq("copycat_id",copycatId)); - List customs = customMapper.selectList(new EntityWrapper().eq("status_code", "disable").eq("copycat_id", copycatId)); + List customs = customMapper.selectList(new EntityWrapper().eq("status_code", "disable").eq("copycat_id", copycatId).orderBy("create_date", false)); JSONArray jsonArray = new JSONArray(); for(Custom custom:customs){ jsonArray.add(custom.getId()); diff --git a/src/main/java/com/gszc/service/impl/InvoiceServiceImpl.java b/src/main/java/com/gszc/service/impl/InvoiceServiceImpl.java index 73956e0..cec20ce 100644 --- a/src/main/java/com/gszc/service/impl/InvoiceServiceImpl.java +++ b/src/main/java/com/gszc/service/impl/InvoiceServiceImpl.java @@ -95,6 +95,7 @@ public class InvoiceServiceImpl extends ServiceImpl impl } else if (type.equals("enable")) { customId.eq("status_code", "enable"); } + customId.orderBy("create_date", false); List invoiceList = invoiceMapper.selectList(customId); for (Invoice invoice : invoiceList) { invoice.setCustomName(customs.getJSONObject(i).getJSONObject("custom").getString("companyName")); diff --git a/src/main/java/com/gszc/service/impl/PcUserServiceImpl.java b/src/main/java/com/gszc/service/impl/PcUserServiceImpl.java index 8cfc222..d99ae57 100644 --- a/src/main/java/com/gszc/service/impl/PcUserServiceImpl.java +++ b/src/main/java/com/gszc/service/impl/PcUserServiceImpl.java @@ -29,7 +29,7 @@ public class PcUserServiceImpl extends ServiceImpl impleme PcUserMapper pcUserMapper; public List userList(){ - List pcUsers = pcUserMapper.selectList(new EntityWrapper().eq("type", "user")); + List pcUsers = pcUserMapper.selectList(new EntityWrapper().eq("type", "user").orderBy("create_date", false)); return pcUsers; }