增加租户界面、单据优化

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

@@ -309,6 +309,9 @@ public class ExceptionConstants {
//单据录入-明细不能为空
public static final int DEPOT_HEAD_ROW_FAILED_CODE = 8500006;
public static final String DEPOT_HEAD_ROW_FAILED_MSG = "单据明细不能为空";
//单据录入-账户不能为空
public static final int DEPOT_HEAD_ACCOUNT_FAILED_CODE = 8500007;
public static final String DEPOT_HEAD_ACCOUNT_FAILED_MSG = "结算账户不能为空";
/**
* 单据明细信息
* type = 90

View File

@@ -439,6 +439,7 @@ public class MaterialController {
@GetMapping(value = "/getMaterialByBarCode")
public BaseResponseInfo getMaterialByBarCode(@RequestParam("barCode") String barCode,
@RequestParam("mpList") String mpList,
@RequestParam(required = false, value = "prefixNo") String prefixNo,
HttpServletRequest request) throws Exception {
BaseResponseInfo res = new BaseResponseInfo();
try {
@@ -463,6 +464,16 @@ public class MaterialController {
}
}
mu.setMaterialOther(expand);
if("LSCK".equals(prefixNo) || "LSTH".equals(prefixNo)) {
//零售价
mu.setBillPrice(mu.getCommodityDecimal());
} else if("CGDD".equals(prefixNo) || "CGRK".equals(prefixNo) || "CGTH".equals(prefixNo) || "QTRK".equals(prefixNo) || "DBCK".equals(prefixNo)) {
//采购价
mu.setBillPrice(mu.getPurchaseDecimal());
} else if("XSDD".equals(prefixNo) || "XSCK".equals(prefixNo) || "XSTH".equals(prefixNo) || "QTCK".equals(prefixNo)) {
//销售价
mu.setBillPrice(mu.getWholesaleDecimal());
}
}
res.code = 200;
res.data = mu;

View File

@@ -20,6 +20,8 @@ public class MaterialVo4Unit extends Material{
private BigDecimal lowDecimal;
private BigDecimal billPrice;
private String mBarCode;
private String commodityUnit;
@@ -90,6 +92,14 @@ public class MaterialVo4Unit extends Material{
this.lowDecimal = lowDecimal;
}
public BigDecimal getBillPrice() {
return billPrice;
}
public void setBillPrice(BigDecimal billPrice) {
this.billPrice = billPrice;
}
public String getmBarCode() {
return mBarCode;
}

View File

@@ -0,0 +1,14 @@
package com.jsh.erp.datasource.entities;
public class TenantEx extends Tenant{
private String createTimeStr;
public String getCreateTimeStr() {
return createTimeStr;
}
public void setCreateTimeStr(String createTimeStr) {
this.createTimeStr = createTimeStr;
}
}

View File

@@ -22,6 +22,10 @@ public class UserEx extends User{
private String userType;
private String userNumLimit;
private String billsNumLimit;
public String getOrgAbr() {
return orgAbr;
}
@@ -77,4 +81,20 @@ public class UserEx extends User{
public void setUserType(String userType) {
this.userType = userType;
}
public String getUserNumLimit() {
return userNumLimit;
}
public void setUserNumLimit(String userNumLimit) {
this.userNumLimit = userNumLimit;
}
public String getBillsNumLimit() {
return billsNumLimit;
}
public void setBillsNumLimit(String billsNumLimit) {
this.billsNumLimit = billsNumLimit;
}
}

View File

@@ -1,13 +1,14 @@
package com.jsh.erp.datasource.mappers;
import com.jsh.erp.datasource.entities.Tenant;
import com.jsh.erp.datasource.entities.TenantEx;
import org.apache.ibatis.annotations.Param;
import java.util.List;
public interface TenantMapperEx {
List<Tenant> selectByConditionTenant(
List<TenantEx> selectByConditionTenant(
@Param("loginName") String loginName,
@Param("offset") Integer offset,
@Param("rows") Integer rows);

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) {

View File

@@ -1,13 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.jsh.erp.datasource.mappers.TenantMapperEx">
<select id="selectByConditionTenant" parameterType="com.jsh.erp.datasource.entities.TenantExample" resultMap="com.jsh.erp.datasource.mappers.TenantMapper.BaseResultMap">
<resultMap extends="com.jsh.erp.datasource.mappers.LogMapper.BaseResultMap" id="ResultMapEx" type="com.jsh.erp.datasource.entities.TenantEx">
</resultMap>
<select id="selectByConditionTenant" parameterType="com.jsh.erp.datasource.entities.TenantExample" resultMap="ResultMapEx">
select *
FROM jsh_tenant
where 1=1
<if test="loginName != null">
and login_name like '%${loginName}%'
</if>
order by id desc
<if test="offset != null and rows != null">
limit #{offset},#{rows}
</if>