| | |
| | | import io.swagger.annotations.ApiResponse; |
| | | import io.swagger.annotations.ApiResponses; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.math.BigDecimal; |
| | |
| | | |
| | | @ApiOperation(value = "专项 - 营业收入", notes = "专项 - 营业收入") |
| | | @PostMapping(value = "/findBusinessInCome") |
| | | public AjaxResult findBusinessInCome(@RequestBody StatisticsParamVo statisticsParam) { |
| | | return dataAnalysisCustomerService.getAnalysisResult(statisticsParam, new Caculate<BigDecimal>() { |
| | | @Override |
| | | public Map<String, BigDecimal> exec(List<StatisticsTimeDaoParam> timeSpaceParam, Long shopId, Long companyId) { |
| | | return tjVipSumDao.selectBusinessInCome(timeSpaceParam, shopId, null); |
| | | } |
| | | }); |
| | | public AjaxResult findBusinessInCome(@RequestBody @Validated StatisticsParamVo statisticsParam) { |
| | | if (statisticsParam.getShopId() != null) { |
| | | return dataAnalysisCustomerService.getAnalysisResult(statisticsParam, new Caculate<BigDecimal>() { |
| | | @Override |
| | | public Map<String, BigDecimal> exec(List<StatisticsTimeDaoParam> timeSpaceParam, Long shopId, Long companyId) { |
| | | switch (statisticsParam.getType()) { |
| | | case "1" : |
| | | return tjVipSumDao.selectBusinessInCome(timeSpaceParam, shopId, null); |
| | | case "2" : |
| | | return tjVipSumDao.selectCashIncome(timeSpaceParam, shopId, null); |
| | | case "3" : |
| | | return tjVipSumDao.selectCardUse(timeSpaceParam, shopId, null); |
| | | case "4" : |
| | | return tjVipSumDao.selectHisConsume(timeSpaceParam, shopId, null); |
| | | case "5" : |
| | | return tjVipSumDao.selectFreeConsume(timeSpaceParam, shopId, null); |
| | | case "6" : |
| | | return tjVipSumDao.selectBusinessInCome(timeSpaceParam, shopId, null); |
| | | case "7" : |
| | | return tjVipSumDao.selectBusinessInCome(timeSpaceParam, shopId, null); |
| | | case "8" : |
| | | return tjVipSumDao.selectArrears(timeSpaceParam, shopId, null); |
| | | default : |
| | | return tjVipSumDao.selectBusinessInCome(timeSpaceParam, shopId, null); |
| | | } |
| | | } |
| | | }); |
| | | } else { |
| | | return dataAnalysisCustomerService.getCompanyAnalysisResult(statisticsParam, new Caculate<BigDecimal>() { |
| | | @Override |
| | | public Map<String, BigDecimal> exec(List<StatisticsTimeDaoParam> timeSpaceParam, Long shopId, Long companyId) { |
| | | switch (statisticsParam.getType()) { |
| | | case "1" : |
| | | return tjVipSumDao.selectBusinessInCome(timeSpaceParam, null, companyId); |
| | | case "2" : |
| | | return tjVipSumDao.selectCashIncome(timeSpaceParam, null, companyId); |
| | | case "3" : |
| | | return tjVipSumDao.selectCardUse(timeSpaceParam, null, companyId); |
| | | case "4" : |
| | | return tjVipSumDao.selectHisConsume(timeSpaceParam, null, companyId); |
| | | case "5" : |
| | | return tjVipSumDao.selectFreeConsume(timeSpaceParam, null, companyId); |
| | | case "6" : |
| | | return tjVipSumDao.selectBusinessInCome(timeSpaceParam, null, companyId); |
| | | case "7" : |
| | | return tjVipSumDao.selectBusinessInCome(timeSpaceParam, null, companyId); |
| | | case "8" : |
| | | return tjVipSumDao.selectArrears(timeSpaceParam, null, companyId); |
| | | default : |
| | | return tjVipSumDao.selectBusinessInCome(timeSpaceParam, null, companyId); |
| | | } |
| | | } |
| | | }); |
| | | } |
| | | } |
| | | |
| | | } |
| | |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | |
| | | import javax.validation.constraints.NotBlank; |
| | | |
| | | /** |
| | | * 统计查询条件 |
| | | * @author jyy |
| | |
| | | /** |
| | | * 开始时间 |
| | | */ |
| | | @NotBlank(message = "参数错误") |
| | | @ApiModelProperty(value = "开始时间", example = "2020-01") |
| | | private String beginTime; |
| | | |
| | | /** |
| | | *结束时间 |
| | | */ |
| | | @NotBlank(message = "参数错误") |
| | | @ApiModelProperty(value = "结束时间", example = "2020-12") |
| | | private String endTime; |
| | | /** |
| | | *统计单位 |
| | | */ |
| | | @NotBlank(message = "参数错误") |
| | | @ApiModelProperty(value = "统计单位", example = "月") |
| | | private String statisticsUnit; |
| | | |
| | |
| | | @ApiModelProperty(value = "门店ID, 不传默认统计整个公司") |
| | | private Long shopId; |
| | | |
| | | @ApiModelProperty(value = "类型 1-营业收入 2-现金收入 3-余额划扣 4-本金消耗 5-赠送消耗 6-现金退款 7-卡项退款 8-欠款") |
| | | private String type; |
| | | |
| | | public String getType() { |
| | | return type; |
| | | } |
| | | |
| | | public void setType(String type) { |
| | | this.type = type; |
| | | } |
| | | |
| | | public String getBeginTime() { |
| | | return beginTime; |
| | | } |
| | |
| | | Map<String, Integer> customerEnterRateCompare(@Param("list") List<StatisticsTimeDaoParam> timeSpaceParam, @Param("shopId") Long shopId); |
| | | |
| | | Map<String, BigDecimal> selectBusinessInCome(@Param("list") List<StatisticsTimeDaoParam> timeSpaceParam, @Param("shopId") Long shopId, @Param("companyId") Long companyId); |
| | | |
| | | Map<String, BigDecimal> selectCashIncome(@Param("list") List<StatisticsTimeDaoParam> timeSpaceParam, @Param("shopId") Long shopId, @Param("companyId") Long companyId); |
| | | |
| | | Map<String, BigDecimal> selectCardUse(@Param("list") List<StatisticsTimeDaoParam> timeSpaceParam, @Param("shopId") Long shopId, @Param("companyId") Long companyId); |
| | | |
| | | Map<String, BigDecimal> selectArrears(@Param("list") List<StatisticsTimeDaoParam> timeSpaceParam, @Param("shopId") Long shopId, @Param("companyId") Long companyId); |
| | | |
| | | Map<String, BigDecimal> selectHisConsume(@Param("list") List<StatisticsTimeDaoParam> timeSpaceParam, @Param("shopId") Long shopId, @Param("companyId") Long companyId); |
| | | |
| | | Map<String, BigDecimal> selectFreeConsume(@Param("list") List<StatisticsTimeDaoParam> timeSpaceParam, @Param("shopId") Long shopId, @Param("companyId") Long companyId); |
| | | } |
| | |
| | | where STATU in ('已付款', '欠款') |
| | | and <![CDATA[order_time > #{item.beginTime} and order_time < #{item.endTime} ]]> |
| | | <if test="companyId != null and companyId != 0"> |
| | | and company_id=17 |
| | | and company_id=#{companyId} |
| | | </if> |
| | | <if test="shopId !=null and shopId !=0 " > |
| | | and SHOP_ID = #{shopId} |
| | |
| | | from area where id=1 |
| | | </select> |
| | | |
| | | <select id="selectCashIncome" resultType="java.util.TreeMap"> |
| | | select |
| | | <foreach collection="list" index="index" item="item" separator="," > |
| | | ( |
| | | select IFNULL(sum(cash_Pay), 0) |
| | | from sys_order |
| | | where STATU in ('已付款') |
| | | and <![CDATA[order_time > #{item.beginTime} and order_time < #{item.endTime} ]]> |
| | | <if test="companyId != null and companyId != 0"> |
| | | and company_id=#{companyId} |
| | | </if> |
| | | <if test="shopId !=null and shopId !=0 " > |
| | | and SHOP_ID = #{shopId} |
| | | </if> |
| | | ) as t${index} |
| | | |
| | | </foreach> |
| | | from area where id=1 |
| | | </select> |
| | | |
| | | <select id="selectCardUse" resultType="java.util.TreeMap"> |
| | | select |
| | | <foreach collection="list" index="index" item="item" separator="," > |
| | | ( |
| | | select IFNULL(sum(card_Pay), 0) |
| | | from sys_order |
| | | where STATU in ('已付款') |
| | | and <![CDATA[order_time > #{item.beginTime} and order_time < #{item.endTime} ]]> |
| | | <if test="companyId != null and companyId != 0"> |
| | | and company_id=#{companyId} |
| | | </if> |
| | | <if test="shopId !=null and shopId !=0 " > |
| | | and SHOP_ID = #{shopId} |
| | | </if> |
| | | ) as t${index} |
| | | |
| | | </foreach> |
| | | from area where id=1 |
| | | </select> |
| | | |
| | | <select id="selectArrears" resultType="java.util.TreeMap"> |
| | | select |
| | | <foreach collection="list" index="index" item="item" separator="," > |
| | | ( |
| | | select IFNULL(sum(card_Pay), 0) |
| | | from sys_order |
| | | where STATU in ('欠款') |
| | | and <![CDATA[order_time > #{item.beginTime} and order_time < #{item.endTime} ]]> |
| | | <if test="companyId != null and companyId != 0"> |
| | | and company_id=#{companyId} |
| | | </if> |
| | | <if test="shopId !=null and shopId !=0 " > |
| | | and SHOP_ID = #{shopId} |
| | | </if> |
| | | ) as t${index} |
| | | |
| | | </foreach> |
| | | from area where id=1 |
| | | </select> |
| | | |
| | | <select id="selectHisConsume" resultType="java.util.TreeMap"> |
| | | select |
| | | <foreach collection="list" index="index" item="item" separator="," > |
| | | ( |
| | | select IFNULL(sum(his_consume), 0) |
| | | from achieve_new |
| | | where order_type in ('服务单') |
| | | and <![CDATA[datatime > #{item.beginTime} and datatime < #{item.endTime} ]]> |
| | | <if test="companyId != null and companyId != 0"> |
| | | and company_id=#{companyId} |
| | | </if> |
| | | <if test="shopId !=null and shopId !=0 " > |
| | | and SHOP_ID = #{shopId} |
| | | </if> |
| | | ) as t${index} |
| | | |
| | | </foreach> |
| | | from area where id=1 |
| | | </select> |
| | | |
| | | <select id="selectFreeConsume" resultType="java.util.TreeMap"> |
| | | select |
| | | <foreach collection="list" index="index" item="item" separator="," > |
| | | ( |
| | | select IFNULL(sum(free_consume), 0) |
| | | from achieve_new |
| | | where order_type in ('服务单') |
| | | and <![CDATA[datatime > #{item.beginTime} and datatime < #{item.endTime} ]]> |
| | | <if test="companyId != null and companyId != 0"> |
| | | and company_id=#{companyId} |
| | | </if> |
| | | <if test="shopId !=null and shopId !=0 " > |
| | | and SHOP_ID = #{shopId} |
| | | </if> |
| | | ) as t${index} |
| | | </foreach> |
| | | from area where id=1 |
| | | </select> |
| | | |
| | | </mapper> |
| | | |