uniapp接口更新-消息记录

master
erzhongxmu 2022-08-22 20:25:24 +08:00
parent 4d81a04c98
commit c5a28be247
2 changed files with 111 additions and 21 deletions

View File

@ -0,0 +1,52 @@
package com.zzjee.api;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.springframework.format.annotation.DateTimeFormat;
import java.util.Date;
public class AnnouncementSendModel {
/**发布时间*/
private java.lang.String startTime;
/**标题*/
private java.lang.String titile;
/**内容*/
private java.lang.String msgContent;
/**
*
*/
private java.lang.String msgAbstract;
public String getStartTime() {
return startTime;
}
public void setStartTime(String startTime) {
this.startTime = startTime;
}
public String getTitile() {
return titile;
}
public void setTitile(String titile) {
this.titile = titile;
}
public String getMsgContent() {
return msgContent;
}
public void setMsgContent(String msgContent) {
this.msgContent = msgContent;
}
public String getMsgAbstract() {
return msgAbstract;
}
public void setMsgAbstract(String msgAbstract) {
this.msgAbstract = msgAbstract;
}
}

View File

@ -1,5 +1,6 @@
package com.zzjee.api; package com.zzjee.api;
import com.alibaba.fastjson.support.odps.udf.CodecCheck;
import com.zzjee.BI.BiBinController; import com.zzjee.BI.BiBinController;
import com.zzjee.BI.biEntity; import com.zzjee.BI.biEntity;
import com.zzjee.md.controller.MdGoodsController; import com.zzjee.md.controller.MdGoodsController;
@ -40,6 +41,7 @@ import org.jeecgframework.jwt.util.Result;
import org.jeecgframework.p3.core.author.LoginUser; import org.jeecgframework.p3.core.author.LoginUser;
import org.jeecgframework.web.system.pojo.base.TSBaseUser; import org.jeecgframework.web.system.pojo.base.TSBaseUser;
import org.jeecgframework.web.system.pojo.base.TSUser; import org.jeecgframework.web.system.pojo.base.TSUser;
import org.jeecgframework.web.system.service.SystemService;
import org.jeecgframework.web.system.service.UserService; import org.jeecgframework.web.system.service.UserService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus; import org.springframework.http.HttpStatus;
@ -51,9 +53,7 @@ import org.springframework.web.util.UriComponentsBuilder;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import javax.validation.ConstraintViolation; import javax.validation.ConstraintViolation;
import java.util.ArrayList; import java.util.*;
import java.util.List;
import java.util.Set;
/** /**
* @Package com.zzjee.api * @Package com.zzjee.api
@ -63,6 +63,8 @@ import java.util.Set;
@RestController @RestController
@RequestMapping("/pdaapi") @RequestMapping("/pdaapi")
public class ApiController { public class ApiController {
@Autowired
private SystemService systemService;
@Autowired @Autowired
private UserService userService; private UserService userService;
@Autowired @Autowired
@ -102,6 +104,7 @@ public class ApiController {
@Autowired @Autowired
private BiBinController biBinController; private BiBinController biBinController;
//收货相关接口begin //收货相关接口begin
//收货列表 //收货列表
@RequestMapping(value = "/wvNoticeController/list", method = RequestMethod.GET) @RequestMapping(value = "/wvNoticeController/list", method = RequestMethod.GET)
@ -129,7 +132,7 @@ public class ApiController {
@RequestParam(value = "id", required = false) String id, @RequestParam(value = "id", required = false) String id,
@RequestParam(value = "searchstr", required = false) String searchstr, @RequestParam(value = "searchstr", required = false) String searchstr,
@RequestParam(value = "searchstr2", required = false) String searchstr2) { @RequestParam(value = "searchstr2", required = false) String searchstr2) {
return wmInQmIController.updateqty(username, id,searchstr, searchstr2); return wmInQmIController.updateqty(username, id, searchstr, searchstr2);
} }
//收货相关接口end //收货相关接口end
@ -314,7 +317,7 @@ public class ApiController {
@RequestMapping(value = "/weightsave/{username}", method = RequestMethod.GET) @RequestMapping(value = "/weightsave/{username}", method = RequestMethod.GET)
@ResponseBody @ResponseBody
public ResponseMessage<?> list10(@PathVariable("username") String username, public ResponseMessage<?> list10(@PathVariable("username") String username,
@RequestParam(value = "searchstr", required = false) String searchstr ) { @RequestParam(value = "searchstr", required = false) String searchstr) {
return wmomController.weight_save(username, searchstr); return wmomController.weight_save(username, searchstr);
} }
@ -327,6 +330,7 @@ public class ApiController {
return wmomController.rfid_save(username, wmientityin, request); return wmomController.rfid_save(username, wmientityin, request);
} }
@RequestMapping(value = "/login", method = RequestMethod.POST) @RequestMapping(value = "/login", method = RequestMethod.POST)
@ResponseBody @ResponseBody
public ResultApi<?> login(@RequestBody TSBaseUser tsBaseUser, HttpServletRequest request) { public ResultApi<?> login(@RequestBody TSBaseUser tsBaseUser, HttpServletRequest request) {
@ -348,6 +352,7 @@ public class ApiController {
} }
return ResultApi.OK(user); return ResultApi.OK(user);
} }
/** /**
* id * id
* *
@ -360,32 +365,32 @@ public class ApiController {
HttpServletRequest request) { HttpServletRequest request) {
//根据用户名获取APP用户 //根据用户名获取APP用户
CriteriaQuery queryuser = new CriteriaQuery(WmsAppUserEntity.class); CriteriaQuery queryuser = new CriteriaQuery(WmsAppUserEntity.class);
queryuser.eq("appuserCode",username); queryuser.eq("appuserCode", username);
List<WmsAppUserEntity> listByCriteriaQuery = wmsAppUserService.getListByCriteriaQuery(queryuser, false); List<WmsAppUserEntity> listByCriteriaQuery = wmsAppUserService.getListByCriteriaQuery(queryuser, false);
if(CollectionUtils.isEmpty(listByCriteriaQuery)){ if (CollectionUtils.isEmpty(listByCriteriaQuery)) {
return Result.error("未找到APP用户信息"); return Result.error("未找到APP用户信息");
} }
//获取用户角色Id //获取用户角色Id
String roleId =listByCriteriaQuery.get(0).getApproleCode(); String roleId = listByCriteriaQuery.get(0).getApproleCode();
System.err.println(roleId); System.err.println(roleId);
//根据用户角色Id获取APP角色集合 //根据用户角色Id获取APP角色集合
CriteriaQuery queryrole = new CriteriaQuery(WmsAppRoleEntity.class); CriteriaQuery queryrole = new CriteriaQuery(WmsAppRoleEntity.class);
queryrole.in("approleCode",roleId.split(",")); queryrole.in("approleCode", roleId.split(","));
List<WmsAppRoleEntity> mesAppRole = wmsAppRoleService.getListByCriteriaQuery(queryrole,false); List<WmsAppRoleEntity> mesAppRole = wmsAppRoleService.getListByCriteriaQuery(queryrole, false);
if(mesAppRole==null){ if (mesAppRole == null) {
return Result.error("未找到APP角色信息"); return Result.error("未找到APP角色信息");
} }
String funidstr = ""; String funidstr = "";
for (WmsAppRoleEntity role : mesAppRole) { for (WmsAppRoleEntity role : mesAppRole) {
//拼接获取的APP模块id //拼接获取的APP模块id
funidstr = funidstr + ","+role.getAppmodelCode(); funidstr = funidstr + "," + role.getAppmodelCode();
System.err.println(funidstr); System.err.println(funidstr);
} }
//根据APP模块id获取APP功能模块集合 //根据APP模块id获取APP功能模块集合
CriteriaQuery funcwrapper = new CriteriaQuery(WmsAppFunctionEntity.class); CriteriaQuery funcwrapper = new CriteriaQuery(WmsAppFunctionEntity.class);
funcwrapper.in("appmodelCode",funidstr.split(",")) ; funcwrapper.in("appmodelCode", funidstr.split(","));
List<WmsAppFunctionEntity> mesAppFunctions = wmsAppFunctionService.getListByCriteriaQuery(funcwrapper,false); List<WmsAppFunctionEntity> mesAppFunctions = wmsAppFunctionService.getListByCriteriaQuery(funcwrapper, false);
if(mesAppFunctions==null){ if (mesAppFunctions == null) {
return Result.error("未找到APP功能模块信息"); return Result.error("未找到APP功能模块信息");
} }
return Result.success(mesAppFunctions); return Result.success(mesAppFunctions);
@ -401,4 +406,37 @@ public class ApiController {
D0.setObj(biEntity); D0.setObj(biEntity);
return new ResponseEntity(D0, HttpStatus.OK); return new ResponseEntity(D0, HttpStatus.OK);
} }
@RequestMapping(value = "/annountCement/listByUser/{username}", method = RequestMethod.GET)
@ResponseBody
public ResponseMessage<?> messagelist(@PathVariable("username") String username,
HttpServletRequest request) {
List<TSUser> roles = systemService.findByProperty(TSUser.class, "userName", username);
TSUser user = null;
String userid = "no";
try {
user = roles.get(0);
userid = user.getId();
} catch (Exception e) {
e.printStackTrace();
}
String sql = "SELECT notice.*,noticeRead.is_read as is_read FROM t_s_notice notice "
+ " LEFT JOIN t_s_notice_read_user noticeRead ON notice.id = noticeRead.notice_id "
+ " WHERE noticeRead.del_flag = 0 and noticeRead.user_id = '" + userid + "' "
+ " ORDER BY noticeRead.is_read asc,noticeRead.create_time DESC ";
List<Map<String, Object>> resultList = systemService.findForJdbc(sql);
List<AnnouncementSendModel> noticeList = new ArrayList<AnnouncementSendModel>();
if (resultList != null && resultList.size() > 0) {
for (int i = 0; i < resultList.size(); i++) {
AnnouncementSendModel announcementSendModel = new AnnouncementSendModel();
Map<String, Object> obj = resultList.get(i);
announcementSendModel.setTitile(String.valueOf(obj.get("notice_title")));
announcementSendModel.setStartTime(String.valueOf(obj.get("create_time")));
announcementSendModel.setMsgAbstract(String.valueOf(obj.get("notice_title")));
announcementSendModel.setMsgContent(String.valueOf(obj.get("notice_content")));
noticeList.add(announcementSendModel);
}
}
return Result.success(noticeList);
}
} }