Helius
2021-01-15 61073b1c849656e9a3e8097ffe3e658cc72946b6
modify
1 files added
7 files modified
288 ■■■■ changed files
zq-erp/src/main/java/com/matrix/system/app/action/ApiCommonAction.java 10 ●●●●● patch | view | raw | blame | history
zq-erp/src/main/java/com/matrix/system/app/action/ApiStatisticsAction.java 24 ●●●● patch | view | raw | blame | history
zq-erp/src/main/java/com/matrix/system/common/dao/SysUsersDao.java 2 ●●●●● patch | view | raw | blame | history
zq-erp/src/main/java/com/matrix/system/common/service/SysUsersService.java 2 ●●●●● patch | view | raw | blame | history
zq-erp/src/main/java/com/matrix/system/common/service/impl/SysUsersServiceImpl.java 5 ●●●●● patch | view | raw | blame | history
zq-erp/src/main/java/com/matrix/system/hive/bean/AppVersion.java 71 ●●●●● patch | view | raw | blame | history
zq-erp/src/main/resources/mybatis/mapper/common/SysUsersDao.xml 4 ●●● patch | view | raw | blame | history
zq-erp/src/main/resources/mybatis/mapper/hive/SysBusinessDataDao.xml 170 ●●●●● patch | view | raw | blame | history
zq-erp/src/main/java/com/matrix/system/app/action/ApiCommonAction.java
@@ -18,6 +18,7 @@
import com.matrix.system.common.bean.SysUsers;
import com.matrix.system.common.service.SysUsersService;
import com.matrix.system.common.tools.PasswordUtil;
import com.matrix.system.hive.bean.AppVersion;
import com.matrix.system.hive.bean.SysShopInfo;
import com.matrix.system.hive.plugin.util.CollectionUtils;
import com.matrix.system.hive.plugin.util.ImageUtil;
@@ -174,4 +175,13 @@
        }
        return AjaxResult.buildFailInstance("修改失败");
    }
    @ApiOperation(value = "获取app版本", notes = "获取app版本")
    @ApiResponses({
            @ApiResponse(code = 200, message = "ok", response = AppVersion.class)
    })
    @GetMapping(value = "/findAppVersion")
    public AjaxResult findAppVersion() {
        return AjaxResult.buildSuccessInstance(sysUsersService.findAppVersion());
    }
}
zq-erp/src/main/java/com/matrix/system/app/action/ApiStatisticsAction.java
@@ -52,23 +52,21 @@
    })
    @PostMapping(value = "/findShopBusinessesData")
    public AjaxResult findShopBusinessesData(@RequestBody BusinessesDto businessesDto) {
        SysBusinessData sysBusinessData = new SysBusinessData();
        // 若shopId为空,则查询门店经营报表
        if (businessesDto.getShopId() == null) {
            sysBusinessData.setShopId(businessesDto.getShopId());
        }
        QueryUtil.setQueryLimitCom(sysBusinessData);
        String unit = "";
        if (BusinessesDto.DAY.equals(businessesDto.getType())) {
            sysBusinessData.setT1("%Y-%m-%d");
            unit = "日";
        } else {
            sysBusinessData.setT1("%Y-%m");
            unit = "月";
        }
        PaginationVO pageVo = new PaginationVO();
        pageVo.setOffset((businessesDto.getPageNum() - 1) * businessesDto.getPageSize());
        pageVo.setLimit(businessesDto.getPageSize());
        return AjaxResult.buildSuccessInstance(sysBusinessDataDao.selectApiBusinessDataInPage(sysBusinessData, pageVo), sysBusinessDataDao.selectApiBusinessDataTotal(sysBusinessData));
        //        PaginationVO pageVo = new PaginationVO();
//        pageVo.setOffset((businessesDto.getPageNum() - 1) * businessesDto.getPageSize());
//        pageVo.setLimit(businessesDto.getPageSize());
        Calendar calendar = Calendar.getInstance();
        Date now = calendar.getTime();
        List<Date> xAxis = StatisticsTimeUtil.getTimeSpace("2021-01-13", "2021-01-13", unit);
        List<StatisticsTimeDaoParam> timeSpaceParam = StatisticsTimeUtil.buidParam(xAxis);
        return AjaxResult.buildSuccessInstance("123");
    }
    @ApiOperation(value = "专项", notes = "专项")
zq-erp/src/main/java/com/matrix/system/common/dao/SysUsersDao.java
@@ -3,6 +3,7 @@
import com.matrix.core.pojo.PaginationVO;
import com.matrix.system.common.bean.SysUserLoginRecord;
import com.matrix.system.common.bean.SysUsers;
import com.matrix.system.hive.bean.AppVersion;
import com.matrix.system.hive.bean.SysBeauticianState;
import com.matrix.system.hive.bean.SysProjServices;
import org.apache.ibatis.annotations.Param;
@@ -122,5 +123,6 @@
     */
    public int emptySignInfoById(Long id);
    public List<AppVersion> selectAppVersion();
}
zq-erp/src/main/java/com/matrix/system/common/service/SysUsersService.java
@@ -3,6 +3,7 @@
import com.matrix.core.pojo.PaginationVO;
import com.matrix.system.common.bean.SysUserLoginRecord;
import com.matrix.system.common.bean.SysUsers;
import com.matrix.system.hive.bean.AppVersion;
import com.matrix.system.hive.bean.SysBeauticianState;
import com.matrix.system.hive.bean.SysProjServices;
@@ -170,5 +171,6 @@
    public int findByCodeBeaStateShopCount(Long shopId,
                                           SysProjServices sysProjServices, List<String> panBanCodes);
    public List<AppVersion> findAppVersion();
}
zq-erp/src/main/java/com/matrix/system/common/service/impl/SysUsersServiceImpl.java
@@ -15,6 +15,7 @@
import com.matrix.system.common.service.SysUsersService;
import com.matrix.system.common.tools.PasswordUtil;
import com.matrix.system.common.tools.ServiceUtil;
import com.matrix.system.hive.bean.AppVersion;
import com.matrix.system.hive.bean.SysBeauticianState;
import com.matrix.system.hive.bean.SysProjServices;
import com.matrix.system.hive.bean.SysShopInfo;
@@ -258,4 +259,8 @@
    }
    @Override
    public List<AppVersion> findAppVersion() {
        return sysUsersDao.selectAppVersion();
    }
}
zq-erp/src/main/java/com/matrix/system/hive/bean/AppVersion.java
New file
@@ -0,0 +1,71 @@
package com.matrix.system.hive.bean;
import com.fasterxml.jackson.annotation.JsonFormat;
import java.util.Date;
/**
 * @author wzy
 * @date 2021-01-15
 **/
public class AppVersion {
    private static final long serialVersionUID = 1L;
    private Long id;
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date createtime;
    private String version;
    private String content;
    private String address;
    private Integer type;
    public Long getId() {
        return id;
    }
    public void setId(Long id) {
        this.id = id;
    }
    public Date getCreatetime() {
        return createtime;
    }
    public void setCreatetime(Date createtime) {
        this.createtime = createtime;
    }
    public String getVersion() {
        return version;
    }
    public void setVersion(String version) {
        this.version = version;
    }
    public String getContent() {
        return content;
    }
    public void setContent(String content) {
        this.content = content;
    }
    public String getAddress() {
        return address;
    }
    public void setAddress(String address) {
        this.address = address;
    }
    public Integer getType() {
        return type;
    }
    public void setType(Integer type) {
        this.type = type;
    }
}
zq-erp/src/main/resources/mybatis/mapper/common/SysUsersDao.xml
@@ -1318,5 +1318,7 @@
   where id=#{id}
   </update>
    <select id="selectAppVersion" resultType="com.matrix.system.hive.bean.AppVersion">
        select * from app_version
    </select>
</mapper>
zq-erp/src/main/resources/mybatis/mapper/hive/SysBusinessDataDao.xml
@@ -622,38 +622,178 @@
    <select id="selectDemo" resultType="com.matrix.system.app.vo.BusinessesDataShowVo">
        <foreach collection="list" index="index" item="item"   separator="union all"  >
            select
                (select sum(amount) from sys_order_flow where shop_id=34 and <![CDATA[ create_time > '2021-01-13 00:00:00' and create_time < '2021-01-14 00:00:00')]]> totalPay,
                (select sum(amount) from sys_order_flow where shop_id=34 and pay_method not in ('储值卡', '欠款') and flow_type != '退款' and <![CDATA[ create_time > '2021-01-13 00:00:00' and create_time < '2021-01-14 00:00:00')]]> cashPay,
                (select sum(amount) from sys_order_flow where shop_id=34 and pay_method = '储值卡' and flow_type != '退款' and <![CDATA[ create_time > '2021-01-13 00:00:00' and create_time < '2021-01-14 00:00:00' ]]>) cardPay,
                (select sum(amount) from sys_order_flow where shop_id=34 and pay_method = '欠款' and <![CDATA[ create_time > '2021-01-13 00:00:00' and create_time < '2021-01-14 00:00:00' ]]>) arrearsPay,
                (select sum(amount) from sys_order_flow where shop_id=34 and pay_method not in ('储值卡', '欠款') and flow_type = '退款' and <![CDATA[ create_time > '2021-01-13 00:00:00' and create_time < '2021-01-14 00:00:00' ]]>) refundCashPay,
                (select sum(amount) from sys_order_flow where shop_id=34 and pay_method in ('储值卡') and flow_type = '退款' and <![CDATA[ create_time > '2021-01-13 00:00:00' and create_time < '2021-01-14 00:00:00' ]]>) refundCardPay,
                (select sum(amount) from sys_order_flow
                    where <![CDATA[ create_time > #{item.beginTime} and create_time < #{item.endTime}]]>
                    <if test="shopId != null">
                        and shop_id=#{shopId}
                    </if>
                    <if test="companyId != null">
                        and company_id=#{companyId}
                    </if>
                    )totalPay,
                (select sum(amount) from sys_order_flow
                    where pay_method not in ('储值卡', '欠款') and flow_type != '退款' and <![CDATA[ create_time > #{item.beginTime} and create_time < #{item.endTime}]]>
                    <if test="shopId != null">
                        and shop_id=#{shopId}
                    </if>
                    <if test="companyId != null">
                        and company_id=#{companyId}
                    </if>
                    ) cashPay,
                (select sum(amount) from sys_order_flow
                    where pay_method = '储值卡' and flow_type != '退款' and <![CDATA[ create_time > #{item.beginTime} and create_time < #{item.endTime}]]>
                    <if test="shopId != null">
                        and shop_id=#{shopId}
                    </if>
                    <if test="companyId != null">
                        and company_id=#{companyId}
                    </if>
                    ) cardPay,
                (select sum(amount) from sys_order_flow
                    where pay_method = '欠款' and <![CDATA[ create_time > #{item.beginTime} and create_time < #{item.endTime}]]>
                    <if test="shopId != null">
                        and shop_id=#{shopId}
                    </if>
                    <if test="companyId != null">
                        and company_id=#{companyId}
                    </if>
                    ) arrearsPay,
                (select sum(amount) from sys_order_flow
                    where pay_method not in ('储值卡', '欠款') and flow_type = '退款' and <![CDATA[ create_time > #{item.beginTime} and create_time < #{item.endTime}]]>
                    <if test="shopId != null">
                        and shop_id=#{shopId}
                    </if>
                    <if test="companyId != null">
                        and company_id=#{companyId}
                    </if>
                    ) refundCashPay,
                (select sum(amount) from sys_order_flow
                    where pay_method in ('储值卡') and flow_type = '退款' and <![CDATA[ create_time > #{item.beginTime} and create_time < #{item.endTime}]]>
                    <if test="shopId != null">
                        and shop_id=#{shopId}
                    </if>
                    <if test="companyId != null">
                        and company_id=#{companyId}
                    </if>
                    ) refundCardPay,
                (select sum(a.amount) from sys_order_flow a
                    inner join sys_order_item b on a.order_id=b.ORDER_ID
                    inner join shopping_goods c on b.goods_id=c.id
                    where c.good_type='家居产品' and a.shop_id=34 and <![CDATA[ a.create_time > '2021-01-13 00:00:00' and a.create_time < '2021-01-14 00:00:00']]> ) productAchieve,
                    where c.good_type='家居产品' and <![CDATA[ a.create_time > #{item.beginTime} and a.create_time < #{item.endTime}]]>
                    <if test="shopId != null">
                        and a.shop_id=#{shopId}
                    </if>
                    <if test="companyId != null">
                        and a.company_id=#{companyId}
                    </if>
                    ) productAchieve,
                (select sum(a.amount) from sys_order_flow a
                    inner join sys_order_item b on a.order_id=b.ORDER_ID
                    inner join shopping_goods c on b.goods_id=c.id
                    where c.good_type!='家居产品' and a.shop_id=34 and <![CDATA[ a.create_time > '2021-01-13 00:00:00' and a.create_time < '2021-01-14 00:00:00']]> ) cardAchieve,
                (select sum(amount) from sys_order_flow where shop_id=34 and flow_type = '退款' and <![CDATA[ create_time > '2021-01-13 00:00:00' and create_time < '2021-01-14 00:00:00' ]]>) refund,
                (select count(1) from sys_order where shop_id=34 and STATU in ('已付款', '欠款') and <![CDATA[ ORDER_TIME > '2021-01-13 00:00:00' and ORDER_TIME < '2021-01-14 00:00:00' ]]>) perCustomCnt,
                    where c.good_type!='家居产品' and <![CDATA[ a.create_time > #{item.beginTime} and a.create_time < #{item.endTime}]]>
                    <if test="shopId != null">
                        and a.shop_id=#{shopId}
                    </if>
                    <if test="companyId != null">
                        and a.company_id=#{companyId}
                    </if>
                    ) cardAchieve,
                (select sum(amount) from sys_order_flow where flow_type = '退款' and <![CDATA[ create_time > #{item.beginTime} and create_time < #{item.endTime}]]>
                    <if test="shopId != null">
                        and shop_id=#{shopId}
                    </if>
                    <if test="companyId != null">
                        and company_id=#{companyId}
                    </if>
                ) refund,
                (select count(1) from sys_order
                    where STATU in ('已付款', '欠款') and <![CDATA[ ORDER_TIME > #{item.beginTime} and ORDER_TIME < #{item.endTime} ]]>
                    <if test="shopId != null">
                        and shop_id=#{shopId}
                    </if>
                    <if test="companyId != null">
                        and company_id=#{companyId}
                    </if>
                    ) perCustomCnt,
                (select sum(b.COUNT) from sys_order a inner join sys_order_item b on a.ID=b.ORDER_ID
                    where a.SHOP_ID=34 and a.STATU in ('已付款', '欠款') and <![CDATA[ ORDER_TIME > '2021-01-13 00:00:00' and ORDER_TIME < '2021-01-14 00:00:00' ]]>) totalSaleCnt,
                    where a.STATU in ('已付款', '欠款') and <![CDATA[ ORDER_TIME > #{item.beginTime} and ORDER_TIME < #{item.endTime} ]]>
                    <if test="shopId != null">
                        and shop_id=#{shopId}
                    </if>
                    <if test="companyId != null">
                        and company_id=#{companyId}
                    </if>
                    ) totalSaleCnt,
                (select sum(e.count * d.GOODS_PRICE) from sys_order a
                    inner join sys_out_store b on a.id=b.ORDER_ID
                    inner join sys_out_store_item c on b.id=c.OUT_STORE_ID
                    inner join sys_store_info d on c.store_id = d.ID
                    inner join sys_order_item e on a.ID=e.ORDER_ID
                    inner join shopping_goods f on e.goods_id=f.id and f.good_type='家居产品'
                    where a.shop_id=34 and a.STATU in ('已付款', '欠款') and <![CDATA[ ORDER_TIME > '2021-01-13 00:00:00' and ORDER_TIME < '2021-01-14 00:00:00']]>
                    where a.STATU in ('已付款', '欠款') and <![CDATA[ ORDER_TIME > #{item.beginTime} and ORDER_TIME < #{item.endTime} ]]>
                    <if test="shopId != null">
                        and a.shop_id=#{shopId}
                    </if>
                    <if test="companyId != null">
                        and a.company_id=#{companyId}
                    </if>
                ) goodsCost,
                (select sum(b.COUNT * IFNULL(c.price, 0)) from sys_order a
                    inner join sys_order_item b on a.ID=b.ORDER_ID
                    inner join shopping_goods c on c.good_type != '家居产品' and b.goods_id=c.id
                    where a.shop_id=34 and a.STATU in ('已付款', '欠款') and <![CDATA[ORDER_TIME > '2021-01-13 00:00:00' and ORDER_TIME < '2021-01-14 00:00:00']]>
                ) otherCost
                    where a.STATU in ('已付款', '欠款') and <![CDATA[ ORDER_TIME > #{item.beginTime} and ORDER_TIME < #{item.endTime} ]]>
                    <if test="shopId != null">
                        and a.shop_id=#{shopId}
                    </if>
                    <if test="companyId != null">
                        and a.company_id=#{companyId}
                    </if>
                ) otherCost,
                (select sum(IFNULL(his_consume, 0)) from achieve_new
                    where <![CDATA[datatime > #{item.beginTime} and datatime < #{item.endTime}]]>
                    <if test="shopId != null">
                        and shop_id=#{shopId}
                    </if>
                    <if test="companyId != null">
                        and company_id=#{companyId}
                    </if>
                    ) consumePay,
                (select sum(IFNULL(free_consume, 0)) from achieve_new
                    where <![CDATA[datatime > #{item.beginTime} and datatime < #{item.endTime}]]>
                    <if test="shopId != null">
                        and shop_id=#{shopId}
                    </if>
                    <if test="companyId != null">
                        and company_id=#{companyId}
                    </if>
                    ) freeConsumePay,
                (select sum(IFNULL(number_of_people, 0)) from achieve_new
                    where <![CDATA[datatime > #{item.beginTime} and datatime < #{item.endTime}]]>
                    <if test="shopId != null">
                        and shop_id=#{shopId}
                    </if>
                    <if test="companyId != null">
                        and company_id=#{companyId}
                    </if>
                    ) peopleCnt,
                (select sum(IFNULL(proj_num, 0)) from achieve_new
                    where <![CDATA[datatime > #{item.beginTime} and datatime < #{item.endTime}]]>
                    <if test="shopId != null">
                        and shop_id=#{shopId}
                    </if>
                    <if test="companyId != null">
                        and company_id=#{companyId}
                    </if>
                    ) projConsumeCnt,
                (select sum(IFNULL(proj_time, 0)) from achieve_new
                    where <![CDATA[datatime > #{item.beginTime} and datatime < #{item.endTime}]]>
                    <if test="shopId != null">
                        and shop_id=#{shopId}
                    </if>
                    <if test="companyId != null">
                        and company_id=#{companyId}
                    </if>
                    ) timeLength
            from dual
        </foreach>
    </select>