优化单据显示,自适应

This commit is contained in:
季圣华
2019-09-14 10:43:17 +08:00
parent 9247e77398
commit edc5404dae
83 changed files with 1151 additions and 498 deletions

View File

@@ -14,6 +14,7 @@ import com.jsh.erp.service.log.LogService;
import com.jsh.erp.utils.BaseResponseInfo;
import com.jsh.erp.utils.ErpInfo;
import com.jsh.erp.utils.StringUtil;
import com.jsh.erp.utils.Tools;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Value;
@@ -30,6 +31,7 @@ import java.util.List;
import java.util.Map;
import static com.jsh.erp.utils.ResponseJsonUtil.returnJson;
import static com.jsh.erp.utils.Tools.getNow3;
/**
* @author ji-sheng-hua 752*718*920
@@ -457,4 +459,39 @@ public class DepotHeadController {
depotHeadService.batchDeleteDepotHeadAndDetail(ids);
return result;
}
/**
* 统计今日销售额、本月销售额、本月进货额
* @param request
* @return
*/
@GetMapping(value = "/getBuyAndSaleStatistics")
public BaseResponseInfo getBuyAndSaleStatistics(HttpServletRequest request) {
BaseResponseInfo res = new BaseResponseInfo();
Map<String, Object> map = new HashMap<String, Object>();
try {
String today = Tools.getNow() + " 00:00:00";
String firstDay = Tools.getCurrentMonth() + "-01 00:00:00";
BigDecimal todaySale = depotHeadService.getBuyAndSaleStatistics("出库", "销售",
1, today, getNow3()); //今日销售出库
BigDecimal todayRetailSale = depotHeadService.getBuyAndSaleStatistics("出库", "销售",
0, today, getNow3()); //今日零售出库
BigDecimal monthSale = depotHeadService.getBuyAndSaleStatistics("出库", "销售",
1,firstDay, getNow3()); //本月销售出库
BigDecimal monthRetailSale = depotHeadService.getBuyAndSaleStatistics("出库", "销售",
0,firstDay, getNow3()); //本月零售出库
BigDecimal monthBuy = depotHeadService.getBuyAndSaleStatistics("入库", "采购",
1, firstDay, getNow3()); //本月采购入库
map.put("todaySale", todaySale.add(todayRetailSale));
map.put("thisMonthSale", monthSale.add(monthRetailSale));
map.put("thisMonthBuy", monthBuy);
res.code = 200;
res.data = map;
} catch(Exception e){
e.printStackTrace();
res.code = 500;
res.data = "获取数据失败";
}
return res;
}
}

View File

@@ -126,4 +126,11 @@ public interface DepotHeadMapperEx {
List<DepotHead> getDepotHeadListByHandsPersonIds(@Param("handsPersonIds") String[] handsPersonIds);
List<DepotHead> getDepotHeadListByDepotIds(@Param("depotIds") String[] depotIds);
BigDecimal getBuyAndSaleStatistics(
@Param("type") String type,
@Param("subType") String subType,
@Param("hasSupplier") Integer hasSupplier,
@Param("beginTime") String beginTime,
@Param("endTime") String endTime);
}

View File

@@ -631,4 +631,8 @@ public class DepotHeadService {
}
return result;
}
public BigDecimal getBuyAndSaleStatistics(String type, String subType, Integer hasSupplier, String beginTime, String endTime) {
return depotHeadMapperEx.getBuyAndSaleStatistics(type, subType, hasSupplier, beginTime, endTime);
}
}

View File

@@ -510,4 +510,29 @@
and ifnull(delete_Flag,'0') !='1'
</select>
<select id="getBuyAndSaleStatistics" resultType="java.math.BigDecimal">
SELECT
ifnull(sum(DiscountLastMoney),0)
FROM jsh_depothead
WHERE 1=1
<if test="type != null">
and Type='${type}'
</if>
<if test="subType != null">
and SubType='${subType}'
</if>
<if test="hasSupplier == 1">
and OrganId is not null
</if>
<if test="hasSupplier == 0">
and OrganId is null
</if>
<if test="beginTime != null">
and OperTime >= '${beginTime}'
</if>
<if test="endTime != null">
and OperTime &lt;= '${endTime}'
</if>
and ifnull(delete_Flag,'0') !='1'
</select>
</mapper>