@@ -135,6 +135,67 @@ public class BusinessConstants {
|
||||
public static final byte USER_STATUS_NORMAL = 0;
|
||||
public static final byte USER_STATUS_DELETE = 1;
|
||||
public static final byte USER_STATUS_BANNED = 2;
|
||||
/**
|
||||
* 日志操作
|
||||
* 新增、修改、删除
|
||||
* */
|
||||
public static final String LOG_OPERATION_TYPE_ADD = "新增";
|
||||
public static final String LOG_OPERATION_TYPE_BATCH_ADD = "批量新增";
|
||||
public static final String LOG_OPERATION_TYPE_EDIT = "修改,id:";
|
||||
public static final String LOG_OPERATION_TYPE_DELETE = "删除,id:";
|
||||
public static final String LOG_OPERATION_TYPE_IMPORT = "导入";
|
||||
|
||||
/**
|
||||
* 数据数量单位
|
||||
* 条
|
||||
* */
|
||||
public static final String LOG_DATA_UNIT = "条";
|
||||
/**
|
||||
* 模块中文名称
|
||||
* 模块对应的标识
|
||||
* */
|
||||
public static final String LOG_MODULE_NAME_USER= "用户";
|
||||
public static final String LOG_INTERFACE_NAME_USER= "user";
|
||||
public static final String LOG_MODULE_NAME_ROLE= "角色";
|
||||
public static final String LOG_INTERFACE_NAME_ROLE= "role";
|
||||
public static final String LOG_MODULE_NAME_APP= "应用";
|
||||
public static final String LOG_INTERFACE_NAME_APP= "app";
|
||||
public static final String LOG_MODULE_NAME_DEPOT= "仓库";
|
||||
public static final String LOG_INTERFACE_NAME_DEPOT= "depot";
|
||||
public static final String LOG_MODULE_NAME_FUNCTIONS= "功能";
|
||||
public static final String LOG_INTERFACE_NAME_FUNCTIONS= "functions";
|
||||
public static final String LOG_MODULE_NAME_IN_OUT_ITEM= "收支项目";
|
||||
public static final String LOG_INTERFACE_NAME_IN_OUT_ITEM= "inOutItem";
|
||||
public static final String LOG_MODULE_NAME_UNIT= "计量单位";
|
||||
public static final String LOG_INTERFACE_NAME_UNIT= "unit";
|
||||
public static final String LOG_MODULE_NAME_PERSON= "经手人";
|
||||
public static final String LOG_INTERFACE_NAME_PERSON= "person";
|
||||
public static final String LOG_MODULE_NAME_USER_BUSINESS= "关联关系";
|
||||
public static final String LOG_INTERFACE_NAME_USER_BUSINESS= "userBusiness";
|
||||
public static final String LOG_MODULE_NAME_SYSTEM_CONFIG= "系统配置";
|
||||
public static final String LOG_INTERFACE_NAME_SYSTEM_CONFIG= "systemConfig";
|
||||
public static final String LOG_MODULE_NAME_MATERIAL_PROPERTY= "商品属性";
|
||||
public static final String LOG_INTERFACE_NAME_MATERIAL_PROPERTY= "materialProperty";
|
||||
public static final String LOG_MODULE_NAME_ACCOUNT= "账户";
|
||||
public static final String LOG_INTERFACE_NAME_ACCOUNT= "account";
|
||||
public static final String LOG_MODULE_NAME_SUPPLIER= "商家";
|
||||
public static final String LOG_INTERFACE_NAME_SUPPLIER= "supplier";
|
||||
public static final String LOG_MODULE_NAME_MATERIAL_CATEGORY= "商品类型";
|
||||
public static final String LOG_INTERFACE_NAME_MATERIAL_CATEGORY= "materialCategory";
|
||||
public static final String LOG_MODULE_NAME_MATERIAL= "商品";
|
||||
public static final String LOG_INTERFACE_NAME_MATERIAL= "material";
|
||||
public static final String LOG_MODULE_NAME_DEPOT_HEAD= "单据";
|
||||
public static final String LOG_INTERFACE_NAME_DEPOT_HEAD= "depotHead";
|
||||
public static final String LOG_MODULE_NAME_DEPOT_ITEM= "单据明细";
|
||||
public static final String LOG_INTERFACE_NAME_DEPOT_ITEM= "depotItem";
|
||||
public static final String LOG_MODULE_NAME_ACCOUNT_HEAD= "财务";
|
||||
public static final String LOG_INTERFACE_NAME_ACCOUNT_HEAD= "accountHead";
|
||||
public static final String LOG_MODULE_NAME_ACCOUNT_ITEM= "财务明细";
|
||||
public static final String LOG_INTERFACE_NAME_ACCOUNT_ITEM= "accountItem";
|
||||
public static final String LOG_MODULE_NAME_SERIAL_NUMBER= "序列号";
|
||||
public static final String LOG_INTERFACE_NAME_SERIAL_NUMBER= "serialNumber";
|
||||
public static final String LOG_MODULE_NAME_ORGANIZATION= "机构";
|
||||
public static final String LOG_INTERFACE_NAME_ORGANIZATION= "organization";
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -5,6 +5,7 @@ import com.alibaba.fastjson.JSONObject;
|
||||
import com.jsh.erp.datasource.entities.AccountItem;
|
||||
import com.jsh.erp.datasource.vo.AccountItemVo4List;
|
||||
import com.jsh.erp.service.accountItem.AccountItemService;
|
||||
import com.jsh.erp.service.log.LogService;
|
||||
import com.jsh.erp.utils.*;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
@@ -40,8 +40,6 @@ public class DepotHeadController {
|
||||
@Resource
|
||||
private DepotHeadService depotHeadService;
|
||||
|
||||
@Resource
|
||||
private LogService logService;
|
||||
|
||||
/**
|
||||
* 批量设置状态-审核或者反审核
|
||||
@@ -435,7 +433,7 @@ public class DepotHeadController {
|
||||
@RequestParam("updated") String updated, HttpServletRequest request) throws Exception{
|
||||
JSONObject result = ExceptionConstants.standardSuccess();
|
||||
depotHeadService.addDepotHeadAndDetail(beanJson,inserted,deleted,updated);
|
||||
logService.insertLog("depotHead", "新增", request);
|
||||
|
||||
return result;
|
||||
}
|
||||
/**
|
||||
|
||||
@@ -11,6 +11,7 @@ import jxl.Workbook;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.dao.DataAccessException;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
@@ -375,8 +376,8 @@ public class SupplierController {
|
||||
importFun(supplierFile);
|
||||
response.sendRedirect("../pages/manage/member.html");
|
||||
}
|
||||
|
||||
public String importFun(MultipartFile supplierFile){
|
||||
|
||||
BaseResponseInfo info = new BaseResponseInfo();
|
||||
Map<String, Object> data = new HashMap<String, Object>();
|
||||
String message = "成功";
|
||||
|
||||
@@ -78,7 +78,7 @@ public class CommonQueryManager {
|
||||
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
||||
public int insert(String apiName, String beanJson, HttpServletRequest request) {
|
||||
if (StringUtil.isNotEmpty(apiName)) {
|
||||
logService.insertLog(apiName, "新增", request);
|
||||
logService.insertLog(apiName, BusinessConstants.LOG_OPERATION_TYPE_ADD, request);
|
||||
return container.getCommonQuery(apiName).insert(beanJson, request);
|
||||
}
|
||||
return 0;
|
||||
@@ -94,7 +94,8 @@ public class CommonQueryManager {
|
||||
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
||||
public int update(String apiName, String beanJson, Long id, HttpServletRequest request) {
|
||||
if (StringUtil.isNotEmpty(apiName)) {
|
||||
logService.insertLog(apiName, "更新,id:" + id, request);
|
||||
logService.insertLog(apiName,
|
||||
new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_EDIT).append(id).toString(), request);
|
||||
return container.getCommonQuery(apiName).update(beanJson, id);
|
||||
}
|
||||
return 0;
|
||||
@@ -109,7 +110,8 @@ public class CommonQueryManager {
|
||||
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
||||
public int delete(String apiName, Long id, HttpServletRequest request) {
|
||||
if (StringUtil.isNotEmpty(apiName)) {
|
||||
logService.insertLog(apiName, "删除,id:" + id, request);
|
||||
logService.insertLog(apiName,
|
||||
new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_DELETE).append(id).toString(), request);
|
||||
return container.getCommonQuery(apiName).delete(id);
|
||||
}
|
||||
return 0;
|
||||
|
||||
@@ -1,10 +1,12 @@
|
||||
package com.jsh.erp.service.account;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.jsh.erp.constants.BusinessConstants;
|
||||
import com.jsh.erp.datasource.entities.*;
|
||||
import com.jsh.erp.datasource.mappers.*;
|
||||
import com.jsh.erp.datasource.vo.AccountVo4InOutList;
|
||||
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.Tools;
|
||||
import org.slf4j.Logger;
|
||||
@@ -12,6 +14,8 @@ import org.slf4j.LoggerFactory;
|
||||
import org.springframework.dao.DataAccessException;
|
||||
import org.springframework.stereotype.Service;
|
||||
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.servlet.http.HttpServletRequest;
|
||||
@@ -39,6 +43,8 @@ public class AccountService {
|
||||
|
||||
@Resource
|
||||
private AccountItemMapper accountItemMapper;
|
||||
@Resource
|
||||
private LogService logService;
|
||||
|
||||
public Account getAccount(long id) {
|
||||
return accountMapper.selectByPrimaryKey(id);
|
||||
@@ -303,6 +309,8 @@ public class AccountService {
|
||||
|
||||
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
||||
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.setIsdefault(isDefault);
|
||||
AccountExample example = new AccountExample();
|
||||
|
||||
@@ -2,11 +2,13 @@ package com.jsh.erp.service.accountItem;
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.jsh.erp.constants.BusinessConstants;
|
||||
import com.jsh.erp.datasource.entities.AccountItem;
|
||||
import com.jsh.erp.datasource.entities.AccountItemExample;
|
||||
import com.jsh.erp.datasource.mappers.AccountItemMapper;
|
||||
import com.jsh.erp.datasource.mappers.AccountItemMapperEx;
|
||||
import com.jsh.erp.datasource.vo.AccountItemVo4List;
|
||||
import com.jsh.erp.service.log.LogService;
|
||||
import com.jsh.erp.utils.ErpInfo;
|
||||
import com.jsh.erp.utils.StringUtil;
|
||||
import org.slf4j.Logger;
|
||||
@@ -14,6 +16,8 @@ import org.slf4j.LoggerFactory;
|
||||
import org.springframework.dao.DataAccessException;
|
||||
import org.springframework.stereotype.Service;
|
||||
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.servlet.http.HttpServletRequest;
|
||||
@@ -31,6 +35,8 @@ public class AccountItemService {
|
||||
|
||||
@Resource
|
||||
private AccountItemMapperEx accountItemMapperEx;
|
||||
@Resource
|
||||
private LogService logService;
|
||||
|
||||
public AccountItem getAccountItem(long id) {
|
||||
return accountItemMapper.selectByPrimaryKey(id);
|
||||
@@ -97,7 +103,10 @@ public class AccountItemService {
|
||||
}
|
||||
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
||||
public String saveDetials(String inserted, String deleted, String updated, Long headerId, String listType) throws DataAccessException {
|
||||
//转为json
|
||||
logService.insertLog(BusinessConstants.LOG_INTERFACE_NAME_ACCOUNT_ITEM,
|
||||
new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_EDIT).append(",headerId:").append(headerId).toString(),
|
||||
((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest());
|
||||
//转为json
|
||||
JSONArray insertedJson = JSONArray.parseArray(inserted);
|
||||
JSONArray deletedJson = JSONArray.parseArray(deleted);
|
||||
JSONArray updatedJson = JSONArray.parseArray(updated);
|
||||
|
||||
@@ -14,6 +14,7 @@ import com.jsh.erp.datasource.vo.DepotHeadVo4InOutMCount;
|
||||
import com.jsh.erp.datasource.vo.DepotHeadVo4List;
|
||||
import com.jsh.erp.datasource.vo.DepotHeadVo4StatementAccount;
|
||||
import com.jsh.erp.service.depotItem.DepotItemService;
|
||||
import com.jsh.erp.service.log.LogService;
|
||||
import com.jsh.erp.service.serialNumber.SerialNumberService;
|
||||
import com.jsh.erp.service.supplier.SupplierService;
|
||||
import com.jsh.erp.service.user.UserService;
|
||||
@@ -22,6 +23,8 @@ import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.stereotype.Service;
|
||||
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.servlet.http.HttpServletRequest;
|
||||
@@ -51,6 +54,8 @@ public class DepotHeadService {
|
||||
private SerialNumberService serialNumberService;
|
||||
@Resource
|
||||
DepotItemMapperEx depotItemMapperEx;
|
||||
@Resource
|
||||
private LogService logService;
|
||||
|
||||
|
||||
public DepotHead getDepotHead(long id) {
|
||||
@@ -143,6 +148,9 @@ public class DepotHeadService {
|
||||
|
||||
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
||||
public int batchSetStatus(String status, String depotHeadIDs) {
|
||||
logService.insertLog(BusinessConstants.LOG_INTERFACE_NAME_DEPOT_HEAD,
|
||||
new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_EDIT).append(depotHeadIDs).toString(),
|
||||
((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest());
|
||||
List<Long> ids = StringUtil.strToLongList(depotHeadIDs);
|
||||
DepotHead depotHead = new DepotHead();
|
||||
depotHead.setStatus(status);
|
||||
@@ -269,6 +277,9 @@ public class DepotHeadService {
|
||||
*/
|
||||
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
||||
public void addDepotHeadAndDetail(String beanJson, String inserted, String deleted, String updated) throws Exception {
|
||||
logService.insertLog(BusinessConstants.LOG_INTERFACE_NAME_DEPOT_HEAD,
|
||||
BusinessConstants.LOG_OPERATION_TYPE_ADD,
|
||||
((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest());
|
||||
/**处理单据主表数据*/
|
||||
DepotHead depotHead = JSONObject.parseObject(beanJson, DepotHead.class);
|
||||
//判断用户是否已经登录过,登录过不再处理
|
||||
@@ -309,6 +320,9 @@ public class DepotHeadService {
|
||||
*/
|
||||
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
||||
public void updateDepotHeadAndDetail(Long id, String beanJson, String inserted, String deleted, String updated, BigDecimal preTotalPrice)throws Exception {
|
||||
logService.insertLog(BusinessConstants.LOG_INTERFACE_NAME_DEPOT_HEAD,
|
||||
new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_EDIT).append(id).toString(),
|
||||
((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest());
|
||||
/**更新单据主表信息*/
|
||||
DepotHead depotHead = JSONObject.parseObject(beanJson, DepotHead.class);
|
||||
//判断用户是否已经登录过,登录过不再处理
|
||||
@@ -337,6 +351,9 @@ public class DepotHeadService {
|
||||
*/
|
||||
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
||||
public void deleteDepotHeadAndDetail(Long id) throws Exception {
|
||||
logService.insertLog(BusinessConstants.LOG_INTERFACE_NAME_DEPOT_HEAD,
|
||||
new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_DELETE).append(id).toString(),
|
||||
((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest());
|
||||
//查询单据主表信息
|
||||
DepotHead depotHead =getDepotHead(id);
|
||||
User userInfo=userService.getCurrentUser();
|
||||
@@ -368,6 +385,9 @@ public class DepotHeadService {
|
||||
*/
|
||||
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
||||
public void batchDeleteDepotHeadAndDetail(String ids) throws Exception{
|
||||
logService.insertLog(BusinessConstants.LOG_INTERFACE_NAME_DEPOT_HEAD,
|
||||
new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_DELETE).append(ids).toString(),
|
||||
((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest());
|
||||
if(StringUtil.isNotEmpty(ids)){
|
||||
String [] headIds=ids.split(",");
|
||||
for(int i=0;i<headIds.length;i++){
|
||||
|
||||
@@ -10,6 +10,7 @@ import com.jsh.erp.datasource.mappers.DepotItemMapper;
|
||||
import com.jsh.erp.datasource.mappers.DepotItemMapperEx;
|
||||
import com.jsh.erp.datasource.mappers.SerialNumberMapperEx;
|
||||
import com.jsh.erp.exception.BusinessRunTimeException;
|
||||
import com.jsh.erp.service.log.LogService;
|
||||
import com.jsh.erp.service.material.MaterialService;
|
||||
import com.jsh.erp.service.serialNumber.SerialNumberService;
|
||||
import com.jsh.erp.service.user.UserService;
|
||||
@@ -21,6 +22,8 @@ import org.slf4j.LoggerFactory;
|
||||
import org.springframework.dao.DataAccessException;
|
||||
import org.springframework.stereotype.Service;
|
||||
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.servlet.http.HttpServletRequest;
|
||||
@@ -54,6 +57,8 @@ public class DepotItemService {
|
||||
SerialNumberService serialNumberService;
|
||||
@Resource
|
||||
private UserService userService;
|
||||
@Resource
|
||||
private LogService logService;
|
||||
|
||||
public DepotItem getDepotItem(long id) {
|
||||
return depotItemMapper.selectByPrimaryKey(id);
|
||||
@@ -224,6 +229,10 @@ public class DepotItemService {
|
||||
* */
|
||||
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
||||
public String saveDetials(String inserted, String deleted, String updated, Long headerId) throws Exception{
|
||||
logService.insertLog(BusinessConstants.LOG_INTERFACE_NAME_DEPOT_ITEM,
|
||||
BusinessConstants.LOG_OPERATION_TYPE_ADD,
|
||||
((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest());
|
||||
|
||||
//查询单据主表信息
|
||||
DepotHead depotHead=depotHeadMapper.selectByPrimaryKey(headerId);
|
||||
//获得当前操作人
|
||||
@@ -461,6 +470,20 @@ public class DepotItemService {
|
||||
depotItem.setOtherfield4(tempUpdatedJson.getString("OtherField4"));
|
||||
depotItem.setOtherfield5(tempUpdatedJson.getString("OtherField5"));
|
||||
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(getCurrentInStock(depotItem.getMaterialid())<depotItem.getBasicnumber().intValue()){
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.jsh.erp.service.log;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.jsh.erp.constants.BusinessConstants;
|
||||
import com.jsh.erp.datasource.entities.Log;
|
||||
import com.jsh.erp.datasource.entities.LogExample;
|
||||
import com.jsh.erp.datasource.entities.User;
|
||||
@@ -97,44 +98,48 @@ public class LogService {
|
||||
public String getModule(String apiName){
|
||||
String moduleName = null;
|
||||
switch (apiName) {
|
||||
case "user":
|
||||
moduleName = "用户"; break;
|
||||
case "role":
|
||||
moduleName = "角色"; break;
|
||||
case "app":
|
||||
moduleName = "应用"; break;
|
||||
case "depot":
|
||||
moduleName = "仓库"; break;
|
||||
case "functions":
|
||||
moduleName = "功能"; break;
|
||||
case "inOutItem":
|
||||
moduleName = "收支项目"; break;
|
||||
case "unit":
|
||||
moduleName = "计量单位"; break;
|
||||
case "person":
|
||||
moduleName = "经手人"; break;
|
||||
case "userBusiness":
|
||||
moduleName = "关联关系"; break;
|
||||
case "systemConfig":
|
||||
moduleName = "系统配置"; break;
|
||||
case "materialProperty":
|
||||
moduleName = "商品属性"; break;
|
||||
case "account":
|
||||
moduleName = "账户"; break;
|
||||
case "supplier":
|
||||
moduleName = "商家"; break;
|
||||
case "materialCategory":
|
||||
moduleName = "商品类型"; break;
|
||||
case "material":
|
||||
moduleName = "商品"; break;
|
||||
case "depotHead":
|
||||
moduleName = "单据"; break;
|
||||
case "depotItem":
|
||||
moduleName = "单据明细"; break;
|
||||
case "accountHead":
|
||||
moduleName = "财务"; break;
|
||||
case "accountItem":
|
||||
moduleName = "财务明细"; break;
|
||||
case BusinessConstants.LOG_INTERFACE_NAME_USER:
|
||||
moduleName = BusinessConstants.LOG_MODULE_NAME_USER; break;
|
||||
case BusinessConstants.LOG_INTERFACE_NAME_ROLE:
|
||||
moduleName = BusinessConstants.LOG_MODULE_NAME_ROLE; break;
|
||||
case BusinessConstants.LOG_INTERFACE_NAME_APP:
|
||||
moduleName =BusinessConstants.LOG_MODULE_NAME_APP; break;
|
||||
case BusinessConstants.LOG_INTERFACE_NAME_DEPOT:
|
||||
moduleName = BusinessConstants.LOG_MODULE_NAME_DEPOT; break;
|
||||
case BusinessConstants.LOG_INTERFACE_NAME_FUNCTIONS:
|
||||
moduleName = BusinessConstants.LOG_MODULE_NAME_FUNCTIONS; break;
|
||||
case BusinessConstants.LOG_INTERFACE_NAME_IN_OUT_ITEM:
|
||||
moduleName = BusinessConstants.LOG_MODULE_NAME_IN_OUT_ITEM; break;
|
||||
case BusinessConstants.LOG_INTERFACE_NAME_UNIT:
|
||||
moduleName = BusinessConstants.LOG_MODULE_NAME_UNIT; break;
|
||||
case BusinessConstants.LOG_INTERFACE_NAME_PERSON:
|
||||
moduleName = BusinessConstants.LOG_MODULE_NAME_PERSON; break;
|
||||
case BusinessConstants.LOG_INTERFACE_NAME_USER_BUSINESS:
|
||||
moduleName = BusinessConstants.LOG_MODULE_NAME_USER_BUSINESS; break;
|
||||
case BusinessConstants.LOG_INTERFACE_NAME_SYSTEM_CONFIG:
|
||||
moduleName = BusinessConstants.LOG_MODULE_NAME_SYSTEM_CONFIG; break;
|
||||
case BusinessConstants.LOG_INTERFACE_NAME_MATERIAL_PROPERTY:
|
||||
moduleName = BusinessConstants.LOG_MODULE_NAME_MATERIAL_PROPERTY; break;
|
||||
case BusinessConstants.LOG_INTERFACE_NAME_ACCOUNT:
|
||||
moduleName = BusinessConstants.LOG_MODULE_NAME_ACCOUNT; break;
|
||||
case BusinessConstants.LOG_INTERFACE_NAME_SUPPLIER:
|
||||
moduleName = BusinessConstants.LOG_MODULE_NAME_SUPPLIER; break;
|
||||
case BusinessConstants.LOG_INTERFACE_NAME_MATERIAL_CATEGORY:
|
||||
moduleName = BusinessConstants.LOG_MODULE_NAME_MATERIAL_CATEGORY; break;
|
||||
case BusinessConstants.LOG_INTERFACE_NAME_MATERIAL:
|
||||
moduleName = BusinessConstants.LOG_MODULE_NAME_MATERIAL; break;
|
||||
case BusinessConstants.LOG_INTERFACE_NAME_DEPOT_HEAD:
|
||||
moduleName = BusinessConstants.LOG_MODULE_NAME_DEPOT_HEAD; break;
|
||||
case BusinessConstants.LOG_INTERFACE_NAME_DEPOT_ITEM:
|
||||
moduleName = BusinessConstants.LOG_MODULE_NAME_DEPOT_ITEM; break;
|
||||
case BusinessConstants.LOG_INTERFACE_NAME_ACCOUNT_HEAD:
|
||||
moduleName = BusinessConstants.LOG_MODULE_NAME_ACCOUNT_HEAD; break;
|
||||
case BusinessConstants.LOG_INTERFACE_NAME_ACCOUNT_ITEM:
|
||||
moduleName = BusinessConstants.LOG_MODULE_NAME_ACCOUNT_ITEM; break;
|
||||
case BusinessConstants.LOG_INTERFACE_NAME_SERIAL_NUMBER:
|
||||
moduleName = BusinessConstants.LOG_MODULE_NAME_SERIAL_NUMBER; break;
|
||||
case BusinessConstants.LOG_INTERFACE_NAME_ORGANIZATION:
|
||||
moduleName = BusinessConstants.LOG_MODULE_NAME_ORGANIZATION; break;
|
||||
}
|
||||
return moduleName;
|
||||
}
|
||||
|
||||
@@ -1,18 +1,22 @@
|
||||
package com.jsh.erp.service.material;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.jsh.erp.constants.BusinessConstants;
|
||||
import com.jsh.erp.datasource.entities.DepotEx;
|
||||
import com.jsh.erp.datasource.entities.Material;
|
||||
import com.jsh.erp.datasource.entities.MaterialExample;
|
||||
import com.jsh.erp.datasource.entities.MaterialVo4Unit;
|
||||
import com.jsh.erp.datasource.mappers.MaterialMapper;
|
||||
import com.jsh.erp.datasource.mappers.MaterialMapperEx;
|
||||
import com.jsh.erp.service.log.LogService;
|
||||
import com.jsh.erp.utils.BaseResponseInfo;
|
||||
import com.jsh.erp.utils.StringUtil;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.stereotype.Service;
|
||||
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.servlet.http.HttpServletRequest;
|
||||
@@ -29,6 +33,8 @@ public class MaterialService {
|
||||
private MaterialMapper materialMapper;
|
||||
@Resource
|
||||
private MaterialMapperEx materialMapperEx;
|
||||
@Resource
|
||||
private LogService logService;
|
||||
|
||||
public Material getMaterial(long id) {
|
||||
return materialMapper.selectByPrimaryKey(id);
|
||||
@@ -141,6 +147,9 @@ public class MaterialService {
|
||||
|
||||
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
||||
public int batchSetEnable(Boolean enabled, String materialIDs) {
|
||||
logService.insertLog(BusinessConstants.LOG_INTERFACE_NAME_MATERIAL,
|
||||
new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_EDIT).append(materialIDs).toString(),
|
||||
((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest());
|
||||
List<Long> ids = StringUtil.strToLongList(materialIDs);
|
||||
Material material = new Material();
|
||||
material.setEnabled(enabled);
|
||||
@@ -177,8 +186,11 @@ public class MaterialService {
|
||||
}
|
||||
return resList;
|
||||
}
|
||||
|
||||
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
||||
public BaseResponseInfo importExcel(List<Material> mList) throws Exception {
|
||||
logService.insertLog(BusinessConstants.LOG_INTERFACE_NAME_MATERIAL,
|
||||
new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_IMPORT).append(mList.size()).append(BusinessConstants.LOG_DATA_UNIT).toString(),
|
||||
((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest());
|
||||
BaseResponseInfo info = new BaseResponseInfo();
|
||||
Map<String, Object> data = new HashMap<String, Object>();
|
||||
try {
|
||||
|
||||
@@ -10,12 +10,15 @@ import com.jsh.erp.datasource.mappers.MaterialCategoryMapper;
|
||||
import com.jsh.erp.datasource.mappers.MaterialCategoryMapperEx;
|
||||
import com.jsh.erp.datasource.vo.TreeNode;
|
||||
import com.jsh.erp.exception.BusinessRunTimeException;
|
||||
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;
|
||||
import org.springframework.stereotype.Service;
|
||||
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.servlet.http.HttpServletRequest;
|
||||
@@ -32,6 +35,8 @@ public class MaterialCategoryService {
|
||||
private MaterialCategoryMapperEx materialCategoryMapperEx;
|
||||
@Resource
|
||||
private UserService userService;
|
||||
@Resource
|
||||
private LogService logService;
|
||||
|
||||
public MaterialCategory getMaterialCategory(long id) {
|
||||
return materialCategoryMapper.selectByPrimaryKey(id);
|
||||
@@ -113,6 +118,9 @@ public class MaterialCategoryService {
|
||||
*/
|
||||
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
||||
public int addMaterialCategory(MaterialCategory mc) throws Exception {
|
||||
logService.insertLog(BusinessConstants.LOG_INTERFACE_NAME_MATERIAL_CATEGORY,
|
||||
BusinessConstants.LOG_OPERATION_TYPE_ADD,
|
||||
((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest());
|
||||
if(mc==null){
|
||||
return 0;
|
||||
}
|
||||
@@ -138,7 +146,9 @@ public class MaterialCategoryService {
|
||||
}
|
||||
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
||||
public int batchDeleteMaterialCategoryByIds(String ids) throws Exception {
|
||||
|
||||
logService.insertLog(BusinessConstants.LOG_INTERFACE_NAME_MATERIAL_CATEGORY,
|
||||
new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_DELETE).append(ids).toString(),
|
||||
((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest());
|
||||
//更新时间
|
||||
Date updateDate =new Date();
|
||||
//更新人
|
||||
@@ -153,6 +163,9 @@ public class MaterialCategoryService {
|
||||
}
|
||||
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
||||
public int editMaterialCategory(MaterialCategory mc) {
|
||||
logService.insertLog(BusinessConstants.LOG_INTERFACE_NAME_MATERIAL_CATEGORY,
|
||||
new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_EDIT).append(mc.getId()).toString(),
|
||||
((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest());
|
||||
if(mc.getParentid()==null){
|
||||
//没有给定父级目录的id,默认设置父级目录为根目录的父目录
|
||||
mc.setParentid(BusinessConstants.MATERIAL_CATEGORY_ROOT_PARENT_ID);
|
||||
|
||||
@@ -10,12 +10,15 @@ import com.jsh.erp.datasource.mappers.OrganizationMapper;
|
||||
import com.jsh.erp.datasource.mappers.OrganizationMapperEx;
|
||||
import com.jsh.erp.datasource.vo.TreeNode;
|
||||
import com.jsh.erp.exception.BusinessRunTimeException;
|
||||
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;
|
||||
import org.springframework.stereotype.Service;
|
||||
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.servlet.http.HttpServletRequest;
|
||||
@@ -38,6 +41,8 @@ public class OrganizationService {
|
||||
private OrganizationMapperEx organizationMapperEx;
|
||||
@Resource
|
||||
private UserService userService;
|
||||
@Resource
|
||||
private LogService logService;
|
||||
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
||||
public int insertOrganization(String beanJson, HttpServletRequest request) {
|
||||
Organization organization = JSONObject.parseObject(beanJson, Organization.class);
|
||||
@@ -62,6 +67,9 @@ public class OrganizationService {
|
||||
}
|
||||
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
||||
public int addOrganization(Organization org) throws Exception{
|
||||
logService.insertLog(BusinessConstants.LOG_INTERFACE_NAME_ORGANIZATION,
|
||||
BusinessConstants.LOG_OPERATION_TYPE_ADD,
|
||||
((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest());
|
||||
//新增时间
|
||||
Date date=new Date();
|
||||
User userInfo=userService.getCurrentUser();
|
||||
@@ -88,6 +96,9 @@ public class OrganizationService {
|
||||
}
|
||||
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
||||
public int editOrganization(Organization org)throws Exception {
|
||||
logService.insertLog(BusinessConstants.LOG_INTERFACE_NAME_ORGANIZATION,
|
||||
new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_EDIT).append(org.getId()).toString(),
|
||||
((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest());
|
||||
//修改时间
|
||||
org.setUpdateTime(new Date());
|
||||
User userInfo=userService.getCurrentUser();
|
||||
@@ -161,6 +172,9 @@ public class OrganizationService {
|
||||
}
|
||||
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
||||
public int batchDeleteOrganizationByIds(String ids) throws Exception{
|
||||
logService.insertLog(BusinessConstants.LOG_INTERFACE_NAME_ORGANIZATION,
|
||||
new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_DELETE).append(ids).toString(),
|
||||
((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest());
|
||||
User userInfo=userService.getCurrentUser();
|
||||
String [] idArray=ids.split(",");
|
||||
return organizationMapperEx.batchDeleteOrganizationByIds(new Date(),userInfo==null?null:userInfo.getId(),idArray);
|
||||
|
||||
@@ -7,6 +7,7 @@ import com.jsh.erp.datasource.entities.*;
|
||||
import com.jsh.erp.datasource.mappers.*;
|
||||
import com.jsh.erp.exception.BusinessRunTimeException;
|
||||
import com.jsh.erp.service.depotItem.DepotItemService;
|
||||
import com.jsh.erp.service.log.LogService;
|
||||
import com.jsh.erp.service.material.MaterialService;
|
||||
import com.jsh.erp.service.user.UserService;
|
||||
import com.jsh.erp.utils.StringUtil;
|
||||
@@ -14,6 +15,8 @@ import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.stereotype.Service;
|
||||
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.servlet.http.HttpServletRequest;
|
||||
@@ -40,11 +43,9 @@ public class SerialNumberService {
|
||||
@Resource
|
||||
private MaterialMapper materialMapper;
|
||||
@Resource
|
||||
private DepotItemService depotItemService;
|
||||
@Resource
|
||||
private UserService userService;
|
||||
@Resource
|
||||
private DepotItemMapperEx depotItemMapperEx;
|
||||
private LogService logService;
|
||||
|
||||
|
||||
public SerialNumber getSerialNumber(long id) {
|
||||
@@ -68,6 +69,7 @@ public class SerialNumberService {
|
||||
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
||||
public int insertSerialNumber(String beanJson, HttpServletRequest request) {
|
||||
SerialNumber serialNumber = JSONObject.parseObject(beanJson, SerialNumber.class);
|
||||
logService.insertLog(BusinessConstants.LOG_INTERFACE_NAME_SERIAL_NUMBER, BusinessConstants.LOG_OPERATION_TYPE_ADD, request);
|
||||
return serialNumberMapper.insertSelective(serialNumber);
|
||||
}
|
||||
|
||||
@@ -168,6 +170,8 @@ public class SerialNumberService {
|
||||
* */
|
||||
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
||||
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){
|
||||
return null;
|
||||
}
|
||||
@@ -191,6 +195,9 @@ public class SerialNumberService {
|
||||
}
|
||||
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
||||
public SerialNumberEx updateSerialNumber(SerialNumberEx serialNumberEx) {
|
||||
logService.insertLog(BusinessConstants.LOG_INTERFACE_NAME_SERIAL_NUMBER,
|
||||
new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_EDIT).append(serialNumberEx.getId()).toString(),
|
||||
((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest());
|
||||
if(serialNumberEx==null){
|
||||
return null;
|
||||
}
|
||||
@@ -345,6 +352,9 @@ public class SerialNumberService {
|
||||
*/
|
||||
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
||||
public void batAddSerialNumber(String materialName, String serialNumberPrefix, Integer batAddTotal, String remark) {
|
||||
logService.insertLog(BusinessConstants.LOG_INTERFACE_NAME_SERIAL_NUMBER,
|
||||
new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_BATCH_ADD).append(batAddTotal).append(BusinessConstants.LOG_DATA_UNIT).toString(),
|
||||
((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest());
|
||||
if(StringUtil.isNotEmpty(materialName)){
|
||||
//查询商品id
|
||||
Long materialId = checkMaterialName(materialName);
|
||||
|
||||
@@ -1,16 +1,20 @@
|
||||
package com.jsh.erp.service.supplier;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.jsh.erp.constants.BusinessConstants;
|
||||
import com.jsh.erp.datasource.entities.Supplier;
|
||||
import com.jsh.erp.datasource.entities.SupplierExample;
|
||||
import com.jsh.erp.datasource.mappers.SupplierMapper;
|
||||
import com.jsh.erp.datasource.mappers.SupplierMapperEx;
|
||||
import com.jsh.erp.service.log.LogService;
|
||||
import com.jsh.erp.utils.BaseResponseInfo;
|
||||
import com.jsh.erp.utils.StringUtil;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.stereotype.Service;
|
||||
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.servlet.http.HttpServletRequest;
|
||||
@@ -28,6 +32,8 @@ public class SupplierService {
|
||||
|
||||
@Resource
|
||||
private SupplierMapperEx supplierMapperEx;
|
||||
@Resource
|
||||
private LogService logService;
|
||||
|
||||
public Supplier getSupplier(long id) {
|
||||
return supplierMapper.selectByPrimaryKey(id);
|
||||
@@ -81,6 +87,9 @@ public class SupplierService {
|
||||
|
||||
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
||||
public int updateAdvanceIn(Long supplierId, BigDecimal advanceIn){
|
||||
logService.insertLog(BusinessConstants.LOG_INTERFACE_NAME_SUPPLIER,
|
||||
new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_EDIT).append(supplierId).toString(),
|
||||
((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest());
|
||||
Supplier supplier = supplierMapper.selectByPrimaryKey(supplierId);
|
||||
if(supplier!=null){
|
||||
supplier.setAdvancein(supplier.getAdvancein().add(advanceIn)); //增加预收款的金额,可能增加的是负值
|
||||
@@ -121,6 +130,9 @@ public class SupplierService {
|
||||
|
||||
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
||||
public int batchSetEnable(Boolean enabled, String supplierIDs) {
|
||||
logService.insertLog(BusinessConstants.LOG_INTERFACE_NAME_SUPPLIER,
|
||||
new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_EDIT).append(supplierIDs).toString(),
|
||||
((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest());
|
||||
List<Long> ids = StringUtil.strToLongList(supplierIDs);
|
||||
Supplier supplier = new Supplier();
|
||||
supplier.setEnabled(enabled);
|
||||
@@ -140,8 +152,11 @@ public class SupplierService {
|
||||
public List<Supplier> findByAll(String supplier, String type, String phonenum, String telephone, String description) {
|
||||
return supplierMapperEx.findByAll(supplier, type, phonenum, telephone, description);
|
||||
}
|
||||
|
||||
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
||||
public BaseResponseInfo importExcel(List<Supplier> mList) throws Exception {
|
||||
logService.insertLog(BusinessConstants.LOG_INTERFACE_NAME_SUPPLIER,
|
||||
new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_IMPORT).append(mList.size()).append(BusinessConstants.LOG_DATA_UNIT).toString(),
|
||||
((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest());
|
||||
BaseResponseInfo info = new BaseResponseInfo();
|
||||
Map<String, Object> data = new HashMap<String, Object>();
|
||||
try {
|
||||
|
||||
@@ -13,6 +13,7 @@ import com.jsh.erp.datasource.mappers.UserMapperEx;
|
||||
import com.jsh.erp.datasource.vo.TreeNode;
|
||||
import com.jsh.erp.datasource.vo.TreeNodeEx;
|
||||
import com.jsh.erp.exception.BusinessRunTimeException;
|
||||
import com.jsh.erp.service.log.LogService;
|
||||
import com.jsh.erp.service.orgaUserRel.OrgaUserRelService;
|
||||
import com.jsh.erp.utils.ExceptionCodeConstants;
|
||||
import com.jsh.erp.utils.JshException;
|
||||
@@ -44,6 +45,8 @@ public class UserService {
|
||||
private UserMapperEx userMapperEx;
|
||||
@Resource
|
||||
private OrgaUserRelService orgaUserRelService;
|
||||
@Resource
|
||||
private LogService logService;
|
||||
|
||||
public User getUser(long id) {
|
||||
return userMapper.selectByPrimaryKey(id);
|
||||
@@ -109,6 +112,9 @@ public class UserService {
|
||||
*/
|
||||
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
||||
public int updateUserByObj(User user) {
|
||||
logService.insertLog(BusinessConstants.LOG_MODULE_NAME_USER,
|
||||
new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_EDIT).append(user.getId()).toString(),
|
||||
((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest());
|
||||
return userMapper.updateByPrimaryKeySelective(user);
|
||||
}
|
||||
/**
|
||||
@@ -122,6 +128,9 @@ public class UserService {
|
||||
*/
|
||||
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
||||
public int resetPwd(String md5Pwd, Long id) {
|
||||
logService.insertLog(BusinessConstants.LOG_MODULE_NAME_USER,
|
||||
new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_EDIT).append(id).toString(),
|
||||
((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest());
|
||||
User user = new User();
|
||||
user.setId(id);
|
||||
user.setPassword(md5Pwd);
|
||||
@@ -208,6 +217,9 @@ public class UserService {
|
||||
}
|
||||
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
||||
public void addUserAndOrgUserRel(UserEx ue) throws Exception{
|
||||
logService.insertLog(BusinessConstants.LOG_MODULE_NAME_USER,
|
||||
BusinessConstants.LOG_OPERATION_TYPE_ADD,
|
||||
((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest());
|
||||
//检查用户名和登录名
|
||||
checkUserNameAndLoginName(ue);
|
||||
//新增用户信息
|
||||
@@ -262,6 +274,9 @@ public class UserService {
|
||||
}
|
||||
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
||||
public void updateUserAndOrgUserRel(UserEx ue) throws Exception{
|
||||
logService.insertLog(BusinessConstants.LOG_MODULE_NAME_USER,
|
||||
new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_EDIT).append(ue.getId()).toString(),
|
||||
((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest());
|
||||
//检查用户名和登录名
|
||||
checkUserNameAndLoginName(ue);
|
||||
//更新用户信息
|
||||
@@ -390,6 +405,9 @@ public class UserService {
|
||||
* */
|
||||
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
||||
public void batDeleteUser(String ids) {
|
||||
logService.insertLog(BusinessConstants.LOG_MODULE_NAME_USER,
|
||||
new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_DELETE).append(ids).toString(),
|
||||
((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest());
|
||||
String idsArray[]=ids.split(",");
|
||||
int i= userMapperEx.batDeleteOrUpdateUser(idsArray,BusinessConstants.USER_STATUS_DELETE);
|
||||
if(i<1){
|
||||
|
||||
@@ -1,14 +1,18 @@
|
||||
package com.jsh.erp.service.userBusiness;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.jsh.erp.constants.BusinessConstants;
|
||||
import com.jsh.erp.datasource.entities.UserBusiness;
|
||||
import com.jsh.erp.datasource.entities.UserBusinessExample;
|
||||
import com.jsh.erp.datasource.mappers.UserBusinessMapper;
|
||||
import com.jsh.erp.service.log.LogService;
|
||||
import com.jsh.erp.utils.StringUtil;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.stereotype.Service;
|
||||
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.servlet.http.HttpServletRequest;
|
||||
@@ -20,6 +24,8 @@ public class UserBusinessService {
|
||||
|
||||
@Resource
|
||||
private UserBusinessMapper userBusinessMapper;
|
||||
@Resource
|
||||
private LogService logService;
|
||||
|
||||
public UserBusiness getUserBusiness(long id) {
|
||||
return userBusinessMapper.selectByPrimaryKey(id);
|
||||
@@ -96,6 +102,9 @@ public class UserBusinessService {
|
||||
|
||||
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
||||
public int updateBtnStr(Long userBusinessId, String btnStr) {
|
||||
logService.insertLog(BusinessConstants.LOG_INTERFACE_NAME_USER_BUSINESS,
|
||||
new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_EDIT).append(userBusinessId).toString(),
|
||||
((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest());
|
||||
UserBusiness userBusiness = new UserBusiness();
|
||||
userBusiness.setBtnstr(btnStr);
|
||||
UserBusinessExample example = new UserBusinessExample();
|
||||
|
||||
@@ -290,7 +290,7 @@ public class Tools {
|
||||
* @return ip
|
||||
*/
|
||||
public static String getLocalIp(HttpServletRequest request) {
|
||||
String remoteAddr = request.getRemoteAddr();
|
||||
String remoteAddr = getIpAddr(request);
|
||||
String forwarded = request.getHeader("X-Forwarded-For");
|
||||
String realIp = request.getHeader("X-Real-IP");
|
||||
|
||||
@@ -313,6 +313,35 @@ public class Tools {
|
||||
}
|
||||
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值
|
||||
|
||||
Reference in New Issue
Block a user