Commit f7c1a124 by wukaiqiang

新增场站、购砂单位用户消息处理接口

parent 40d1b877
......@@ -16,6 +16,8 @@ import java.util.zip.CheckedOutputStream;
import java.util.zip.ZipEntry;
import java.util.zip.ZipOutputStream;
import javax.servlet.http.HttpServletRequest;
import org.json.JSONObject;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
......@@ -26,6 +28,7 @@ import org.springframework.format.annotation.DateTimeFormat;
import org.springframework.http.HttpHeaders;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.util.Assert;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
......@@ -50,6 +53,7 @@ import com.beecode.bcp.type.json.JSONObjectUtils;
import com.beecode.inz.basis.team.pojo.ResponseObj;
import com.beecode.inz.message.internal.QueryParam;
import com.beecode.inz.message.service.MessageInfoService;
import com.beecode.inz.message.util.MessageUtils;
import com.beecode.inz.message.web.info.MessageInfo;
import com.beecode.nlib.utils.StringUtils;
import com.google.gson.Gson;
......@@ -80,10 +84,12 @@ public class DinasCommonController {
@Autowired
private MessageInfoService messageInfoService;
@Autowired
private HttpServletRequest request;
@Autowired
public AttachmentService attachmentService;
private final Logger logger = LoggerFactory.getLogger(getClass());
private final static String READ = "read";
/**
* @Description: 根据部门id查询全公司及其该部门的子部门(包括该部门自身)
......@@ -414,5 +420,71 @@ public class DinasCommonController {
}
return messageInfos;
}
/**
* 根据消息的id更改消息的状态为已读(场站用户)
* @param partId
* @return
*/
@RequestMapping(value ="/warehouse/api/common/message/{msgid}",method = RequestMethod.PUT)
public void updateReadStatusByMsgIdWarehouse(@PathVariable("msgid") String msgid) {
Assert.notNull(msgid, "msgid must not be null");
String operation = request.getHeader("operation");
switch(operation){
case READ: messageInfoService.updateReadStatusByMsgId(msgid);
break;
default:
throw new UnsupportedOperationException("operation: " + operation);
}
}
/**
* 根据消息的id更改消息的状态为已读(购砂单位用户)
* @param partId
* @return
*/
@RequestMapping(value ="/sand/user/common/message/{msgid}",method = RequestMethod.PUT)
public void updateReadStatusByMsgIdSand(@PathVariable("msgid") String msgid) {
Assert.notNull(msgid, "msgid must not be null");
String operation = request.getHeader("operation");
switch(operation){
case READ: messageInfoService.updateReadStatusByMsgId(msgid);
break;
default:
throw new UnsupportedOperationException("operation: " + operation);
}
}
/**
* 根据当前用户的id和消息类型获取未读消息数量(场站用户)
* @param partId
* @return
* @throws Exception
*/
@RequestMapping(value ="/warehouse/api/common/message/noread/count",method = RequestMethod.GET)
public Object countNoReadByUserIdAndType(@RequestParam String type,@RequestParam UUID userId) throws Exception {
String count = messageInfoService.countNoReadByUserIdAndType(userId.toString(), type);
return count;
}
/**
* 根据当前用户的id和消息类型获取未读消息数量(购砂单位用户)
* @param partId
* @return
* @throws Exception
*/
@RequestMapping(value ="/sand/user/common/message/noread/count",method = RequestMethod.GET)
public Object countNoReadByUserIdAndTypeSand(@RequestParam String type,@RequestParam UUID userId) throws Exception {
//String userId = MessageUtils.gerCurrentUserId(isCustomer);
String count = messageInfoService.countNoReadByUserIdAndType(userId.toString(), type);
return count;
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment