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;
import com.alibaba.fastjson.support.odps.udf.CodecCheck;
import com.zzjee.BI.BiBinController;
import com.zzjee.BI.biEntity;
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.web.system.pojo.base.TSBaseUser;
import org.jeecgframework.web.system.pojo.base.TSUser;
import org.jeecgframework.web.system.service.SystemService;
import org.jeecgframework.web.system.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
@ -51,9 +53,7 @@ import org.springframework.web.util.UriComponentsBuilder;
import javax.servlet.http.HttpServletRequest;
import javax.validation.ConstraintViolation;
import java.util.ArrayList;
import java.util.List;
import java.util.Set;
import java.util.*;
/**
* @Package com.zzjee.api
@ -63,6 +63,8 @@ import java.util.Set;
@RestController
@RequestMapping("/pdaapi")
public class ApiController {
@Autowired
private SystemService systemService;
@Autowired
private UserService userService;
@Autowired
@ -102,6 +104,7 @@ public class ApiController {
@Autowired
private BiBinController biBinController;
//收货相关接口begin
//收货列表
@RequestMapping(value = "/wvNoticeController/list", method = RequestMethod.GET)
@ -127,9 +130,9 @@ public class ApiController {
@ResponseBody
public ResponseEntity<?> update1(@RequestParam(value = "username", required = false) String username,
@RequestParam(value = "id", required = false) String id,
@RequestParam(value = "searchstr", required = false) String searchstr,
@RequestParam(value = "searchstr2", required = false) String searchstr2) {
return wmInQmIController.updateqty(username, id,searchstr, searchstr2);
@RequestParam(value = "searchstr", required = false) String searchstr,
@RequestParam(value = "searchstr2", required = false) String searchstr2) {
return wmInQmIController.updateqty(username, id, searchstr, searchstr2);
}
//收货相关接口end
@ -314,7 +317,7 @@ public class ApiController {
@RequestMapping(value = "/weightsave/{username}", method = RequestMethod.GET)
@ResponseBody
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);
}
@ -327,11 +330,12 @@ public class ApiController {
return wmomController.rfid_save(username, wmientityin, request);
}
@RequestMapping(value = "/login", method = RequestMethod.POST)
@ResponseBody
public ResultApi<?> login(@RequestBody TSBaseUser tsBaseUser, HttpServletRequest request) {
logger.info("获取TOKEN[{}]" + tsBaseUser.getUserName());
ResultDO D0 = new ResultDO();
ResultDO D0 = new ResultDO();
// 验证
if (org.apache.commons.lang3.StringUtils.isEmpty(tsBaseUser.getUserName())) {
return ResultApi.error("用户账号不能为空!");
@ -345,9 +349,10 @@ public class ApiController {
D0.setErrorMsg("用户账号密码错误!");
D0.setOK(false);
return ResultApi.error("获取TOKEN,账号密码错误[{}]!");
}
}
return ResultApi.OK(user);
}
/**
* id
*
@ -357,35 +362,35 @@ public class ApiController {
@RequestMapping(value = "/appfunctionList/{username}", method = RequestMethod.GET)
@ResponseBody
public ResponseMessage<?> appfunctionList(@PathVariable("username") String username,
HttpServletRequest request) {
HttpServletRequest request) {
//根据用户名获取APP用户
CriteriaQuery queryuser = new CriteriaQuery(WmsAppUserEntity.class);
queryuser.eq("appuserCode",username);
queryuser.eq("appuserCode", username);
List<WmsAppUserEntity> listByCriteriaQuery = wmsAppUserService.getListByCriteriaQuery(queryuser, false);
if(CollectionUtils.isEmpty(listByCriteriaQuery)){
if (CollectionUtils.isEmpty(listByCriteriaQuery)) {
return Result.error("未找到APP用户信息");
}
//获取用户角色Id
String roleId =listByCriteriaQuery.get(0).getApproleCode();
String roleId = listByCriteriaQuery.get(0).getApproleCode();
System.err.println(roleId);
//根据用户角色Id获取APP角色集合
CriteriaQuery queryrole = new CriteriaQuery(WmsAppRoleEntity.class);
queryrole.in("approleCode",roleId.split(","));
List<WmsAppRoleEntity> mesAppRole = wmsAppRoleService.getListByCriteriaQuery(queryrole,false);
if(mesAppRole==null){
queryrole.in("approleCode", roleId.split(","));
List<WmsAppRoleEntity> mesAppRole = wmsAppRoleService.getListByCriteriaQuery(queryrole, false);
if (mesAppRole == null) {
return Result.error("未找到APP角色信息");
}
String funidstr = "";
for (WmsAppRoleEntity role : mesAppRole) {
//拼接获取的APP模块id
funidstr = funidstr + ","+role.getAppmodelCode();
funidstr = funidstr + "," + role.getAppmodelCode();
System.err.println(funidstr);
}
//根据APP模块id获取APP功能模块集合
CriteriaQuery funcwrapper = new CriteriaQuery(WmsAppFunctionEntity.class);
funcwrapper.in("appmodelCode",funidstr.split(",")) ;
List<WmsAppFunctionEntity> mesAppFunctions = wmsAppFunctionService.getListByCriteriaQuery(funcwrapper,false);
if(mesAppFunctions==null){
funcwrapper.in("appmodelCode", funidstr.split(","));
List<WmsAppFunctionEntity> mesAppFunctions = wmsAppFunctionService.getListByCriteriaQuery(funcwrapper, false);
if (mesAppFunctions == null) {
return Result.error("未找到APP功能模块信息");
}
return Result.success(mesAppFunctions);
@ -396,9 +401,42 @@ public class ApiController {
@ResponseBody
public ResponseEntity<?> bilist(@RequestParam(value = "username", required = false) String username) {
biEntity biEntity = biBinController.getBi(username);
ResultDO D0 = new ResultDO();
ResultDO D0 = new ResultDO();
D0.setOK(false);
D0.setObj(biEntity);
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);
}
}