vue版本上线
This commit is contained in:
@@ -0,0 +1,69 @@
|
||||
package com.jsh.erp.service.userBusiness;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.jsh.erp.constants.BusinessConstants;
|
||||
import com.jsh.erp.service.ICommonQuery;
|
||||
import com.jsh.erp.service.depot.DepotResource;
|
||||
import com.jsh.erp.service.depot.DepotService;
|
||||
import com.jsh.erp.utils.Constants;
|
||||
import com.jsh.erp.utils.QueryUtils;
|
||||
import com.jsh.erp.utils.StringUtil;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Service(value = "userBusiness_component")
|
||||
@UserBusinessResource
|
||||
public class UserBusinessComponent implements ICommonQuery {
|
||||
|
||||
@Resource
|
||||
private UserBusinessService userBusinessService;
|
||||
|
||||
@Override
|
||||
public Object selectOne(Long id) throws Exception {
|
||||
return userBusinessService.getUserBusiness(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<?> select(Map<String, String> map)throws Exception {
|
||||
return getUserBusinessList(map);
|
||||
}
|
||||
|
||||
private List<?> getUserBusinessList(Map<String, String> map)throws Exception {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Long counts(Map<String, String> map)throws Exception {
|
||||
return BusinessConstants.DEFAULT_LIST_NULL_NUMBER;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int insert(JSONObject obj, HttpServletRequest request) throws Exception {
|
||||
return userBusinessService.insertUserBusiness(obj, request);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int update(JSONObject obj, HttpServletRequest request)throws Exception {
|
||||
return userBusinessService.updateUserBusiness(obj, request);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int delete(Long id, HttpServletRequest request)throws Exception {
|
||||
return userBusinessService.deleteUserBusiness(id, request);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int deleteBatch(String ids, HttpServletRequest request)throws Exception {
|
||||
return userBusinessService.batchDeleteUserBusiness(ids, request);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int checkIsNameExist(Long id, String name)throws Exception {
|
||||
return userBusinessService.checkIsNameExist(id, name);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
package com.jsh.erp.service.userBusiness;
|
||||
|
||||
import com.jsh.erp.service.ResourceInfo;
|
||||
|
||||
import java.lang.annotation.*;
|
||||
|
||||
/**
|
||||
* @author jishenghua qq752718920 2018-10-7 15:26:27
|
||||
*/
|
||||
@ResourceInfo(value = "userBusiness")
|
||||
@Inherited
|
||||
@Target(ElementType.TYPE)
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
public @interface UserBusinessResource {
|
||||
}
|
||||
@@ -0,0 +1,198 @@
|
||||
package com.jsh.erp.service.userBusiness;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.jsh.erp.constants.BusinessConstants;
|
||||
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.JshException;
|
||||
import com.jsh.erp.service.CommonQueryManager;
|
||||
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;
|
||||
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;
|
||||
import java.util.*;
|
||||
|
||||
@Service
|
||||
public class UserBusinessService {
|
||||
private Logger logger = LoggerFactory.getLogger(UserBusinessService.class);
|
||||
|
||||
@Resource
|
||||
private UserBusinessMapper userBusinessMapper;
|
||||
@Resource
|
||||
private UserBusinessMapperEx userBusinessMapperEx;
|
||||
@Resource
|
||||
private LogService logService;
|
||||
@Resource
|
||||
private UserService userService;
|
||||
|
||||
@Resource
|
||||
private FunctionService functionService;
|
||||
|
||||
@Resource
|
||||
private CommonQueryManager configResourceManager;
|
||||
|
||||
public UserBusiness getUserBusiness(long id)throws Exception {
|
||||
UserBusiness result=null;
|
||||
try{
|
||||
result=userBusinessMapper.selectByPrimaryKey(id);
|
||||
}catch(Exception e){
|
||||
JshException.readFail(logger, e);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public List<UserBusiness> getUserBusiness()throws Exception {
|
||||
UserBusinessExample example = new UserBusinessExample();
|
||||
example.createCriteria().andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
|
||||
List<UserBusiness> list=null;
|
||||
try{
|
||||
list=userBusinessMapper.selectByExample(example);
|
||||
}catch(Exception e){
|
||||
JshException.readFail(logger, e);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
||||
public int insertUserBusiness(JSONObject obj, HttpServletRequest request) throws Exception {
|
||||
UserBusiness userBusiness = JSONObject.parseObject(obj.toJSONString(), UserBusiness.class);
|
||||
int result=0;
|
||||
try{
|
||||
String value = userBusiness.getValue();
|
||||
String newValue = value.replaceAll(",","\\]\\[");
|
||||
userBusiness.setValue(newValue);
|
||||
result=userBusinessMapper.insertSelective(userBusiness);
|
||||
logService.insertLog("关联关系", BusinessConstants.LOG_OPERATION_TYPE_ADD, request);
|
||||
}catch(Exception e){
|
||||
JshException.writeFail(logger, e);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
||||
public int updateUserBusiness(JSONObject obj, HttpServletRequest request) throws Exception {
|
||||
UserBusiness userBusiness = JSONObject.parseObject(obj.toJSONString(), UserBusiness.class);
|
||||
int result=0;
|
||||
try{
|
||||
String value = userBusiness.getValue();
|
||||
String newValue = value.replaceAll(",","\\]\\[");
|
||||
userBusiness.setValue(newValue);
|
||||
result=userBusinessMapper.updateByPrimaryKeySelective(userBusiness);
|
||||
logService.insertLog("关联关系", BusinessConstants.LOG_OPERATION_TYPE_EDIT, request);
|
||||
}catch(Exception e){
|
||||
JshException.writeFail(logger, e);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
||||
public int deleteUserBusiness(Long id, HttpServletRequest request)throws Exception {
|
||||
return batchDeleteUserBusinessByIds(id.toString());
|
||||
}
|
||||
|
||||
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
||||
public int batchDeleteUserBusiness(String ids, HttpServletRequest request)throws Exception {
|
||||
return batchDeleteUserBusinessByIds(ids);
|
||||
}
|
||||
|
||||
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
||||
public int batchDeleteUserBusinessByIds(String ids) throws Exception{
|
||||
logService.insertLog("关联关系",
|
||||
new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_DELETE).append(ids).toString(),
|
||||
((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest());
|
||||
User userInfo=userService.getCurrentUser();
|
||||
String [] idArray=ids.split(",");
|
||||
int result=0;
|
||||
try{
|
||||
result= userBusinessMapperEx.batchDeleteUserBusinessByIds(new Date(),userInfo==null?null:userInfo.getId(),idArray);
|
||||
}catch(Exception e){
|
||||
JshException.writeFail(logger, e);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public int checkIsNameExist(Long id, String name)throws Exception {
|
||||
return 1;
|
||||
}
|
||||
|
||||
public List<UserBusiness> getBasicData(String keyId, String type)throws Exception{
|
||||
UserBusinessExample example = new UserBusinessExample();
|
||||
example.createCriteria().andKeyIdEqualTo(keyId).andTypeEqualTo(type)
|
||||
.andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
|
||||
List<UserBusiness> list=null;
|
||||
try{
|
||||
list= userBusinessMapper.selectByExample(example);
|
||||
}catch(Exception e){
|
||||
JshException.readFail(logger, e);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
public Long checkIsValueExist(String type, String keyId)throws Exception {
|
||||
UserBusinessExample example = new UserBusinessExample();
|
||||
example.createCriteria().andTypeEqualTo(type).andKeyIdEqualTo(keyId)
|
||||
.andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
|
||||
List<UserBusiness> list=null;
|
||||
try{
|
||||
list= userBusinessMapper.selectByExample(example);
|
||||
}catch(Exception e){
|
||||
JshException.readFail(logger, e);
|
||||
}
|
||||
Long id = null;
|
||||
if(list!=null&&list.size() > 0) {
|
||||
id = list.get(0).getId();
|
||||
}
|
||||
return id;
|
||||
}
|
||||
|
||||
public Boolean checkIsUserBusinessExist(String TypeVale, String KeyIdValue, String UBValue)throws Exception {
|
||||
UserBusinessExample example = new UserBusinessExample();
|
||||
String newVaule = "%" + UBValue + "%";
|
||||
if(TypeVale !=null && KeyIdValue !=null) {
|
||||
example.createCriteria().andTypeEqualTo(TypeVale).andKeyIdEqualTo(KeyIdValue).andValueLike(newVaule)
|
||||
.andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
|
||||
} else {
|
||||
example.createCriteria().andValueLike(newVaule)
|
||||
.andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
|
||||
}
|
||||
List<UserBusiness> list=null;
|
||||
try{
|
||||
list= userBusinessMapper.selectByExample(example);
|
||||
}catch(Exception e){
|
||||
JshException.readFail(logger, e);
|
||||
}
|
||||
if(list!=null&&list.size() > 0) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
||||
public int updateBtnStr(Long userBusinessId, String btnStr) throws Exception{
|
||||
logService.insertLog("关联关系",
|
||||
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();
|
||||
example.createCriteria().andIdEqualTo(userBusinessId);
|
||||
int result=0;
|
||||
try{
|
||||
result= userBusinessMapper.updateByExampleSelective(userBusiness, example);
|
||||
}catch(Exception e){
|
||||
JshException.writeFail(logger, e);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user