修复修改商品信息时,后台获取商品信息不准确的问题
This commit is contained in:
@@ -140,8 +140,8 @@ public class BusinessConstants {
|
|||||||
* 新增、修改、删除
|
* 新增、修改、删除
|
||||||
* */
|
* */
|
||||||
public static final String LOG_OPERATION_TYPE_ADD = "新增";
|
public static final String LOG_OPERATION_TYPE_ADD = "新增";
|
||||||
public static final String LOG_OPERATION_TYPE_EDIT = "修改";
|
public static final String LOG_OPERATION_TYPE_EDIT = "修改,id:";
|
||||||
public static final String LOG_OPERATION_TYPE_DELETE = "删除";
|
public static final String LOG_OPERATION_TYPE_DELETE = "删除,id:";
|
||||||
/**
|
/**
|
||||||
* 模块中文名称
|
* 模块中文名称
|
||||||
* 模块对应的标识
|
* 模块对应的标识
|
||||||
|
|||||||
@@ -1,10 +1,12 @@
|
|||||||
package com.jsh.erp.service.account;
|
package com.jsh.erp.service.account;
|
||||||
|
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import com.jsh.erp.constants.BusinessConstants;
|
||||||
import com.jsh.erp.datasource.entities.*;
|
import com.jsh.erp.datasource.entities.*;
|
||||||
import com.jsh.erp.datasource.mappers.*;
|
import com.jsh.erp.datasource.mappers.*;
|
||||||
import com.jsh.erp.datasource.vo.AccountVo4InOutList;
|
import com.jsh.erp.datasource.vo.AccountVo4InOutList;
|
||||||
import com.jsh.erp.datasource.vo.AccountVo4List;
|
import com.jsh.erp.datasource.vo.AccountVo4List;
|
||||||
|
import com.jsh.erp.service.log.LogService;
|
||||||
import com.jsh.erp.utils.StringUtil;
|
import com.jsh.erp.utils.StringUtil;
|
||||||
import com.jsh.erp.utils.Tools;
|
import com.jsh.erp.utils.Tools;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
@@ -12,6 +14,8 @@ import org.slf4j.LoggerFactory;
|
|||||||
import org.springframework.dao.DataAccessException;
|
import org.springframework.dao.DataAccessException;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
import org.springframework.web.context.request.RequestContextHolder;
|
||||||
|
import org.springframework.web.context.request.ServletRequestAttributes;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
@@ -39,6 +43,8 @@ public class AccountService {
|
|||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
private AccountItemMapper accountItemMapper;
|
private AccountItemMapper accountItemMapper;
|
||||||
|
@Resource
|
||||||
|
private LogService logService;
|
||||||
|
|
||||||
public Account getAccount(long id) {
|
public Account getAccount(long id) {
|
||||||
return accountMapper.selectByPrimaryKey(id);
|
return accountMapper.selectByPrimaryKey(id);
|
||||||
@@ -303,6 +309,7 @@ public class AccountService {
|
|||||||
|
|
||||||
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
||||||
public int updateAmountIsDefault(Boolean isDefault, Long accountId) {
|
public int updateAmountIsDefault(Boolean isDefault, Long accountId) {
|
||||||
|
logService.insertLog(BusinessConstants.LOG_INTERFACE_NAME_ACCOUNT,BusinessConstants.LOG_OPERATION_TYPE_EDIT+accountId,((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest());
|
||||||
Account account = new Account();
|
Account account = new Account();
|
||||||
account.setIsdefault(isDefault);
|
account.setIsdefault(isDefault);
|
||||||
AccountExample example = new AccountExample();
|
AccountExample example = new AccountExample();
|
||||||
|
|||||||
@@ -461,6 +461,20 @@ public class DepotItemService {
|
|||||||
depotItem.setOtherfield4(tempUpdatedJson.getString("OtherField4"));
|
depotItem.setOtherfield4(tempUpdatedJson.getString("OtherField4"));
|
||||||
depotItem.setOtherfield5(tempUpdatedJson.getString("OtherField5"));
|
depotItem.setOtherfield5(tempUpdatedJson.getString("OtherField5"));
|
||||||
depotItem.setMtype(tempUpdatedJson.getString("MType"));
|
depotItem.setMtype(tempUpdatedJson.getString("MType"));
|
||||||
|
/**
|
||||||
|
* create by: qiankunpingtai
|
||||||
|
* create time: 2019/3/25 15:18
|
||||||
|
* website:http://39.105.146.63/symphony/
|
||||||
|
* description:
|
||||||
|
* 修改了商品类型时,库中的商品和页面传递的不同
|
||||||
|
* 这里需要重新获取页面传递的商品信息
|
||||||
|
*/
|
||||||
|
if(!material.getId().equals(depotItem.getMaterialid())){
|
||||||
|
material= materialService.getMaterial(depotItem.getMaterialid());
|
||||||
|
if(material==null){
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
/**出库时处理序列号*/
|
/**出库时处理序列号*/
|
||||||
if(BusinessConstants.DEPOTHEAD_TYPE_OUT.equals(depotHead.getType())){
|
if(BusinessConstants.DEPOTHEAD_TYPE_OUT.equals(depotHead.getType())){
|
||||||
if(getCurrentInStock(depotItem.getMaterialid())<depotItem.getBasicnumber().intValue()){
|
if(getCurrentInStock(depotItem.getMaterialid())<depotItem.getBasicnumber().intValue()){
|
||||||
|
|||||||
@@ -15,6 +15,8 @@ import org.slf4j.Logger;
|
|||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
import org.springframework.web.context.request.RequestContextHolder;
|
||||||
|
import org.springframework.web.context.request.ServletRequestAttributes;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
@@ -172,6 +174,7 @@ public class SerialNumberService {
|
|||||||
* */
|
* */
|
||||||
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
||||||
public SerialNumberEx addSerialNumber(SerialNumberEx serialNumberEx) {
|
public SerialNumberEx addSerialNumber(SerialNumberEx serialNumberEx) {
|
||||||
|
logService.insertLog(BusinessConstants.LOG_INTERFACE_NAME_SERIAL_NUMBER,BusinessConstants.LOG_OPERATION_TYPE_ADD,((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest());
|
||||||
if(serialNumberEx==null){
|
if(serialNumberEx==null){
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -290,7 +290,7 @@ public class Tools {
|
|||||||
* @return ip
|
* @return ip
|
||||||
*/
|
*/
|
||||||
public static String getLocalIp(HttpServletRequest request) {
|
public static String getLocalIp(HttpServletRequest request) {
|
||||||
String remoteAddr = request.getRemoteAddr();
|
String remoteAddr = getIpAddr(request);
|
||||||
String forwarded = request.getHeader("X-Forwarded-For");
|
String forwarded = request.getHeader("X-Forwarded-For");
|
||||||
String realIp = request.getHeader("X-Real-IP");
|
String realIp = request.getHeader("X-Real-IP");
|
||||||
|
|
||||||
@@ -313,6 +313,35 @@ public class Tools {
|
|||||||
}
|
}
|
||||||
return ip;
|
return ip;
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* 获取访问者IP
|
||||||
|
*
|
||||||
|
* 在一般情况下使用Request.getRemoteAddr()即可,但是经过nginx等反向代理软件后,这个方法会失效。
|
||||||
|
*
|
||||||
|
* 本方法先从Header中获取X-Real-IP,如果不存在再从X-Forwarded-For获得第一个IP(用,分割),
|
||||||
|
* 如果还不存在则调用Request .getRemoteAddr()。
|
||||||
|
*
|
||||||
|
* @param request
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public static String getIpAddr(HttpServletRequest request) {
|
||||||
|
String ip = request.getHeader("X-Real-IP");
|
||||||
|
if (!StringUtils.isEmpty(ip) && !"unknown".equalsIgnoreCase(ip)) {
|
||||||
|
return ip;
|
||||||
|
}
|
||||||
|
ip = request.getHeader("X-Forwarded-For");
|
||||||
|
if (!StringUtils.isEmpty(ip) && !"unknown".equalsIgnoreCase(ip)) {
|
||||||
|
// 多次反向代理后会有多个IP值,第一个为真实IP。
|
||||||
|
int index = ip.indexOf(',');
|
||||||
|
if (index != -1) {
|
||||||
|
return ip.substring(0, index);
|
||||||
|
} else {
|
||||||
|
return ip;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return request.getRemoteAddr();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 转化前台批量传入的ID值
|
* 转化前台批量传入的ID值
|
||||||
|
|||||||
Reference in New Issue
Block a user