切换到jsh的版本
This commit is contained in:
@@ -1,10 +1,17 @@
|
||||
package com.jsh.erp;
|
||||
|
||||
import org.mybatis.spring.annotation.MapperScan;
|
||||
import org.springframework.beans.factory.annotation.Qualifier;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.boot.autoconfigure.web.servlet.DispatcherServletAutoConfiguration;
|
||||
import org.springframework.boot.web.servlet.ServletComponentScan;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.scheduling.annotation.EnableScheduling;
|
||||
import org.springframework.web.servlet.DispatcherServlet;
|
||||
|
||||
import javax.servlet.http.Cookie;
|
||||
|
||||
@SpringBootApplication
|
||||
@MapperScan(basePackages = {"com.jsh.erp.datasource.mappers"})
|
||||
|
||||
@@ -7,6 +7,7 @@ import com.baomidou.mybatisplus.extension.plugins.PaginationInterceptor;
|
||||
import com.baomidou.mybatisplus.extension.plugins.PerformanceInterceptor;
|
||||
import com.baomidou.mybatisplus.extension.plugins.tenant.TenantHandler;
|
||||
import com.baomidou.mybatisplus.extension.plugins.tenant.TenantSqlParser;
|
||||
import com.jsh.erp.datasource.entities.User;
|
||||
import net.sf.jsqlparser.expression.Expression;
|
||||
import net.sf.jsqlparser.expression.LongValue;
|
||||
import org.apache.ibatis.mapping.MappedStatement;
|
||||
@@ -21,15 +22,7 @@ import java.util.List;
|
||||
|
||||
@Configuration
|
||||
public class TenantConfig {
|
||||
/**
|
||||
* create by: qiankunpingtai
|
||||
* create time: 2019/4/28 14:28
|
||||
* website:https://qiankunpingtai.cn
|
||||
* description:
|
||||
* 实现多租户和无租户模式数据可以兼容在一个数据库中
|
||||
* 多租户模式:根据tenant_id=租户id来筛选个人数据
|
||||
* 无租户模式:根据tenant_id=-1来筛选数据
|
||||
*/
|
||||
|
||||
@Bean
|
||||
public PaginationInterceptor paginationInterceptor(HttpServletRequest request) {
|
||||
PaginationInterceptor paginationInterceptor = new PaginationInterceptor();
|
||||
@@ -41,11 +34,9 @@ public class TenantConfig {
|
||||
//从session中获取租户id
|
||||
Object tenantId = request.getSession().getAttribute("tenantId");
|
||||
if(tenantId!=null){
|
||||
//多租户模式,租户id从当前用户获取
|
||||
return new LongValue(Long.parseLong(tenantId.toString()));
|
||||
} else {
|
||||
//无租户模式,租户id为-1
|
||||
return new LongValue(Long.valueOf(-1));
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -56,11 +47,30 @@ public class TenantConfig {
|
||||
|
||||
@Override
|
||||
public boolean doTableFilter(String tableName) {
|
||||
// 这里可以判断是否过滤表
|
||||
if ("tbl_sequence".equals(tableName) || "dual".equals(tableName)|| "jsh_tenant".equals(tableName)) {
|
||||
return true;
|
||||
//获取开启状态
|
||||
Object tenantId = request.getSession().getAttribute("tenantId");
|
||||
if(tenantId!=null) {
|
||||
//从session中获取租户id
|
||||
String loginName = null;
|
||||
Object userInfo = request.getSession().getAttribute("user");
|
||||
if(userInfo != null) {
|
||||
User user = (User) userInfo;
|
||||
loginName = user.getLoginame();
|
||||
}
|
||||
if(("admin").equals(loginName)) {
|
||||
return true;
|
||||
} else {
|
||||
// 这里可以判断是否过滤表
|
||||
if ("jsh_materialproperty".equals(tableName) || "tbl_sequence".equals(tableName)
|
||||
|| "jsh_userbusiness".equals(tableName) || "jsh_functions".equals(tableName)
|
||||
|| "jsh_tenant".equals(tableName)) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -71,14 +81,12 @@ public class TenantConfig {
|
||||
@Override
|
||||
public boolean doFilter(MetaObject metaObject) {
|
||||
MappedStatement ms = SqlParserHelper.getMappedStatement(metaObject);
|
||||
// 过滤自定义查询,此处跳过指定id的查询(不追加租户id过滤条件)
|
||||
if ("com.jsh.erp.datasource.mappers.UserMapperEx.getUserListByLoginName".equals(ms.getId())||
|
||||
"com.jsh.erp.datasource.mappers.UserMapperEx.getUserListByloginNameAndPassword".equals(ms.getId())||
|
||||
"com.jsh.erp.datasource.mappers.DepotItemMapperEx.getCurrentRepByMaterialIdAndDepotId".equals(ms.getId())) {
|
||||
// 过滤自定义查询此时无租户信息约束出现
|
||||
if ("com.jsh.erp.datasource.mappers.UserMapperEx.getUserListByUserNameOrLoginName".equals(ms.getId())||
|
||||
"com.jsh.erp.datasource.mappers.DepotItemMapperEx.getStockByParam".equals(ms.getId())) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
||||
}
|
||||
});
|
||||
return paginationInterceptor;
|
||||
|
||||
@@ -213,11 +213,7 @@ public class BusinessConstants {
|
||||
* 默认管理员账号
|
||||
*/
|
||||
public static final String DEFAULT_MANAGER = "admin";
|
||||
/**
|
||||
* 测试用户的基础数据设定
|
||||
* */
|
||||
public static final String TEST_USER_NUM_LIMIT="2000";
|
||||
public static final String TEST_BILLS_NUM_LIMIT="200000";
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -278,9 +278,6 @@ public class ExceptionConstants {
|
||||
//商品库存不足
|
||||
public static final int MATERIAL_STOCK_NOT_ENOUGH_CODE = 8000004;
|
||||
public static final String MATERIAL_STOCK_NOT_ENOUGH_MSG = "商品:%s库存不足";
|
||||
//商品单位不正确
|
||||
public static final int MATERIAL_UNIT_NOT_RIGHT_CODE = 8000005;
|
||||
public static final String MATERIAL_UNIT_NOT_RIGHT_MSG = "商品:%s单位不正确,使用单位:%s,基础单位:%s,副单位:%s";
|
||||
/**
|
||||
* 单据信息
|
||||
* type = 85
|
||||
|
||||
@@ -5,7 +5,6 @@ import com.jsh.erp.constants.BusinessConstants;
|
||||
import com.jsh.erp.constants.ExceptionConstants;
|
||||
import com.jsh.erp.datasource.entities.AccountHead;
|
||||
import com.jsh.erp.datasource.entities.AccountHeadVo4ListEx;
|
||||
import com.jsh.erp.exception.BusinessParamCheckingException;
|
||||
import com.jsh.erp.exception.BusinessRunTimeException;
|
||||
import com.jsh.erp.service.accountHead.AccountHeadService;
|
||||
import com.jsh.erp.utils.BaseResponseInfo;
|
||||
@@ -35,6 +34,27 @@ public class AccountHeadController {
|
||||
@Resource
|
||||
private AccountHeadService accountHeadService;
|
||||
|
||||
/**
|
||||
* 获取最大的id
|
||||
* @param request
|
||||
* @return
|
||||
*/
|
||||
@GetMapping(value = "/getMaxId")
|
||||
public BaseResponseInfo getMaxId(HttpServletRequest request)throws Exception {
|
||||
BaseResponseInfo res = new BaseResponseInfo();
|
||||
Map<String, Object> map = new HashMap<String, Object>();
|
||||
try {
|
||||
Long maxId = accountHeadService.getMaxId();
|
||||
map.put("maxId", maxId);
|
||||
res.code = 200;
|
||||
res.data = map;
|
||||
} catch(Exception e){
|
||||
e.printStackTrace();
|
||||
res.code = 500;
|
||||
res.data = "获取数据失败";
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询单位的累计应收和累计应付,收预付款不计入此处
|
||||
@@ -125,38 +145,5 @@ public class AccountHeadController {
|
||||
}
|
||||
return result;
|
||||
}
|
||||
/**
|
||||
* create by: qiankunpingtai
|
||||
* website:https://qiankunpingtai.cn
|
||||
* description:
|
||||
* 新增财务信息和财务明细信息
|
||||
* create time: 2019/5/21 15:50
|
||||
* @Param: beanJson
|
||||
* @Param: inserted
|
||||
* @Param: deleted
|
||||
* @Param: updated
|
||||
* @Param: request
|
||||
* @return java.lang.Object
|
||||
*/
|
||||
@RequestMapping(value = "/addAccountHeadAndDetail")
|
||||
public Object addAccountHeadAndDetail(@RequestParam("info") String beanJson,
|
||||
@RequestParam("inserted") String inserted,
|
||||
@RequestParam("deleted") String deleted,
|
||||
@RequestParam("updated") String updated,
|
||||
@RequestParam("listType") String listType,HttpServletRequest request) throws Exception{
|
||||
|
||||
JSONObject result = ExceptionConstants.standardSuccess();
|
||||
accountHeadService.addAccountHeadAndDetail(beanJson,inserted,deleted,updated,listType);
|
||||
return result;
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/updateAccountHeadAndDetail")
|
||||
public Object updateAccountHeadAndDetail(@RequestParam("id") Long id,@RequestParam("info") String beanJson,@RequestParam("inserted") String inserted,
|
||||
@RequestParam("deleted") String deleted,
|
||||
@RequestParam("updated") String updated,@RequestParam("listType") String listType) throws Exception{
|
||||
|
||||
JSONObject result = ExceptionConstants.standardSuccess();
|
||||
accountHeadService.updateAccountHeadAndDetail(id,beanJson,inserted,deleted,updated,listType);
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -86,6 +86,27 @@ public class DepotHeadController {
|
||||
return res;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取最大的id
|
||||
* @param request
|
||||
* @return
|
||||
*/
|
||||
@GetMapping(value = "/getMaxId")
|
||||
public BaseResponseInfo getMaxId(HttpServletRequest request)throws Exception {
|
||||
BaseResponseInfo res = new BaseResponseInfo();
|
||||
Map<String, Object> map = new HashMap<String, Object>();
|
||||
try {
|
||||
Long maxId = depotHeadService.getMaxId();
|
||||
map.put("maxId", maxId);
|
||||
res.code = 200;
|
||||
res.data = map;
|
||||
} catch(Exception e){
|
||||
e.printStackTrace();
|
||||
res.code = 500;
|
||||
res.data = "获取数据失败";
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查找单据_根据月份(报表)
|
||||
@@ -383,7 +404,7 @@ public class DepotHeadController {
|
||||
throw new BusinessParamCheckingException(ExceptionConstants.DEPOT_HEAD_OVER_LIMIT_FAILED_CODE,
|
||||
ExceptionConstants.DEPOT_HEAD_OVER_LIMIT_FAILED_MSG);
|
||||
} else {
|
||||
depotHeadService.addDepotHeadAndDetail(beanJson,inserted,deleted,updated);
|
||||
depotHeadService.addDepotHeadAndDetail(beanJson,inserted,deleted,updated,tenantId);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -4,8 +4,7 @@ import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.jsh.erp.constants.BusinessConstants;
|
||||
import com.jsh.erp.constants.ExceptionConstants;
|
||||
import com.jsh.erp.datasource.entities.DepotItemVo4DetailByTypeAndMId;
|
||||
import com.jsh.erp.datasource.entities.DepotItemVo4WithInfoEx;
|
||||
import com.jsh.erp.datasource.entities.*;
|
||||
import com.jsh.erp.datasource.vo.DepotItemStockWarningCount;
|
||||
import com.jsh.erp.exception.BusinessRunTimeException;
|
||||
import com.jsh.erp.service.depotItem.DepotItemService;
|
||||
@@ -13,10 +12,8 @@ import com.jsh.erp.service.material.MaterialService;
|
||||
import com.jsh.erp.utils.*;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.dao.DataAccessException;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
@@ -74,8 +71,6 @@ public class DepotItemController {
|
||||
item.put("Type", d.getNewtype()); //进出类型
|
||||
item.put("BasicNumber", d.getBnum()); //数量
|
||||
item.put("OperTime", d.getOtime()); //时间
|
||||
item.put("depotName", d.getDepotName()); //仓库名称
|
||||
item.put("depotInName", d.getDepotInName()); //调入仓库名称
|
||||
dataArray.add(item);
|
||||
}
|
||||
}
|
||||
@@ -92,27 +87,32 @@ public class DepotItemController {
|
||||
|
||||
/**
|
||||
* 根据商品id和仓库id查询库存数量
|
||||
* @param depotId
|
||||
* @param mId
|
||||
* @param request
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
@RequestMapping(value = "/findStockNumByMaterialId")
|
||||
public String findStockNumByMaterialId(
|
||||
@RequestParam("materialId") String mId,
|
||||
HttpServletRequest request) throws Exception{
|
||||
Map<String, Object> objectMap = new HashMap<String, Object>();
|
||||
//存放数据json数组
|
||||
JSONArray dataArray = new JSONArray();
|
||||
JSONObject item = new JSONObject();
|
||||
item.put("thisSum", depotItemService.getCurrentRepByMaterialIdAndDepotId(Long.valueOf(mId),null));
|
||||
dataArray.add(item);
|
||||
objectMap.put("page", dataArray);
|
||||
return returnJson(objectMap, ErpInfo.OK.name, ErpInfo.OK.code);
|
||||
@GetMapping(value = "/findStockNumById")
|
||||
public BaseResponseInfo findStockNumById(
|
||||
@RequestParam("depotId") Long depotId,
|
||||
@RequestParam("mId") Long mId,
|
||||
HttpServletRequest request) throws Exception{
|
||||
BaseResponseInfo res = new BaseResponseInfo();
|
||||
Map<String, Object> map = new HashMap<String, Object>();
|
||||
try {
|
||||
Long tenantId = Long.parseLong(request.getSession().getAttribute("tenantId").toString());
|
||||
map.put("stock", depotItemService.getStockByParam(depotId,mId,null,null,tenantId));
|
||||
res.code = 200;
|
||||
res.data = map;
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
res.code = 500;
|
||||
res.data = "获取数据失败";
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 查询计量单位信息
|
||||
*
|
||||
@@ -144,7 +144,7 @@ public class DepotItemController {
|
||||
try {
|
||||
List<DepotItemVo4WithInfoEx> dataList = new ArrayList<DepotItemVo4WithInfoEx>();
|
||||
if(headerId != 0) {
|
||||
dataList = depotItemService.getDetailList(headerId);
|
||||
dataList = depotItemService.getDetailList(headerId);
|
||||
}
|
||||
String[] mpArr = mpList.split(",");
|
||||
JSONObject outer = new JSONObject();
|
||||
@@ -164,13 +164,17 @@ public class DepotItemController {
|
||||
ratio = ratio.substring(ratio.indexOf("("));
|
||||
}
|
||||
//品名/型号/扩展信息/包装
|
||||
String MaterialName = diEx.getMName() + ((diEx.getMModel() == null || diEx.getMModel().equals("")) ? "" : "(" + diEx.getMModel() + ")");
|
||||
String MaterialName = (diEx.getMName() == null || diEx.getMName().equals("")) ? "" : diEx.getMName()
|
||||
+ ((diEx.getMModel() == null || diEx.getMModel().equals("")) ? "" : "(" + diEx.getMModel() + ")");
|
||||
String materialOther = getOtherInfo(mpArr, diEx);
|
||||
MaterialName = MaterialName + materialOther + ((diEx.getUName() == null || diEx.getUName().equals("")) ? "" : "(" + diEx.getUName() + ")") + ratio;
|
||||
item.put("MaterialName", MaterialName);
|
||||
item.put("MaterialName", MaterialName == null ? "" : MaterialName);
|
||||
item.put("Stock", depotItemService.getStockByParam(diEx.getDepotid(),diEx.getMaterialid(),null,null,tenantId));
|
||||
item.put("Unit", diEx.getMunit());
|
||||
item.put("OperNumber", diEx.getOpernumber());
|
||||
item.put("BasicNumber", diEx.getBasicnumber());
|
||||
//统计该商品已分批出库的总数量-用于订单
|
||||
item.put("finishNumber", depotItemService.getFinishNumber(diEx.getMaterialid(),diEx.getHeaderid()));
|
||||
item.put("UnitPrice", diEx.getUnitprice());
|
||||
item.put("TaxUnitPrice", diEx.getTaxunitprice());
|
||||
item.put("AllPrice", diEx.getAllprice());
|
||||
@@ -235,11 +239,11 @@ public class DepotItemController {
|
||||
return materialOther;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 查找所有的明细
|
||||
* @param currentPage
|
||||
* @param pageSize
|
||||
* @param projectId
|
||||
* @param monthTime
|
||||
* @param headIds
|
||||
* @param materialIds
|
||||
@@ -247,7 +251,7 @@ public class DepotItemController {
|
||||
* @param request
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = "/findByAll")
|
||||
@PostMapping(value = "/findByAll")
|
||||
public BaseResponseInfo findByAll(@RequestParam("currentPage") Integer currentPage,
|
||||
@RequestParam("pageSize") Integer pageSize,
|
||||
@RequestParam("depotId") Long depotId,
|
||||
@@ -301,12 +305,11 @@ public class DepotItemController {
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 导出excel表格
|
||||
* @param currentPage
|
||||
* @param pageSize
|
||||
* @param projectId
|
||||
* @param monthTime
|
||||
* @param headIds
|
||||
* @param materialIds
|
||||
@@ -357,18 +360,19 @@ public class DepotItemController {
|
||||
|
||||
/**
|
||||
* 统计总计金额
|
||||
* @param pid
|
||||
* @param monthTime
|
||||
* @param headIds
|
||||
* @param materialIds
|
||||
* @param request
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = "/totalCountMoney")
|
||||
@PostMapping(value = "/totalCountMoney")
|
||||
public BaseResponseInfo totalCountMoney(@RequestParam("depotId") Long depotId,
|
||||
@RequestParam("monthTime") String monthTime,
|
||||
@RequestParam("headIds") String headIds,
|
||||
@RequestParam("materialIds") String materialIds,
|
||||
HttpServletRequest request) throws Exception{
|
||||
@RequestParam("monthTime") String monthTime,
|
||||
@RequestParam("headIds") String headIds,
|
||||
@RequestParam("materialIds") String materialIds,
|
||||
HttpServletRequest request) throws Exception{
|
||||
BaseResponseInfo res = new BaseResponseInfo();
|
||||
Map<String, Object> map = new HashMap<String, Object>();
|
||||
Long tenantId = Long.parseLong(request.getSession().getAttribute("tenantId").toString());
|
||||
@@ -394,8 +398,6 @@ public class DepotItemController {
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 进货统计
|
||||
* @param currentPage
|
||||
@@ -407,7 +409,7 @@ public class DepotItemController {
|
||||
* @param request
|
||||
* @return
|
||||
*/
|
||||
@GetMapping(value = "/buyIn")
|
||||
@PostMapping(value = "/buyIn")
|
||||
public BaseResponseInfo buyIn(@RequestParam("currentPage") Integer currentPage,
|
||||
@RequestParam("pageSize") Integer pageSize,
|
||||
@RequestParam("monthTime") String monthTime,
|
||||
@@ -427,10 +429,10 @@ public class DepotItemController {
|
||||
if (null != dataList) {
|
||||
for (DepotItemVo4WithInfoEx diEx : dataList) {
|
||||
JSONObject item = new JSONObject();
|
||||
BigDecimal InSum = sumNumberBuyOrSale("入库", "采购", diEx.getMId(), monthTime);
|
||||
BigDecimal OutSum = sumNumberBuyOrSale("出库", "采购退货", diEx.getMId(), monthTime);
|
||||
BigDecimal InSumPrice = sumPriceBuyOrSale("入库", "采购", diEx.getMId(), monthTime);
|
||||
BigDecimal OutSumPrice = sumPriceBuyOrSale("出库", "采购退货", diEx.getMId(), monthTime);
|
||||
BigDecimal InSum = depotItemService.buyOrSale("入库", "采购", diEx.getMId(), monthTime, "number");
|
||||
BigDecimal OutSum = depotItemService.buyOrSale("出库", "采购退货", diEx.getMId(), monthTime, "number");
|
||||
BigDecimal InSumPrice = depotItemService.buyOrSale("入库", "采购", diEx.getMId(), monthTime, "price");
|
||||
BigDecimal OutSumPrice = depotItemService.buyOrSale("出库", "采购退货", diEx.getMId(), monthTime, "price");
|
||||
item.put("MaterialName", diEx.getMName());
|
||||
item.put("MaterialModel", diEx.getMModel());
|
||||
//扩展信息
|
||||
@@ -438,6 +440,7 @@ public class DepotItemController {
|
||||
item.put("MaterialOther", materialOther);
|
||||
item.put("MaterialColor", diEx.getMColor());
|
||||
item.put("MaterialUnit", diEx.getMaterialUnit());
|
||||
item.put("UName", diEx.getUName());
|
||||
item.put("InSum", InSum);
|
||||
item.put("OutSum", OutSum);
|
||||
item.put("InSumPrice", InSumPrice);
|
||||
@@ -467,7 +470,7 @@ public class DepotItemController {
|
||||
* @param request
|
||||
* @return
|
||||
*/
|
||||
@GetMapping(value = "/saleOut")
|
||||
@PostMapping(value = "/saleOut")
|
||||
public BaseResponseInfo saleOut(@RequestParam("currentPage") Integer currentPage,
|
||||
@RequestParam("pageSize") Integer pageSize,
|
||||
@RequestParam("monthTime") String monthTime,
|
||||
@@ -487,14 +490,15 @@ public class DepotItemController {
|
||||
if (null != dataList) {
|
||||
for (DepotItemVo4WithInfoEx diEx : dataList) {
|
||||
JSONObject item = new JSONObject();
|
||||
BigDecimal OutSumRetail = sumNumberBuyOrSale("出库", "零售", diEx.getMId(), monthTime);
|
||||
BigDecimal OutSum = sumNumberBuyOrSale("出库", "销售", diEx.getMId(), monthTime);
|
||||
BigDecimal InSumRetail = sumNumberBuyOrSale("入库", "零售退货", diEx.getMId(), monthTime);
|
||||
BigDecimal InSum = sumNumberBuyOrSale("入库", "销售退货", diEx.getMId(), monthTime);
|
||||
BigDecimal OutSumRetailPrice = sumPriceBuyOrSale("出库", "零售", diEx.getMId(), monthTime);
|
||||
BigDecimal OutSumPrice = sumPriceBuyOrSale("出库", "销售", diEx.getMId(), monthTime);
|
||||
BigDecimal InSumRetailPrice = sumPriceBuyOrSale("入库", "零售退货", diEx.getMId(), monthTime);
|
||||
BigDecimal InSumPrice = sumPriceBuyOrSale("入库", "销售退货", diEx.getMId(), monthTime);
|
||||
BigDecimal OutSumRetail = depotItemService.buyOrSale("出库", "零售", diEx.getMId(), monthTime,"number");
|
||||
BigDecimal OutSum = depotItemService.buyOrSale("出库", "销售", diEx.getMId(), monthTime,"number");
|
||||
BigDecimal InSumRetail = depotItemService.buyOrSale("入库", "零售退货", diEx.getMId(), monthTime,"number");
|
||||
BigDecimal InSum = depotItemService.buyOrSale("入库", "销售退货", diEx.getMId(), monthTime,"number");
|
||||
BigDecimal OutSumRetailPrice = depotItemService.buyOrSale("出库", "零售", diEx.getMId(), monthTime,"price");
|
||||
BigDecimal OutSumPrice = depotItemService.buyOrSale("出库", "销售", diEx.getMId(), monthTime,"price");
|
||||
BigDecimal InSumRetailPrice = depotItemService.buyOrSale("入库", "零售退货", diEx.getMId(), monthTime,"price");
|
||||
BigDecimal InSumPrice = depotItemService.buyOrSale("入库", "销售退货", diEx.getMId(), monthTime,"price");
|
||||
BigDecimal OutInSumPrice = (OutSumRetailPrice.add(OutSumPrice)).subtract(InSumRetailPrice.add(InSumPrice));
|
||||
item.put("MaterialName", diEx.getMName());
|
||||
item.put("MaterialModel", diEx.getMModel());
|
||||
//扩展信息
|
||||
@@ -502,10 +506,12 @@ public class DepotItemController {
|
||||
item.put("MaterialOther", materialOther);
|
||||
item.put("MaterialColor", diEx.getMColor());
|
||||
item.put("MaterialUnit", diEx.getMaterialUnit());
|
||||
item.put("UName", diEx.getUName());
|
||||
item.put("OutSum", OutSumRetail.add(OutSum));
|
||||
item.put("InSum", InSumRetail.add(InSum));
|
||||
item.put("OutSumPrice", OutSumRetailPrice.add(OutSumPrice));
|
||||
item.put("InSumPrice", InSumRetailPrice.add(InSumPrice));
|
||||
item.put("OutInSumPrice",OutInSumPrice);//实际销售金额
|
||||
dataArray.add(item);
|
||||
}
|
||||
}
|
||||
@@ -520,34 +526,22 @@ public class DepotItemController {
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
public BigDecimal sumNumberBuyOrSale(String type, String subType, Long MId, String MonthTime)throws Exception {
|
||||
BigDecimal sumNumber = BigDecimal.ZERO;
|
||||
String sumType = "Number";
|
||||
try {
|
||||
BigDecimal sum = depotItemService.buyOrSale(type, subType, MId, MonthTime, sumType);
|
||||
if(sum != null) {
|
||||
sumNumber = sum;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
/**
|
||||
* 获取单位
|
||||
* @param materialUnit
|
||||
* @param uName
|
||||
* @return
|
||||
*/
|
||||
public String getUName(String materialUnit, String uName) {
|
||||
String unitName = null;
|
||||
if(!StringUtil.isEmpty(materialUnit)) {
|
||||
unitName = materialUnit;
|
||||
} else if(!StringUtil.isEmpty(uName)) {
|
||||
unitName = uName.substring(0,uName.indexOf(","));
|
||||
}
|
||||
return sumNumber;
|
||||
return unitName;
|
||||
}
|
||||
|
||||
public BigDecimal sumPriceBuyOrSale(String type, String subType, Long MId, String MonthTime)throws Exception {
|
||||
BigDecimal sumPrice = BigDecimal.ZERO;
|
||||
String sumType = "Price";
|
||||
try {
|
||||
BigDecimal sum = depotItemService.buyOrSale(type, subType, MId, MonthTime, sumType);
|
||||
if(sum != null) {
|
||||
sumPrice = sum;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return sumPrice;
|
||||
}
|
||||
/**
|
||||
* 获取单价
|
||||
* @param presetPriceOne
|
||||
@@ -624,6 +618,7 @@ public class DepotItemController {
|
||||
* @param currentPage
|
||||
* @param pageSize
|
||||
* @param projectId
|
||||
* @param monthTime
|
||||
* @param request
|
||||
* @param response
|
||||
* @return
|
||||
@@ -646,7 +641,6 @@ public class DepotItemController {
|
||||
if (null != dataList) {
|
||||
for (DepotItemStockWarningCount diEx : dataList) {
|
||||
String[] objs = new String[9];
|
||||
|
||||
objs[0] = diEx.getMaterialName().toString();
|
||||
objs[1] = diEx.getMaterialModel().toString();
|
||||
objs[2] = diEx.getMaterialOther().toString();
|
||||
@@ -711,20 +705,4 @@ public class DepotItemController {
|
||||
}
|
||||
return res;
|
||||
}
|
||||
/**
|
||||
* 获取单位
|
||||
* @param materialUnit
|
||||
* @param uName
|
||||
* @return
|
||||
*/
|
||||
public String getUName(String materialUnit, String uName) {
|
||||
String unitName = null;
|
||||
if(!StringUtil.isEmpty(materialUnit)) {
|
||||
unitName = materialUnit;
|
||||
} else if(!StringUtil.isEmpty(uName)) {
|
||||
unitName = uName.substring(0,uName.indexOf(","));
|
||||
}
|
||||
return unitName;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -154,10 +154,9 @@ public class FunctionsController {
|
||||
if(("admin").equals(loginName)) {
|
||||
dataList.add(fun);
|
||||
} else {
|
||||
// if(!("系统管理").equals(fun.getName())) {
|
||||
// dataList.add(fun);
|
||||
// }
|
||||
dataList.add(fun);
|
||||
if(!("系统管理").equals(fun.getName())) {
|
||||
dataList.add(fun);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -2,28 +2,19 @@ package com.jsh.erp.controller;
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import com.jsh.erp.constants.BusinessConstants;
|
||||
import com.jsh.erp.constants.ExceptionConstants;
|
||||
import com.jsh.erp.datasource.entities.Role;
|
||||
import com.jsh.erp.exception.BusinessRunTimeException;
|
||||
import com.jsh.erp.service.role.RoleService;
|
||||
import com.jsh.erp.service.user.UserService;
|
||||
import com.jsh.erp.service.userBusiness.UserBusinessService;
|
||||
import com.jsh.erp.utils.*;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import static com.jsh.erp.utils.ResponseJsonUtil.returnJson;
|
||||
|
||||
/**
|
||||
* @author ji sheng hua 华夏ERP
|
||||
@@ -74,35 +65,11 @@ public class RoleController {
|
||||
return arr;
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/list")
|
||||
public String list(@RequestParam(value = Constants.PAGE_SIZE, required = false) Integer pageSize,
|
||||
@RequestParam(value = Constants.CURRENT_PAGE, required = false) Integer currentPage,
|
||||
@RequestParam("name") String name,
|
||||
HttpServletRequest request)throws Exception {
|
||||
Map<String, String> parameterMap = ParamUtils.requestToMap(request);
|
||||
parameterMap.put("name", name);
|
||||
PageQueryInfo queryInfo = new PageQueryInfo();
|
||||
Map<String, Object> objectMap = new HashMap<String, Object>();
|
||||
if (pageSize == null || pageSize <= 0) {
|
||||
pageSize = BusinessConstants.DEFAULT_PAGINATION_PAGE_SIZE;
|
||||
}
|
||||
if (currentPage == null || currentPage <= 0) {
|
||||
currentPage = BusinessConstants.DEFAULT_PAGINATION_PAGE_NUMBER;
|
||||
}
|
||||
PageHelper.startPage(currentPage,pageSize,true);
|
||||
List<Role> list = roleService.getRoleList(parameterMap);
|
||||
//获取分页查询后的数据
|
||||
PageInfo<Role> pageInfo = new PageInfo<>(list);
|
||||
objectMap.put("page", queryInfo);
|
||||
if (list == null) {
|
||||
queryInfo.setRows(new ArrayList<Object>());
|
||||
queryInfo.setTotal(BusinessConstants.DEFAULT_LIST_NULL_NUMBER);
|
||||
return returnJson(objectMap, "查找不到数据", ErpInfo.OK.code);
|
||||
}
|
||||
queryInfo.setRows(list);
|
||||
queryInfo.setTotal(pageInfo.getTotal());
|
||||
return returnJson(objectMap, ErpInfo.OK.name, ErpInfo.OK.code);
|
||||
@PostMapping(value = "/list")
|
||||
public List<Role> list(HttpServletRequest request)throws Exception {
|
||||
return roleService.getRole();
|
||||
}
|
||||
|
||||
/**
|
||||
* create by: qiankunpingtai
|
||||
* website:https://qiankunpingtai.cn
|
||||
|
||||
@@ -43,7 +43,7 @@ public class UserController {
|
||||
private Logger logger = LoggerFactory.getLogger(UserController.class);
|
||||
|
||||
@Value("${manage.roleId}")
|
||||
private Long manageRoleId;
|
||||
private Integer manageRoleId;
|
||||
|
||||
@Resource
|
||||
private UserService userService;
|
||||
@@ -103,11 +103,9 @@ public class UserController {
|
||||
break;
|
||||
default:
|
||||
try {
|
||||
//验证通过 ,可以登录,放入session,记录登录日志
|
||||
user = userService.getUserListByloginNameAndPassword(username,password);
|
||||
// logService.create(new Logdetails(user, "登录系统", model.getClientIp(),
|
||||
// new Timestamp(System.currentTimeMillis()), (short) 0, "管理用户:" + username + " 登录系统", username + " 登录系统"));
|
||||
msgTip = "user can login";
|
||||
//验证通过 ,可以登录,放入session,记录登录日志
|
||||
user = userService.getUserByUserName(username);
|
||||
request.getSession().setAttribute("user",user);
|
||||
if(user.getTenantId()!=null) {
|
||||
Tenant tenant = tenantService.getTenantByTenantId(user.getTenantId());
|
||||
@@ -345,7 +343,8 @@ public class UserController {
|
||||
ue.setUsername(loginame);
|
||||
ue.setLoginame(loginame);
|
||||
ue.setPassword(password);
|
||||
ue = userService.registerUser(ue,manageRoleId);
|
||||
userService.checkUserNameAndLoginName(ue); //检查用户名和登录名
|
||||
ue = userService.registerUser(ue,manageRoleId,request);
|
||||
return result;
|
||||
}
|
||||
/**
|
||||
|
||||
@@ -1,692 +0,0 @@
|
||||
package com.jsh.erp.datasource.entities;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class AssetCategoryExample {
|
||||
/**
|
||||
* This field was generated by MyBatis Generator.
|
||||
* This field corresponds to the database table jsh_assetcategory
|
||||
*
|
||||
* @mbggenerated
|
||||
*/
|
||||
protected String orderByClause;
|
||||
|
||||
/**
|
||||
* This field was generated by MyBatis Generator.
|
||||
* This field corresponds to the database table jsh_assetcategory
|
||||
*
|
||||
* @mbggenerated
|
||||
*/
|
||||
protected boolean distinct;
|
||||
|
||||
/**
|
||||
* This field was generated by MyBatis Generator.
|
||||
* This field corresponds to the database table jsh_assetcategory
|
||||
*
|
||||
* @mbggenerated
|
||||
*/
|
||||
protected List<Criteria> oredCriteria;
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
* This method corresponds to the database table jsh_assetcategory
|
||||
*
|
||||
* @mbggenerated
|
||||
*/
|
||||
public AssetCategoryExample() {
|
||||
oredCriteria = new ArrayList<Criteria>();
|
||||
}
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
* This method corresponds to the database table jsh_assetcategory
|
||||
*
|
||||
* @mbggenerated
|
||||
*/
|
||||
public void setOrderByClause(String orderByClause) {
|
||||
this.orderByClause = orderByClause;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
* This method corresponds to the database table jsh_assetcategory
|
||||
*
|
||||
* @mbggenerated
|
||||
*/
|
||||
public String getOrderByClause() {
|
||||
return orderByClause;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
* This method corresponds to the database table jsh_assetcategory
|
||||
*
|
||||
* @mbggenerated
|
||||
*/
|
||||
public void setDistinct(boolean distinct) {
|
||||
this.distinct = distinct;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
* This method corresponds to the database table jsh_assetcategory
|
||||
*
|
||||
* @mbggenerated
|
||||
*/
|
||||
public boolean isDistinct() {
|
||||
return distinct;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
* This method corresponds to the database table jsh_assetcategory
|
||||
*
|
||||
* @mbggenerated
|
||||
*/
|
||||
public List<Criteria> getOredCriteria() {
|
||||
return oredCriteria;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
* This method corresponds to the database table jsh_assetcategory
|
||||
*
|
||||
* @mbggenerated
|
||||
*/
|
||||
public void or(Criteria criteria) {
|
||||
oredCriteria.add(criteria);
|
||||
}
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
* This method corresponds to the database table jsh_assetcategory
|
||||
*
|
||||
* @mbggenerated
|
||||
*/
|
||||
public Criteria or() {
|
||||
Criteria criteria = createCriteriaInternal();
|
||||
oredCriteria.add(criteria);
|
||||
return criteria;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
* This method corresponds to the database table jsh_assetcategory
|
||||
*
|
||||
* @mbggenerated
|
||||
*/
|
||||
public Criteria createCriteria() {
|
||||
Criteria criteria = createCriteriaInternal();
|
||||
if (oredCriteria.size() == 0) {
|
||||
oredCriteria.add(criteria);
|
||||
}
|
||||
return criteria;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
* This method corresponds to the database table jsh_assetcategory
|
||||
*
|
||||
* @mbggenerated
|
||||
*/
|
||||
protected Criteria createCriteriaInternal() {
|
||||
Criteria criteria = new Criteria();
|
||||
return criteria;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
* This method corresponds to the database table jsh_assetcategory
|
||||
*
|
||||
* @mbggenerated
|
||||
*/
|
||||
public void clear() {
|
||||
oredCriteria.clear();
|
||||
orderByClause = null;
|
||||
distinct = false;
|
||||
}
|
||||
|
||||
/**
|
||||
* This class was generated by MyBatis Generator.
|
||||
* This class corresponds to the database table jsh_assetcategory
|
||||
*
|
||||
* @mbggenerated
|
||||
*/
|
||||
protected abstract static class GeneratedCriteria {
|
||||
protected List<Criterion> criteria;
|
||||
|
||||
protected GeneratedCriteria() {
|
||||
super();
|
||||
criteria = new ArrayList<Criterion>();
|
||||
}
|
||||
|
||||
public boolean isValid() {
|
||||
return criteria.size() > 0;
|
||||
}
|
||||
|
||||
public List<Criterion> getAllCriteria() {
|
||||
return criteria;
|
||||
}
|
||||
|
||||
public List<Criterion> getCriteria() {
|
||||
return criteria;
|
||||
}
|
||||
|
||||
protected void addCriterion(String condition) {
|
||||
if (condition == null) {
|
||||
throw new RuntimeException("Value for condition cannot be null");
|
||||
}
|
||||
criteria.add(new Criterion(condition));
|
||||
}
|
||||
|
||||
protected void addCriterion(String condition, Object value, String property) {
|
||||
if (value == null) {
|
||||
throw new RuntimeException("Value for " + property + " cannot be null");
|
||||
}
|
||||
criteria.add(new Criterion(condition, value));
|
||||
}
|
||||
|
||||
protected void addCriterion(String condition, Object value1, Object value2, String property) {
|
||||
if (value1 == null || value2 == null) {
|
||||
throw new RuntimeException("Between values for " + property + " cannot be null");
|
||||
}
|
||||
criteria.add(new Criterion(condition, value1, value2));
|
||||
}
|
||||
|
||||
public Criteria andIdIsNull() {
|
||||
addCriterion("id is null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andIdIsNotNull() {
|
||||
addCriterion("id is not null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andIdEqualTo(Long value) {
|
||||
addCriterion("id =", value, "id");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andIdNotEqualTo(Long value) {
|
||||
addCriterion("id <>", value, "id");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andIdGreaterThan(Long value) {
|
||||
addCriterion("id >", value, "id");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andIdGreaterThanOrEqualTo(Long value) {
|
||||
addCriterion("id >=", value, "id");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andIdLessThan(Long value) {
|
||||
addCriterion("id <", value, "id");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andIdLessThanOrEqualTo(Long value) {
|
||||
addCriterion("id <=", value, "id");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andIdIn(List<Long> values) {
|
||||
addCriterion("id in", values, "id");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andIdNotIn(List<Long> values) {
|
||||
addCriterion("id not in", values, "id");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andIdBetween(Long value1, Long value2) {
|
||||
addCriterion("id between", value1, value2, "id");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andIdNotBetween(Long value1, Long value2) {
|
||||
addCriterion("id not between", value1, value2, "id");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andAssetnameIsNull() {
|
||||
addCriterion("assetname is null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andAssetnameIsNotNull() {
|
||||
addCriterion("assetname is not null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andAssetnameEqualTo(String value) {
|
||||
addCriterion("assetname =", value, "assetname");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andAssetnameNotEqualTo(String value) {
|
||||
addCriterion("assetname <>", value, "assetname");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andAssetnameGreaterThan(String value) {
|
||||
addCriterion("assetname >", value, "assetname");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andAssetnameGreaterThanOrEqualTo(String value) {
|
||||
addCriterion("assetname >=", value, "assetname");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andAssetnameLessThan(String value) {
|
||||
addCriterion("assetname <", value, "assetname");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andAssetnameLessThanOrEqualTo(String value) {
|
||||
addCriterion("assetname <=", value, "assetname");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andAssetnameLike(String value) {
|
||||
addCriterion("assetname like", value, "assetname");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andAssetnameNotLike(String value) {
|
||||
addCriterion("assetname not like", value, "assetname");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andAssetnameIn(List<String> values) {
|
||||
addCriterion("assetname in", values, "assetname");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andAssetnameNotIn(List<String> values) {
|
||||
addCriterion("assetname not in", values, "assetname");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andAssetnameBetween(String value1, String value2) {
|
||||
addCriterion("assetname between", value1, value2, "assetname");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andAssetnameNotBetween(String value1, String value2) {
|
||||
addCriterion("assetname not between", value1, value2, "assetname");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andIsystemIsNull() {
|
||||
addCriterion("isystem is null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andIsystemIsNotNull() {
|
||||
addCriterion("isystem is not null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andIsystemEqualTo(Byte value) {
|
||||
addCriterion("isystem =", value, "isystem");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andIsystemNotEqualTo(Byte value) {
|
||||
addCriterion("isystem <>", value, "isystem");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andIsystemGreaterThan(Byte value) {
|
||||
addCriterion("isystem >", value, "isystem");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andIsystemGreaterThanOrEqualTo(Byte value) {
|
||||
addCriterion("isystem >=", value, "isystem");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andIsystemLessThan(Byte value) {
|
||||
addCriterion("isystem <", value, "isystem");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andIsystemLessThanOrEqualTo(Byte value) {
|
||||
addCriterion("isystem <=", value, "isystem");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andIsystemIn(List<Byte> values) {
|
||||
addCriterion("isystem in", values, "isystem");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andIsystemNotIn(List<Byte> values) {
|
||||
addCriterion("isystem not in", values, "isystem");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andIsystemBetween(Byte value1, Byte value2) {
|
||||
addCriterion("isystem between", value1, value2, "isystem");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andIsystemNotBetween(Byte value1, Byte value2) {
|
||||
addCriterion("isystem not between", value1, value2, "isystem");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andDescriptionIsNull() {
|
||||
addCriterion("description is null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andDescriptionIsNotNull() {
|
||||
addCriterion("description is not null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andDescriptionEqualTo(String value) {
|
||||
addCriterion("description =", value, "description");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andDescriptionNotEqualTo(String value) {
|
||||
addCriterion("description <>", value, "description");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andDescriptionGreaterThan(String value) {
|
||||
addCriterion("description >", value, "description");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andDescriptionGreaterThanOrEqualTo(String value) {
|
||||
addCriterion("description >=", value, "description");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andDescriptionLessThan(String value) {
|
||||
addCriterion("description <", value, "description");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andDescriptionLessThanOrEqualTo(String value) {
|
||||
addCriterion("description <=", value, "description");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andDescriptionLike(String value) {
|
||||
addCriterion("description like", value, "description");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andDescriptionNotLike(String value) {
|
||||
addCriterion("description not like", value, "description");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andDescriptionIn(List<String> values) {
|
||||
addCriterion("description in", values, "description");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andDescriptionNotIn(List<String> values) {
|
||||
addCriterion("description not in", values, "description");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andDescriptionBetween(String value1, String value2) {
|
||||
addCriterion("description between", value1, value2, "description");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andDescriptionNotBetween(String value1, String value2) {
|
||||
addCriterion("description not between", value1, value2, "description");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andTenantIdIsNull() {
|
||||
addCriterion("tenant_id is null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andTenantIdIsNotNull() {
|
||||
addCriterion("tenant_id is not null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andTenantIdEqualTo(Long value) {
|
||||
addCriterion("tenant_id =", value, "tenantId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andTenantIdNotEqualTo(Long value) {
|
||||
addCriterion("tenant_id <>", value, "tenantId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andTenantIdGreaterThan(Long value) {
|
||||
addCriterion("tenant_id >", value, "tenantId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andTenantIdGreaterThanOrEqualTo(Long value) {
|
||||
addCriterion("tenant_id >=", value, "tenantId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andTenantIdLessThan(Long value) {
|
||||
addCriterion("tenant_id <", value, "tenantId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andTenantIdLessThanOrEqualTo(Long value) {
|
||||
addCriterion("tenant_id <=", value, "tenantId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andTenantIdIn(List<Long> values) {
|
||||
addCriterion("tenant_id in", values, "tenantId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andTenantIdNotIn(List<Long> values) {
|
||||
addCriterion("tenant_id not in", values, "tenantId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andTenantIdBetween(Long value1, Long value2) {
|
||||
addCriterion("tenant_id between", value1, value2, "tenantId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andTenantIdNotBetween(Long value1, Long value2) {
|
||||
addCriterion("tenant_id not between", value1, value2, "tenantId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andDeleteFlagIsNull() {
|
||||
addCriterion("delete_Flag is null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andDeleteFlagIsNotNull() {
|
||||
addCriterion("delete_Flag is not null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andDeleteFlagEqualTo(String value) {
|
||||
addCriterion("delete_Flag =", value, "deleteFlag");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andDeleteFlagNotEqualTo(String value) {
|
||||
addCriterion("delete_Flag <>", value, "deleteFlag");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andDeleteFlagGreaterThan(String value) {
|
||||
addCriterion("delete_Flag >", value, "deleteFlag");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andDeleteFlagGreaterThanOrEqualTo(String value) {
|
||||
addCriterion("delete_Flag >=", value, "deleteFlag");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andDeleteFlagLessThan(String value) {
|
||||
addCriterion("delete_Flag <", value, "deleteFlag");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andDeleteFlagLessThanOrEqualTo(String value) {
|
||||
addCriterion("delete_Flag <=", value, "deleteFlag");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andDeleteFlagLike(String value) {
|
||||
addCriterion("delete_Flag like", value, "deleteFlag");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andDeleteFlagNotLike(String value) {
|
||||
addCriterion("delete_Flag not like", value, "deleteFlag");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andDeleteFlagIn(List<String> values) {
|
||||
addCriterion("delete_Flag in", values, "deleteFlag");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andDeleteFlagNotIn(List<String> values) {
|
||||
addCriterion("delete_Flag not in", values, "deleteFlag");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andDeleteFlagBetween(String value1, String value2) {
|
||||
addCriterion("delete_Flag between", value1, value2, "deleteFlag");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andDeleteFlagNotBetween(String value1, String value2) {
|
||||
addCriterion("delete_Flag not between", value1, value2, "deleteFlag");
|
||||
return (Criteria) this;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* This class was generated by MyBatis Generator.
|
||||
* This class corresponds to the database table jsh_assetcategory
|
||||
*
|
||||
* @mbggenerated do_not_delete_during_merge
|
||||
*/
|
||||
public static class Criteria extends GeneratedCriteria {
|
||||
|
||||
protected Criteria() {
|
||||
super();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* This class was generated by MyBatis Generator.
|
||||
* This class corresponds to the database table jsh_assetcategory
|
||||
*
|
||||
* @mbggenerated
|
||||
*/
|
||||
public static class Criterion {
|
||||
private String condition;
|
||||
|
||||
private Object value;
|
||||
|
||||
private Object secondValue;
|
||||
|
||||
private boolean noValue;
|
||||
|
||||
private boolean singleValue;
|
||||
|
||||
private boolean betweenValue;
|
||||
|
||||
private boolean listValue;
|
||||
|
||||
private String typeHandler;
|
||||
|
||||
public String getCondition() {
|
||||
return condition;
|
||||
}
|
||||
|
||||
public Object getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
public Object getSecondValue() {
|
||||
return secondValue;
|
||||
}
|
||||
|
||||
public boolean isNoValue() {
|
||||
return noValue;
|
||||
}
|
||||
|
||||
public boolean isSingleValue() {
|
||||
return singleValue;
|
||||
}
|
||||
|
||||
public boolean isBetweenValue() {
|
||||
return betweenValue;
|
||||
}
|
||||
|
||||
public boolean isListValue() {
|
||||
return listValue;
|
||||
}
|
||||
|
||||
public String getTypeHandler() {
|
||||
return typeHandler;
|
||||
}
|
||||
|
||||
protected Criterion(String condition) {
|
||||
super();
|
||||
this.condition = condition;
|
||||
this.typeHandler = null;
|
||||
this.noValue = true;
|
||||
}
|
||||
|
||||
protected Criterion(String condition, Object value, String typeHandler) {
|
||||
super();
|
||||
this.condition = condition;
|
||||
this.value = value;
|
||||
this.typeHandler = typeHandler;
|
||||
if (value instanceof List<?>) {
|
||||
this.listValue = true;
|
||||
} else {
|
||||
this.singleValue = true;
|
||||
}
|
||||
}
|
||||
|
||||
protected Criterion(String condition, Object value) {
|
||||
this(condition, value, null);
|
||||
}
|
||||
|
||||
protected Criterion(String condition, Object value, Object secondValue, String typeHandler) {
|
||||
super();
|
||||
this.condition = condition;
|
||||
this.value = value;
|
||||
this.secondValue = secondValue;
|
||||
this.typeHandler = typeHandler;
|
||||
this.betweenValue = true;
|
||||
}
|
||||
|
||||
protected Criterion(String condition, Object value, Object secondValue) {
|
||||
this(condition, value, secondValue, null);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -11,10 +11,6 @@ public class DepotItemVo4DetailByTypeAndMId {
|
||||
private Integer bnum;
|
||||
|
||||
private Date otime;
|
||||
//仓库名称
|
||||
private String depotName;
|
||||
//调入仓库名称
|
||||
private String depotInName;
|
||||
|
||||
public String getNumber() {
|
||||
return number;
|
||||
@@ -47,20 +43,4 @@ public class DepotItemVo4DetailByTypeAndMId {
|
||||
public void setOtime(Date otime) {
|
||||
this.otime = otime;
|
||||
}
|
||||
|
||||
public String getDepotName() {
|
||||
return depotName;
|
||||
}
|
||||
|
||||
public void setDepotName(String depotName) {
|
||||
this.depotName = depotName;
|
||||
}
|
||||
|
||||
public String getDepotInName() {
|
||||
return depotInName;
|
||||
}
|
||||
|
||||
public void setDepotInName(String depotInName) {
|
||||
this.depotInName = depotInName;
|
||||
}
|
||||
}
|
||||
@@ -97,14 +97,6 @@ public class Functions {
|
||||
*/
|
||||
private String deleteFlag;
|
||||
|
||||
/**
|
||||
* This field was generated by MyBatis Generator.
|
||||
* This field corresponds to the database column jsh_functions.tenant_id
|
||||
*
|
||||
* @mbggenerated
|
||||
*/
|
||||
private Long tenantId;
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
* This method returns the value of the database column jsh_functions.Id
|
||||
@@ -392,28 +384,4 @@ public class Functions {
|
||||
public void setDeleteFlag(String deleteFlag) {
|
||||
this.deleteFlag = deleteFlag == null ? null : deleteFlag.trim();
|
||||
}
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
* This method returns the value of the database column jsh_functions.tenant_id
|
||||
*
|
||||
* @return the value of jsh_functions.tenant_id
|
||||
*
|
||||
* @mbggenerated
|
||||
*/
|
||||
public Long getTenantId() {
|
||||
return tenantId;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
* This method sets the value of the database column jsh_functions.tenant_id
|
||||
*
|
||||
* @param tenantId the value for jsh_functions.tenant_id
|
||||
*
|
||||
* @mbggenerated
|
||||
*/
|
||||
public void setTenantId(Long tenantId) {
|
||||
this.tenantId = tenantId;
|
||||
}
|
||||
}
|
||||
@@ -1003,66 +1003,6 @@ public class FunctionsExample {
|
||||
addCriterion("delete_Flag not between", value1, value2, "deleteFlag");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andTenantIdIsNull() {
|
||||
addCriterion("tenant_id is null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andTenantIdIsNotNull() {
|
||||
addCriterion("tenant_id is not null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andTenantIdEqualTo(Long value) {
|
||||
addCriterion("tenant_id =", value, "tenantId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andTenantIdNotEqualTo(Long value) {
|
||||
addCriterion("tenant_id <>", value, "tenantId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andTenantIdGreaterThan(Long value) {
|
||||
addCriterion("tenant_id >", value, "tenantId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andTenantIdGreaterThanOrEqualTo(Long value) {
|
||||
addCriterion("tenant_id >=", value, "tenantId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andTenantIdLessThan(Long value) {
|
||||
addCriterion("tenant_id <", value, "tenantId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andTenantIdLessThanOrEqualTo(Long value) {
|
||||
addCriterion("tenant_id <=", value, "tenantId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andTenantIdIn(List<Long> values) {
|
||||
addCriterion("tenant_id in", values, "tenantId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andTenantIdNotIn(List<Long> values) {
|
||||
addCriterion("tenant_id not in", values, "tenantId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andTenantIdBetween(Long value1, Long value2) {
|
||||
addCriterion("tenant_id between", value1, value2, "tenantId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andTenantIdNotBetween(Long value1, Long value2) {
|
||||
addCriterion("tenant_id not between", value1, value2, "tenantId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -49,14 +49,6 @@ public class MaterialProperty {
|
||||
*/
|
||||
private String deleteFlag;
|
||||
|
||||
/**
|
||||
* This field was generated by MyBatis Generator.
|
||||
* This field corresponds to the database column jsh_materialproperty.tenant_id
|
||||
*
|
||||
* @mbggenerated
|
||||
*/
|
||||
private Long tenantId;
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
* This method returns the value of the database column jsh_materialproperty.id
|
||||
@@ -200,28 +192,4 @@ public class MaterialProperty {
|
||||
public void setDeleteFlag(String deleteFlag) {
|
||||
this.deleteFlag = deleteFlag == null ? null : deleteFlag.trim();
|
||||
}
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
* This method returns the value of the database column jsh_materialproperty.tenant_id
|
||||
*
|
||||
* @return the value of jsh_materialproperty.tenant_id
|
||||
*
|
||||
* @mbggenerated
|
||||
*/
|
||||
public Long getTenantId() {
|
||||
return tenantId;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
* This method sets the value of the database column jsh_materialproperty.tenant_id
|
||||
*
|
||||
* @param tenantId the value for jsh_materialproperty.tenant_id
|
||||
*
|
||||
* @mbggenerated
|
||||
*/
|
||||
public void setTenantId(Long tenantId) {
|
||||
this.tenantId = tenantId;
|
||||
}
|
||||
}
|
||||
@@ -593,66 +593,6 @@ public class MaterialPropertyExample {
|
||||
addCriterion("delete_Flag not between", value1, value2, "deleteFlag");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andTenantIdIsNull() {
|
||||
addCriterion("tenant_id is null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andTenantIdIsNotNull() {
|
||||
addCriterion("tenant_id is not null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andTenantIdEqualTo(Long value) {
|
||||
addCriterion("tenant_id =", value, "tenantId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andTenantIdNotEqualTo(Long value) {
|
||||
addCriterion("tenant_id <>", value, "tenantId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andTenantIdGreaterThan(Long value) {
|
||||
addCriterion("tenant_id >", value, "tenantId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andTenantIdGreaterThanOrEqualTo(Long value) {
|
||||
addCriterion("tenant_id >=", value, "tenantId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andTenantIdLessThan(Long value) {
|
||||
addCriterion("tenant_id <", value, "tenantId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andTenantIdLessThanOrEqualTo(Long value) {
|
||||
addCriterion("tenant_id <=", value, "tenantId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andTenantIdIn(List<Long> values) {
|
||||
addCriterion("tenant_id in", values, "tenantId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andTenantIdNotIn(List<Long> values) {
|
||||
addCriterion("tenant_id not in", values, "tenantId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andTenantIdBetween(Long value1, Long value2) {
|
||||
addCriterion("tenant_id between", value1, value2, "tenantId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andTenantIdNotBetween(Long value1, Long value2) {
|
||||
addCriterion("tenant_id not between", value1, value2, "tenantId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -49,14 +49,6 @@ public class UserBusiness {
|
||||
*/
|
||||
private String deleteFlag;
|
||||
|
||||
/**
|
||||
* This field was generated by MyBatis Generator.
|
||||
* This field corresponds to the database column jsh_userbusiness.tenant_id
|
||||
*
|
||||
* @mbggenerated
|
||||
*/
|
||||
private Long tenantId;
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
* This method returns the value of the database column jsh_userbusiness.Id
|
||||
@@ -200,28 +192,4 @@ public class UserBusiness {
|
||||
public void setDeleteFlag(String deleteFlag) {
|
||||
this.deleteFlag = deleteFlag == null ? null : deleteFlag.trim();
|
||||
}
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
* This method returns the value of the database column jsh_userbusiness.tenant_id
|
||||
*
|
||||
* @return the value of jsh_userbusiness.tenant_id
|
||||
*
|
||||
* @mbggenerated
|
||||
*/
|
||||
public Long getTenantId() {
|
||||
return tenantId;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
* This method sets the value of the database column jsh_userbusiness.tenant_id
|
||||
*
|
||||
* @param tenantId the value for jsh_userbusiness.tenant_id
|
||||
*
|
||||
* @mbggenerated
|
||||
*/
|
||||
public void setTenantId(Long tenantId) {
|
||||
this.tenantId = tenantId;
|
||||
}
|
||||
}
|
||||
@@ -603,66 +603,6 @@ public class UserBusinessExample {
|
||||
addCriterion("delete_Flag not between", value1, value2, "deleteFlag");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andTenantIdIsNull() {
|
||||
addCriterion("tenant_id is null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andTenantIdIsNotNull() {
|
||||
addCriterion("tenant_id is not null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andTenantIdEqualTo(Long value) {
|
||||
addCriterion("tenant_id =", value, "tenantId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andTenantIdNotEqualTo(Long value) {
|
||||
addCriterion("tenant_id <>", value, "tenantId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andTenantIdGreaterThan(Long value) {
|
||||
addCriterion("tenant_id >", value, "tenantId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andTenantIdGreaterThanOrEqualTo(Long value) {
|
||||
addCriterion("tenant_id >=", value, "tenantId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andTenantIdLessThan(Long value) {
|
||||
addCriterion("tenant_id <", value, "tenantId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andTenantIdLessThanOrEqualTo(Long value) {
|
||||
addCriterion("tenant_id <=", value, "tenantId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andTenantIdIn(List<Long> values) {
|
||||
addCriterion("tenant_id in", values, "tenantId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andTenantIdNotIn(List<Long> values) {
|
||||
addCriterion("tenant_id not in", values, "tenantId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andTenantIdBetween(Long value1, Long value2) {
|
||||
addCriterion("tenant_id between", value1, value2, "tenantId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andTenantIdNotBetween(Long value1, Long value2) {
|
||||
addCriterion("tenant_id not between", value1, value2, "tenantId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -25,6 +25,7 @@ public interface AccountHeadMapperEx {
|
||||
@Param("beginTime") String beginTime,
|
||||
@Param("endTime") String endTime);
|
||||
|
||||
Long getMaxId();
|
||||
|
||||
BigDecimal findAllMoney(
|
||||
@Param("supplierId") Integer supplierId,
|
||||
@@ -42,7 +43,4 @@ public interface AccountHeadMapperEx {
|
||||
List<AccountHead> getAccountHeadListByOrganIds(@Param("organIds") String[] organIds);
|
||||
|
||||
List<AccountHead> getAccountHeadListByHandsPersonIds(@Param("handsPersonIds") String[] handsPersonIds);
|
||||
|
||||
int addAccountHead(AccountHead accountHead);
|
||||
int updateAccountHead(AccountHead accountHead);
|
||||
}
|
||||
@@ -38,6 +38,7 @@ public interface DepotHeadMapperEx {
|
||||
@Param("materialParam") String materialParam,
|
||||
@Param("depotIds") String depotIds);
|
||||
|
||||
Long getMaxId();
|
||||
|
||||
String findMaterialsListByHeaderId(
|
||||
@Param("id") Long id);
|
||||
@@ -110,6 +111,7 @@ public interface DepotHeadMapperEx {
|
||||
* */
|
||||
void updatedepotHead(DepotHead depotHead);
|
||||
|
||||
void updateBuildOnlyNumber();
|
||||
/**
|
||||
* 获得一个全局唯一的数作为订单号的追加
|
||||
* */
|
||||
|
||||
@@ -36,15 +36,6 @@ public interface DepotItemMapperEx {
|
||||
Long findDetailByTypeAndMaterialIdCounts(
|
||||
@Param("mId") Long mId);
|
||||
|
||||
|
||||
int findByTypeAndDepotIdAndMaterialIdIn(
|
||||
@Param("depotId") Long depotId,
|
||||
@Param("mId") Long mId);
|
||||
|
||||
int findByTypeAndDepotIdAndMaterialIdOut(
|
||||
@Param("depotId") Long depotId,
|
||||
@Param("mId") Long mId);
|
||||
|
||||
List<DepotItemVo4WithInfoEx> getDetailList(
|
||||
@Param("headerId") Long headerId);
|
||||
|
||||
@@ -115,6 +106,4 @@ public interface DepotItemMapperEx {
|
||||
int findStockWarningCountTotal( @Param("pid") Integer pid);
|
||||
|
||||
BigDecimal getFinishNumber(@Param("mid") Long mid, @Param("linkNumber") String linkNumber);
|
||||
|
||||
BigDecimal getCurrentRepByMaterialIdAndDepotId(@Param("materialId") Long materialId, @Param("depotId") Long depotId,@Param("tenantId")Long tenantId);
|
||||
}
|
||||
|
||||
@@ -6,7 +6,6 @@ import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public interface RoleMapperEx {
|
||||
|
||||
@@ -19,5 +18,4 @@ public interface RoleMapperEx {
|
||||
@Param("name") String name);
|
||||
|
||||
int batchDeleteRoleByIds(@Param("updateTime") Date updateTime, @Param("updater") Long updater, @Param("ids") String ids[]);
|
||||
List<Role> getRoleList(Map<String, String> parameterMap);
|
||||
}
|
||||
@@ -93,4 +93,4 @@ public interface TenantMapper {
|
||||
* @mbggenerated
|
||||
*/
|
||||
int updateByPrimaryKey(Tenant record);
|
||||
}
|
||||
}
|
||||
@@ -14,4 +14,4 @@ public interface TenantMapperEx {
|
||||
|
||||
Long countsByTenant(
|
||||
@Param("loginName") String loginName);
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,5 @@
|
||||
package com.jsh.erp.datasource.mappers;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.SqlParser;
|
||||
import com.jsh.erp.datasource.entities.User;
|
||||
import com.jsh.erp.datasource.entities.UserEx;
|
||||
import com.jsh.erp.datasource.entities.UserExample;
|
||||
@@ -29,18 +28,12 @@ public interface UserMapperEx {
|
||||
int addUser(UserEx ue);
|
||||
|
||||
int updateUser(UserEx ue);
|
||||
/**
|
||||
* 这个查询不添加租户id,保证登录名全局唯一
|
||||
* */
|
||||
List<User> getUserListByLoginName(@Param("loginame") String loginame);
|
||||
|
||||
List<User> getUserListByUserNameOrLoginName(@Param("userName") String userName,
|
||||
@Param("loginame") String loginame);
|
||||
|
||||
int batDeleteOrUpdateUser(@Param("ids") String ids[], @Param("status") byte status);
|
||||
|
||||
List<TreeNodeEx> getNodeTree();
|
||||
List<TreeNodeEx> getNextNodeTree(Map<String, Object> parameterMap);
|
||||
|
||||
List<User> getUserListByUserNameAndTenantId(@Param("userName")String userName, @Param("tenantId")Long tenantId);
|
||||
|
||||
String addRegisterUserNotInclueUser(@Param("userId") Long userId,@Param("tenantId") Long tenantId,@Param("roleId") Long roleId);
|
||||
List<User> getUserListByloginNameAndPassword(@Param("loginame")String loginame, @Param("password")String password);
|
||||
}
|
||||
@@ -9,7 +9,6 @@ import com.jsh.erp.datasource.mappers.AccountHeadMapper;
|
||||
import com.jsh.erp.datasource.mappers.AccountHeadMapperEx;
|
||||
import com.jsh.erp.datasource.mappers.AccountItemMapperEx;
|
||||
import com.jsh.erp.exception.BusinessRunTimeException;
|
||||
import com.jsh.erp.service.accountItem.AccountItemService;
|
||||
import com.jsh.erp.exception.JshException;
|
||||
import com.jsh.erp.service.log.LogService;
|
||||
import com.jsh.erp.service.user.UserService;
|
||||
@@ -24,7 +23,6 @@ import org.springframework.web.context.request.ServletRequestAttributes;
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.math.BigDecimal;
|
||||
import java.sql.Timestamp;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
@@ -44,8 +42,6 @@ public class AccountHeadService {
|
||||
private LogService logService;
|
||||
@Resource
|
||||
private AccountItemMapperEx accountItemMapperEx;
|
||||
@Resource
|
||||
private AccountItemService accountItemService;
|
||||
|
||||
public AccountHead getAccountHead(long id) throws Exception {
|
||||
AccountHead result=null;
|
||||
@@ -162,6 +158,16 @@ public class AccountHeadService {
|
||||
return list==null?0:list.size();
|
||||
}
|
||||
|
||||
public Long getMaxId()throws Exception {
|
||||
Long result = null;
|
||||
try{
|
||||
result = accountHeadMapperEx.getMaxId();
|
||||
}catch(Exception e){
|
||||
JshException.readFail(logger, e);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public BigDecimal findAllMoney(Integer supplierId, String type, String mode, String endTime) {
|
||||
String modeName = "";
|
||||
if (mode.equals("实际")) {
|
||||
@@ -306,49 +312,4 @@ public class AccountHeadService {
|
||||
deleteTotal= batchDeleteAccountHeadByIds(ids);
|
||||
return deleteTotal;
|
||||
}
|
||||
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
||||
public void addAccountHeadAndDetail(String beanJson, String inserted, String deleted, String updated, String listType) throws Exception {
|
||||
/**处理财务信息*/
|
||||
AccountHead accountHead = JSONObject.parseObject(beanJson, AccountHead.class);
|
||||
try{
|
||||
accountHeadMapperEx.addAccountHead(accountHead);
|
||||
}catch(Exception e){
|
||||
logger.error("异常码[{}],异常提示[{}],异常[{}]",
|
||||
ExceptionConstants.DATA_WRITE_FAIL_CODE,ExceptionConstants.DATA_WRITE_FAIL_MSG,e);
|
||||
throw new BusinessRunTimeException(ExceptionConstants.DATA_WRITE_FAIL_CODE,
|
||||
ExceptionConstants.DATA_WRITE_FAIL_MSG);
|
||||
}
|
||||
/**
|
||||
* create by: qiankunpingtai
|
||||
* create time: 2019/5/22 10:30
|
||||
* website:https://qiankunpingtai.cn
|
||||
* description:
|
||||
* 处理财务明细信息
|
||||
*
|
||||
*/
|
||||
accountItemService.saveDetials(inserted, deleted, updated, accountHead.getId(), listType);
|
||||
|
||||
}
|
||||
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
||||
public void updateAccountHeadAndDetail(Long id, String beanJson, String inserted, String deleted, String updated, String listType)throws Exception {
|
||||
/**更新财务信息*/
|
||||
AccountHead accountHead = JSONObject.parseObject(beanJson, AccountHead.class);
|
||||
accountHead.setId(id);
|
||||
try{
|
||||
accountHeadMapperEx.updateAccountHead(accountHead);
|
||||
}catch(Exception e){
|
||||
logger.error("异常码[{}],异常提示[{}],异常[{}]",
|
||||
ExceptionConstants.DATA_WRITE_FAIL_CODE,ExceptionConstants.DATA_WRITE_FAIL_MSG,e);
|
||||
throw new BusinessRunTimeException(ExceptionConstants.DATA_WRITE_FAIL_CODE,
|
||||
ExceptionConstants.DATA_WRITE_FAIL_MSG);
|
||||
}
|
||||
/**
|
||||
* create by: qiankunpingtai
|
||||
* create time: 2019/5/22 10:30
|
||||
* website:https://qiankunpingtai.cn
|
||||
* description:
|
||||
* 更新财务明细信息
|
||||
*/
|
||||
accountItemService.saveDetials(inserted, deleted, updated, accountHead.getId(), listType);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -228,15 +228,16 @@ public class DepotHeadService {
|
||||
/**
|
||||
* 创建一个唯一的序列号
|
||||
* */
|
||||
public String buildOnlyNumber()throws Exception{
|
||||
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
||||
public String buildOnlyNumber()throws Exception{
|
||||
Long buildOnlyNumber=null;
|
||||
synchronized (this){
|
||||
try{
|
||||
depotHeadMapperEx.updateBuildOnlyNumber(); //编号+1
|
||||
buildOnlyNumber= depotHeadMapperEx.getBuildOnlyNumber(BusinessConstants.DEPOT_NUMBER_SEQ);
|
||||
}catch(Exception e){
|
||||
JshException.writeFail(logger, e);
|
||||
}
|
||||
|
||||
}
|
||||
if(buildOnlyNumber<BusinessConstants.SEQ_TO_STRING_MIN_LENGTH){
|
||||
StringBuffer sb=new StringBuffer(buildOnlyNumber.toString());
|
||||
@@ -250,7 +251,15 @@ public class DepotHeadService {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public Long getMaxId()throws Exception {
|
||||
Long result = null;
|
||||
try{
|
||||
result = depotHeadMapperEx.getMaxId();
|
||||
}catch(Exception e){
|
||||
JshException.readFail(logger, e);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public String findMaterialsListByHeaderId(Long id)throws Exception {
|
||||
String result = null;
|
||||
@@ -460,7 +469,7 @@ public class DepotHeadService {
|
||||
* @return java.lang.String
|
||||
*/
|
||||
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
||||
public void addDepotHeadAndDetail(String beanJson, String inserted, String deleted, String updated) throws Exception {
|
||||
public void addDepotHeadAndDetail(String beanJson, String inserted, String deleted, String updated,Long tenantId) throws Exception {
|
||||
logService.insertLog(BusinessConstants.LOG_INTERFACE_NAME_DEPOT_HEAD,
|
||||
BusinessConstants.LOG_OPERATION_TYPE_ADD,
|
||||
((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest());
|
||||
@@ -485,7 +494,7 @@ public class DepotHeadService {
|
||||
}
|
||||
}
|
||||
/**入库和出库处理单据子表信息*/
|
||||
depotItemService.saveDetials(inserted,deleted,updated,depotHead.getId());
|
||||
depotItemService.saveDetials(inserted,deleted,updated,depotHead.getId(),tenantId);
|
||||
/**如果关联单据号非空则更新订单的状态为2 */
|
||||
if(depotHead.getLinknumber()!=null) {
|
||||
DepotHead depotHeadOrders = new DepotHead();
|
||||
@@ -537,7 +546,7 @@ public class DepotHeadService {
|
||||
}
|
||||
}
|
||||
/**入库和出库处理单据子表信息*/
|
||||
depotItemService.saveDetials(inserted,deleted,updated,depotHead.getId());
|
||||
depotItemService.saveDetials(inserted,deleted,updated,depotHead.getId(),tenantId);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -32,7 +32,6 @@ import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
|
||||
@Service
|
||||
public class DepotItemService {
|
||||
@@ -65,10 +64,7 @@ public class DepotItemService {
|
||||
try{
|
||||
result=depotItemMapper.selectByPrimaryKey(id);
|
||||
}catch(Exception e){
|
||||
logger.error("异常码[{}],异常提示[{}],异常[{}]",
|
||||
ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e);
|
||||
throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE,
|
||||
ExceptionConstants.DATA_READ_FAIL_MSG);
|
||||
JshException.readFail(logger, e);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
@@ -80,10 +76,7 @@ public class DepotItemService {
|
||||
try{
|
||||
list=depotItemMapper.selectByExample(example);
|
||||
}catch(Exception e){
|
||||
logger.error("异常码[{}],异常提示[{}],异常[{}]",
|
||||
ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e);
|
||||
throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE,
|
||||
ExceptionConstants.DATA_READ_FAIL_MSG);
|
||||
JshException.readFail(logger, e);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
@@ -93,10 +86,7 @@ public class DepotItemService {
|
||||
try{
|
||||
list=depotItemMapperEx.selectByConditionDepotItem(name, type, remark, offset, rows);
|
||||
}catch(Exception e){
|
||||
logger.error("异常码[{}],异常提示[{}],异常[{}]",
|
||||
ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e);
|
||||
throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE,
|
||||
ExceptionConstants.DATA_READ_FAIL_MSG);
|
||||
JshException.readFail(logger, e);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
@@ -106,10 +96,7 @@ public class DepotItemService {
|
||||
try{
|
||||
result=depotItemMapperEx.countsByDepotItem(name, type, remark);
|
||||
}catch(Exception e){
|
||||
logger.error("异常码[{}],异常提示[{}],异常[{}]",
|
||||
ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e);
|
||||
throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE,
|
||||
ExceptionConstants.DATA_READ_FAIL_MSG);
|
||||
JshException.readFail(logger, e);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
@@ -121,10 +108,7 @@ public class DepotItemService {
|
||||
try{
|
||||
result=depotItemMapper.insertSelective(depotItem);
|
||||
}catch(Exception e){
|
||||
logger.error("异常码[{}],异常提示[{}],异常[{}]",
|
||||
ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e);
|
||||
throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE,
|
||||
ExceptionConstants.DATA_READ_FAIL_MSG);
|
||||
JshException.readFail(logger, e);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
@@ -137,10 +121,7 @@ public class DepotItemService {
|
||||
try{
|
||||
result=depotItemMapper.updateByPrimaryKeySelective(depotItem);
|
||||
}catch(Exception e){
|
||||
logger.error("异常码[{}],异常提示[{}],异常[{}]",
|
||||
ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e);
|
||||
throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE,
|
||||
ExceptionConstants.DATA_READ_FAIL_MSG);
|
||||
JshException.readFail(logger, e);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
@@ -151,10 +132,7 @@ public class DepotItemService {
|
||||
try{
|
||||
result=depotItemMapper.deleteByPrimaryKey(id);
|
||||
}catch(Exception e){
|
||||
logger.error("异常码[{}],异常提示[{}],异常[{}]",
|
||||
ExceptionConstants.DATA_WRITE_FAIL_CODE,ExceptionConstants.DATA_WRITE_FAIL_MSG,e);
|
||||
throw new BusinessRunTimeException(ExceptionConstants.DATA_WRITE_FAIL_CODE,
|
||||
ExceptionConstants.DATA_WRITE_FAIL_MSG);
|
||||
JshException.writeFail(logger, e);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
@@ -168,10 +146,7 @@ public class DepotItemService {
|
||||
try{
|
||||
result=depotItemMapper.deleteByExample(example);
|
||||
}catch(Exception e){
|
||||
logger.error("异常码[{}],异常提示[{}],异常[{}]",
|
||||
ExceptionConstants.DATA_WRITE_FAIL_CODE,ExceptionConstants.DATA_WRITE_FAIL_MSG,e);
|
||||
throw new BusinessRunTimeException(ExceptionConstants.DATA_WRITE_FAIL_CODE,
|
||||
ExceptionConstants.DATA_WRITE_FAIL_MSG);
|
||||
JshException.writeFail(logger, e);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
@@ -183,10 +158,7 @@ public class DepotItemService {
|
||||
try{
|
||||
list=depotItemMapper.selectByExample(example);
|
||||
}catch(Exception e){
|
||||
logger.error("异常码[{}],异常提示[{}],异常[{}]",
|
||||
ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e);
|
||||
throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE,
|
||||
ExceptionConstants.DATA_READ_FAIL_MSG);
|
||||
JshException.readFail(logger, e);
|
||||
}
|
||||
return list==null?0:list.size();
|
||||
}
|
||||
@@ -201,10 +173,7 @@ public class DepotItemService {
|
||||
try{
|
||||
list = depotItemMapperEx.findDetailByTypeAndMaterialIdList(mId, QueryUtils.offset(map), QueryUtils.rows(map));
|
||||
}catch(Exception e){
|
||||
logger.error("异常码[{}],异常提示[{}],异常[{}]",
|
||||
ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e);
|
||||
throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE,
|
||||
ExceptionConstants.DATA_READ_FAIL_MSG);
|
||||
JshException.readFail(logger, e);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
@@ -245,13 +214,6 @@ public class DepotItemService {
|
||||
}
|
||||
return result;
|
||||
}
|
||||
public int findByTypeAndMaterialIdAndDepotId(String type, Long mId, Long depotId) {
|
||||
if(type.equals(TYPE)) {
|
||||
return depotItemMapperEx.findByTypeAndDepotIdAndMaterialIdIn(depotId, mId);
|
||||
} else {
|
||||
return depotItemMapperEx.findByTypeAndDepotIdAndMaterialIdOut(depotId, mId);
|
||||
}
|
||||
}
|
||||
|
||||
public List<DepotItemVo4WithInfoEx> getDetailList(Long headerId)throws Exception {
|
||||
List<DepotItemVo4WithInfoEx> list =null;
|
||||
@@ -292,13 +254,12 @@ public class DepotItemService {
|
||||
result= depotItemMapperEx.buyOrSalePrice(type, subType, MId, MonthTime, sumType);
|
||||
}
|
||||
}catch(Exception e){
|
||||
logger.error("异常码[{}],异常提示[{}],异常[{}]",
|
||||
ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e);
|
||||
throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE,
|
||||
ExceptionConstants.DATA_READ_FAIL_MSG);
|
||||
JshException.readFail(logger, e);
|
||||
}
|
||||
return result;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 统计采购或销售的总金额
|
||||
* @param type
|
||||
@@ -317,14 +278,13 @@ public class DepotItemService {
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 2019-02-02修改
|
||||
* 我之前对操作数量的理解有偏差
|
||||
* 这里重点重申一下:BasicNumber=OperNumber*ratio
|
||||
* */
|
||||
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
||||
public String saveDetials(String inserted, String deleted, String updated, Long headerId) throws Exception{
|
||||
public String saveDetials(String inserted, String deleted, String updated, Long headerId, Long tenantId) throws Exception{
|
||||
logService.insertLog(BusinessConstants.LOG_INTERFACE_NAME_DEPOT_ITEM,
|
||||
BusinessConstants.LOG_OPERATION_TYPE_ADD,
|
||||
((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest());
|
||||
@@ -333,185 +293,183 @@ public class DepotItemService {
|
||||
try{
|
||||
depotHead =depotHeadMapper.selectByPrimaryKey(headerId);
|
||||
}catch(Exception e){
|
||||
logger.error("异常码[{}],异常提示[{}],异常[{}]",
|
||||
ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e);
|
||||
throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE,
|
||||
ExceptionConstants.DATA_READ_FAIL_MSG);
|
||||
JshException.readFail(logger, e);
|
||||
}
|
||||
//获得当前操作人
|
||||
User userInfo=userService.getCurrentUser();
|
||||
//转为json
|
||||
JSONArray insertedJson = JSONArray.parseArray(inserted);
|
||||
JSONArray deletedJson = JSONArray.parseArray(deleted);
|
||||
JSONArray updatedJson = JSONArray.parseArray(updated);
|
||||
/**
|
||||
* 2019-01-28优先处理删除的
|
||||
* 删除的可以继续卖,删除的需要将使用的序列号回收
|
||||
* 插入的需要判断当前货源是否充足
|
||||
* 更新的需要判断货源是否充足
|
||||
* */
|
||||
if (null != deletedJson) {
|
||||
StringBuffer bf=new StringBuffer();
|
||||
for (int i = 0; i < deletedJson.size(); i++) {
|
||||
//首先回收序列号,如果是调拨,不用处理序列号
|
||||
JSONObject tempDeletedJson = JSONObject.parseObject(deletedJson.getString(i));
|
||||
if(BusinessConstants.DEPOTHEAD_TYPE_OUT.equals(depotHead.getType())
|
||||
&&!BusinessConstants.SUB_TYPE_TRANSFER.equals(depotHead.getSubtype())){
|
||||
DepotItem depotItem = getDepotItem(tempDeletedJson.getLong("Id"));
|
||||
JSONArray insertedJson = JSONArray.parseArray(inserted);
|
||||
JSONArray deletedJson = JSONArray.parseArray(deleted);
|
||||
JSONArray updatedJson = JSONArray.parseArray(updated);
|
||||
/**
|
||||
* 2019-01-28优先处理删除的
|
||||
* 删除的可以继续卖,删除的需要将使用的序列号回收
|
||||
* 插入的需要判断当前货源是否充足
|
||||
* 更新的需要判断货源是否充足
|
||||
* */
|
||||
if (null != deletedJson) {
|
||||
StringBuffer bf=new StringBuffer();
|
||||
for (int i = 0; i < deletedJson.size(); i++) {
|
||||
//首先回收序列号,如果是调拨,不用处理序列号
|
||||
JSONObject tempDeletedJson = JSONObject.parseObject(deletedJson.getString(i));
|
||||
if(BusinessConstants.DEPOTHEAD_TYPE_OUT.equals(depotHead.getType())
|
||||
&&!BusinessConstants.SUB_TYPE_TRANSFER.equals(depotHead.getSubtype())){
|
||||
DepotItem depotItem = getDepotItem(tempDeletedJson.getLong("Id"));
|
||||
if(depotItem==null){
|
||||
continue;
|
||||
}
|
||||
/**
|
||||
* 判断商品是否开启序列号,开启的收回序列号,未开启的跳过
|
||||
* */
|
||||
Material material= materialService.getMaterial(depotItem.getMaterialid());
|
||||
if(material==null){
|
||||
continue;
|
||||
}
|
||||
if(BusinessConstants.ENABLE_SERIAL_NUMBER_ENABLED.equals(material.getEnableserialnumber())){
|
||||
serialNumberService.cancelSerialNumber(depotItem.getMaterialid(),depotItem.getHeaderid(),(depotItem.getBasicnumber()==null?0:depotItem.getBasicnumber()).intValue(),
|
||||
userInfo);
|
||||
}
|
||||
}
|
||||
this.deleteDepotItem(tempDeletedJson.getLong("Id"));
|
||||
bf.append(tempDeletedJson.getLong("Id"));
|
||||
if(i<(deletedJson.size()-1)){
|
||||
bf.append(",");
|
||||
}
|
||||
}
|
||||
this.batchDeleteDepotItemByIds(bf.toString());
|
||||
}
|
||||
if (null != insertedJson) {
|
||||
for (int i = 0; i < insertedJson.size(); i++) {
|
||||
DepotItem depotItem = new DepotItem();
|
||||
JSONObject tempInsertedJson = JSONObject.parseObject(insertedJson.getString(i));
|
||||
depotItem.setHeaderid(headerId);
|
||||
depotItem.setMaterialid(tempInsertedJson.getLong("MaterialId"));
|
||||
depotItem.setMunit(tempInsertedJson.getString("Unit"));
|
||||
if (!StringUtil.isEmpty(tempInsertedJson.get("OperNumber").toString())) {
|
||||
depotItem.setOpernumber(tempInsertedJson.getBigDecimal("OperNumber"));
|
||||
try {
|
||||
String Unit = tempInsertedJson.get("Unit").toString();
|
||||
BigDecimal oNumber = tempInsertedJson.getBigDecimal("OperNumber");
|
||||
Long mId = Long.parseLong(tempInsertedJson.get("MaterialId").toString());
|
||||
/***
|
||||
* 为什么调用的方法要先把基础单位去掉,去掉之后后续还能获取到?
|
||||
* */
|
||||
//以下进行单位换算
|
||||
// String UnitName = findUnitName(mId); //查询计量单位名称
|
||||
String unitName = materialService.findUnitName(mId);
|
||||
if (!StringUtil.isEmpty(unitName)) {
|
||||
String unitList = unitName.substring(0, unitName.indexOf("("));
|
||||
String ratioList = unitName.substring(unitName.indexOf("("));
|
||||
String basicUnit = unitList.substring(0, unitList.indexOf(",")); //基本单位
|
||||
String otherUnit = unitList.substring(unitList.indexOf(",") + 1); //副单位
|
||||
Integer ratio = Integer.parseInt(ratioList.substring(ratioList.indexOf(":") + 1).replace(")", "")); //比例
|
||||
if (Unit.equals(basicUnit)) { //如果等于基础单位
|
||||
depotItem.setBasicnumber(oNumber); //数量一致
|
||||
} else if (Unit.equals(otherUnit)) { //如果等于副单位
|
||||
depotItem.setBasicnumber(oNumber.multiply(new BigDecimal(ratio)) ); //数量乘以比例
|
||||
}
|
||||
} else {
|
||||
depotItem.setBasicnumber(oNumber); //其他情况
|
||||
}
|
||||
} catch (Exception e) {
|
||||
logger.error(">>>>>>>>>>>>>>>>>>>设置基础数量异常", e);
|
||||
}
|
||||
}
|
||||
if (!StringUtil.isEmpty(tempInsertedJson.get("UnitPrice").toString())) {
|
||||
depotItem.setUnitprice(tempInsertedJson.getBigDecimal("UnitPrice"));
|
||||
}
|
||||
if (!StringUtil.isEmpty(tempInsertedJson.get("TaxUnitPrice").toString())) {
|
||||
depotItem.setTaxunitprice(tempInsertedJson.getBigDecimal("TaxUnitPrice"));
|
||||
}
|
||||
if (!StringUtil.isEmpty(tempInsertedJson.get("AllPrice").toString())) {
|
||||
depotItem.setAllprice(tempInsertedJson.getBigDecimal("AllPrice"));
|
||||
}
|
||||
depotItem.setRemark(tempInsertedJson.getString("Remark"));
|
||||
if (tempInsertedJson.get("DepotId") != null && !StringUtil.isEmpty(tempInsertedJson.get("DepotId").toString())) {
|
||||
depotItem.setDepotid(tempInsertedJson.getLong("DepotId"));
|
||||
}
|
||||
if (tempInsertedJson.get("AnotherDepotId") != null && !StringUtil.isEmpty(tempInsertedJson.get("AnotherDepotId").toString())) {
|
||||
depotItem.setAnotherdepotid(tempInsertedJson.getLong("AnotherDepotId"));
|
||||
}
|
||||
if (!StringUtil.isEmpty(tempInsertedJson.get("TaxRate").toString())) {
|
||||
depotItem.setTaxrate(tempInsertedJson.getBigDecimal("TaxRate"));
|
||||
}
|
||||
if (!StringUtil.isEmpty(tempInsertedJson.get("TaxMoney").toString())) {
|
||||
depotItem.setTaxmoney(tempInsertedJson.getBigDecimal("TaxMoney"));
|
||||
}
|
||||
if (!StringUtil.isEmpty(tempInsertedJson.get("TaxLastMoney").toString())) {
|
||||
depotItem.setTaxlastmoney(tempInsertedJson.getBigDecimal("TaxLastMoney"));
|
||||
}
|
||||
if (tempInsertedJson.get("OtherField1") != null) {
|
||||
depotItem.setOtherfield1(tempInsertedJson.getString("OtherField1"));
|
||||
}
|
||||
if (tempInsertedJson.get("OtherField2") != null) {
|
||||
depotItem.setOtherfield2(tempInsertedJson.getString("OtherField2"));
|
||||
}
|
||||
if (tempInsertedJson.get("OtherField3") != null) {
|
||||
depotItem.setOtherfield3(tempInsertedJson.getString("OtherField3"));
|
||||
}
|
||||
if (tempInsertedJson.get("OtherField4") != null) {
|
||||
depotItem.setOtherfield4(tempInsertedJson.getString("OtherField4"));
|
||||
}
|
||||
if (tempInsertedJson.get("OtherField5") != null) {
|
||||
depotItem.setOtherfield5(tempInsertedJson.getString("OtherField5"));
|
||||
}
|
||||
if (tempInsertedJson.get("MType") != null) {
|
||||
depotItem.setMtype(tempInsertedJson.getString("MType"));
|
||||
}
|
||||
/**
|
||||
* 出库时判断库存是否充足
|
||||
* */
|
||||
if(BusinessConstants.DEPOTHEAD_TYPE_OUT.equals(depotHead.getType())){
|
||||
if(depotItem==null){
|
||||
continue;
|
||||
}
|
||||
Material material= materialService.getMaterial(depotItem.getMaterialid());
|
||||
if(material==null){
|
||||
continue;
|
||||
}
|
||||
BigDecimal stock = getStockByParam(depotItem.getDepotid(),depotItem.getMaterialid(),null,null,tenantId);
|
||||
BigDecimal thisBasicNumber = depotItem.getBasicnumber()==null?BigDecimal.ZERO:depotItem.getBasicnumber();
|
||||
if(stock.compareTo(thisBasicNumber)<0){
|
||||
throw new BusinessRunTimeException(ExceptionConstants.MATERIAL_STOCK_NOT_ENOUGH_CODE,
|
||||
String.format(ExceptionConstants.MATERIAL_STOCK_NOT_ENOUGH_MSG,material==null?"":material.getName()));
|
||||
}
|
||||
|
||||
/**出库时处理序列号*/
|
||||
if(!BusinessConstants.SUB_TYPE_TRANSFER.equals(depotHead.getSubtype())) {
|
||||
/**
|
||||
* 判断商品是否开启序列号,开启的收回序列号,未开启的跳过
|
||||
* */
|
||||
if(BusinessConstants.ENABLE_SERIAL_NUMBER_ENABLED.equals(material.getEnableserialnumber())) {
|
||||
//查询单据子表中开启序列号的数据列表
|
||||
serialNumberService.checkAndUpdateSerialNumber(depotItem, userInfo);
|
||||
}
|
||||
}
|
||||
}
|
||||
this.insertDepotItemWithObj(depotItem);
|
||||
}
|
||||
}
|
||||
|
||||
if (null != updatedJson) {
|
||||
for (int i = 0; i < updatedJson.size(); i++) {
|
||||
JSONObject tempUpdatedJson = JSONObject.parseObject(updatedJson.getString(i));
|
||||
DepotItem depotItem = this.getDepotItem(tempUpdatedJson.getLong("Id"));
|
||||
if(depotItem==null){
|
||||
continue;
|
||||
}
|
||||
/**
|
||||
* 判断商品是否开启序列号,开启的收回序列号,未开启的跳过
|
||||
* */
|
||||
Material material= materialService.getMaterial(depotItem.getMaterialid());
|
||||
if(material==null){
|
||||
continue;
|
||||
}
|
||||
if(BusinessConstants.ENABLE_SERIAL_NUMBER_ENABLED.equals(material.getEnableserialnumber())){
|
||||
serialNumberService.cancelSerialNumber(depotItem.getMaterialid(),depotItem.getHeaderid(),(depotItem.getBasicnumber()==null?0:depotItem.getBasicnumber()).intValue(),
|
||||
userInfo);
|
||||
}
|
||||
}
|
||||
this.deleteDepotItem(tempDeletedJson.getLong("Id"));
|
||||
bf.append(tempDeletedJson.getLong("Id"));
|
||||
if(i<(deletedJson.size()-1)){
|
||||
bf.append(",");
|
||||
}
|
||||
}
|
||||
this.batchDeleteDepotItemByIds(bf.toString());
|
||||
}
|
||||
if (null != insertedJson) {
|
||||
for (int i = 0; i < insertedJson.size(); i++) {
|
||||
DepotItem depotItem = new DepotItem();
|
||||
JSONObject tempInsertedJson = JSONObject.parseObject(insertedJson.getString(i));
|
||||
depotItem.setHeaderid(headerId);
|
||||
depotItem.setMaterialid(tempInsertedJson.getLong("MaterialId"));
|
||||
depotItem.setMunit(tempInsertedJson.getString("Unit"));
|
||||
Material material= materialService.getMaterial(depotItem.getMaterialid());
|
||||
if (!StringUtil.isEmpty(tempInsertedJson.get("OperNumber").toString())) {
|
||||
depotItem.setOpernumber(tempInsertedJson.getBigDecimal("OperNumber"));
|
||||
String Unit = tempInsertedJson.get("Unit").toString();
|
||||
BigDecimal oNumber = tempInsertedJson.getBigDecimal("OperNumber");
|
||||
Long mId = Long.parseLong(tempInsertedJson.get("MaterialId").toString());
|
||||
/***
|
||||
* 为什么调用的方法要先把基础单位去掉,去掉之后后续还能获取到?
|
||||
* */
|
||||
//以下进行单位换算
|
||||
// String UnitName = findUnitName(mId); //查询计量单位名称
|
||||
String unitName = materialService.findUnitName(mId);
|
||||
if (!StringUtil.isEmpty(unitName)) {
|
||||
String unitList = unitName.substring(0, unitName.indexOf("("));
|
||||
String ratioList = unitName.substring(unitName.indexOf("("));
|
||||
String basicUnit = unitList.substring(0, unitList.indexOf(",")); //基本单位
|
||||
String otherUnit = unitList.substring(unitList.indexOf(",") + 1); //副单位
|
||||
Integer ratio = Integer.parseInt(ratioList.substring(ratioList.indexOf(":") + 1).replace(")", "")); //比例
|
||||
if (Unit.equals(basicUnit)) { //如果等于基础单位
|
||||
depotItem.setBasicnumber(oNumber); //数量一致
|
||||
} else if (Unit.equals(otherUnit)) { //如果等于副单位
|
||||
depotItem.setBasicnumber(oNumber.multiply(new BigDecimal(ratio)) ); //数量乘以比例
|
||||
}else{
|
||||
//不等于基础单位也不等于副单位,单位存在问题
|
||||
throw new BusinessRunTimeException(ExceptionConstants.MATERIAL_UNIT_NOT_RIGHT_CODE,
|
||||
String.format(ExceptionConstants.MATERIAL_UNIT_NOT_RIGHT_MSG,material==null?"":material.getName(),Unit,basicUnit,otherUnit));
|
||||
}
|
||||
} else {
|
||||
depotItem.setBasicnumber(oNumber); //其他情况
|
||||
}
|
||||
}
|
||||
if (!StringUtil.isEmpty(tempInsertedJson.get("UnitPrice").toString())) {
|
||||
depotItem.setUnitprice(tempInsertedJson.getBigDecimal("UnitPrice"));
|
||||
}
|
||||
if (!StringUtil.isEmpty(tempInsertedJson.get("TaxUnitPrice").toString())) {
|
||||
depotItem.setTaxunitprice(tempInsertedJson.getBigDecimal("TaxUnitPrice"));
|
||||
}
|
||||
if (!StringUtil.isEmpty(tempInsertedJson.get("AllPrice").toString())) {
|
||||
depotItem.setAllprice(tempInsertedJson.getBigDecimal("AllPrice"));
|
||||
}
|
||||
depotItem.setRemark(tempInsertedJson.getString("Remark"));
|
||||
if (tempInsertedJson.get("DepotId") != null && !StringUtil.isEmpty(tempInsertedJson.get("DepotId").toString())) {
|
||||
depotItem.setDepotid(tempInsertedJson.getLong("DepotId"));
|
||||
}
|
||||
if (tempInsertedJson.get("AnotherDepotId") != null && !StringUtil.isEmpty(tempInsertedJson.get("AnotherDepotId").toString())) {
|
||||
depotItem.setAnotherdepotid(tempInsertedJson.getLong("AnotherDepotId"));
|
||||
}
|
||||
if (!StringUtil.isEmpty(tempInsertedJson.get("TaxRate").toString())) {
|
||||
depotItem.setTaxrate(tempInsertedJson.getBigDecimal("TaxRate"));
|
||||
}
|
||||
if (!StringUtil.isEmpty(tempInsertedJson.get("TaxMoney").toString())) {
|
||||
depotItem.setTaxmoney(tempInsertedJson.getBigDecimal("TaxMoney"));
|
||||
}
|
||||
if (!StringUtil.isEmpty(tempInsertedJson.get("TaxLastMoney").toString())) {
|
||||
depotItem.setTaxlastmoney(tempInsertedJson.getBigDecimal("TaxLastMoney"));
|
||||
}
|
||||
if (tempInsertedJson.get("OtherField1") != null) {
|
||||
depotItem.setOtherfield1(tempInsertedJson.getString("OtherField1"));
|
||||
}
|
||||
if (tempInsertedJson.get("OtherField2") != null) {
|
||||
depotItem.setOtherfield2(tempInsertedJson.getString("OtherField2"));
|
||||
}
|
||||
if (tempInsertedJson.get("OtherField3") != null) {
|
||||
depotItem.setOtherfield3(tempInsertedJson.getString("OtherField3"));
|
||||
}
|
||||
if (tempInsertedJson.get("OtherField4") != null) {
|
||||
depotItem.setOtherfield4(tempInsertedJson.getString("OtherField4"));
|
||||
}
|
||||
if (tempInsertedJson.get("OtherField5") != null) {
|
||||
depotItem.setOtherfield5(tempInsertedJson.getString("OtherField5"));
|
||||
}
|
||||
if (tempInsertedJson.get("MType") != null) {
|
||||
depotItem.setMtype(tempInsertedJson.getString("MType"));
|
||||
}
|
||||
/**
|
||||
* 出库时判断库存是否充足
|
||||
* */
|
||||
if(BusinessConstants.DEPOTHEAD_TYPE_OUT.equals(depotHead.getType())){
|
||||
if(depotItem==null){
|
||||
continue;
|
||||
}
|
||||
if(material==null){
|
||||
continue;
|
||||
}
|
||||
if(getCurrentRepByMaterialIdAndDepotId(material.getId(),depotItem.getDepotid()).compareTo(depotItem.getBasicnumber()==null?BigDecimal.ZERO:depotItem.getBasicnumber())==-1){
|
||||
throw new BusinessRunTimeException(ExceptionConstants.MATERIAL_STOCK_NOT_ENOUGH_CODE,
|
||||
String.format(ExceptionConstants.MATERIAL_STOCK_NOT_ENOUGH_MSG,material==null?"":material.getName()));
|
||||
}
|
||||
|
||||
/**出库时处理序列号*/
|
||||
if(!BusinessConstants.SUB_TYPE_TRANSFER.equals(depotHead.getSubtype())) {
|
||||
//首先回收序列号
|
||||
if(BusinessConstants.DEPOTHEAD_TYPE_OUT.equals(depotHead.getType())
|
||||
&&!BusinessConstants.SUB_TYPE_TRANSFER.equals(depotHead.getSubtype())) {
|
||||
/**
|
||||
* 判断商品是否开启序列号,开启的收回序列号,未开启的跳过
|
||||
* */
|
||||
if(BusinessConstants.ENABLE_SERIAL_NUMBER_ENABLED.equals(material.getEnableserialnumber())) {
|
||||
//查询单据子表中开启序列号的数据列表
|
||||
serialNumberService.checkAndUpdateSerialNumber(depotItem, userInfo);
|
||||
}
|
||||
}
|
||||
}
|
||||
this.insertDepotItemWithObj(depotItem);
|
||||
}
|
||||
}
|
||||
|
||||
if (null != updatedJson) {
|
||||
for (int i = 0; i < updatedJson.size(); i++) {
|
||||
JSONObject tempUpdatedJson = JSONObject.parseObject(updatedJson.getString(i));
|
||||
DepotItem depotItem = this.getDepotItem(tempUpdatedJson.getLong("Id"));
|
||||
if(depotItem==null){
|
||||
continue;
|
||||
}
|
||||
Material material= materialService.getMaterial(depotItem.getMaterialid());
|
||||
if(material==null){
|
||||
continue;
|
||||
}
|
||||
//首先回收序列号
|
||||
if(BusinessConstants.DEPOTHEAD_TYPE_OUT.equals(depotHead.getType())) {
|
||||
|
||||
if(!BusinessConstants.SUB_TYPE_TRANSFER.equals(depotHead.getSubtype())) {
|
||||
/**
|
||||
* 判断商品是否开启序列号,开启的收回序列号,未开启的跳过
|
||||
* */
|
||||
if (BusinessConstants.ENABLE_SERIAL_NUMBER_ENABLED.equals(material.getEnableserialnumber())) {
|
||||
serialNumberService.cancelSerialNumber(depotItem.getMaterialid(), depotItem.getHeaderid(), (depotItem.getBasicnumber() == null ? 0 : depotItem.getBasicnumber()).intValue(),
|
||||
serialNumberService.cancelSerialNumber(depotItem.getMaterialid(), depotItem.getHeaderid(), (depotItem.getBasicnumber()==null?0:depotItem.getBasicnumber()).intValue(),
|
||||
userInfo);
|
||||
}
|
||||
/**收回序列号的时候释放库存*/
|
||||
@@ -519,104 +477,102 @@ public class DepotItemService {
|
||||
depotItem.setBasicnumber(BigDecimal.ZERO);
|
||||
this.updateDepotItemWithObj(depotItem);
|
||||
}
|
||||
}
|
||||
depotItem.setId(tempUpdatedJson.getLong("Id"));
|
||||
depotItem.setMaterialid(tempUpdatedJson.getLong("MaterialId"));
|
||||
depotItem.setMunit(tempUpdatedJson.getString("Unit"));
|
||||
if(!material.getId().equals(depotItem.getMaterialid())){
|
||||
material= materialService.getMaterial(depotItem.getMaterialid());
|
||||
}
|
||||
if (!StringUtil.isEmpty(tempUpdatedJson.get("OperNumber").toString())) {
|
||||
depotItem.setOpernumber(tempUpdatedJson.getBigDecimal("OperNumber"));
|
||||
String Unit = tempUpdatedJson.get("Unit").toString();
|
||||
BigDecimal oNumber = tempUpdatedJson.getBigDecimal("OperNumber");
|
||||
Long mId = Long.parseLong(tempUpdatedJson.get("MaterialId").toString());
|
||||
//以下进行单位换算
|
||||
// String UnitName = findUnitName(mId); //查询计量单位名称
|
||||
String unitName = materialService.findUnitName(mId);
|
||||
if (!StringUtil.isEmpty(unitName)) {
|
||||
String unitList = unitName.substring(0, unitName.indexOf("("));
|
||||
String ratioList = unitName.substring(unitName.indexOf("("));
|
||||
String basicUnit = unitList.substring(0, unitList.indexOf(",")); //基本单位
|
||||
String otherUnit = unitList.substring(unitList.indexOf(",") + 1); //副单位
|
||||
Integer ratio = Integer.parseInt(ratioList.substring(ratioList.indexOf(":") + 1).replace(")", "")); //比例
|
||||
if (Unit.equals(basicUnit)) { //如果等于基础单位
|
||||
depotItem.setBasicnumber(oNumber); //数量一致
|
||||
} else if (Unit.equals(otherUnit)) { //如果等于副单位
|
||||
depotItem.setBasicnumber(oNumber.multiply(new BigDecimal(ratio))); //数量乘以比例
|
||||
}else{
|
||||
//不等于基础单位也不等于副单位,单位存在问题
|
||||
throw new BusinessRunTimeException(ExceptionConstants.MATERIAL_UNIT_NOT_RIGHT_CODE,
|
||||
String.format(ExceptionConstants.MATERIAL_UNIT_NOT_RIGHT_MSG,material==null?"":material.getName(),Unit,basicUnit,otherUnit));
|
||||
}
|
||||
} else {
|
||||
depotItem.setBasicnumber(oNumber); //其他情况
|
||||
}
|
||||
}
|
||||
if (!StringUtil.isEmpty(tempUpdatedJson.get("UnitPrice").toString())) {
|
||||
depotItem.setUnitprice(tempUpdatedJson.getBigDecimal("UnitPrice"));
|
||||
}
|
||||
if (!StringUtil.isEmpty(tempUpdatedJson.get("TaxUnitPrice").toString())) {
|
||||
depotItem.setTaxunitprice(tempUpdatedJson.getBigDecimal("TaxUnitPrice"));
|
||||
}
|
||||
if (!StringUtil.isEmpty(tempUpdatedJson.get("AllPrice").toString())) {
|
||||
depotItem.setAllprice(tempUpdatedJson.getBigDecimal("AllPrice"));
|
||||
}
|
||||
depotItem.setRemark(tempUpdatedJson.getString("Remark"));
|
||||
if (tempUpdatedJson.get("DepotId") != null && !StringUtil.isEmpty(tempUpdatedJson.get("DepotId").toString())) {
|
||||
depotItem.setDepotid(tempUpdatedJson.getLong("DepotId"));
|
||||
}
|
||||
if (tempUpdatedJson.get("AnotherDepotId") != null && !StringUtil.isEmpty(tempUpdatedJson.get("AnotherDepotId").toString())) {
|
||||
depotItem.setAnotherdepotid(tempUpdatedJson.getLong("AnotherDepotId"));
|
||||
}
|
||||
if (!StringUtil.isEmpty(tempUpdatedJson.get("TaxRate").toString())) {
|
||||
depotItem.setTaxrate(tempUpdatedJson.getBigDecimal("TaxRate"));
|
||||
}
|
||||
if (!StringUtil.isEmpty(tempUpdatedJson.get("TaxMoney").toString())) {
|
||||
depotItem.setTaxmoney(tempUpdatedJson.getBigDecimal("TaxMoney"));
|
||||
}
|
||||
if (!StringUtil.isEmpty(tempUpdatedJson.get("TaxLastMoney").toString())) {
|
||||
depotItem.setTaxlastmoney(tempUpdatedJson.getBigDecimal("TaxLastMoney"));
|
||||
}
|
||||
depotItem.setOtherfield1(tempUpdatedJson.getString("OtherField1"));
|
||||
depotItem.setOtherfield2(tempUpdatedJson.getString("OtherField2"));
|
||||
depotItem.setOtherfield3(tempUpdatedJson.getString("OtherField3"));
|
||||
depotItem.setOtherfield4(tempUpdatedJson.getString("OtherField4"));
|
||||
depotItem.setOtherfield5(tempUpdatedJson.getString("OtherField5"));
|
||||
depotItem.setMtype(tempUpdatedJson.getString("MType"));
|
||||
/**
|
||||
* create by: qiankunpingtai
|
||||
* create time: 2019/3/25 15:18
|
||||
* website:https://qiankunpingtai.cn
|
||||
* description:
|
||||
* 修改了商品类型时,库中的商品和页面传递的不同
|
||||
* 这里需要重新获取页面传递的商品信息
|
||||
*/
|
||||
if(!material.getId().equals(depotItem.getMaterialid())){
|
||||
if(material==null){
|
||||
continue;
|
||||
}
|
||||
}
|
||||
/**出库时处理序列号*/
|
||||
if(BusinessConstants.DEPOTHEAD_TYPE_OUT.equals(depotHead.getType())){
|
||||
if(getCurrentRepByMaterialIdAndDepotId(material.getId(),depotItem.getDepotid())
|
||||
.compareTo(depotItem.getBasicnumber()==null?BigDecimal.ZERO:depotItem.getBasicnumber())==-1){
|
||||
throw new BusinessRunTimeException(ExceptionConstants.MATERIAL_STOCK_NOT_ENOUGH_CODE,
|
||||
String.format(ExceptionConstants.MATERIAL_STOCK_NOT_ENOUGH_MSG,material==null?"":material.getName()));
|
||||
}
|
||||
if(!BusinessConstants.SUB_TYPE_TRANSFER.equals(depotHead.getSubtype())) {
|
||||
/**
|
||||
* 判断商品是否开启序列号,开启的收回序列号,未开启的跳过
|
||||
* */
|
||||
if(BusinessConstants.ENABLE_SERIAL_NUMBER_ENABLED.equals(material.getEnableserialnumber())) {
|
||||
//查询单据子表中开启序列号的数据列表
|
||||
serialNumberService.checkAndUpdateSerialNumber(depotItem, userInfo);
|
||||
depotItem.setId(tempUpdatedJson.getLong("Id"));
|
||||
depotItem.setMaterialid(tempUpdatedJson.getLong("MaterialId"));
|
||||
depotItem.setMunit(tempUpdatedJson.getString("Unit"));
|
||||
if (!StringUtil.isEmpty(tempUpdatedJson.get("OperNumber").toString())) {
|
||||
depotItem.setOpernumber(tempUpdatedJson.getBigDecimal("OperNumber"));
|
||||
try {
|
||||
String Unit = tempUpdatedJson.get("Unit").toString();
|
||||
BigDecimal oNumber = tempUpdatedJson.getBigDecimal("OperNumber");
|
||||
Long mId = Long.parseLong(tempUpdatedJson.get("MaterialId").toString());
|
||||
//以下进行单位换算
|
||||
// String UnitName = findUnitName(mId); //查询计量单位名称
|
||||
String unitName = materialService.findUnitName(mId);
|
||||
if (!StringUtil.isEmpty(unitName)) {
|
||||
String unitList = unitName.substring(0, unitName.indexOf("("));
|
||||
String ratioList = unitName.substring(unitName.indexOf("("));
|
||||
String basicUnit = unitList.substring(0, unitList.indexOf(",")); //基本单位
|
||||
String otherUnit = unitList.substring(unitList.indexOf(",") + 1); //副单位
|
||||
Integer ratio = Integer.parseInt(ratioList.substring(ratioList.indexOf(":") + 1).replace(")", "")); //比例
|
||||
if (Unit.equals(basicUnit)) { //如果等于基础单位
|
||||
depotItem.setBasicnumber(oNumber); //数量一致
|
||||
} else if (Unit.equals(otherUnit)) { //如果等于副单位
|
||||
depotItem.setBasicnumber(oNumber.multiply(new BigDecimal(ratio))); //数量乘以比例
|
||||
}
|
||||
} else {
|
||||
depotItem.setBasicnumber(oNumber); //其他情况
|
||||
}
|
||||
} catch (Exception e) {
|
||||
logger.error(">>>>>>>>>>>>>>>>>>>设置基础数量异常", e);
|
||||
}
|
||||
}
|
||||
if (!StringUtil.isEmpty(tempUpdatedJson.get("UnitPrice").toString())) {
|
||||
depotItem.setUnitprice(tempUpdatedJson.getBigDecimal("UnitPrice"));
|
||||
}
|
||||
if (!StringUtil.isEmpty(tempUpdatedJson.get("TaxUnitPrice").toString())) {
|
||||
depotItem.setTaxunitprice(tempUpdatedJson.getBigDecimal("TaxUnitPrice"));
|
||||
}
|
||||
if (!StringUtil.isEmpty(tempUpdatedJson.get("AllPrice").toString())) {
|
||||
depotItem.setAllprice(tempUpdatedJson.getBigDecimal("AllPrice"));
|
||||
}
|
||||
depotItem.setRemark(tempUpdatedJson.getString("Remark"));
|
||||
if (tempUpdatedJson.get("DepotId") != null && !StringUtil.isEmpty(tempUpdatedJson.get("DepotId").toString())) {
|
||||
depotItem.setDepotid(tempUpdatedJson.getLong("DepotId"));
|
||||
}
|
||||
if (tempUpdatedJson.get("AnotherDepotId") != null && !StringUtil.isEmpty(tempUpdatedJson.get("AnotherDepotId").toString())) {
|
||||
depotItem.setAnotherdepotid(tempUpdatedJson.getLong("AnotherDepotId"));
|
||||
}
|
||||
if (!StringUtil.isEmpty(tempUpdatedJson.get("TaxRate").toString())) {
|
||||
depotItem.setTaxrate(tempUpdatedJson.getBigDecimal("TaxRate"));
|
||||
}
|
||||
if (!StringUtil.isEmpty(tempUpdatedJson.get("TaxMoney").toString())) {
|
||||
depotItem.setTaxmoney(tempUpdatedJson.getBigDecimal("TaxMoney"));
|
||||
}
|
||||
if (!StringUtil.isEmpty(tempUpdatedJson.get("TaxLastMoney").toString())) {
|
||||
depotItem.setTaxlastmoney(tempUpdatedJson.getBigDecimal("TaxLastMoney"));
|
||||
}
|
||||
depotItem.setOtherfield1(tempUpdatedJson.getString("OtherField1"));
|
||||
depotItem.setOtherfield2(tempUpdatedJson.getString("OtherField2"));
|
||||
depotItem.setOtherfield3(tempUpdatedJson.getString("OtherField3"));
|
||||
depotItem.setOtherfield4(tempUpdatedJson.getString("OtherField4"));
|
||||
depotItem.setOtherfield5(tempUpdatedJson.getString("OtherField5"));
|
||||
depotItem.setMtype(tempUpdatedJson.getString("MType"));
|
||||
/**
|
||||
* create by: qiankunpingtai
|
||||
* create time: 2019/3/25 15:18
|
||||
* website:https://qiankunpingtai.cn
|
||||
* description:
|
||||
* 修改了商品类型时,库中的商品和页面传递的不同
|
||||
* 这里需要重新获取页面传递的商品信息
|
||||
*/
|
||||
if(!material.getId().equals(depotItem.getMaterialid())){
|
||||
material= materialService.getMaterial(depotItem.getMaterialid());
|
||||
if(material==null){
|
||||
continue;
|
||||
}
|
||||
}
|
||||
/**出库时处理序列号*/
|
||||
if(BusinessConstants.DEPOTHEAD_TYPE_OUT.equals(depotHead.getType())){
|
||||
BigDecimal stock = getStockByParam(depotItem.getDepotid(),depotItem.getMaterialid(),null,null,tenantId);
|
||||
BigDecimal thisBasicNumber = depotItem.getBasicnumber()==null?BigDecimal.ZERO:depotItem.getBasicnumber();
|
||||
if(stock.compareTo(thisBasicNumber)<0){
|
||||
throw new BusinessRunTimeException(ExceptionConstants.MATERIAL_STOCK_NOT_ENOUGH_CODE,
|
||||
String.format(ExceptionConstants.MATERIAL_STOCK_NOT_ENOUGH_MSG,material==null?"":material.getName()));
|
||||
}
|
||||
if(!BusinessConstants.SUB_TYPE_TRANSFER.equals(depotHead.getSubtype())) {
|
||||
/**
|
||||
* 判断商品是否开启序列号,开启的收回序列号,未开启的跳过
|
||||
* */
|
||||
if(BusinessConstants.ENABLE_SERIAL_NUMBER_ENABLED.equals(material.getEnableserialnumber())) {
|
||||
//查询单据子表中开启序列号的数据列表
|
||||
serialNumberService.checkAndUpdateSerialNumber(depotItem, userInfo);
|
||||
}
|
||||
}
|
||||
}
|
||||
this.updateDepotItemWithObj(depotItem);
|
||||
}
|
||||
this.updateDepotItemWithObj(depotItem);
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
/**
|
||||
@@ -639,17 +595,7 @@ public class DepotItemService {
|
||||
}
|
||||
return unitName;
|
||||
}
|
||||
/**
|
||||
* 查询商品当前库存数量是否充足,
|
||||
*
|
||||
* */
|
||||
public int getCurrentInStock(Long materialId, Long depotId){
|
||||
//入库数量
|
||||
int inSum = findByTypeAndMaterialIdAndDepotId(BusinessConstants.DEPOTHEAD_TYPE_STORAGE, materialId, depotId);
|
||||
//出库数量
|
||||
int outSum = findByTypeAndMaterialIdAndDepotId(BusinessConstants.DEPOTHEAD_TYPE_OUT, materialId ,depotId);
|
||||
return (inSum-outSum);
|
||||
}
|
||||
|
||||
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
||||
public int batchDeleteDepotItemByIds(String ids)throws Exception {
|
||||
logService.insertLog(BusinessConstants.LOG_INTERFACE_NAME_DEPOT_ITEM,
|
||||
@@ -661,10 +607,7 @@ public class DepotItemService {
|
||||
try{
|
||||
result =depotItemMapperEx.batchDeleteDepotItemByIds(new Date(),userInfo==null?null:userInfo.getId(),idArray);
|
||||
}catch(Exception e){
|
||||
logger.error("异常码[{}],异常提示[{}],异常[{}]",
|
||||
ExceptionConstants.DATA_WRITE_FAIL_CODE,ExceptionConstants.DATA_WRITE_FAIL_MSG,e);
|
||||
throw new BusinessRunTimeException(ExceptionConstants.DATA_WRITE_FAIL_CODE,
|
||||
ExceptionConstants.DATA_WRITE_FAIL_MSG);
|
||||
JshException.writeFail(logger, e);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
@@ -690,35 +633,6 @@ public class DepotItemService {
|
||||
}
|
||||
return result;
|
||||
}
|
||||
/**
|
||||
* create by: qiankunpingtai
|
||||
* create time: 2019/5/16 18:15
|
||||
* website:https://qiankunpingtai.cn
|
||||
* description:
|
||||
* 查询指定仓库指定材料的当前库存
|
||||
*/
|
||||
public BigDecimal getCurrentRepByMaterialIdAndDepotId(Long materialId,Long depotId) {
|
||||
BigDecimal result = BigDecimal.ZERO;
|
||||
HttpServletRequest request = ((ServletRequestAttributes) Objects.requireNonNull(RequestContextHolder.getRequestAttributes())).getRequest();
|
||||
Long tenantId=null;
|
||||
Object tenantIdO = request.getSession().getAttribute("tenantId");
|
||||
if(tenantIdO!=null){
|
||||
//多租户模式,租户id从当前用户获取
|
||||
tenantId=Long.valueOf(tenantIdO.toString());
|
||||
} else {
|
||||
//无租户模式,租户id为-1
|
||||
tenantId=Long.valueOf(-1);
|
||||
}
|
||||
try{
|
||||
result =depotItemMapperEx.getCurrentRepByMaterialIdAndDepotId(materialId,depotId,tenantId);
|
||||
}catch(Exception e){
|
||||
logger.error("异常码[{}],异常提示[{}],异常[{}]",
|
||||
ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e);
|
||||
throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE,
|
||||
ExceptionConstants.DATA_READ_FAIL_MSG);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 统计该商品已分批出库的总数量-用于订单
|
||||
|
||||
@@ -24,7 +24,6 @@ import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Service
|
||||
public class RoleService {
|
||||
@@ -49,10 +48,12 @@ public class RoleService {
|
||||
return result;
|
||||
}
|
||||
|
||||
public List<Role> getRoleList(Map<String, String> parameterMap)throws Exception {
|
||||
public List<Role> getRole()throws Exception {
|
||||
RoleExample example = new RoleExample();
|
||||
example.createCriteria().andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
|
||||
List<Role> list=null;
|
||||
try{
|
||||
list=roleMapperEx.getRoleList(parameterMap);
|
||||
list=roleMapper.selectByExample(example);
|
||||
}catch(Exception e){
|
||||
JshException.readFail(logger, e);
|
||||
}
|
||||
|
||||
@@ -379,29 +379,19 @@ public class SerialNumberService {
|
||||
* @return void
|
||||
*/
|
||||
public void checkAndUpdateSerialNumber(DepotItem depotItem,User userInfo) throws Exception{
|
||||
if(depotItem!=null){
|
||||
//查询商品下已分配的可用序列号数量
|
||||
int serialNumberSum=0;
|
||||
try{
|
||||
serialNumberSum= serialNumberMapperEx.countSerialNumberByMaterialIdAndDepotheadId(depotItem.getMaterialid(),null,BusinessConstants.IS_SELL_HOLD);
|
||||
//BasicNumber=OperNumber*ratio
|
||||
}catch(Exception e){
|
||||
logger.error("异常码[{}],异常提示[{}],异常[{}]",
|
||||
ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e);
|
||||
throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE,
|
||||
ExceptionConstants.DATA_READ_FAIL_MSG);
|
||||
}
|
||||
if((depotItem.getBasicnumber()==null?0:depotItem.getBasicnumber()).intValue()>serialNumberSum){
|
||||
//获取商品名称
|
||||
Material material= materialMapper.selectByPrimaryKey(depotItem.getMaterialid());
|
||||
throw new BusinessRunTimeException(ExceptionConstants.MATERIAL_SERIAL_NUMBERE_NOT_ENOUGH_CODE,
|
||||
String.format(ExceptionConstants.MATERIAL_SERIAL_NUMBERE_NOT_ENOUGH_MSG,material==null?"":material.getName()));
|
||||
}
|
||||
|
||||
//商品下序列号充足,分配序列号
|
||||
sellSerialNumber(depotItem.getMaterialid(),depotItem.getHeaderid(),(depotItem.getBasicnumber()==null?0:depotItem.getBasicnumber()).intValue(),userInfo);
|
||||
}
|
||||
|
||||
if(depotItem!=null){
|
||||
//查询商品下已分配的可用序列号数量
|
||||
int SerialNumberSum= serialNumberMapperEx.countSerialNumberByMaterialIdAndDepotheadId(depotItem.getMaterialid(),null,BusinessConstants.IS_SELL_HOLD);
|
||||
//BasicNumber=OperNumber*ratio
|
||||
if((depotItem.getBasicnumber()==null?0:depotItem.getBasicnumber()).intValue()>SerialNumberSum){
|
||||
//获取商品名称
|
||||
Material material= materialMapper.selectByPrimaryKey(depotItem.getMaterialid());
|
||||
throw new BusinessRunTimeException(ExceptionConstants.MATERIAL_SERIAL_NUMBERE_NOT_ENOUGH_CODE,
|
||||
String.format(ExceptionConstants.MATERIAL_SERIAL_NUMBERE_NOT_ENOUGH_MSG,material==null?"":material.getName()));
|
||||
}
|
||||
//商品下序列号充足,分配序列号
|
||||
sellSerialNumber(depotItem.getMaterialid(),depotItem.getHeaderid(),(depotItem.getBasicnumber()==null?0:depotItem.getBasicnumber()).intValue(),userInfo);
|
||||
}
|
||||
}
|
||||
/**
|
||||
*
|
||||
@@ -483,30 +473,25 @@ public class SerialNumberService {
|
||||
|
||||
int insertNum=0;
|
||||
StringBuffer prefixBuf=new StringBuffer(serialNumberPrefix).append(million);
|
||||
do{
|
||||
list=new ArrayList<SerialNumberEx>();
|
||||
int forNum = BusinessConstants.BATCH_INSERT_MAX_NUMBER>=batAddTotal?batAddTotal:BusinessConstants.BATCH_INSERT_MAX_NUMBER;
|
||||
for(int i=0;i<forNum;i++){
|
||||
insertNum++;
|
||||
SerialNumberEx each=new SerialNumberEx();
|
||||
each.setMaterialId(materialId);
|
||||
each.setCreator(userId);
|
||||
each.setCreateTime(date);
|
||||
each.setUpdater(userId);
|
||||
each.setUpdateTime(date);
|
||||
each.setRemark(remark);
|
||||
each.setSerialNumber(new StringBuffer(prefixBuf.toString()).append(insertNum).toString());
|
||||
list.add(each);
|
||||
}
|
||||
int result=0;
|
||||
try{
|
||||
result = serialNumberMapperEx.batAddSerialNumber(list);
|
||||
}catch(Exception e){
|
||||
JshException.writeFail(logger, e);
|
||||
}
|
||||
list=new ArrayList<SerialNumberEx>();
|
||||
int forNum = BusinessConstants.BATCH_INSERT_MAX_NUMBER>=batAddTotal?batAddTotal:BusinessConstants.BATCH_INSERT_MAX_NUMBER;
|
||||
for(int i=0;i<forNum;i++){
|
||||
insertNum++;
|
||||
SerialNumberEx each=new SerialNumberEx();
|
||||
each.setMaterialId(materialId);
|
||||
each.setCreator(userId);
|
||||
each.setCreateTime(date);
|
||||
each.setUpdater(userId);
|
||||
each.setUpdateTime(date);
|
||||
each.setRemark(remark);
|
||||
each.setSerialNumber(new StringBuffer(prefixBuf.toString()).append(insertNum).toString());
|
||||
list.add(each);
|
||||
}
|
||||
try{
|
||||
serialNumberMapperEx.batAddSerialNumber(list);
|
||||
batAddTotal -= BusinessConstants.BATCH_INSERT_MAX_NUMBER;
|
||||
}while(batAddTotal>0);
|
||||
}catch(Exception e){
|
||||
JshException.writeFail(logger, e);
|
||||
}
|
||||
}
|
||||
}
|
||||
/**
|
||||
|
||||
@@ -209,7 +209,7 @@ public class SupplierService {
|
||||
int result=0;
|
||||
try{
|
||||
if(supplier!=null){
|
||||
supplier.setAdvancein((supplier.getAdvancein()==null?BigDecimal.ZERO:supplier.getAdvancein()).add(advanceIn)); //增加预收款的金额,可能增加的是负值
|
||||
supplier.setAdvancein(supplier.getAdvancein().add(advanceIn)); //增加预收款的金额,可能增加的是负值
|
||||
result=supplierMapper.updateByPrimaryKeySelective(supplier);
|
||||
}
|
||||
}catch(Exception e){
|
||||
|
||||
@@ -45,7 +45,7 @@ public class TenantComponent implements ICommonQuery {
|
||||
|
||||
@Override
|
||||
public int insert(String beanJson, HttpServletRequest request)throws Exception {
|
||||
return tenantService.insertTenant(beanJson);
|
||||
return tenantService.insertTenant(beanJson, request);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -68,7 +68,7 @@ public class TenantService {
|
||||
}
|
||||
|
||||
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
||||
public int insertTenant(String beanJson)throws Exception {
|
||||
public int insertTenant(String beanJson, HttpServletRequest request)throws Exception {
|
||||
Tenant tenant = JSONObject.parseObject(beanJson, Tenant.class);
|
||||
int result=0;
|
||||
try{
|
||||
|
||||
@@ -21,7 +21,6 @@ import com.jsh.erp.service.userBusiness.UserBusinessService;
|
||||
import com.jsh.erp.utils.ExceptionCodeConstants;
|
||||
import com.jsh.erp.utils.StringUtil;
|
||||
import com.jsh.erp.utils.Tools;
|
||||
import org.apache.ibatis.annotations.DeleteProvider;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.stereotype.Service;
|
||||
@@ -219,33 +218,35 @@ public class UserService {
|
||||
return result;
|
||||
}
|
||||
|
||||
public int validateUser(String username, String password){
|
||||
/**默认是可以登录的*/
|
||||
List<User> list = null;
|
||||
try {
|
||||
list=this.getUserListByloginName(username);
|
||||
} catch (Exception e) {
|
||||
logger.error("异常码[{}],异常提示[{}],异常[{}]",
|
||||
ExceptionConstants.DATA_READ_FAIL_CODE, ExceptionConstants.DATA_READ_FAIL_MSG,e);
|
||||
logger.error(">>>>>>>>访问验证用户姓名是否存在后台信息异常", e);
|
||||
return ExceptionCodeConstants.UserExceptionCode.USER_ACCESS_EXCEPTION;
|
||||
}
|
||||
public int validateUser(String username, String password) throws Exception {
|
||||
/**默认是可以登录的*/
|
||||
List<User> list = null;
|
||||
try {
|
||||
UserExample example = new UserExample();
|
||||
example.createCriteria().andLoginameEqualTo(username);
|
||||
list = userMapper.selectByExample(example);
|
||||
} catch (Exception e) {
|
||||
logger.error(">>>>>>>>访问验证用户姓名是否存在后台信息异常", e);
|
||||
return ExceptionCodeConstants.UserExceptionCode.USER_ACCESS_EXCEPTION;
|
||||
}
|
||||
|
||||
if (null != list && list.size() == 0) {
|
||||
return ExceptionCodeConstants.UserExceptionCode.USER_NOT_EXIST;
|
||||
}
|
||||
User user=null;
|
||||
try {
|
||||
user = this.getUserListByloginNameAndPassword(username,password);
|
||||
} catch (Exception e) {
|
||||
logger.error(">>>>>>>>>>访问验证用户密码后台信息异常", e);
|
||||
return ExceptionCodeConstants.UserExceptionCode.USER_ACCESS_EXCEPTION;
|
||||
}
|
||||
if (null != list && list.size() == 0) {
|
||||
return ExceptionCodeConstants.UserExceptionCode.USER_NOT_EXIST;
|
||||
}
|
||||
|
||||
if (null == user ) {
|
||||
return ExceptionCodeConstants.UserExceptionCode.USER_PASSWORD_ERROR;
|
||||
}
|
||||
return ExceptionCodeConstants.UserExceptionCode.USER_CONDITION_FIT;
|
||||
try {
|
||||
UserExample example = new UserExample();
|
||||
example.createCriteria().andLoginameEqualTo(username).andPasswordEqualTo(password);
|
||||
list = userMapper.selectByExample(example);
|
||||
} catch (Exception e) {
|
||||
logger.error(">>>>>>>>>>访问验证用户密码后台信息异常", e);
|
||||
return ExceptionCodeConstants.UserExceptionCode.USER_ACCESS_EXCEPTION;
|
||||
}
|
||||
|
||||
if (null != list && list.size() == 0) {
|
||||
return ExceptionCodeConstants.UserExceptionCode.USER_PASSWORD_ERROR;
|
||||
}
|
||||
return ExceptionCodeConstants.UserExceptionCode.USER_CONDITION_FIT;
|
||||
}
|
||||
|
||||
public User getUserByUserName(String username)throws Exception {
|
||||
@@ -310,8 +311,7 @@ public class UserService {
|
||||
BusinessConstants.LOG_OPERATION_TYPE_ADD,
|
||||
((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest());
|
||||
//检查用户名和登录名
|
||||
checkLoginName(ue);
|
||||
checkUserName(ue);
|
||||
checkUserNameAndLoginName(ue);
|
||||
//新增用户信息
|
||||
ue= this.addUser(ue);
|
||||
if(ue==null){
|
||||
@@ -351,11 +351,7 @@ public class UserService {
|
||||
* 3是否管理者默认为员工
|
||||
* 4默认用户状态为正常
|
||||
* */
|
||||
|
||||
//用户没有设置密码时,使用默认密码
|
||||
if(StringUtil.isEmpty(ue.getPassword())){
|
||||
ue.setPassword(Tools.md5Encryp(BusinessConstants.USER_DEFAULT_PASSWORD));
|
||||
}
|
||||
ue.setPassword(Tools.md5Encryp(BusinessConstants.USER_DEFAULT_PASSWORD));
|
||||
ue.setIsystem(BusinessConstants.USER_NOT_SYSTEM);
|
||||
if(ue.getIsmanager()==null){
|
||||
ue.setIsmanager(BusinessConstants.USER_NOT_MANAGER);
|
||||
@@ -374,7 +370,7 @@ public class UserService {
|
||||
}
|
||||
|
||||
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
||||
public UserEx registerUser(UserEx ue, Long manageRoleId) throws Exception{
|
||||
public UserEx registerUser(UserEx ue, Integer manageRoleId, HttpServletRequest request) throws Exception{
|
||||
/**
|
||||
* create by: qiankunpingtai
|
||||
* create time: 2019/4/9 18:00
|
||||
@@ -386,46 +382,42 @@ public class UserService {
|
||||
throw new BusinessRunTimeException(ExceptionConstants.USER_NAME_LIMIT_USE_CODE,
|
||||
ExceptionConstants.USER_NAME_LIMIT_USE_MSG);
|
||||
} else {
|
||||
/**
|
||||
* create by: qiankunpingtai
|
||||
* create time: 2019/4/24 10:57
|
||||
* website:https://qiankunpingtai.cn
|
||||
* description:
|
||||
* 检查登录名是否已存在
|
||||
*
|
||||
*/
|
||||
checkLoginName(ue);
|
||||
/**
|
||||
* create by: qiankunpingtai
|
||||
* create time: 2019/4/24 14:47
|
||||
* website:https://qiankunpingtai.cn
|
||||
* description:
|
||||
* 注册一个新用户需要做如下操作
|
||||
* 1、分配应用
|
||||
* 2、分配功能模块
|
||||
* 3、分配产品扩展字段
|
||||
* 4、分配角色(默认添加超级管理员角色,不可修改)
|
||||
* 5、写入用户信息
|
||||
* 6、写入用户角色应用功能关系
|
||||
*/
|
||||
|
||||
ue=this.addUser(ue);
|
||||
|
||||
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 result=0;
|
||||
try{
|
||||
result= userMapperEx.addUser(ue);
|
||||
}catch(Exception e){
|
||||
JshException.writeFail(logger, e);
|
||||
}
|
||||
//更新租户id
|
||||
User user = new User();
|
||||
user.setId(ue.getId());
|
||||
user.setTenantId(ue.getId());
|
||||
userService.updateUserTenant(user);
|
||||
addRegisterUserNotInclueUser(user.getId(),user.getTenantId(),manageRoleId);
|
||||
// //新增用户与角色的关系
|
||||
// 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());
|
||||
return ue;
|
||||
//新增用户与角色的关系
|
||||
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());
|
||||
//创建租户信息
|
||||
JSONObject tenantObj = new JSONObject();
|
||||
tenantObj.put("tenantId", ue.getId());
|
||||
tenantObj.put("loginName",ue.getLoginame());
|
||||
String param = tenantObj.toJSONString();
|
||||
tenantService.insertTenant(param, request);
|
||||
logger.info("===============创建租户信息完成===============");
|
||||
if (result > 0) {
|
||||
return ue;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -450,8 +442,7 @@ public class UserService {
|
||||
new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_EDIT).append(ue.getId()).toString(),
|
||||
((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest());
|
||||
//检查用户名和登录名
|
||||
checkLoginName(ue);
|
||||
checkUserName(ue);
|
||||
checkUserNameAndLoginName(ue);
|
||||
//更新用户信息
|
||||
ue = this.updateUser(ue);
|
||||
if (ue == null) {
|
||||
@@ -503,13 +494,14 @@ public class UserService {
|
||||
return null;
|
||||
}
|
||||
/**
|
||||
* create by: qiankunpingtai
|
||||
* create time: 2019/4/24 11:02
|
||||
* website:https://qiankunpingtai.cn
|
||||
* create by: cjl
|
||||
* description:
|
||||
* 检查登录名全局唯一
|
||||
* 检查用户名称和登录名不能重复
|
||||
* create time: 2019/3/12 11:36
|
||||
* @Param: userEx
|
||||
* @return void
|
||||
*/
|
||||
public void checkLoginName(UserEx userEx)throws Exception{
|
||||
public void checkUserNameAndLoginName(UserEx userEx)throws Exception{
|
||||
List<User> list=null;
|
||||
if(userEx==null){
|
||||
return;
|
||||
@@ -539,25 +531,10 @@ public class UserService {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
/**
|
||||
* create by: qiankunpingtai
|
||||
* create time: 2019/4/24 11:02
|
||||
* website:https://qiankunpingtai.cn
|
||||
* description:
|
||||
* 检查用户名同一个租户范围内内唯一
|
||||
*
|
||||
*/
|
||||
public void checkUserName(UserEx userEx)throws Exception{
|
||||
List<User> list=null;
|
||||
if(userEx==null){
|
||||
return;
|
||||
}
|
||||
Long userId=userEx.getId();
|
||||
//检查用户名
|
||||
if(!StringUtils.isEmpty(userEx.getUsername())){
|
||||
String userName=userEx.getUsername();
|
||||
list=this.getUserListByUserNameAndTenantId(userName,userEx.getTenantId());
|
||||
list=this.getUserListByUserName(userName);
|
||||
if(list!=null&&list.size()>0){
|
||||
if(list.size()>1){
|
||||
//超过一条数据存在,该用户名已存在
|
||||
@@ -578,58 +555,32 @@ public class UserService {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
/**
|
||||
* create by: qiankunpingtai
|
||||
* website:https://qiankunpingtai.cn
|
||||
* description:
|
||||
* 通过用户名和租户id获取用户信息
|
||||
* create time: 2019/4/24 11:18
|
||||
* @Param: userName
|
||||
* @Param: tenantId
|
||||
* @return java.util.List<com.jsh.erp.datasource.entities.User>
|
||||
*/
|
||||
private List<User> getUserListByUserNameAndTenantId(String userName, Long tenantId) {
|
||||
|
||||
* 通过用户名获取用户列表
|
||||
* */
|
||||
public List<User> getUserListByUserName(String userName)throws Exception{
|
||||
List<User> list =null;
|
||||
try{
|
||||
list=userMapperEx.getUserListByUserNameAndTenantId(userName,tenantId);
|
||||
list=userMapperEx.getUserListByUserNameOrLoginName(userName,null);
|
||||
}catch(Exception e){
|
||||
JshException.readFail(logger, e);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过登录名获取用户列表
|
||||
* */
|
||||
public List<User> getUserListByloginName(String loginName){
|
||||
List<User> list =null;
|
||||
try{
|
||||
list=userMapperEx.getUserListByLoginName(loginName);
|
||||
list=userMapperEx.getUserListByUserNameOrLoginName(null,loginName);
|
||||
}catch(Exception e){
|
||||
JshException.readFail(logger, e);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
/**
|
||||
* 通过登录名和密码获取用户列表
|
||||
* */
|
||||
public User getUserListByloginNameAndPassword(String loginName,String password){
|
||||
List<User> list =null;
|
||||
try{
|
||||
list=userMapperEx.getUserListByloginNameAndPassword(loginName,password);
|
||||
}catch(Exception e){
|
||||
logger.error("异常码[{}],异常提示[{}],异常[{}]",
|
||||
ExceptionConstants.DATA_READ_FAIL_CODE, ExceptionConstants.DATA_READ_FAIL_MSG,e);
|
||||
throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE,
|
||||
ExceptionConstants.DATA_READ_FAIL_MSG);
|
||||
}
|
||||
if(list!=null&&list.size()>0){
|
||||
return list.get(0);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
/**
|
||||
* 批量删除用户
|
||||
* */
|
||||
@@ -662,34 +613,4 @@ public class UserService {
|
||||
}
|
||||
return list;
|
||||
}
|
||||
/**
|
||||
* create by: qiankunpingtai
|
||||
* website:https://qiankunpingtai.cn
|
||||
* description:
|
||||
* 1、分配应用
|
||||
* 2、分配功能模块
|
||||
* 3、分配产品扩展字段
|
||||
* 4、分配角色(默认添加超级管理员角色,不可修改)
|
||||
* 5、写入用户角色应用功能关系
|
||||
* create time: 2019/4/26 9:37
|
||||
* @Param: userId 用户id
|
||||
* @Param: tenantId 租户id
|
||||
* @Param: roleId 模板角色id
|
||||
* @return java.lang.String
|
||||
*/
|
||||
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
||||
public String addRegisterUserNotInclueUser(Long userId,Long tenantId,Long roleId)throws Exception {
|
||||
|
||||
String result =null;
|
||||
try{
|
||||
result=userMapperEx.addRegisterUserNotInclueUser(userId,tenantId,roleId);
|
||||
}catch(Exception e){
|
||||
logger.error("异常码[{}],异常提示[{}],异常[{}]",
|
||||
ExceptionConstants.DATA_WRITE_FAIL_CODE,ExceptionConstants.DATA_WRITE_FAIL_MSG,e);
|
||||
throw new BusinessRunTimeException(ExceptionConstants.DATA_WRITE_FAIL_CODE,
|
||||
ExceptionConstants.DATA_WRITE_FAIL_MSG);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user