增加租户界面、单据优化

This commit is contained in:
季圣华
2021-06-01 23:33:00 +08:00
parent 21633c673f
commit 15245791c8
12 changed files with 102 additions and 10 deletions

View File

@@ -531,6 +531,10 @@ public class DepotHeadService {
HttpServletRequest request) throws Exception {
/**处理单据主表数据*/
DepotHead depotHead = JSONObject.parseObject(beanJson, DepotHead.class);
if(StringUtil.isEmpty(depotHead.getAccountIdList()) && depotHead.getAccountId()==null) {
throw new BusinessRunTimeException(ExceptionConstants.DEPOT_HEAD_ACCOUNT_FAILED_CODE,
String.format(ExceptionConstants.DEPOT_HEAD_ACCOUNT_FAILED_MSG));
}
//判断用户是否已经登录过,登录过不再处理
User userInfo=userService.getCurrentUser();
depotHead.setCreator(userInfo==null?null:userInfo.getId());
@@ -594,6 +598,10 @@ public class DepotHeadService {
BigDecimal preTotalPrice, Long tenantId,HttpServletRequest request)throws Exception {
/**更新单据主表信息*/
DepotHead depotHead = JSONObject.parseObject(beanJson, DepotHead.class);
if(StringUtil.isEmpty(depotHead.getAccountIdList()) && depotHead.getAccountId()==null) {
throw new BusinessRunTimeException(ExceptionConstants.DEPOT_HEAD_ACCOUNT_FAILED_CODE,
String.format(ExceptionConstants.DEPOT_HEAD_ACCOUNT_FAILED_MSG));
}
if(StringUtil.isNotEmpty(depotHead.getAccountIdList())){
depotHead.setAccountIdList(depotHead.getAccountIdList().replace("[", "").replace("]", "").replaceAll("\"", ""));
}

View File

@@ -1,6 +1,7 @@
package com.jsh.erp.service.tenant;
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.TenantMapper;
@@ -8,6 +9,7 @@ import com.jsh.erp.datasource.mappers.TenantMapperEx;
import com.jsh.erp.exception.BusinessRunTimeException;
import com.jsh.erp.exception.JshException;
import com.jsh.erp.utils.StringUtil;
import com.jsh.erp.utils.Tools;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Value;
@@ -56,10 +58,15 @@ public class TenantService {
return list;
}
public List<Tenant> select(String loginName, int offset, int rows)throws Exception {
List<Tenant> list=null;
public List<TenantEx> select(String loginName, int offset, int rows)throws Exception {
List<TenantEx> list= new ArrayList<>();
try{
list=tenantMapperEx.selectByConditionTenant(loginName, offset, rows);
list = tenantMapperEx.selectByConditionTenant(loginName, offset, rows);
if (null != list) {
for (TenantEx tenantEx : list) {
tenantEx.setCreateTimeStr(Tools.getCenternTime(tenantEx.getCreateTime()));
}
}
}catch(Exception e){
JshException.readFail(logger, e);
}
@@ -81,8 +88,12 @@ public class TenantService {
Tenant tenant = JSONObject.parseObject(obj.toJSONString(), Tenant.class);
int result=0;
try{
tenant.setUserNumLimit(userNumLimit); //默认用户限制数量
tenant.setBillsNumLimit(billsNumLimit); //默认单据限制数量
if(tenant.getUserNumLimit()==null) {
tenant.setUserNumLimit(userNumLimit); //默认用户限制数量
}
if(tenant.getBillsNumLimit()==null) {
tenant.setBillsNumLimit(billsNumLimit); //默认单据限制数量
}
tenant.setCreateTime(new Date());
result=tenantMapper.insertSelective(tenant);
}catch(Exception e){
@@ -130,7 +141,7 @@ public class TenantService {
public int checkIsNameExist(Long id, String name)throws Exception {
TenantExample example = new TenantExample();
example.createCriteria().andIdEqualTo(id);
example.createCriteria().andIdNotEqualTo(id).andLoginNameEqualTo(name);
List<Tenant> list=null;
try{
list= tenantMapper.selectByExample(example);

View File

@@ -511,6 +511,8 @@ public class UserService {
JSONObject tenantObj = new JSONObject();
tenantObj.put("tenantId", ue.getId());
tenantObj.put("loginName",ue.getLoginName());
tenantObj.put("userNumLimit",ue.getUserNumLimit());
tenantObj.put("billsNumLimit",ue.getBillsNumLimit());
tenantService.insertTenant(tenantObj, request);
logger.info("===============创建租户信息完成===============");
if (result > 0) {