|  | @@ -2915,6 +2915,12 @@ public class TWarehouseBillsServiceImpl implements ITWarehouseBillsService {
 | 
	
		
			
				|  |  |       */
 | 
	
		
			
				|  |  |      @Override
 | 
	
		
			
				|  |  |      public List<Map<String, Object>> selectAppStockList(TWarehouseBills warehouseBills) {
 | 
	
		
			
				|  |  | +        String external = null;
 | 
	
		
			
				|  |  | +        SysUser user = SecurityUtils.getLoginUser().getUser();
 | 
	
		
			
				|  |  | +        if ("外部用户".equals(user.getDept().getDeptName())) {
 | 
	
		
			
				|  |  | +            external = user.getUserName();
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +        warehouseBills.setExternal(external);
 | 
	
		
			
				|  |  |          return tWarehouseBillsMapper.selectAppStockList(warehouseBills);
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |  
 | 
	
	
		
			
				|  | @@ -7664,7 +7670,7 @@ public class TWarehouseBillsServiceImpl implements ITWarehouseBillsService {
 | 
	
		
			
				|  |  |       * @return
 | 
	
		
			
				|  |  |       */
 | 
	
		
			
				|  |  |      @Override
 | 
	
		
			
				|  |  | -    public AjaxResult stockStatistics() {
 | 
	
		
			
				|  |  | +    public Map<String, String> stockStatistics() {
 | 
	
		
			
				|  |  |          String external = null;
 | 
	
		
			
				|  |  |          String customerName;
 | 
	
		
			
				|  |  |          SysUser user = SecurityUtils.getLoginUser().getUser();
 | 
	
	
		
			
				|  | @@ -7692,16 +7698,16 @@ public class TWarehouseBillsServiceImpl implements ITWarehouseBillsService {
 | 
	
		
			
				|  |  |          // 本周
 | 
	
		
			
				|  |  |          data.put("inStockTotalWeek", inAndOutStockStatistics("SJRK", DateUtils.beginOfWeek(), DateUtils.endOfWeek(), external));
 | 
	
		
			
				|  |  |          data.put("outStockTotalWeek", inAndOutStockStatistics("SJCK", DateUtils.beginOfWeek(), DateUtils.endOfWeek(), external));
 | 
	
		
			
				|  |  | +        // 上周
 | 
	
		
			
				|  |  | +        data.put("inStockTotalLastWeek", inAndOutStockStatistics("SJRK", DateUtils.beginOfLastWeek(), DateUtils.endOfLastWeek(), external));
 | 
	
		
			
				|  |  | +        data.put("outStockTotalLastWeek", inAndOutStockStatistics("SJCK", DateUtils.beginOfLastWeek(), DateUtils.endOfLastWeek(), external));
 | 
	
		
			
				|  |  |          // 本月
 | 
	
		
			
				|  |  |          data.put("inStockTotalMonth", inAndOutStockStatistics("SJRK", DateUtils.beginOfMonth(), DateUtils.endOfMonth(), external));
 | 
	
		
			
				|  |  |          data.put("outStockTotalMonth", inAndOutStockStatistics("SJCK", DateUtils.beginOfMonth(), DateUtils.endOfMonth(), external));
 | 
	
		
			
				|  |  |          // 上个月
 | 
	
		
			
				|  |  |          data.put("inStockTotalLastMonth", inAndOutStockStatistics("SJRK", DateUtils.beginOfLastMonth(), DateUtils.endOfLastMonth(), external));
 | 
	
		
			
				|  |  |          data.put("outStockTotalLastMonth", inAndOutStockStatistics("SJCK", DateUtils.beginOfLastMonth(), DateUtils.endOfLastMonth(), external));
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -        // 库龄
 | 
	
		
			
				|  |  | -        data.put("stockDays", String.valueOf(tWhgenlegMapper.stockDays(external).get("days")));
 | 
	
		
			
				|  |  | -        return AjaxResult.success(data);
 | 
	
		
			
				|  |  | +        return data;
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      /**
 | 
	
	
		
			
				|  | @@ -7710,7 +7716,7 @@ public class TWarehouseBillsServiceImpl implements ITWarehouseBillsService {
 | 
	
		
			
				|  |  |       * @return
 | 
	
		
			
				|  |  |       */
 | 
	
		
			
				|  |  |      @Override
 | 
	
		
			
				|  |  | -    public AjaxResult cycleStockStatistics() {
 | 
	
		
			
				|  |  | +    public Map<String, String> cycleStockStatistics() {
 | 
	
		
			
				|  |  |          String external = null;
 | 
	
		
			
				|  |  |          SysUser user = SecurityUtils.getLoginUser().getUser();
 | 
	
		
			
				|  |  |          if ("外部用户".equals(user.getDept().getDeptName())) {
 | 
	
	
		
			
				|  | @@ -7718,6 +7724,8 @@ public class TWarehouseBillsServiceImpl implements ITWarehouseBillsService {
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |          Map<String, String> data = new HashMap<>();
 | 
	
		
			
				|  |  | +        // 库龄
 | 
	
		
			
				|  |  | +        data.put("stockDays", String.valueOf(tWhgenlegMapper.stockDays(external).get("days")));
 | 
	
		
			
				|  |  |          // 7天
 | 
	
		
			
				|  |  |          data.put("stockTotalA", stockStatistics(DateUtils.offsetDate(-6), null, external));
 | 
	
		
			
				|  |  |          // 15天
 | 
	
	
		
			
				|  | @@ -7732,13 +7740,13 @@ public class TWarehouseBillsServiceImpl implements ITWarehouseBillsService {
 | 
	
		
			
				|  |  |          data.put("stockTotalF", stockStatistics(DateUtils.offsetDate(-179), DateUtils.offsetDate(-89), external));
 | 
	
		
			
				|  |  |          // 180天+
 | 
	
		
			
				|  |  |          data.put("stockTotalG", stockStatistics(null, DateUtils.offsetDate(-179), external));
 | 
	
		
			
				|  |  | -        return AjaxResult.success(data);
 | 
	
		
			
				|  |  | +        return data;
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      private String inAndOutStockStatistics(String billType, String beginDate, String endDate, String external) {
 | 
	
		
			
				|  |  |          beginDate += " 00:00:00";
 | 
	
		
			
				|  |  |          endDate += " 23:59:59";
 | 
	
		
			
				|  |  | -        Map<String, Object> statistics = tWarehousebillsfeesMapper.inAndOutStockStatistics(billType, beginDate, endDate, external);
 | 
	
		
			
				|  |  | +        Map<String, Object> statistics = tWarehousebillsitemsMapper.inAndOutStockStatistics(billType, beginDate, endDate, external);
 | 
	
		
			
				|  |  |          return String.valueOf(statistics.get("total"));
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |  
 |