This commit is contained in:
qiankunpingtai
2019-04-15 15:19:00 +08:00
22 changed files with 225 additions and 132 deletions

View File

@@ -75,7 +75,7 @@
if (res && res.code === 200) {
alert("注册成功!");
} else {
alert("注册失败!");
alert(res.msg);
}
},
//此处添加错误处理

View File

@@ -208,6 +208,11 @@ public class BusinessConstants {
public static final String DELETE_TYPE_NORMAL = "1";
public static final String DELETE_TYPE_FORCE = "2";
/**
* 默认管理员账号
*/
public static final String DEFAULT_MANAGER = "admin";

View File

@@ -56,6 +56,9 @@ public class ExceptionConstants {
//用户录入数量超出限制
public static final int USER_OVER_LIMIT_FAILED_CODE = 500004;
public static final String USER_OVER_LIMIT_FAILED_MSG = "用户录入数量超出限制,请联系管理员续费";
//此用户名限制使用
public static final int USER_NAME_LIMIT_USE_CODE = 500004;
public static final String USER_NAME_LIMIT_USE_MSG = "此用户名限制使用";
/**
* 角色信息

View File

@@ -27,6 +27,8 @@ public class AccountHeadVo4ListEx {
private Long tenantId;
private String deleteFlag;
private String organname;
private String handspersonname;
@@ -121,6 +123,14 @@ public class AccountHeadVo4ListEx {
this.tenantId = tenantId;
}
public String getDeleteFlag() {
return deleteFlag;
}
public void setDeleteFlag(String deleteFlag) {
this.deleteFlag = deleteFlag;
}
public String getOrganname() {
return organname;
}

View File

@@ -64,6 +64,7 @@ public class AccountService {
public List<Account> getAccount() {
AccountExample example = new AccountExample();
example.createCriteria().andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
return accountMapper.selectByExample(example);
}
@@ -132,6 +133,7 @@ public class AccountService {
public List<Account> findBySelect() {
AccountExample example = new AccountExample();
example.createCriteria().andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
example.setOrderByClause("id desc");
return accountMapper.selectByExample(example);
}
@@ -152,13 +154,15 @@ public class AccountService {
Date mTime = StringUtil.getDateByString(timeStr + "-01 00:00:00", null);
if (type.equals("month")) {
example.createCriteria().andAccountidEqualTo(id).andPaytypeNotEqualTo("预付款")
.andOpertimeGreaterThanOrEqualTo(bTime).andOpertimeLessThanOrEqualTo(eTime);
.andOpertimeGreaterThanOrEqualTo(bTime).andOpertimeLessThanOrEqualTo(eTime)
.andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
} else if (type.equals("date")) {
example.createCriteria().andAccountidEqualTo(id).andPaytypeNotEqualTo("预付款")
.andOpertimeLessThanOrEqualTo(mTime);
.andOpertimeLessThanOrEqualTo(mTime).andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
}
} else {
example.createCriteria().andAccountidEqualTo(id).andPaytypeNotEqualTo("预付款");
example.createCriteria().andAccountidEqualTo(id).andPaytypeNotEqualTo("预付款")
.andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
}
List<DepotHead> dataList = depotHeadMapper.selectByExample(example);
if (dataList != null) {
@@ -190,13 +194,16 @@ public class AccountService {
Date mTime = StringUtil.getDateByString(timeStr + "-01 00:00:00", null);
if (type.equals("month")) {
example.createCriteria().andAccountidEqualTo(id)
.andBilltimeGreaterThanOrEqualTo(bTime).andBilltimeLessThanOrEqualTo(eTime);
.andBilltimeGreaterThanOrEqualTo(bTime).andBilltimeLessThanOrEqualTo(eTime)
.andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
} else if (type.equals("date")) {
example.createCriteria().andAccountidEqualTo(id)
.andBilltimeLessThanOrEqualTo(mTime);
.andBilltimeLessThanOrEqualTo(mTime)
.andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
}
} else {
example.createCriteria().andAccountidEqualTo(id);
example.createCriteria().andAccountidEqualTo(id)
.andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
}
List<AccountHead> dataList = accountHeadMapper.selectByExample(example);
if (dataList != null) {
@@ -227,9 +234,11 @@ public class AccountService {
Date eTime = StringUtil.getDateByString(timeStr + "-31 00:00:00", null);
Date mTime = StringUtil.getDateByString(timeStr + "-01 00:00:00", null);
if (type.equals("month")) {
example.createCriteria().andBilltimeGreaterThanOrEqualTo(bTime).andBilltimeLessThanOrEqualTo(eTime);
example.createCriteria().andBilltimeGreaterThanOrEqualTo(bTime).andBilltimeLessThanOrEqualTo(eTime)
.andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
} else if (type.equals("date")) {
example.createCriteria().andBilltimeLessThanOrEqualTo(mTime);
example.createCriteria().andBilltimeLessThanOrEqualTo(mTime)
.andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
}
}
List<AccountHead> dataList = accountHeadMapper.selectByExample(example);
@@ -245,9 +254,11 @@ public class AccountService {
AccountItemExample exampleAi = new AccountItemExample();
if (!ids.equals("")) {
List<Long> idList = StringUtil.strToLongList(ids);
exampleAi.createCriteria().andAccountidEqualTo(id).andHeaderidIn(idList);
exampleAi.createCriteria().andAccountidEqualTo(id).andHeaderidIn(idList)
.andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
} else {
exampleAi.createCriteria().andAccountidEqualTo(id);
exampleAi.createCriteria().andAccountidEqualTo(id)
.andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
}
List<AccountItem> dataListOne = accountItemMapper.selectByExample(exampleAi);
if (dataListOne != null) {
@@ -282,13 +293,16 @@ public class AccountService {
Date mTime = StringUtil.getDateByString(timeStr + "-01 00:00:00", null);
if (type.equals("month")) {
example.createCriteria().andAccountidlistLike("%" +id.toString() + "%")
.andOpertimeGreaterThanOrEqualTo(bTime).andOpertimeLessThanOrEqualTo(eTime);
.andOpertimeGreaterThanOrEqualTo(bTime).andOpertimeLessThanOrEqualTo(eTime)
.andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
} else if (type.equals("date")) {
example.createCriteria().andAccountidlistLike("%" +id.toString() + "%")
.andOpertimeLessThanOrEqualTo(mTime);
.andOpertimeLessThanOrEqualTo(mTime)
.andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
}
} else {
example.createCriteria().andAccountidlistLike("%" +id.toString() + "%");
example.createCriteria().andAccountidlistLike("%" +id.toString() + "%")
.andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
}
List<DepotHead> dataList = depotHeadMapper.selectByExample(example);
if (dataList != null) {

View File

@@ -49,6 +49,7 @@ public class AccountItemService {
public List<AccountItem> getAccountItem() {
AccountItemExample example = new AccountItemExample();
example.createCriteria().andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
return accountItemMapper.selectByExample(example);
}

View File

@@ -42,7 +42,7 @@ public class AppService {
public List<App> findDock(){
AppExample example = new AppExample();
example.createCriteria().andZlEqualTo("dock").andEnabledEqualTo(true);
example.createCriteria().andZlEqualTo("dock").andEnabledEqualTo(true).andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
example.setOrderByClause("Sort");
List<App> list = appMapper.selectByExample(example);
return list;
@@ -57,7 +57,7 @@ public class AppService {
*/
public List<App> findDesk(){
AppExample example = new AppExample();
example.createCriteria().andZlEqualTo("desk").andEnabledEqualTo(true);
example.createCriteria().andZlEqualTo("desk").andEnabledEqualTo(true).andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
example.setOrderByClause("Sort");
List<App> list = appMapper.selectByExample(example);
return list;
@@ -69,6 +69,7 @@ public class AppService {
public List<App> getApp() {
AppExample example = new AppExample();
example.createCriteria().andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
return appMapper.selectByExample(example);
}
@@ -108,7 +109,7 @@ public class AppService {
public List<App> findRoleAPP(){
AppExample example = new AppExample();
example.createCriteria().andEnabledEqualTo(true);
example.createCriteria().andEnabledEqualTo(true).andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
example.setOrderByClause("Sort");
List<App> list = appMapper.selectByExample(example);
return list;
@@ -117,7 +118,8 @@ public class AppService {
public List<App> findAppInIds(String ids, String type){
List<Long> idList = StringUtil.strToLongList(ids);
AppExample example = new AppExample();
example.createCriteria().andZlEqualTo(type).andEnabledEqualTo(true).andIdIn(idList);
example.createCriteria().andZlEqualTo(type).andEnabledEqualTo(true).andIdIn(idList)
.andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
example.setOrderByClause("Sort");
List<App> list = appMapper.selectByExample(example);
return list;

View File

@@ -47,11 +47,13 @@ public class DepotService {
public List<Depot> getDepot() {
DepotExample example = new DepotExample();
example.createCriteria().andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
return depotMapper.selectByExample(example);
}
public List<Depot> getAllList() {
DepotExample example = new DepotExample();
example.createCriteria().andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
example.setOrderByClause("sort");
return depotMapper.selectByExample(example);
}
@@ -99,7 +101,7 @@ public class DepotService {
public List<Depot> findUserDepot(){
DepotExample example = new DepotExample();
example.createCriteria().andTypeEqualTo(0);
example.createCriteria().andTypeEqualTo(0).andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
example.setOrderByClause("Sort");
List<Depot> list = depotMapper.selectByExample(example);
return list;

View File

@@ -64,6 +64,7 @@ public class DepotHeadService {
public List<DepotHead> getDepotHead() {
DepotHeadExample example = new DepotHeadExample();
example.createCriteria().andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
return depotHeadMapper.selectByExample(example);
}
@@ -191,7 +192,7 @@ public class DepotHeadService {
DepotHeadExample example = new DepotHeadExample();
monthTime = monthTime + "-31 23:59:59";
Date month = StringUtil.getDateByString(monthTime, null);
example.createCriteria().andOpertimeLessThanOrEqualTo(month);
example.createCriteria().andOpertimeLessThanOrEqualTo(month).andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
return depotHeadMapper.selectByExample(example);
}

View File

@@ -66,6 +66,7 @@ public class DepotItemService {
public List<DepotItem> getDepotItem() {
DepotItemExample example = new DepotItemExample();
example.createCriteria().andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
return depotItemMapper.selectByExample(example);
}

View File

@@ -42,6 +42,7 @@ public class FunctionsService {
public List<Functions> getFunctions() {
FunctionsExample example = new FunctionsExample();
example.createCriteria().andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
return functionsMapper.selectByExample(example);
}
@@ -88,7 +89,8 @@ public class FunctionsService {
public List<Functions> getRoleFunctions(String pNumber) {
FunctionsExample example = new FunctionsExample();
example.createCriteria().andEnabledEqualTo(true).andPnumberEqualTo(pNumber);
example.createCriteria().andEnabledEqualTo(true).andPnumberEqualTo(pNumber)
.andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
example.setOrderByClause("Sort");
List<Functions> list = functionsMapper.selectByExample(example);
return list;
@@ -96,7 +98,8 @@ public class FunctionsService {
public List<Functions> findRoleFunctions(String pnumber){
FunctionsExample example = new FunctionsExample();
example.createCriteria().andEnabledEqualTo(true).andPnumberEqualTo(pnumber);
example.createCriteria().andEnabledEqualTo(true).andPnumberEqualTo(pnumber)
.andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
example.setOrderByClause("Sort");
List<Functions> list = functionsMapper.selectByExample(example);
return list;
@@ -105,11 +108,13 @@ public class FunctionsService {
public List<Functions> findByIds(String functionsIds){
List<Long> idList = StringUtil.strToLongList(functionsIds);
FunctionsExample example = new FunctionsExample();
example.createCriteria().andEnabledEqualTo(true).andIdIn(idList);
example.createCriteria().andEnabledEqualTo(true).andIdIn(idList)
.andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
example.setOrderByClause("Sort asc");
List<Functions> list = functionsMapper.selectByExample(example);
return list;
}
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
public int batchDeleteFunctionsByIds(String ids) {
logService.insertLog(BusinessConstants.LOG_INTERFACE_NAME_FUNCTIONS,

View File

@@ -49,6 +49,7 @@ public class InOutItemService {
public List<InOutItem> getInOutItem() {
InOutItemExample example = new InOutItemExample();
example.createCriteria().andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
return inOutItemMapper.selectByExample(example);
}
@@ -96,9 +97,9 @@ public class InOutItemService {
public List<InOutItem> findBySelect(String type) {
InOutItemExample example = new InOutItemExample();
if (type.equals("in")) {
example.createCriteria().andTypeEqualTo("收入");
example.createCriteria().andTypeEqualTo("收入").andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
} else if (type.equals("out")) {
example.createCriteria().andTypeEqualTo("支出");
example.createCriteria().andTypeEqualTo("支出").andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
}
example.setOrderByClause("id desc");
return inOutItemMapper.selectByExample(example);

View File

@@ -45,6 +45,7 @@ public class MaterialService {
public List<Material> getMaterial() {
MaterialExample example = new MaterialExample();
example.createCriteria().andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
return materialMapper.selectByExample(example);
}
@@ -175,6 +176,7 @@ public class MaterialService {
public List<Material> findByOrder(){
MaterialExample example = new MaterialExample();
example.createCriteria().andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
example.setOrderByClause("Name,Model asc");
return materialMapper.selectByExample(example);
}

View File

@@ -42,8 +42,10 @@ public class MaterialPropertyService {
public List<MaterialProperty> getMaterialProperty() {
MaterialPropertyExample example = new MaterialPropertyExample();
example.createCriteria().andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
return materialPropertyMapper.selectByExample(example);
}
public List<MaterialProperty> select(String name, int offset, int rows) {
return materialPropertyMapperEx.selectByConditionMaterialProperty(name, offset, rows);
}

View File

@@ -49,6 +49,7 @@ public class PersonService {
public List<Person> getPerson() {
PersonExample example = new PersonExample();
example.createCriteria().andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
return personMapper.selectByExample(example);
}
@@ -96,7 +97,7 @@ public class PersonService {
public String getPersonByIds(String personIDs) {
List<Long> ids = StringUtil.strToLongList(personIDs);
PersonExample example = new PersonExample();
example.createCriteria().andIdIn(ids);
example.createCriteria().andIdIn(ids).andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
example.setOrderByClause("Id asc");
List<Person> list = personMapper.selectByExample(example);
StringBuffer sb = new StringBuffer();
@@ -110,7 +111,7 @@ public class PersonService {
public List<Person> getPersonByType(String type) {
PersonExample example = new PersonExample();
example.createCriteria().andTypeEqualTo(type);
example.createCriteria().andTypeEqualTo(type).andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
example.setOrderByClause("Id asc");
return personMapper.selectByExample(example);
}

View File

@@ -43,6 +43,7 @@ public class RoleService {
public List<Role> getRole() {
RoleExample example = new RoleExample();
example.createCriteria().andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
return roleMapper.selectByExample(example);
}

View File

@@ -53,6 +53,7 @@ public class SupplierService {
public List<Supplier> getSupplier() {
SupplierExample example = new SupplierExample();
example.createCriteria().andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
return supplierMapper.selectByExample(example);
}
@@ -114,28 +115,31 @@ public class SupplierService {
public List<Supplier> findBySelectCus() {
SupplierExample example = new SupplierExample();
example.createCriteria().andTypeLike("客户").andEnabledEqualTo(true);
example.createCriteria().andTypeLike("客户").andEnabledEqualTo(true).andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
example.setOrderByClause("id desc");
return supplierMapper.selectByExample(example);
}
public List<Supplier> findBySelectSup() {
SupplierExample example = new SupplierExample();
example.createCriteria().andTypeLike("供应商").andEnabledEqualTo(true);
example.createCriteria().andTypeLike("供应商").andEnabledEqualTo(true)
.andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
example.setOrderByClause("id desc");
return supplierMapper.selectByExample(example);
}
public List<Supplier> findBySelectRetail() {
SupplierExample example = new SupplierExample();
example.createCriteria().andTypeLike("会员").andEnabledEqualTo(true);
example.createCriteria().andTypeLike("会员").andEnabledEqualTo(true)
.andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
example.setOrderByClause("id desc");
return supplierMapper.selectByExample(example);
}
public List<Supplier> findById(Long supplierId) {
SupplierExample example = new SupplierExample();
example.createCriteria().andIdEqualTo(supplierId);
example.createCriteria().andIdEqualTo(supplierId)
.andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
example.setOrderByClause("id desc");
return supplierMapper.selectByExample(example);
}
@@ -155,7 +159,8 @@ public class SupplierService {
public List<Supplier> findUserCustomer(){
SupplierExample example = new SupplierExample();
example.createCriteria().andTypeEqualTo("客户");
example.createCriteria().andTypeEqualTo("客户")
.andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
example.setOrderByClause("id desc");
List<Supplier> list = supplierMapper.selectByExample(example);
return list;

View File

@@ -42,6 +42,7 @@ public class SystemConfigService {
public List<SystemConfig> getSystemConfig() {
SystemConfigExample example = new SystemConfigExample();
example.createCriteria().andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
return systemConfigMapper.selectByExample(example);
}
public List<SystemConfig> select(String companyName, int offset, int rows) {
@@ -84,6 +85,7 @@ public class SystemConfigService {
List<SystemConfig> list = systemConfigMapper.selectByExample(example);
return list.size();
}
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
public int batchDeleteSystemConfigByIds(String ids) {
logService.insertLog(BusinessConstants.LOG_INTERFACE_NAME_SYSTEM_CONFIG,

View File

@@ -49,6 +49,7 @@ public class UnitService {
public List<Unit> getUnit() {
UnitExample example = new UnitExample();
example.createCriteria().andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
return unitMapper.selectByExample(example);
}

View File

@@ -223,38 +223,43 @@ public class UserService {
}
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
public void addUserAndOrgUserRel(UserEx ue) throws Exception{
logService.insertLog(BusinessConstants.LOG_INTERFACE_NAME_USER,
BusinessConstants.LOG_OPERATION_TYPE_ADD,
((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest());
//检查用户名和登录名
checkUserNameAndLoginName(ue);
//新增用户信息
ue= this.addUser(ue);
if(ue==null){
logger.error("异常码[{}],异常提示[{}],参数,[{}]",
ExceptionConstants.USER_ADD_FAILED_CODE,ExceptionConstants.USER_ADD_FAILED_MSG);
throw new BusinessRunTimeException(ExceptionConstants.USER_ADD_FAILED_CODE,
ExceptionConstants.USER_ADD_FAILED_MSG);
}
if(ue.getOrgaId()==null){
//如果没有选择机构,就不建机构和用户的关联关系
return;
}
//新增用户和机构关联关系
OrgaUserRel oul=new OrgaUserRel();
//机构id
oul.setOrgaId(ue.getOrgaId());
//用户id
oul.setUserId(ue.getId());
//用户在机构中的排序
oul.setUserBlngOrgaDsplSeq(ue.getUserBlngOrgaDsplSeq());
if(BusinessConstants.DEFAULT_MANAGER.equals(ue.getLoginame())) {
throw new BusinessRunTimeException(ExceptionConstants.USER_NAME_LIMIT_USE_CODE,
ExceptionConstants.USER_NAME_LIMIT_USE_MSG);
} else {
logService.insertLog(BusinessConstants.LOG_INTERFACE_NAME_USER,
BusinessConstants.LOG_OPERATION_TYPE_ADD,
((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest());
//检查用户名和登录名
checkUserNameAndLoginName(ue);
//新增用户信息
ue= this.addUser(ue);
if(ue==null){
logger.error("异常码[{}],异常提示[{}],参数,[{}]",
ExceptionConstants.USER_ADD_FAILED_CODE,ExceptionConstants.USER_ADD_FAILED_MSG);
throw new BusinessRunTimeException(ExceptionConstants.USER_ADD_FAILED_CODE,
ExceptionConstants.USER_ADD_FAILED_MSG);
}
if(ue.getOrgaId()==null){
//如果没有选择机构,就不建机构和用户的关联关系
return;
}
//新增用户和机构关联关系
OrgaUserRel oul=new OrgaUserRel();
//机构id
oul.setOrgaId(ue.getOrgaId());
//用户id
oul.setUserId(ue.getId());
//用户在机构中的排序
oul.setUserBlngOrgaDsplSeq(ue.getUserBlngOrgaDsplSeq());
oul=orgaUserRelService.addOrgaUserRel(oul);
if(oul==null){
logger.error("异常码[{}],异常提示[{}],参数,[{}]",
ExceptionConstants.ORGA_USER_REL_ADD_FAILED_CODE,ExceptionConstants.ORGA_USER_REL_ADD_FAILED_MSG);
throw new BusinessRunTimeException(ExceptionConstants.ORGA_USER_REL_ADD_FAILED_CODE,
ExceptionConstants.ORGA_USER_REL_ADD_FAILED_MSG);
oul=orgaUserRelService.addOrgaUserRel(oul);
if(oul==null){
logger.error("异常码[{}],异常提示[{}],参数,[{}]",
ExceptionConstants.ORGA_USER_REL_ADD_FAILED_CODE,ExceptionConstants.ORGA_USER_REL_ADD_FAILED_MSG);
throw new BusinessRunTimeException(ExceptionConstants.ORGA_USER_REL_ADD_FAILED_CODE,
ExceptionConstants.ORGA_USER_REL_ADD_FAILED_MSG);
}
}
}
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
@@ -288,30 +293,35 @@ public class UserService {
* description:
* 多次创建事务,事物之间无法协同,应该在入口处创建一个事务以做协调
*/
ue.setPassword(Tools.md5Encryp(ue.getPassword()));
ue.setIsystem(BusinessConstants.USER_NOT_SYSTEM);
if(ue.getIsmanager()==null){
ue.setIsmanager(BusinessConstants.USER_NOT_MANAGER);
if(BusinessConstants.DEFAULT_MANAGER.equals(ue.getLoginame())) {
throw new BusinessRunTimeException(ExceptionConstants.USER_NAME_LIMIT_USE_CODE,
ExceptionConstants.USER_NAME_LIMIT_USE_MSG);
} else {
ue.setPassword(Tools.md5Encryp(ue.getPassword()));
ue.setIsystem(BusinessConstants.USER_NOT_SYSTEM);
if (ue.getIsmanager() == null) {
ue.setIsmanager(BusinessConstants.USER_NOT_MANAGER);
}
ue.setStatus(BusinessConstants.USER_STATUS_NORMAL);
int i = userMapperEx.addUser(ue);
//更新租户id
User user = new User();
user.setId(ue.getId());
user.setTenantId(ue.getId());
userService.updateUserTenant(user);
//新增用户与角色的关系
JSONObject ubObj = new JSONObject();
ubObj.put("type", "UserRole");
ubObj.put("keyid", ue.getId());
JSONArray ubArr = new JSONArray();
ubArr.add(manageRoleId);
ubObj.put("value", ubArr.toString());
userBusinessService.insertUserBusiness(ubObj.toString(), ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest());
if (i > 0) {
return ue;
}
return null;
}
ue.setStatus(BusinessConstants.USER_STATUS_NORMAL);
int i=userMapperEx.addUser(ue);
//更新租户id
User user = new User();
user.setId(ue.getId());
user.setTenantId(ue.getId());
userService.updateUserTenant(user);
//新增用户与角色的关系
JSONObject ubObj = new JSONObject();
ubObj.put("type", "UserRole");
ubObj.put("keyid", ue.getId());
JSONArray ubArr = new JSONArray();
ubArr.add(manageRoleId);
ubObj.put("value", ubArr.toString());
userBusinessService.insertUserBusiness(ubObj.toString(), ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest());
if(i>0){
return ue;
}
return null;
}
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
@@ -323,47 +333,51 @@ public class UserService {
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
public void updateUserAndOrgUserRel(UserEx ue) throws Exception{
logService.insertLog(BusinessConstants.LOG_INTERFACE_NAME_USER,
new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_EDIT).append(ue.getId()).toString(),
((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest());
//检查用户名和登录名
checkUserNameAndLoginName(ue);
//更新用户信息
ue=this.updateUser(ue);
if(ue==null){
logger.error("异常码[{}],异常提示[{}],参数,[{}]",
ExceptionConstants.USER_EDIT_FAILED_CODE,ExceptionConstants.USER_EDIT_FAILED_MSG);
throw new BusinessRunTimeException(ExceptionConstants.USER_EDIT_FAILED_CODE,
ExceptionConstants.USER_EDIT_FAILED_MSG);
if(BusinessConstants.DEFAULT_MANAGER.equals(ue.getLoginame())) {
throw new BusinessRunTimeException(ExceptionConstants.USER_NAME_LIMIT_USE_CODE,
ExceptionConstants.USER_NAME_LIMIT_USE_MSG);
} else {
logService.insertLog(BusinessConstants.LOG_INTERFACE_NAME_USER,
new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_EDIT).append(ue.getId()).toString(),
((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest());
//检查用户名和登录名
checkUserNameAndLoginName(ue);
//更新用户信息
ue = this.updateUser(ue);
if (ue == null) {
logger.error("异常码[{}],异常提示[{}],参数,[{}]",
ExceptionConstants.USER_EDIT_FAILED_CODE, ExceptionConstants.USER_EDIT_FAILED_MSG);
throw new BusinessRunTimeException(ExceptionConstants.USER_EDIT_FAILED_CODE,
ExceptionConstants.USER_EDIT_FAILED_MSG);
}
if (ue.getOrgaId() == null) {
//如果没有选择机构,就不建机构和用户的关联关系
return;
}
//更新用户和机构关联关系
OrgaUserRel oul = new OrgaUserRel();
//机构和用户关联关系id
oul.setId(ue.getOrgaUserRelId());
//机构id
oul.setOrgaId(ue.getOrgaId());
//用户id
oul.setUserId(ue.getId());
//用户在机构中的排序
oul.setUserBlngOrgaDsplSeq(ue.getUserBlngOrgaDsplSeq());
if (oul.getId() != null) {
//已存在机构和用户的关联关系,更新
oul = orgaUserRelService.updateOrgaUserRel(oul);
} else {
//不存在机构和用户的关联关系,新建
oul = orgaUserRelService.addOrgaUserRel(oul);
}
if (oul == null) {
logger.error("异常码[{}],异常提示[{}],参数,[{}]",
ExceptionConstants.ORGA_USER_REL_EDIT_FAILED_CODE, ExceptionConstants.ORGA_USER_REL_EDIT_FAILED_MSG);
throw new BusinessRunTimeException(ExceptionConstants.ORGA_USER_REL_EDIT_FAILED_CODE,
ExceptionConstants.ORGA_USER_REL_EDIT_FAILED_MSG);
}
}
if(ue.getOrgaId()==null){
//如果没有选择机构,就不建机构和用户的关联关系
return;
}
//更新用户和机构关联关系
OrgaUserRel oul=new OrgaUserRel();
//机构和用户关联关系id
oul.setId(ue.getOrgaUserRelId());
//机构id
oul.setOrgaId(ue.getOrgaId());
//用户id
oul.setUserId(ue.getId());
//用户在机构中的排序
oul.setUserBlngOrgaDsplSeq(ue.getUserBlngOrgaDsplSeq());
if(oul.getId()!=null){
//已存在机构和用户的关联关系,更新
oul=orgaUserRelService.updateOrgaUserRel(oul);
}else{
//不存在机构和用户的关联关系,新建
oul=orgaUserRelService.addOrgaUserRel(oul);
}
if(oul==null){
logger.error("异常码[{}],异常提示[{}],参数,[{}]",
ExceptionConstants.ORGA_USER_REL_EDIT_FAILED_CODE,ExceptionConstants.ORGA_USER_REL_EDIT_FAILED_MSG);
throw new BusinessRunTimeException(ExceptionConstants.ORGA_USER_REL_EDIT_FAILED_CODE,
ExceptionConstants.ORGA_USER_REL_EDIT_FAILED_MSG);
}
}
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
public UserEx updateUser(UserEx ue){

View File

@@ -59,6 +59,7 @@ public class UserBusinessService {
public List<UserBusiness> getUserBusiness() {
UserBusinessExample example = new UserBusinessExample();
example.createCriteria().andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
return userBusinessMapper.selectByExample(example);
}
@@ -104,14 +105,16 @@ public class UserBusinessService {
public List<UserBusiness> getBasicData(String keyId, String type){
UserBusinessExample example = new UserBusinessExample();
example.createCriteria().andKeyidEqualTo(keyId).andTypeEqualTo(type);
example.createCriteria().andKeyidEqualTo(keyId).andTypeEqualTo(type)
.andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
List<UserBusiness> list = userBusinessMapper.selectByExample(example);
return list;
}
public Long checkIsValueExist(String type, String keyId) {
UserBusinessExample example = new UserBusinessExample();
example.createCriteria().andTypeEqualTo(type).andKeyidEqualTo(keyId);
example.createCriteria().andTypeEqualTo(type).andKeyidEqualTo(keyId)
.andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
List<UserBusiness> list = userBusinessMapper.selectByExample(example);
Long id = null;
if(list.size() > 0) {
@@ -124,9 +127,11 @@ 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);
example.createCriteria().andValueLike(newVaule)
.andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
}
List<UserBusiness> list = userBusinessMapper.selectByExample(example);
if(list.size() > 0) {
@@ -150,7 +155,8 @@ public class UserBusinessService {
public List<UserBusiness> findRoleByUserId(String userId){
UserBusinessExample example = new UserBusinessExample();
example.createCriteria().andKeyidEqualTo(userId).andTypeEqualTo("UserRole");
example.createCriteria().andKeyidEqualTo(userId).andTypeEqualTo("UserRole")
.andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
List<UserBusiness> list = userBusinessMapper.selectByExample(example);
return list;
}
@@ -158,10 +164,12 @@ public class UserBusinessService {
public List<UserBusiness> findAppByRoles(String roles){
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 = userBusinessMapper.selectByExample(example);
return list;
}
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
public int batchDeleteUserBusinessByIds(String ids) {
logService.insertLog(BusinessConstants.LOG_INTERFACE_NAME_USER_BUSINESS,

View File

@@ -88,6 +88,18 @@
</foreach>
)
</update>
<select id="getAccountHeadListByAccountIds" resultMap="com.jsh.erp.datasource.mappers.AccountHeadMapper.BaseResultMap">
select
<include refid="com.jsh.erp.datasource.mappers.AccountHeadMapper.Base_Column_List" />
from jsh_accounthead
where 1=1
and accountId in (
<foreach collection="accountIds" item="accountId" separator=",">
#{accountId}
</foreach>
)
and ifnull(delete_Flag,'0') !='1'
</select>
<select id="getAccountHeadListByOrganIds" resultMap="com.jsh.erp.datasource.mappers.AccountHeadMapper.BaseResultMap">
select
<include refid="com.jsh.erp.datasource.mappers.AccountHeadMapper.Base_Column_List" />