给单据接口进行价格屏蔽
This commit is contained in:
@@ -383,7 +383,7 @@ public class DepotHeadController {
|
|||||||
BaseResponseInfo res = new BaseResponseInfo();
|
BaseResponseInfo res = new BaseResponseInfo();
|
||||||
DepotHeadVo4List dhl = new DepotHeadVo4List();
|
DepotHeadVo4List dhl = new DepotHeadVo4List();
|
||||||
try {
|
try {
|
||||||
List<DepotHeadVo4List> list = depotHeadService.getDetailByNumber(number);
|
List<DepotHeadVo4List> list = depotHeadService.getDetailByNumber(number, request);
|
||||||
if(list.size()>0) {
|
if(list.size()>0) {
|
||||||
dhl = list.get(0);
|
dhl = list.get(0);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ import com.jsh.erp.service.material.MaterialService;
|
|||||||
import com.jsh.erp.service.role.RoleService;
|
import com.jsh.erp.service.role.RoleService;
|
||||||
import com.jsh.erp.service.systemConfig.SystemConfigService;
|
import com.jsh.erp.service.systemConfig.SystemConfigService;
|
||||||
import com.jsh.erp.service.unit.UnitService;
|
import com.jsh.erp.service.unit.UnitService;
|
||||||
|
import com.jsh.erp.service.user.UserService;
|
||||||
import com.jsh.erp.utils.*;
|
import com.jsh.erp.utils.*;
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
import io.swagger.annotations.ApiOperation;
|
import io.swagger.annotations.ApiOperation;
|
||||||
@@ -63,6 +64,9 @@ public class DepotItemController {
|
|||||||
@Resource
|
@Resource
|
||||||
private RoleService roleService;
|
private RoleService roleService;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private UserService userService;
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
private SystemConfigService systemConfigService;
|
private SystemConfigService systemConfigService;
|
||||||
|
|
||||||
@@ -186,7 +190,10 @@ public class DepotItemController {
|
|||||||
HttpServletRequest request)throws Exception {
|
HttpServletRequest request)throws Exception {
|
||||||
BaseResponseInfo res = new BaseResponseInfo();
|
BaseResponseInfo res = new BaseResponseInfo();
|
||||||
try {
|
try {
|
||||||
List<DepotItemVo4WithInfoEx> dataList = new ArrayList<DepotItemVo4WithInfoEx>();
|
Long userId = userService.getUserId(request);
|
||||||
|
String priceLimit = userService.getRoleTypeByUserId(userId).getPriceLimit();
|
||||||
|
List<DepotItemVo4WithInfoEx> dataList = new ArrayList<>();
|
||||||
|
String billCategory = depotHeadService.getBillCategory(depotHeadService.getDepotHead(headerId).getSubType());
|
||||||
if(headerId != 0) {
|
if(headerId != 0) {
|
||||||
dataList = depotItemService.getDetailList(headerId);
|
dataList = depotItemService.getDetailList(headerId);
|
||||||
}
|
}
|
||||||
@@ -234,15 +241,15 @@ public class DepotItemController {
|
|||||||
item.put("basicNumber", diEx.getBasicNumber());
|
item.put("basicNumber", diEx.getBasicNumber());
|
||||||
item.put("preNumber", diEx.getOperNumber()); //原数量
|
item.put("preNumber", diEx.getOperNumber()); //原数量
|
||||||
item.put("finishNumber", depotItemService.getFinishNumber(diEx.getMaterialExtendId(), diEx.getId(), diEx.getHeaderId(), unitInfo, materialUnit, linkType)); //已入库|已出库
|
item.put("finishNumber", depotItemService.getFinishNumber(diEx.getMaterialExtendId(), diEx.getId(), diEx.getHeaderId(), unitInfo, materialUnit, linkType)); //已入库|已出库
|
||||||
item.put("purchaseDecimal", diEx.getPurchaseDecimal()); //采购价
|
item.put("purchaseDecimal", roleService.parseBillPriceByLimit(diEx.getPurchaseDecimal(), billCategory, priceLimit, request)); //采购价
|
||||||
if("basic".equals(linkType)) {
|
if("basic".equals(linkType)) {
|
||||||
//正常情况显示金额,而以销定购的情况不能显示金额
|
//正常情况显示金额,而以销定购的情况不能显示金额
|
||||||
item.put("unitPrice", diEx.getUnitPrice());
|
item.put("unitPrice", roleService.parseBillPriceByLimit(diEx.getUnitPrice(), billCategory, priceLimit, request));
|
||||||
item.put("taxUnitPrice", diEx.getTaxUnitPrice());
|
item.put("taxUnitPrice", roleService.parseBillPriceByLimit(diEx.getTaxUnitPrice(), billCategory, priceLimit, request));
|
||||||
item.put("allPrice", diEx.getAllPrice());
|
item.put("allPrice", roleService.parseBillPriceByLimit(diEx.getAllPrice(), billCategory, priceLimit, request));
|
||||||
item.put("taxRate", diEx.getTaxRate());
|
item.put("taxRate", roleService.parseBillPriceByLimit(diEx.getTaxRate(), billCategory, priceLimit, request));
|
||||||
item.put("taxMoney", diEx.getTaxMoney());
|
item.put("taxMoney", roleService.parseBillPriceByLimit(diEx.getTaxMoney(), billCategory, priceLimit, request));
|
||||||
item.put("taxLastMoney", diEx.getTaxLastMoney());
|
item.put("taxLastMoney", roleService.parseBillPriceByLimit(diEx.getTaxLastMoney(), billCategory, priceLimit, request));
|
||||||
}
|
}
|
||||||
BigDecimal allWeight = diEx.getBasicNumber()==null||diEx.getWeight()==null?BigDecimal.ZERO:diEx.getBasicNumber().multiply(diEx.getWeight());
|
BigDecimal allWeight = diEx.getBasicNumber()==null||diEx.getWeight()==null?BigDecimal.ZERO:diEx.getBasicNumber().multiply(diEx.getWeight());
|
||||||
item.put("weight", allWeight);
|
item.put("weight", allWeight);
|
||||||
@@ -265,9 +272,9 @@ public class DepotItemController {
|
|||||||
if(StringUtil.isNotEmpty(isReadOnly) && "1".equals(isReadOnly)) {
|
if(StringUtil.isNotEmpty(isReadOnly) && "1".equals(isReadOnly)) {
|
||||||
JSONObject footItem = new JSONObject();
|
JSONObject footItem = new JSONObject();
|
||||||
footItem.put("operNumber", totalOperNumber);
|
footItem.put("operNumber", totalOperNumber);
|
||||||
footItem.put("allPrice", totalAllPrice);
|
footItem.put("allPrice", roleService.parseBillPriceByLimit(totalAllPrice, billCategory, priceLimit, request));
|
||||||
footItem.put("taxMoney", totalTaxMoney);
|
footItem.put("taxMoney", roleService.parseBillPriceByLimit(totalTaxMoney, billCategory, priceLimit, request));
|
||||||
footItem.put("taxLastMoney", totalTaxLastMoney);
|
footItem.put("taxLastMoney", roleService.parseBillPriceByLimit(totalTaxLastMoney, billCategory, priceLimit, request));
|
||||||
footItem.put("weight", totalWeight);
|
footItem.put("weight", totalWeight);
|
||||||
dataArray.add(footItem);
|
dataArray.add(footItem);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -107,6 +107,10 @@ public class DepotHeadService {
|
|||||||
String beginTime, String endTime, String materialParam, Long organId, Long creator, Long depotId, Long accountId, String remark, int offset, int rows) throws Exception {
|
String beginTime, String endTime, String materialParam, Long organId, Long creator, Long depotId, Long accountId, String remark, int offset, int rows) throws Exception {
|
||||||
List<DepotHeadVo4List> resList = new ArrayList<>();
|
List<DepotHeadVo4List> resList = new ArrayList<>();
|
||||||
try{
|
try{
|
||||||
|
HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest();
|
||||||
|
Long userId = userService.getUserId(request);
|
||||||
|
String priceLimit = userService.getRoleTypeByUserId(userId).getPriceLimit();
|
||||||
|
String billCategory = getBillCategory(subType);
|
||||||
String [] depotArray = getDepotArray(subType);
|
String [] depotArray = getDepotArray(subType);
|
||||||
String [] creatorArray = getCreatorArray(roleType);
|
String [] creatorArray = getCreatorArray(roleType);
|
||||||
String [] statusArray = StringUtil.isNotEmpty(status) ? status.split(",") : null;
|
String [] statusArray = StringUtil.isNotEmpty(status) ? status.split(",") : null;
|
||||||
@@ -145,26 +149,33 @@ public class DepotHeadService {
|
|||||||
dh.setAccountMoneyList(accountmoneylistStr);
|
dh.setAccountMoneyList(accountmoneylistStr);
|
||||||
}
|
}
|
||||||
if(dh.getChangeAmount() != null) {
|
if(dh.getChangeAmount() != null) {
|
||||||
dh.setChangeAmount(dh.getChangeAmount().abs());
|
dh.setChangeAmount(roleService.parseBillPriceByLimit(dh.getChangeAmount().abs(), billCategory, priceLimit, request));
|
||||||
} else {
|
} else {
|
||||||
dh.setChangeAmount(BigDecimal.ZERO);
|
dh.setChangeAmount(BigDecimal.ZERO);
|
||||||
}
|
}
|
||||||
if(dh.getTotalPrice() != null) {
|
if(dh.getTotalPrice() != null) {
|
||||||
dh.setTotalPrice(dh.getTotalPrice().abs());
|
dh.setTotalPrice(roleService.parseBillPriceByLimit(dh.getTotalPrice().abs(), billCategory, priceLimit, request));
|
||||||
}
|
}
|
||||||
|
BigDecimal discountLastMoney = dh.getDiscountLastMoney()!=null?dh.getDiscountLastMoney():BigDecimal.ZERO;
|
||||||
|
dh.setDiscountLastMoney(roleService.parseBillPriceByLimit(discountLastMoney, billCategory, priceLimit, request));
|
||||||
|
BigDecimal backAmount = dh.getBackAmount()!=null?dh.getBackAmount():BigDecimal.ZERO;
|
||||||
|
dh.setBackAmount(roleService.parseBillPriceByLimit(backAmount, billCategory, priceLimit, request));
|
||||||
if(dh.getDeposit() == null) {
|
if(dh.getDeposit() == null) {
|
||||||
dh.setDeposit(BigDecimal.ZERO);
|
dh.setDeposit(BigDecimal.ZERO);
|
||||||
|
} else {
|
||||||
|
dh.setDeposit(roleService.parseBillPriceByLimit(dh.getDeposit(), billCategory, priceLimit, request));
|
||||||
}
|
}
|
||||||
//已经完成的欠款
|
//已经完成的欠款
|
||||||
if(finishDepositMap!=null) {
|
if(finishDepositMap!=null) {
|
||||||
dh.setFinishDeposit(finishDepositMap.get(dh.getNumber()) != null ? finishDepositMap.get(dh.getNumber()) : BigDecimal.ZERO);
|
BigDecimal finishDeposit = finishDepositMap.get(dh.getNumber()) != null ? finishDepositMap.get(dh.getNumber()) : BigDecimal.ZERO;
|
||||||
|
dh.setFinishDeposit(roleService.parseBillPriceByLimit(finishDeposit, billCategory, priceLimit, request));
|
||||||
}
|
}
|
||||||
//欠款计算
|
//欠款计算
|
||||||
BigDecimal discountLastMoney = dh.getDiscountLastMoney()!=null?dh.getDiscountLastMoney():BigDecimal.ZERO;
|
|
||||||
BigDecimal otherMoney = dh.getOtherMoney()!=null?dh.getOtherMoney():BigDecimal.ZERO;
|
BigDecimal otherMoney = dh.getOtherMoney()!=null?dh.getOtherMoney():BigDecimal.ZERO;
|
||||||
BigDecimal deposit = dh.getDeposit()!=null?dh.getDeposit():BigDecimal.ZERO;
|
BigDecimal deposit = dh.getDeposit()!=null?dh.getDeposit():BigDecimal.ZERO;
|
||||||
BigDecimal changeAmount = dh.getChangeAmount()!=null?dh.getChangeAmount():BigDecimal.ZERO;
|
BigDecimal changeAmount = dh.getChangeAmount()!=null?dh.getChangeAmount():BigDecimal.ZERO;
|
||||||
dh.setDebt(discountLastMoney.add(otherMoney).subtract((deposit.add(changeAmount))));
|
BigDecimal debt = discountLastMoney.add(otherMoney).subtract((deposit.add(changeAmount)));
|
||||||
|
dh.setDebt(roleService.parseBillPriceByLimit(debt, billCategory, priceLimit, request));
|
||||||
//是否有付款单或收款单
|
//是否有付款单或收款单
|
||||||
if(financialBillNoMap!=null) {
|
if(financialBillNoMap!=null) {
|
||||||
Integer financialBillNoSize = financialBillNoMap.get(dh.getId());
|
Integer financialBillNoSize = financialBillNoMap.get(dh.getId());
|
||||||
@@ -725,9 +736,11 @@ public class DepotHeadService {
|
|||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<DepotHeadVo4List> getDetailByNumber(String number)throws Exception {
|
public List<DepotHeadVo4List> getDetailByNumber(String number, HttpServletRequest request)throws Exception {
|
||||||
List<DepotHeadVo4List> resList = new ArrayList<DepotHeadVo4List>();
|
List<DepotHeadVo4List> resList = new ArrayList<>();
|
||||||
try{
|
try{
|
||||||
|
Long userId = userService.getUserId(request);
|
||||||
|
String priceLimit = userService.getRoleTypeByUserId(userId).getPriceLimit();
|
||||||
Map<Long,String> personMap = personService.getPersonMap();
|
Map<Long,String> personMap = personService.getPersonMap();
|
||||||
Map<Long,String> accountMap = accountService.getAccountMap();
|
Map<Long,String> accountMap = accountService.getAccountMap();
|
||||||
List<DepotHeadVo4List> list = depotHeadMapperEx.getDetailByNumber(number);
|
List<DepotHeadVo4List> list = depotHeadMapperEx.getDetailByNumber(number);
|
||||||
@@ -743,6 +756,7 @@ public class DepotHeadService {
|
|||||||
Map<String,Integer> billSizeMap = getBillSizeMapByLinkNumberList(numberList);
|
Map<String,Integer> billSizeMap = getBillSizeMapByLinkNumberList(numberList);
|
||||||
Map<Long,String> materialsListMap = findMaterialsListMapByHeaderIdList(idList);
|
Map<Long,String> materialsListMap = findMaterialsListMapByHeaderIdList(idList);
|
||||||
DepotHeadVo4List dh = list.get(0);
|
DepotHeadVo4List dh = list.get(0);
|
||||||
|
String billCategory = getBillCategory(dh.getSubType());
|
||||||
if(accountMap!=null && StringUtil.isNotEmpty(dh.getAccountIdList()) && StringUtil.isNotEmpty(dh.getAccountMoneyList())) {
|
if(accountMap!=null && StringUtil.isNotEmpty(dh.getAccountIdList()) && StringUtil.isNotEmpty(dh.getAccountMoneyList())) {
|
||||||
String accountStr = accountService.getAccountStrByIdAndMoney(accountMap, dh.getAccountIdList(), dh.getAccountMoneyList());
|
String accountStr = accountService.getAccountStrByIdAndMoney(accountMap, dh.getAccountIdList(), dh.getAccountMoneyList());
|
||||||
dh.setAccountName(accountStr);
|
dh.setAccountName(accountStr);
|
||||||
@@ -756,17 +770,28 @@ public class DepotHeadService {
|
|||||||
dh.setAccountMoneyList(accountmoneylistStr);
|
dh.setAccountMoneyList(accountmoneylistStr);
|
||||||
}
|
}
|
||||||
if(dh.getChangeAmount() != null) {
|
if(dh.getChangeAmount() != null) {
|
||||||
dh.setChangeAmount(dh.getChangeAmount().abs());
|
dh.setChangeAmount(roleService.parseBillPriceByLimit(dh.getChangeAmount().abs(), billCategory, priceLimit, request));
|
||||||
|
} else {
|
||||||
|
dh.setChangeAmount(BigDecimal.ZERO);
|
||||||
}
|
}
|
||||||
if(dh.getTotalPrice() != null) {
|
if(dh.getTotalPrice() != null) {
|
||||||
dh.setTotalPrice(dh.getTotalPrice().abs());
|
dh.setTotalPrice(roleService.parseBillPriceByLimit(dh.getTotalPrice().abs(), billCategory, priceLimit, request));
|
||||||
|
}
|
||||||
|
BigDecimal discountLastMoney = dh.getDiscountLastMoney()!=null?dh.getDiscountLastMoney():BigDecimal.ZERO;
|
||||||
|
dh.setDiscountLastMoney(roleService.parseBillPriceByLimit(discountLastMoney, billCategory, priceLimit, request));
|
||||||
|
BigDecimal backAmount = dh.getBackAmount()!=null?dh.getBackAmount():BigDecimal.ZERO;
|
||||||
|
dh.setBackAmount(roleService.parseBillPriceByLimit(backAmount, billCategory, priceLimit, request));
|
||||||
|
if(dh.getDeposit() == null) {
|
||||||
|
dh.setDeposit(BigDecimal.ZERO);
|
||||||
|
} else {
|
||||||
|
dh.setDeposit(roleService.parseBillPriceByLimit(dh.getDeposit(), billCategory, priceLimit, request));
|
||||||
}
|
}
|
||||||
//欠款计算
|
//欠款计算
|
||||||
BigDecimal discountLastMoney = dh.getDiscountLastMoney()!=null?dh.getDiscountLastMoney():BigDecimal.ZERO;
|
|
||||||
BigDecimal otherMoney = dh.getOtherMoney()!=null?dh.getOtherMoney():BigDecimal.ZERO;
|
BigDecimal otherMoney = dh.getOtherMoney()!=null?dh.getOtherMoney():BigDecimal.ZERO;
|
||||||
BigDecimal deposit = dh.getDeposit()!=null?dh.getDeposit():BigDecimal.ZERO;
|
BigDecimal deposit = dh.getDeposit()!=null?dh.getDeposit():BigDecimal.ZERO;
|
||||||
BigDecimal changeAmount = dh.getChangeAmount()!=null?dh.getChangeAmount():BigDecimal.ZERO;
|
BigDecimal changeAmount = dh.getChangeAmount()!=null?dh.getChangeAmount():BigDecimal.ZERO;
|
||||||
dh.setDebt(discountLastMoney.add(otherMoney).subtract((deposit.add(changeAmount))));
|
BigDecimal debt = discountLastMoney.add(otherMoney).subtract((deposit.add(changeAmount)));
|
||||||
|
dh.setDebt(roleService.parseBillPriceByLimit(debt, billCategory, priceLimit, request));
|
||||||
//是否有付款单或收款单
|
//是否有付款单或收款单
|
||||||
if(financialBillNoMap!=null) {
|
if(financialBillNoMap!=null) {
|
||||||
Integer financialBillNoSize = financialBillNoMap.get(dh.getId());
|
Integer financialBillNoSize = financialBillNoMap.get(dh.getId());
|
||||||
@@ -1233,6 +1258,15 @@ public class DepotHeadService {
|
|||||||
JshException.readFail(logger, e);
|
JshException.readFail(logger, e);
|
||||||
}
|
}
|
||||||
return total;
|
return total;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getBillCategory(String subType) {
|
||||||
|
if(subType.equals("零售") || subType.equals("零售退货")) {
|
||||||
|
return "retail";
|
||||||
|
} else if(subType.equals("销售订单") || subType.equals("销售") || subType.equals("销售退货")) {
|
||||||
|
return "sale";
|
||||||
|
} else {
|
||||||
|
return "buy";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -241,6 +241,30 @@ public class RoleService {
|
|||||||
return price;
|
return price;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据权限进行屏蔽价格-单据
|
||||||
|
* @param price
|
||||||
|
* @param billCategory
|
||||||
|
* @param priceLimit
|
||||||
|
* @param request
|
||||||
|
* @return
|
||||||
|
* @throws Exception
|
||||||
|
*/
|
||||||
|
public BigDecimal parseBillPriceByLimit(BigDecimal price, String billCategory, String priceLimit, HttpServletRequest request) throws Exception {
|
||||||
|
if(StringUtil.isNotEmpty(priceLimit)) {
|
||||||
|
if("buy".equals(billCategory) && priceLimit.contains("1")) {
|
||||||
|
return BigDecimal.ZERO;
|
||||||
|
}
|
||||||
|
if("retail".equals(billCategory) && priceLimit.contains("2")) {
|
||||||
|
return BigDecimal.ZERO;
|
||||||
|
}
|
||||||
|
if("sale".equals(billCategory) && priceLimit.contains("3")) {
|
||||||
|
return BigDecimal.ZERO;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return price;
|
||||||
|
}
|
||||||
|
|
||||||
public String getCurrentPriceLimit(HttpServletRequest request) throws Exception {
|
public String getCurrentPriceLimit(HttpServletRequest request) throws Exception {
|
||||||
Long userId = userService.getUserId(request);
|
Long userId = userService.getUserId(request);
|
||||||
return userService.getRoleTypeByUserId(userId).getPriceLimit();
|
return userService.getRoleTypeByUserId(userId).getPriceLimit();
|
||||||
|
|||||||
Reference in New Issue
Block a user