修改单据insert和update的代码,解决大数据量无法写入的bug,另外增加消息提醒的定时刷新
This commit is contained in:
@@ -438,4 +438,25 @@ $(function () {
|
||||
}, 10 * 1000);
|
||||
}
|
||||
|
||||
//更新消息条数
|
||||
function getMsgCountByStatus() {
|
||||
$.ajax({
|
||||
type: "get",
|
||||
url: "/msg/getMsgCountByStatus?status=1",
|
||||
dataType: "json",
|
||||
success: function (res) {
|
||||
if (res && res.code === 200) {
|
||||
if(res.data) {
|
||||
var count = res.data.count;
|
||||
$("#msgNum, #msgNum2").text(count);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
getMsgCountByStatus();
|
||||
setInterval(function() {
|
||||
getMsgCountByStatus()
|
||||
}, 1000*60);
|
||||
|
||||
});
|
||||
@@ -2513,9 +2513,10 @@
|
||||
$.ajax({
|
||||
type:"post",
|
||||
url: url,
|
||||
contentType:"application/json",
|
||||
dataType: "json",
|
||||
async : false,
|
||||
data: ({
|
||||
data: JSON.stringify({
|
||||
info:infoStr,
|
||||
inserted: JSON.stringify(inserted),
|
||||
deleted: JSON.stringify(deleted),
|
||||
@@ -2553,9 +2554,10 @@
|
||||
$.ajax({
|
||||
type:"post",
|
||||
url: url,
|
||||
contentType:"application/json",
|
||||
dataType: "json",
|
||||
async : false,
|
||||
data: ({
|
||||
data: JSON.stringify({
|
||||
id:url.substring(url.lastIndexOf("?id=")+4,url.length),
|
||||
info:infoStr,
|
||||
inserted: JSON.stringify(inserted),
|
||||
|
||||
@@ -4,6 +4,7 @@ import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.jsh.erp.constants.ExceptionConstants;
|
||||
import com.jsh.erp.datasource.entities.DepotHead;
|
||||
import com.jsh.erp.datasource.entities.DepotHeadVo4Body;
|
||||
import com.jsh.erp.datasource.vo.DepotHeadVo4InDetail;
|
||||
import com.jsh.erp.datasource.vo.DepotHeadVo4InOutMCount;
|
||||
import com.jsh.erp.datasource.vo.DepotHeadVo4List;
|
||||
@@ -382,21 +383,19 @@ public class DepotHeadController {
|
||||
}
|
||||
|
||||
/**
|
||||
* create by: cjl
|
||||
* description:
|
||||
* 新增单据主表及单据子表信息
|
||||
* create time: 2019/1/25 14:36
|
||||
* @Param: beanJson
|
||||
* @Param: inserted
|
||||
* @Param: deleted
|
||||
* @Param: updated
|
||||
* @return java.lang.String
|
||||
* 新增单据主表及单据子表信息
|
||||
* @param body
|
||||
* @param request
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
@RequestMapping(value = "/addDepotHeadAndDetail")
|
||||
public Object addDepotHeadAndDetail(@RequestParam("info") String beanJson,@RequestParam("inserted") String inserted,
|
||||
@RequestParam("deleted") String deleted,
|
||||
@RequestParam("updated") String updated, HttpServletRequest request) throws Exception{
|
||||
@PostMapping(value = "/addDepotHeadAndDetail")
|
||||
public Object addDepotHeadAndDetail(@RequestBody DepotHeadVo4Body body, HttpServletRequest request) throws Exception{
|
||||
JSONObject result = ExceptionConstants.standardSuccess();
|
||||
String beanJson = body.getInfo();
|
||||
String inserted = body.getInserted();
|
||||
String deleted = body.getDeleted();
|
||||
String updated = body.getUpdated();
|
||||
Long billsNumLimit = Long.parseLong(request.getSession().getAttribute("billsNumLimit").toString());
|
||||
Long tenantId = Long.parseLong(request.getSession().getAttribute("tenantId").toString());
|
||||
Long count = depotHeadService.countDepotHead(null,null,null,null,null,null,null);
|
||||
@@ -408,58 +407,49 @@ public class DepotHeadController {
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* create by: cjl
|
||||
* description:
|
||||
* 更新单据主表及单据子表信息
|
||||
* create time: 2019/1/28 14:47
|
||||
* @Param: id
|
||||
* @Param: beanJson
|
||||
* @Param: inserted
|
||||
* @Param: deleted
|
||||
* @Param: updated
|
||||
* @Param: preTotalPrice
|
||||
* @return java.lang.Object
|
||||
* @param body
|
||||
* @param request
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
@RequestMapping(value = "/updateDepotHeadAndDetail")
|
||||
public Object updateDepotHeadAndDetail(@RequestParam("id") Long id,
|
||||
@RequestParam("info") String beanJson,
|
||||
@RequestParam("inserted") String inserted,
|
||||
@RequestParam("deleted") String deleted,
|
||||
@RequestParam("updated") String updated,
|
||||
@RequestParam("preTotalPrice") BigDecimal preTotalPrice,
|
||||
HttpServletRequest request) throws Exception{
|
||||
@PostMapping(value = "/updateDepotHeadAndDetail")
|
||||
public Object updateDepotHeadAndDetail(@RequestBody DepotHeadVo4Body body, HttpServletRequest request) throws Exception{
|
||||
Long tenantId = Long.parseLong(request.getSession().getAttribute("tenantId").toString());
|
||||
JSONObject result = ExceptionConstants.standardSuccess();
|
||||
Long id = body.getId();
|
||||
String beanJson = body.getInfo();
|
||||
String inserted = body.getInserted();
|
||||
String deleted = body.getDeleted();
|
||||
String updated = body.getUpdated();
|
||||
BigDecimal preTotalPrice = body.getPreTotalPrice();
|
||||
depotHeadService.updateDepotHeadAndDetail(id,beanJson,inserted,deleted,updated,preTotalPrice,tenantId,request);
|
||||
return result;
|
||||
}
|
||||
/**
|
||||
* create by: cjl
|
||||
* description:
|
||||
* 删除单据主表及子表信息
|
||||
* create time: 2019/1/28 17:29
|
||||
* @Param: id
|
||||
* @return java.lang.Object
|
||||
*/
|
||||
@RequestMapping(value = "/deleteDepotHeadAndDetail")
|
||||
public Object deleteDepotHeadAndDetail(@RequestParam("id") Long id) throws Exception{
|
||||
|
||||
/**
|
||||
* 删除单据主表及子表信息
|
||||
* @param id
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
@PostMapping(value = "/deleteDepotHeadAndDetail")
|
||||
public Object deleteDepotHeadAndDetail(@RequestParam("id") Long id) throws Exception{
|
||||
JSONObject result = ExceptionConstants.standardSuccess();
|
||||
depotHeadService.deleteDepotHeadAndDetail(id);
|
||||
return result;
|
||||
}
|
||||
/**
|
||||
* create by: cjl
|
||||
* description:
|
||||
* 删除单据主表及子表信息
|
||||
* create time: 2019/1/28 17:29
|
||||
* @Param: id
|
||||
* @return java.lang.Object
|
||||
*/
|
||||
@RequestMapping(value = "/batchDeleteDepotHeadAndDetail")
|
||||
public Object batchDeleteDepotHeadAndDetail(@RequestParam("ids") String ids) throws Exception{
|
||||
|
||||
/**
|
||||
* 批量删除单据主表及子表信息
|
||||
* @param ids
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
@PostMapping(value = "/batchDeleteDepotHeadAndDetail")
|
||||
public Object batchDeleteDepotHeadAndDetail(@RequestParam("ids") String ids) throws Exception{
|
||||
JSONObject result = ExceptionConstants.standardSuccess();
|
||||
depotHeadService.batchDeleteDepotHeadAndDetail(ids);
|
||||
return result;
|
||||
|
||||
@@ -9,7 +9,9 @@ import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author ji sheng hua 华夏ERP
|
||||
@@ -54,4 +56,22 @@ public class MsgController {
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
@GetMapping("/getMsgCountByStatus")
|
||||
public BaseResponseInfo getMsgCountByStatus(@RequestParam("status") String status,
|
||||
HttpServletRequest request)throws Exception {
|
||||
BaseResponseInfo res = new BaseResponseInfo();
|
||||
try {
|
||||
Map<String, Long> map = new HashMap<String, Long>();
|
||||
Long count = msgService.getMsgCountByStatus(status);
|
||||
map.put("count", count);
|
||||
res.code = 200;
|
||||
res.data = map;
|
||||
} catch(Exception e){
|
||||
e.printStackTrace();
|
||||
res.code = 500;
|
||||
res.data = "获取数据失败";
|
||||
}
|
||||
return res;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,66 @@
|
||||
package com.jsh.erp.datasource.entities;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
public class DepotHeadVo4Body {
|
||||
|
||||
private Long id;
|
||||
|
||||
private String info;
|
||||
|
||||
private String inserted;
|
||||
|
||||
private String deleted;
|
||||
|
||||
private String updated;
|
||||
|
||||
private BigDecimal preTotalPrice;
|
||||
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(Long id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getInfo() {
|
||||
return info;
|
||||
}
|
||||
|
||||
public void setInfo(String info) {
|
||||
this.info = info;
|
||||
}
|
||||
|
||||
public String getInserted() {
|
||||
return inserted;
|
||||
}
|
||||
|
||||
public void setInserted(String inserted) {
|
||||
this.inserted = inserted;
|
||||
}
|
||||
|
||||
public String getDeleted() {
|
||||
return deleted;
|
||||
}
|
||||
|
||||
public void setDeleted(String deleted) {
|
||||
this.deleted = deleted;
|
||||
}
|
||||
|
||||
public String getUpdated() {
|
||||
return updated;
|
||||
}
|
||||
|
||||
public void setUpdated(String updated) {
|
||||
this.updated = updated;
|
||||
}
|
||||
|
||||
public BigDecimal getPreTotalPrice() {
|
||||
return preTotalPrice;
|
||||
}
|
||||
|
||||
public void setPreTotalPrice(BigDecimal preTotalPrice) {
|
||||
this.preTotalPrice = preTotalPrice;
|
||||
}
|
||||
}
|
||||
@@ -20,4 +20,8 @@ public interface MsgMapperEx {
|
||||
int insertSelectiveByTask(Msg record);
|
||||
|
||||
int checkIsNameExistByTask(@Param("msgTitle") String msgTitle);
|
||||
|
||||
Long getMsgCountByStatus(
|
||||
@Param("status") String status,
|
||||
@Param("userId") Long userId);
|
||||
}
|
||||
@@ -5,11 +5,13 @@ import com.jsh.erp.constants.BusinessConstants;
|
||||
import com.jsh.erp.constants.ExceptionConstants;
|
||||
import com.jsh.erp.datasource.entities.Msg;
|
||||
import com.jsh.erp.datasource.entities.MsgExample;
|
||||
import com.jsh.erp.datasource.entities.User;
|
||||
import com.jsh.erp.datasource.mappers.MsgMapper;
|
||||
import com.jsh.erp.datasource.mappers.MsgMapperEx;
|
||||
import com.jsh.erp.exception.BusinessRunTimeException;
|
||||
import com.jsh.erp.service.depotHead.DepotHeadService;
|
||||
import com.jsh.erp.service.log.LogService;
|
||||
import com.jsh.erp.service.user.UserService;
|
||||
import com.jsh.erp.utils.StringUtil;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
@@ -34,6 +36,9 @@ public class MsgService {
|
||||
@Resource
|
||||
private DepotHeadService depotHeadService;
|
||||
|
||||
@Resource
|
||||
private UserService userService;
|
||||
|
||||
@Resource
|
||||
private LogService logService;
|
||||
|
||||
@@ -232,4 +237,18 @@ public class MsgService {
|
||||
ExceptionConstants.DATA_WRITE_FAIL_MSG);
|
||||
}
|
||||
}
|
||||
|
||||
public Long getMsgCountByStatus(String status)throws Exception {
|
||||
Long result=null;
|
||||
try{
|
||||
User userInfo=userService.getCurrentUser();
|
||||
result=msgMapperEx.getMsgCountByStatus(status, userInfo.getId());
|
||||
}catch(Exception e){
|
||||
logger.error("异常码[{}],异常提示[{}],异常[{}]",
|
||||
ExceptionConstants.DATA_READ_FAIL_CODE, ExceptionConstants.DATA_READ_FAIL_MSG,e);
|
||||
throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE,
|
||||
ExceptionConstants.DATA_READ_FAIL_MSG);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -57,4 +57,15 @@
|
||||
and msg_title = '${msgTitle}'
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<select id="getMsgCountByStatus" resultType="java.lang.Long">
|
||||
SELECT
|
||||
COUNT(id)
|
||||
FROM jsh_msg
|
||||
WHERE 1=1
|
||||
and ifnull(delete_Flag,'0') !='1'
|
||||
<if test="status != null">
|
||||
and status = '${status}'
|
||||
</if>
|
||||
</select>
|
||||
</mapper>
|
||||
Reference in New Issue
Block a user