优化表结构
This commit is contained in:
@@ -104,9 +104,9 @@ public class AccountService {
|
||||
if ((thisMonthAmount.compareTo(BigDecimal.ZERO))!=0) {
|
||||
thisMonthAmountFmt = df.format(thisMonthAmount);
|
||||
}
|
||||
al.setThismonthamount(thisMonthAmountFmt); //本月发生额
|
||||
BigDecimal currentAmount = getAccountSum(al.getId(), "", "month").add(getAccountSumByHead(al.getId(), "", "month")).add(getAccountSumByDetail(al.getId(), "", "month")).add(getManyAccountSum(al.getId(), "", "month")) .add(al.getInitialamount()) ;
|
||||
al.setCurrentamount(currentAmount);
|
||||
al.setThisMonthAmount(thisMonthAmountFmt); //本月发生额
|
||||
BigDecimal currentAmount = getAccountSum(al.getId(), "", "month").add(getAccountSumByHead(al.getId(), "", "month")).add(getAccountSumByDetail(al.getId(), "", "month")).add(getManyAccountSum(al.getId(), "", "month")) .add(al.getInitialAmount()) ;
|
||||
al.setCurrentAmount(currentAmount);
|
||||
resList.add(al);
|
||||
}
|
||||
}
|
||||
@@ -126,10 +126,10 @@ public class AccountService {
|
||||
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
||||
public int insertAccount(String beanJson, HttpServletRequest request)throws Exception {
|
||||
Account account = JSONObject.parseObject(beanJson, Account.class);
|
||||
if(account.getInitialamount() == null) {
|
||||
account.setInitialamount(BigDecimal.ZERO);
|
||||
if(account.getInitialAmount() == null) {
|
||||
account.setInitialAmount(BigDecimal.ZERO);
|
||||
}
|
||||
account.setIsdefault(false);
|
||||
account.setIsDefault(false);
|
||||
int result=0;
|
||||
try{
|
||||
result = accountMapper.insertSelective(account);
|
||||
@@ -442,7 +442,7 @@ public class AccountService {
|
||||
logService.insertLog("账户",BusinessConstants.LOG_OPERATION_TYPE_EDIT+accountId,
|
||||
((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest());
|
||||
Account account = new Account();
|
||||
account.setIsdefault(isDefault);
|
||||
account.setIsDefault(isDefault);
|
||||
AccountExample example = new AccountExample();
|
||||
example.createCriteria().andIdEqualTo(accountId);
|
||||
int result=0;
|
||||
@@ -561,7 +561,7 @@ public class AccountService {
|
||||
BigDecimal monthAmount = getAccountSum(a.getId(), timeStr, "month").add(getAccountSumByHead(a.getId(), timeStr, "month"))
|
||||
.add(getAccountSumByDetail(a.getId(), timeStr, "month")).add(getManyAccountSum(a.getId(), timeStr, "month"));
|
||||
BigDecimal currentAmount = getAccountSum(a.getId(), "", "month").add(getAccountSumByHead(a.getId(), "", "month"))
|
||||
.add(getAccountSumByDetail(a.getId(), "", "month")).add(getManyAccountSum(a.getId(), "", "month")).add(a.getInitialamount());
|
||||
.add(getAccountSumByDetail(a.getId(), "", "month")).add(getManyAccountSum(a.getId(), "", "month")).add(a.getInitialAmount());
|
||||
allMonthAmount = allMonthAmount.add(monthAmount);
|
||||
allCurrentAmount = allCurrentAmount.add(currentAmount);
|
||||
}
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package com.jsh.erp.service.functions;
|
||||
|
||||
import com.jsh.erp.service.ICommonQuery;
|
||||
import com.jsh.erp.service.functions.FunctionsService;
|
||||
import com.jsh.erp.utils.Constants;
|
||||
import com.jsh.erp.utils.QueryUtils;
|
||||
import com.jsh.erp.utils.StringUtil;
|
||||
@@ -12,16 +11,16 @@ import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Service(value = "functions_component")
|
||||
@FunctionsResource
|
||||
public class FunctionsComponent implements ICommonQuery {
|
||||
@Service(value = "function_component")
|
||||
@FunctionResource
|
||||
public class FunctionComponent implements ICommonQuery {
|
||||
|
||||
@Resource
|
||||
private FunctionsService functionsService;
|
||||
private FunctionService functionService;
|
||||
|
||||
@Override
|
||||
public Object selectOne(Long id) throws Exception {
|
||||
return functionsService.getFunctions(id);
|
||||
return functionService.getFunction(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -34,7 +33,7 @@ public class FunctionsComponent implements ICommonQuery {
|
||||
String name = StringUtil.getInfo(search, "name");
|
||||
String type = StringUtil.getInfo(search, "type");
|
||||
String order = QueryUtils.order(map);
|
||||
return functionsService.select(name, type, QueryUtils.offset(map), QueryUtils.rows(map));
|
||||
return functionService.select(name, type, QueryUtils.offset(map), QueryUtils.rows(map));
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -42,32 +41,32 @@ public class FunctionsComponent implements ICommonQuery {
|
||||
String search = map.get(Constants.SEARCH);
|
||||
String name = StringUtil.getInfo(search, "name");
|
||||
String type = StringUtil.getInfo(search, "type");
|
||||
return functionsService.countFunctions(name, type);
|
||||
return functionService.countFunction(name, type);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int insert(String beanJson, HttpServletRequest request)throws Exception {
|
||||
return functionsService.insertFunctions(beanJson, request);
|
||||
return functionService.insertFunction(beanJson, request);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int update(String beanJson, Long id, HttpServletRequest request)throws Exception {
|
||||
return functionsService.updateFunctions(beanJson, id, request);
|
||||
return functionService.updateFunction(beanJson, id, request);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int delete(Long id, HttpServletRequest request)throws Exception {
|
||||
return functionsService.deleteFunctions(id, request);
|
||||
return functionService.deleteFunction(id, request);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int batchDelete(String ids, HttpServletRequest request)throws Exception {
|
||||
return functionsService.batchDeleteFunctions(ids, request);
|
||||
return functionService.batchDeleteFunction(ids, request);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int checkIsNameExist(Long id, String name)throws Exception {
|
||||
return functionsService.checkIsNameExist(id, name);
|
||||
return functionService.checkIsNameExist(id, name);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -7,9 +7,9 @@ import java.lang.annotation.*;
|
||||
/**
|
||||
* @author jishenghua qq752718920 2018-10-7 15:26:27
|
||||
*/
|
||||
@ResourceInfo(value = "functions")
|
||||
@ResourceInfo(value = "function")
|
||||
@Inherited
|
||||
@Target(ElementType.TYPE)
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
public @interface FunctionsResource {
|
||||
public @interface FunctionResource {
|
||||
}
|
||||
@@ -2,14 +2,11 @@ package com.jsh.erp.service.functions;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.jsh.erp.constants.BusinessConstants;
|
||||
import com.jsh.erp.constants.ExceptionConstants;
|
||||
import com.jsh.erp.datasource.entities.DepotItem;
|
||||
import com.jsh.erp.datasource.entities.Functions;
|
||||
import com.jsh.erp.datasource.entities.FunctionsExample;
|
||||
import com.jsh.erp.datasource.entities.Function;
|
||||
import com.jsh.erp.datasource.entities.FunctionExample;
|
||||
import com.jsh.erp.datasource.entities.User;
|
||||
import com.jsh.erp.datasource.mappers.FunctionsMapper;
|
||||
import com.jsh.erp.datasource.mappers.FunctionsMapperEx;
|
||||
import com.jsh.erp.exception.BusinessRunTimeException;
|
||||
import com.jsh.erp.datasource.mappers.FunctionMapper;
|
||||
import com.jsh.erp.datasource.mappers.FunctionMapperEx;
|
||||
import com.jsh.erp.exception.JshException;
|
||||
import com.jsh.erp.service.log.LogService;
|
||||
import com.jsh.erp.service.user.UserService;
|
||||
@@ -28,21 +25,21 @@ import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
@Service
|
||||
public class FunctionsService {
|
||||
private Logger logger = LoggerFactory.getLogger(FunctionsService.class);
|
||||
public class FunctionService {
|
||||
private Logger logger = LoggerFactory.getLogger(FunctionService.class);
|
||||
|
||||
@Resource
|
||||
private FunctionsMapper functionsMapper;
|
||||
private FunctionMapper functionsMapper;
|
||||
|
||||
@Resource
|
||||
private FunctionsMapperEx functionsMapperEx;
|
||||
private FunctionMapperEx functionMapperEx;
|
||||
@Resource
|
||||
private UserService userService;
|
||||
@Resource
|
||||
private LogService logService;
|
||||
|
||||
public Functions getFunctions(long id)throws Exception {
|
||||
Functions result=null;
|
||||
public Function getFunction(long id)throws Exception {
|
||||
Function result=null;
|
||||
try{
|
||||
result=functionsMapper.selectByPrimaryKey(id);
|
||||
}catch(Exception e){
|
||||
@@ -51,11 +48,11 @@ public class FunctionsService {
|
||||
return result;
|
||||
}
|
||||
|
||||
public List<Functions> getFunctionsListByIds(String ids)throws Exception {
|
||||
public List<Function> getFunctionListByIds(String ids)throws Exception {
|
||||
List<Long> idList = StringUtil.strToLongList(ids);
|
||||
List<Functions> list = new ArrayList<>();
|
||||
List<Function> list = new ArrayList<>();
|
||||
try{
|
||||
FunctionsExample example = new FunctionsExample();
|
||||
FunctionExample example = new FunctionExample();
|
||||
example.createCriteria().andIdIn(idList);
|
||||
list = functionsMapper.selectByExample(example);
|
||||
}catch(Exception e){
|
||||
@@ -64,10 +61,10 @@ public class FunctionsService {
|
||||
return list;
|
||||
}
|
||||
|
||||
public List<Functions> getFunctions()throws Exception {
|
||||
FunctionsExample example = new FunctionsExample();
|
||||
public List<Function> getFunction()throws Exception {
|
||||
FunctionExample example = new FunctionExample();
|
||||
example.createCriteria().andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
|
||||
List<Functions> list=null;
|
||||
List<Function> list=null;
|
||||
try{
|
||||
list=functionsMapper.selectByExample(example);
|
||||
}catch(Exception e){
|
||||
@@ -76,20 +73,20 @@ public class FunctionsService {
|
||||
return list;
|
||||
}
|
||||
|
||||
public List<Functions> select(String name, String type, int offset, int rows)throws Exception {
|
||||
List<Functions> list=null;
|
||||
public List<Function> select(String name, String type, int offset, int rows)throws Exception {
|
||||
List<Function> list=null;
|
||||
try{
|
||||
list=functionsMapperEx.selectByConditionFunctions(name, type, offset, rows);
|
||||
list= functionMapperEx.selectByConditionFunction(name, type, offset, rows);
|
||||
}catch(Exception e){
|
||||
JshException.readFail(logger, e);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
public Long countFunctions(String name, String type)throws Exception {
|
||||
public Long countFunction(String name, String type)throws Exception {
|
||||
Long result=null;
|
||||
try{
|
||||
result=functionsMapperEx.countsByFunctions(name, type);
|
||||
result= functionMapperEx.countsByFunction(name, type);
|
||||
}catch(Exception e){
|
||||
JshException.readFail(logger, e);
|
||||
}
|
||||
@@ -97,8 +94,8 @@ public class FunctionsService {
|
||||
}
|
||||
|
||||
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
||||
public int insertFunctions(String beanJson, HttpServletRequest request)throws Exception {
|
||||
Functions functions = JSONObject.parseObject(beanJson, Functions.class);
|
||||
public int insertFunction(String beanJson, HttpServletRequest request)throws Exception {
|
||||
Function functions = JSONObject.parseObject(beanJson, Function.class);
|
||||
int result=0;
|
||||
try{
|
||||
result=functionsMapper.insertSelective(functions);
|
||||
@@ -111,8 +108,8 @@ public class FunctionsService {
|
||||
}
|
||||
|
||||
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
||||
public int updateFunctions(String beanJson, Long id, HttpServletRequest request) throws Exception{
|
||||
Functions functions = JSONObject.parseObject(beanJson, Functions.class);
|
||||
public int updateFunction(String beanJson, Long id, HttpServletRequest request) throws Exception{
|
||||
Function functions = JSONObject.parseObject(beanJson, Function.class);
|
||||
functions.setId(id);
|
||||
int result=0;
|
||||
try{
|
||||
@@ -126,7 +123,7 @@ public class FunctionsService {
|
||||
}
|
||||
|
||||
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
||||
public int deleteFunctions(Long id, HttpServletRequest request)throws Exception {
|
||||
public int deleteFunction(Long id, HttpServletRequest request)throws Exception {
|
||||
int result=0;
|
||||
try{
|
||||
result=functionsMapper.deleteByPrimaryKey(id);
|
||||
@@ -139,9 +136,9 @@ public class FunctionsService {
|
||||
}
|
||||
|
||||
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
||||
public int batchDeleteFunctions(String ids, HttpServletRequest request)throws Exception {
|
||||
public int batchDeleteFunction(String ids, HttpServletRequest request)throws Exception {
|
||||
List<Long> idList = StringUtil.strToLongList(ids);
|
||||
FunctionsExample example = new FunctionsExample();
|
||||
FunctionExample example = new FunctionExample();
|
||||
example.createCriteria().andIdIn(idList);
|
||||
int result=0;
|
||||
try{
|
||||
@@ -154,9 +151,9 @@ public class FunctionsService {
|
||||
}
|
||||
|
||||
public int checkIsNameExist(Long id, String name)throws Exception {
|
||||
FunctionsExample example = new FunctionsExample();
|
||||
FunctionExample example = new FunctionExample();
|
||||
example.createCriteria().andIdNotEqualTo(id).andNameEqualTo(name).andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
|
||||
List<Functions> list=null;
|
||||
List<Function> list=null;
|
||||
try{
|
||||
list = functionsMapper.selectByExample(example);
|
||||
}catch(Exception e){
|
||||
@@ -165,12 +162,12 @@ public class FunctionsService {
|
||||
return list==null?0:list.size();
|
||||
}
|
||||
|
||||
public List<Functions> getRoleFunctions(String pNumber)throws Exception {
|
||||
FunctionsExample example = new FunctionsExample();
|
||||
example.createCriteria().andEnabledEqualTo(true).andPnumberEqualTo(pNumber)
|
||||
public List<Function> getRoleFunction(String pNumber)throws Exception {
|
||||
FunctionExample example = new FunctionExample();
|
||||
example.createCriteria().andEnabledEqualTo(true).andParentNumberEqualTo(pNumber)
|
||||
.andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
|
||||
example.setOrderByClause("Sort");
|
||||
List<Functions> list=null;
|
||||
List<Function> list=null;
|
||||
try{
|
||||
list = functionsMapper.selectByExample(example);
|
||||
}catch(Exception e){
|
||||
@@ -179,12 +176,12 @@ public class FunctionsService {
|
||||
return list;
|
||||
}
|
||||
|
||||
public List<Functions> findRoleFunctions(String pnumber)throws Exception{
|
||||
FunctionsExample example = new FunctionsExample();
|
||||
example.createCriteria().andEnabledEqualTo(true).andPnumberEqualTo(pnumber)
|
||||
public List<Function> findRoleFunction(String pnumber)throws Exception{
|
||||
FunctionExample example = new FunctionExample();
|
||||
example.createCriteria().andEnabledEqualTo(true).andParentNumberEqualTo(pnumber)
|
||||
.andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
|
||||
example.setOrderByClause("Sort");
|
||||
List<Functions> list=null;
|
||||
List<Function> list=null;
|
||||
try{
|
||||
list =functionsMapper.selectByExample(example);
|
||||
}catch(Exception e){
|
||||
@@ -193,13 +190,13 @@ public class FunctionsService {
|
||||
return list;
|
||||
}
|
||||
|
||||
public List<Functions> findByIds(String functionsIds)throws Exception{
|
||||
public List<Function> findByIds(String functionsIds)throws Exception{
|
||||
List<Long> idList = StringUtil.strToLongList(functionsIds);
|
||||
FunctionsExample example = new FunctionsExample();
|
||||
FunctionExample example = new FunctionExample();
|
||||
example.createCriteria().andEnabledEqualTo(true).andIdIn(idList)
|
||||
.andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
|
||||
example.setOrderByClause("Sort asc");
|
||||
List<Functions> list=null;
|
||||
List<Function> list=null;
|
||||
try{
|
||||
list =functionsMapper.selectByExample(example);
|
||||
}catch(Exception e){
|
||||
@@ -209,11 +206,11 @@ public class FunctionsService {
|
||||
}
|
||||
|
||||
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
||||
public int batchDeleteFunctionsByIds(String ids)throws Exception {
|
||||
public int batchDeleteFunctionByIds(String ids)throws Exception {
|
||||
StringBuffer sb = new StringBuffer();
|
||||
sb.append(BusinessConstants.LOG_OPERATION_TYPE_DELETE);
|
||||
List<Functions> list = getFunctionsListByIds(ids);
|
||||
for(Functions functions: list){
|
||||
List<Function> list = getFunctionListByIds(ids);
|
||||
for(Function functions: list){
|
||||
sb.append("[").append(functions.getName()).append("]");
|
||||
}
|
||||
logService.insertLog("功能", sb.toString(),
|
||||
@@ -222,7 +219,7 @@ public class FunctionsService {
|
||||
String [] idArray=ids.split(",");
|
||||
int result=0;
|
||||
try{
|
||||
result =functionsMapperEx.batchDeleteFunctionsByIds(new Date(),userInfo==null?null:userInfo.getId(),idArray);
|
||||
result = functionMapperEx.batchDeleteFunctionByIds(new Date(),userInfo==null?null:userInfo.getId(),idArray);
|
||||
}catch(Exception e){
|
||||
JshException.writeFail(logger, e);
|
||||
}
|
||||
@@ -25,20 +25,19 @@ public class LogComponent implements ICommonQuery {
|
||||
|
||||
@Override
|
||||
public List<?> select(Map<String, String> map)throws Exception {
|
||||
return getUserList(map);
|
||||
return getLogList(map);
|
||||
}
|
||||
|
||||
private List<?> getUserList(Map<String, String> map)throws Exception {
|
||||
private List<?> getLogList(Map<String, String> map)throws Exception {
|
||||
String search = map.get(Constants.SEARCH);
|
||||
String operation = StringUtil.getInfo(search, "operation");
|
||||
Integer usernameID = StringUtil.parseInteger(StringUtil.getInfo(search, "usernameID"));
|
||||
Integer userId = StringUtil.parseInteger(StringUtil.getInfo(search, "userId"));
|
||||
String clientIp = StringUtil.getInfo(search, "clientIp");
|
||||
Integer status = StringUtil.parseInteger(StringUtil.getInfo(search, "status"));
|
||||
String beginTime = StringUtil.getInfo(search, "beginTime");
|
||||
String endTime = StringUtil.getInfo(search, "endTime");
|
||||
String contentdetails = StringUtil.getInfo(search, "contentdetails");
|
||||
String order = QueryUtils.order(map);
|
||||
return logService.select(operation, usernameID, clientIp, status, beginTime, endTime, contentdetails,
|
||||
String content = StringUtil.getInfo(search, "content");
|
||||
return logService.select(operation, userId, clientIp, status, beginTime, endTime, content,
|
||||
QueryUtils.offset(map), QueryUtils.rows(map));
|
||||
}
|
||||
|
||||
@@ -46,13 +45,13 @@ public class LogComponent implements ICommonQuery {
|
||||
public Long counts(Map<String, String> map)throws Exception {
|
||||
String search = map.get(Constants.SEARCH);
|
||||
String operation = StringUtil.getInfo(search, "operation");
|
||||
Integer usernameID = StringUtil.parseInteger(StringUtil.getInfo(search, "usernameID"));
|
||||
Integer userId = StringUtil.parseInteger(StringUtil.getInfo(search, "userId"));
|
||||
String clientIp = StringUtil.getInfo(search, "clientIp");
|
||||
Integer status = StringUtil.parseInteger(StringUtil.getInfo(search, "status"));
|
||||
String beginTime = StringUtil.getInfo(search, "beginTime");
|
||||
String endTime = StringUtil.getInfo(search, "endTime");
|
||||
String contentdetails = StringUtil.getInfo(search, "contentdetails");
|
||||
return logService.countLog(operation, usernameID, clientIp, status, beginTime, endTime, contentdetails);
|
||||
String content = StringUtil.getInfo(search, "content");
|
||||
return logService.countLog(operation, userId, clientIp, status, beginTime, endTime, content);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -55,15 +55,15 @@ public class LogService {
|
||||
return list;
|
||||
}
|
||||
|
||||
public List<LogVo4List> select(String operation, Integer usernameID, String clientIp, Integer status, String beginTime, String endTime,
|
||||
String contentdetails, int offset, int rows)throws Exception {
|
||||
public List<LogVo4List> select(String operation, Integer userId, String clientIp, Integer status, String beginTime, String endTime,
|
||||
String content, int offset, int rows)throws Exception {
|
||||
List<LogVo4List> list=null;
|
||||
try{
|
||||
list=logMapperEx.selectByConditionLog(operation, usernameID, clientIp, status, beginTime, endTime,
|
||||
contentdetails, offset, rows);
|
||||
list=logMapperEx.selectByConditionLog(operation, userId, clientIp, status, beginTime, endTime,
|
||||
content, offset, rows);
|
||||
if (null != list) {
|
||||
for (LogVo4List log : list) {
|
||||
log.setCreateTimeStr(Tools.getCenternTime(log.getCreatetime()));
|
||||
log.setCreateTimeStr(Tools.getCenternTime(log.getCreateTime()));
|
||||
}
|
||||
}
|
||||
}catch(Exception e){
|
||||
@@ -72,11 +72,11 @@ public class LogService {
|
||||
return list;
|
||||
}
|
||||
|
||||
public Long countLog(String operation, Integer usernameID, String clientIp, Integer status, String beginTime, String endTime,
|
||||
String contentdetails)throws Exception {
|
||||
public Long countLog(String operation, Integer userId, String clientIp, Integer status, String beginTime, String endTime,
|
||||
String content)throws Exception {
|
||||
Long result=null;
|
||||
try{
|
||||
result=logMapperEx.countsByLog(operation, usernameID, clientIp, status, beginTime, endTime, contentdetails);
|
||||
result=logMapperEx.countsByLog(operation, userId, clientIp, status, beginTime, endTime, content);
|
||||
}catch(Exception e){
|
||||
JshException.readFail(logger, e);
|
||||
}
|
||||
@@ -153,13 +153,13 @@ public class LogService {
|
||||
Long userId = getUserId(request);
|
||||
if(userId!=null) {
|
||||
Log log = new Log();
|
||||
log.setUserid(userId);
|
||||
log.setUserId(userId);
|
||||
log.setOperation(moduleName);
|
||||
log.setClientip(getLocalIp(request));
|
||||
log.setCreatetime(new Date());
|
||||
log.setClientIp(getLocalIp(request));
|
||||
log.setCreateTime(new Date());
|
||||
Byte status = 0;
|
||||
log.setStatus(status);
|
||||
log.setContentdetails(content);
|
||||
log.setContent(content);
|
||||
logMapper.insertSelective(log);
|
||||
}
|
||||
}catch(Exception e){
|
||||
|
||||
@@ -90,7 +90,7 @@ public class MaterialCategoryService {
|
||||
List<MaterialCategory> res= new ArrayList<MaterialCategory>();
|
||||
List<MaterialCategory> list=null;
|
||||
MaterialCategoryExample example = new MaterialCategoryExample();
|
||||
example.createCriteria().andParentidEqualTo(parentId).andIdNotEqualTo(1l);
|
||||
example.createCriteria().andParentIdEqualTo(parentId).andIdNotEqualTo(1L);
|
||||
example.setOrderByClause("id");
|
||||
list=materialCategoryMapper.selectByExample(example);
|
||||
if(list!=null && list.size()>0) {
|
||||
@@ -230,9 +230,9 @@ public class MaterialCategoryService {
|
||||
if(mc==null){
|
||||
return 0;
|
||||
}
|
||||
if(mc.getParentid()==null){
|
||||
if(mc.getParentId()==null){
|
||||
//没有给定父级目录的id,默认设置父级目录为根目录的父目录
|
||||
mc.setParentid(BusinessConstants.MATERIAL_CATEGORY_ROOT_PARENT_ID);
|
||||
mc.setParentId(BusinessConstants.MATERIAL_CATEGORY_ROOT_PARENT_ID);
|
||||
}
|
||||
//检查商品类型编号是否已存在
|
||||
checkMaterialCategorySerialNo(mc);
|
||||
@@ -288,9 +288,9 @@ public class MaterialCategoryService {
|
||||
logService.insertLog("商品类型",
|
||||
new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_EDIT).append(mc.getName()).toString(),
|
||||
((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest());
|
||||
if(mc.getParentid()==null){
|
||||
if(mc.getParentId()==null){
|
||||
//没有给定父级目录的id,默认设置父级目录为根目录的父目录
|
||||
mc.setParentid(BusinessConstants.MATERIAL_CATEGORY_ROOT_PARENT_ID);
|
||||
mc.setParentId(BusinessConstants.MATERIAL_CATEGORY_ROOT_PARENT_ID);
|
||||
}
|
||||
//检查商品类型编号是否已存在
|
||||
checkMaterialCategorySerialNo(mc);
|
||||
@@ -362,7 +362,7 @@ public class MaterialCategoryService {
|
||||
/**
|
||||
* 校验
|
||||
* 1、产品表 jsh_material
|
||||
* 2、产品类型表 jsh_materialcategory
|
||||
* 2、产品类型表 jsh_material_category
|
||||
* 是否有相关数据
|
||||
* */
|
||||
int deleteTotal=0;
|
||||
@@ -386,7 +386,7 @@ public class MaterialCategoryService {
|
||||
ExceptionConstants.DELETE_FORCE_CONFIRM_MSG);
|
||||
}
|
||||
/**
|
||||
* 校验产品类型表 jsh_materialcategory
|
||||
* 校验产品类型表 jsh_material_category
|
||||
* */
|
||||
List<MaterialCategory> materialCategoryList=null;
|
||||
try{
|
||||
@@ -412,7 +412,7 @@ public class MaterialCategoryService {
|
||||
* @param name
|
||||
*/
|
||||
public Long getCategoryIdByName(String name){
|
||||
Long categoryId = 0l;
|
||||
Long categoryId = 0L;
|
||||
MaterialCategoryExample example = new MaterialCategoryExample();
|
||||
example.createCriteria().andNameEqualTo(name).andStatusNotEqualTo(BusinessConstants.DELETE_TYPE_FORCE);
|
||||
List<MaterialCategory> list = materialCategoryMapper.selectByExample(example);
|
||||
|
||||
@@ -88,7 +88,7 @@ public class MaterialPropertyService {
|
||||
try{
|
||||
result=materialPropertyMapper.insertSelective(materialProperty);
|
||||
logService.insertLog("商品属性",
|
||||
new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_ADD).append(materialProperty.getNativename()).toString(), request);
|
||||
new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_ADD).append(materialProperty.getNativeName()).toString(), request);
|
||||
}catch(Exception e){
|
||||
JshException.writeFail(logger, e);
|
||||
}
|
||||
@@ -103,7 +103,7 @@ public class MaterialPropertyService {
|
||||
try{
|
||||
result=materialPropertyMapper.updateByPrimaryKeySelective(materialProperty);
|
||||
logService.insertLog("商品属性",
|
||||
new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_EDIT).append(materialProperty.getNativename()).toString(), request);
|
||||
new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_EDIT).append(materialProperty.getNativeName()).toString(), request);
|
||||
}catch(Exception e){
|
||||
JshException.writeFail(logger, e);
|
||||
}
|
||||
|
||||
@@ -173,7 +173,7 @@ public class PersonService {
|
||||
List<Long> ids = StringUtil.strToLongList(personIDs);
|
||||
PersonExample example = new PersonExample();
|
||||
example.createCriteria().andIdIn(ids).andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
|
||||
example.setOrderByClause("Id asc");
|
||||
example.setOrderByClause("id asc");
|
||||
List<Person> list =null;
|
||||
try{
|
||||
list=personMapper.selectByExample(example);
|
||||
@@ -192,7 +192,7 @@ public class PersonService {
|
||||
public List<Person> getPersonByType(String type)throws Exception {
|
||||
PersonExample example = new PersonExample();
|
||||
example.createCriteria().andTypeEqualTo(type).andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
|
||||
example.setOrderByClause("Id asc");
|
||||
example.setOrderByClause("id asc");
|
||||
List<Person> list =null;
|
||||
try{
|
||||
list=personMapper.selectByExample(example);
|
||||
|
||||
@@ -104,7 +104,7 @@ public class UnitService {
|
||||
try{
|
||||
result=unitMapper.insertSelective(unit);
|
||||
logService.insertLog("计量单位",
|
||||
new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_ADD).append(unit.getUname()).toString(), request);
|
||||
new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_ADD).append(unit.getName()).toString(), request);
|
||||
}catch(Exception e){
|
||||
JshException.writeFail(logger, e);
|
||||
}
|
||||
@@ -119,7 +119,7 @@ public class UnitService {
|
||||
try{
|
||||
result=unitMapper.updateByPrimaryKeySelective(unit);
|
||||
logService.insertLog("计量单位",
|
||||
new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_EDIT).append(unit.getUname()).toString(), request);
|
||||
new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_EDIT).append(unit.getName()).toString(), request);
|
||||
}catch(Exception e){
|
||||
JshException.writeFail(logger, e);
|
||||
}
|
||||
@@ -156,7 +156,7 @@ public class UnitService {
|
||||
|
||||
public int checkIsNameExist(Long id, String name)throws Exception {
|
||||
UnitExample example = new UnitExample();
|
||||
example.createCriteria().andIdNotEqualTo(id).andUnameEqualTo(name).andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
|
||||
example.createCriteria().andIdNotEqualTo(id).andNameEqualTo(name).andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
|
||||
List<Unit> list=null;
|
||||
try{
|
||||
list=unitMapper.selectByExample(example);
|
||||
@@ -171,7 +171,7 @@ public class UnitService {
|
||||
sb.append(BusinessConstants.LOG_OPERATION_TYPE_DELETE);
|
||||
List<Unit> list = getUnitListByIds(ids);
|
||||
for(Unit unit: list){
|
||||
sb.append("[").append(unit.getUname()).append("]");
|
||||
sb.append("[").append(unit.getName()).append("]");
|
||||
}
|
||||
logService.insertLog("计量单位", sb.toString(),
|
||||
((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest());
|
||||
@@ -234,9 +234,9 @@ public class UnitService {
|
||||
* @param name
|
||||
*/
|
||||
public Long getUnitIdByName(String name){
|
||||
Long unitId = 0l;
|
||||
Long unitId = 0L;
|
||||
UnitExample example = new UnitExample();
|
||||
example.createCriteria().andUnameEqualTo(name).andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
|
||||
example.createCriteria().andNameEqualTo(name).andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
|
||||
List<Unit> list = unitMapper.selectByExample(example);
|
||||
if(list!=null && list.size()>0) {
|
||||
unitId = list.get(0).getId();
|
||||
|
||||
@@ -2,14 +2,12 @@ package com.jsh.erp.service.userBusiness;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.jsh.erp.constants.BusinessConstants;
|
||||
import com.jsh.erp.constants.ExceptionConstants;
|
||||
import com.jsh.erp.datasource.entities.*;
|
||||
import com.jsh.erp.datasource.mappers.UserBusinessMapper;
|
||||
import com.jsh.erp.datasource.mappers.UserBusinessMapperEx;
|
||||
import com.jsh.erp.exception.BusinessRunTimeException;
|
||||
import com.jsh.erp.exception.JshException;
|
||||
import com.jsh.erp.service.CommonQueryManager;
|
||||
import com.jsh.erp.service.functions.FunctionsService;
|
||||
import com.jsh.erp.service.functions.FunctionService;
|
||||
import com.jsh.erp.service.log.LogService;
|
||||
import com.jsh.erp.service.user.UserService;
|
||||
import com.jsh.erp.utils.StringUtil;
|
||||
@@ -17,7 +15,6 @@ import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
import org.springframework.web.context.request.RequestContextHolder;
|
||||
import org.springframework.web.context.request.ServletRequestAttributes;
|
||||
|
||||
@@ -39,7 +36,7 @@ public class UserBusinessService {
|
||||
private UserService userService;
|
||||
|
||||
@Resource
|
||||
private FunctionsService functionsService;
|
||||
private FunctionService functionService;
|
||||
|
||||
@Resource
|
||||
private CommonQueryManager configResourceManager;
|
||||
@@ -127,7 +124,7 @@ public class UserBusinessService {
|
||||
|
||||
public List<UserBusiness> getBasicData(String keyId, String type)throws Exception{
|
||||
UserBusinessExample example = new UserBusinessExample();
|
||||
example.createCriteria().andKeyidEqualTo(keyId).andTypeEqualTo(type)
|
||||
example.createCriteria().andKeyIdEqualTo(keyId).andTypeEqualTo(type)
|
||||
.andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
|
||||
List<UserBusiness> list=null;
|
||||
try{
|
||||
@@ -140,7 +137,7 @@ public class UserBusinessService {
|
||||
|
||||
public Long checkIsValueExist(String type, String keyId)throws Exception {
|
||||
UserBusinessExample example = new UserBusinessExample();
|
||||
example.createCriteria().andTypeEqualTo(type).andKeyidEqualTo(keyId)
|
||||
example.createCriteria().andTypeEqualTo(type).andKeyIdEqualTo(keyId)
|
||||
.andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
|
||||
List<UserBusiness> list=null;
|
||||
try{
|
||||
@@ -159,7 +156,7 @@ public class UserBusinessService {
|
||||
UserBusinessExample example = new UserBusinessExample();
|
||||
String newVaule = "%" + UBValue + "%";
|
||||
if(TypeVale !=null && KeyIdValue !=null) {
|
||||
example.createCriteria().andTypeEqualTo(TypeVale).andKeyidEqualTo(KeyIdValue).andValueLike(newVaule)
|
||||
example.createCriteria().andTypeEqualTo(TypeVale).andKeyIdEqualTo(KeyIdValue).andValueLike(newVaule)
|
||||
.andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
|
||||
} else {
|
||||
example.createCriteria().andValueLike(newVaule)
|
||||
@@ -184,7 +181,7 @@ public class UserBusinessService {
|
||||
new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_EDIT).append(userBusinessId).toString(),
|
||||
((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest());
|
||||
UserBusiness userBusiness = new UserBusiness();
|
||||
userBusiness.setBtnstr(btnStr);
|
||||
userBusiness.setBtnStr(btnStr);
|
||||
UserBusinessExample example = new UserBusinessExample();
|
||||
example.createCriteria().andIdEqualTo(userBusinessId);
|
||||
int result=0;
|
||||
@@ -198,7 +195,7 @@ public class UserBusinessService {
|
||||
|
||||
public List<UserBusiness> findRoleByUserId(String userId)throws Exception{
|
||||
UserBusinessExample example = new UserBusinessExample();
|
||||
example.createCriteria().andKeyidEqualTo(userId).andTypeEqualTo("UserRole")
|
||||
example.createCriteria().andKeyIdEqualTo(userId).andTypeEqualTo("UserRole")
|
||||
.andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
|
||||
List<UserBusiness> list=null;
|
||||
try{
|
||||
@@ -212,7 +209,7 @@ public class UserBusinessService {
|
||||
public List<UserBusiness> findAppByRoles(String roles)throws Exception{
|
||||
List<String> rolesList = StringUtil.strToStringList(roles);
|
||||
UserBusinessExample example = new UserBusinessExample();
|
||||
example.createCriteria().andKeyidIn(rolesList).andTypeEqualTo("RoleAPP")
|
||||
example.createCriteria().andKeyIdIn(rolesList).andTypeEqualTo("RoleAPP")
|
||||
.andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
|
||||
List<UserBusiness> list=null;
|
||||
try{
|
||||
|
||||
Reference in New Issue
Block a user