切换到jsh的版本
This commit is contained in:
@@ -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;
|
||||
}
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user