姜友瑶
2022-06-15 7bb22e67688232190a00ee3e63b5b93ea6037273
Merge branch 'developer'
12 files modified
330 ■■■■ changed files
zq-erp/src/main/java/com/matrix/system/hive/action/StoreInOutController.java 71 ●●●●● patch | view | raw | blame | history
zq-erp/src/main/java/com/matrix/system/hive/dao/SysOrderDao.java 2 ●●●●● patch | view | raw | blame | history
zq-erp/src/main/java/com/matrix/system/hive/dao/SysProjServicesDao.java 3 ●●●● patch | view | raw | blame | history
zq-erp/src/main/java/com/matrix/system/hive/pojo/StoreInOutRecordVO.java 183 ●●●● patch | view | raw | blame | history
zq-erp/src/main/java/com/matrix/system/hive/service/SysOrderService.java 1 ●●●● patch | view | raw | blame | history
zq-erp/src/main/java/com/matrix/system/hive/service/SysProjServicesService.java 2 ●●●●● patch | view | raw | blame | history
zq-erp/src/main/java/com/matrix/system/hive/service/imp/SysOrderServiceImpl.java 8 ●●●● patch | view | raw | blame | history
zq-erp/src/main/java/com/matrix/system/hive/service/imp/SysProjServicesServiceImpl.java 5 ●●●●● patch | view | raw | blame | history
zq-erp/src/main/resources/mybatis/mapper/hive/SysOrderDao.xml 21 ●●●●● patch | view | raw | blame | history
zq-erp/src/main/resources/mybatis/mapper/hive/SysProjServicesDao.xml 24 ●●●●● patch | view | raw | blame | history
zq-erp/src/main/resources/mybatis/mapper/hive/SysStoreInfoDao.xml 8 ●●●● patch | view | raw | blame | history
zq-erp/src/main/resources/templates/views/admin/hive-erp/statistics/store-inout-sum.html 2 ●●●●● patch | view | raw | blame | history
zq-erp/src/main/java/com/matrix/system/hive/action/StoreInOutController.java
@@ -1,18 +1,20 @@
package com.matrix.system.hive.action;
import cn.hutool.core.collection.CollUtil;
import com.matrix.core.pojo.AjaxResult;
import com.matrix.core.pojo.PaginationVO;
import com.matrix.core.tools.DateUtil;
import com.matrix.core.tools.excl.ExcelSheetPO;
import com.matrix.core.tools.excl.ExcelVersion;
import com.matrix.system.common.tools.DataAuthUtil;
import com.matrix.system.common.tools.ResponseHeadUtil;
import com.matrix.system.constance.Dictionary;
import com.matrix.system.hive.action.util.QueryUtil;
import com.matrix.system.hive.bean.SysCheckInfo;
import com.matrix.system.hive.bean.SysOrder;
import com.matrix.system.hive.bean.SysProjServices;
import com.matrix.system.hive.dao.SysStoreInfoDao;
import com.matrix.core.tools.DateUtil;
import com.matrix.system.hive.pojo.StoreInOutRecordVO;
import com.matrix.system.hive.service.SysOrderService;
import com.matrix.system.hive.service.SysProjServicesService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
@@ -23,10 +25,10 @@
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.OutputStream;
import java.net.URLDecoder;
import java.net.URLEncoder;
import java.util.ArrayList;
import java.util.List;
import java.util.*;
import java.util.function.Function;
import java.util.stream.Collectors;
/**
@@ -42,6 +44,12 @@
    @Autowired
    SysStoreInfoDao storeInfoDao;
    @Autowired
    SysOrderService orderService;
    @Autowired
    SysProjServicesService projServicesService;
    /**
     * 列表显示
     */
@@ -50,9 +58,52 @@
    AjaxResult showList(StoreInOutRecordVO inOutRecordVO, PaginationVO pageVo) {
        QueryUtil.setQueryLimitCom(inOutRecordVO);
        List<StoreInOutRecordVO> dataList =storeInfoDao.findStoreInOutRecord(inOutRecordVO,pageVo);
        //原始订单号赋值
        setExtInfo(dataList);
        return AjaxResult.buildSuccessInstance(dataList,storeInfoDao.findStoreInOutTotal(inOutRecordVO));
    }
    /**
     * 填充扩展信息
     * @param dataList
     */
    private void setExtInfo(List<StoreInOutRecordVO> dataList) {
        List<Long> serviceIds = dataList.stream().map(StoreInOutRecordVO::getServiceId).filter(e -> Objects.nonNull(e)).collect(Collectors.toList());
        List<Long> orderIds = dataList.stream().map(StoreInOutRecordVO::getOrderId).filter(e -> Objects.nonNull(e)).collect(Collectors.toList());
        List<SysOrder> orderList = orderService.findByIds(orderIds);
        Map<String, SysOrder> orderMap=new HashMap<>();
        Map<String, SysProjServices> serviceMap=new HashMap<>();
        if(CollUtil.isNotEmpty(orderList)){
            orderMap = orderList.stream().collect(Collectors.toMap(e->String.format("%s_%s",e.getId(),"DD"), Function.identity(), (a, b) -> a));
        }
        List<SysProjServices> projServicesList = projServicesService.findByIds(serviceIds);
        if(CollUtil.isNotEmpty(projServicesList)){
            serviceMap= projServicesList.stream().collect(Collectors.toMap(e->String.format("%s_%s",e.getId(),"FWD"), Function.identity(), (a, b) -> a));
        }
        if(orderMap.size()>0){
            for (StoreInOutRecordVO e : dataList){
                if(Objects.nonNull(e.getOrderId())){
                    SysOrder order = orderMap.get(String.format("%s_%s", e.getOrderId(), "DD"));
                    if(Objects.nonNull(order)){
                        e.setSourceOrderNo(order.getOrderNo() );
                        e.setVipName(order.getVipName());
                    }
                }
                if(Objects.nonNull(e.getServiceId())){
                    SysProjServices sysProjServices = serviceMap.get(String.format("%s_%s", e.getServiceId(), "FWD"));
                    if(Objects.nonNull(sysProjServices)){
                        e.setSourceOrderNo( sysProjServices.getServiceNo());
                        e.setVipName(sysProjServices.getVipName());
                    }
                }
            }
        }
    }
    /**
@@ -77,13 +128,17 @@
        String title = "库存流向明细";
        orderSheet.setSheetName(title);
        orderSheet.setTitle(title);
        String[] header = {"时间", "产品编码", "商品名称", "库存分类", "出库数量", "出库单价", "出库金额", "单据编号", "单据类型", "库存批次", "操作人", "单据备注", "门店"};
        String[] header = {"时间", "产品编码", "商品名称", "库存分类", "出库数量", "出库单价", "出库金额", "来源单据",  "下单客户",  "单据编号", "单据类型", "库存批次", "操作人", "单据备注", "门店"};
        orderSheet.setHeaders(header);
        if (getMe().getShopRole().equals(Dictionary.FLAG_NO_N)) {
            inOutRecordVO.setShopId(getMe().getShopId());
        }
        List<StoreInOutRecordVO> dataList =storeInfoDao.findStoreInOutRecord(inOutRecordVO,null);
        //原始订单号赋值
        setExtInfo(dataList);
        List<List<Object>> list = new ArrayList<>();
        if (dataList.size() > 0) {
            for (StoreInOutRecordVO item : dataList) {
@@ -96,6 +151,8 @@
                temp.add(item.getAmount());
                temp.add(item.getGoodsPrice());
                temp.add(item.getTotalPrice());
                temp.add(item.getSourceOrderNo());
                temp.add(item.getVipName());
                temp.add(item.getOrderNo());
                temp.add(item.getOrderType());
                temp.add(item.getBatch());
zq-erp/src/main/java/com/matrix/system/hive/dao/SysOrderDao.java
@@ -36,6 +36,8 @@
    public SysOrder  selectById(Long id);
    public List<SysOrder>  selectByIds(@Param("list")List<Long> ids);
    public int selectInPageCount(@Param("record") SysOrder sysOrder);
    public void updateOrderTime(@Param("payTime") Date orderTime, @Param("id") Long id);
zq-erp/src/main/java/com/matrix/system/hive/dao/SysProjServicesDao.java
@@ -9,7 +9,6 @@
import com.matrix.system.shopXcx.api.vo.ErpServiceOrderListVo;
import org.apache.ibatis.annotations.Param;
import java.util.Date;
import java.util.List;
@@ -71,4 +70,6 @@
    int updateNoticeTimes(@Param("list")List<Long> noticedIds);
    List<SysProjServices> selectProjServicesByOrderItemId(@Param("itemId") Long itemId);
    List<SysProjServices> selectByIds(@Param("list")List<Long> ids);
}
zq-erp/src/main/java/com/matrix/system/hive/pojo/StoreInOutRecordVO.java
@@ -1,8 +1,8 @@
package com.matrix.system.hive.pojo;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.matrix.core.pojo.EntityDTO;
import com.matrix.core.tools.DateUtil;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
import java.util.Date;
@@ -11,7 +11,18 @@
 * 库存出入库明细
 * @author JYY
 */
@Data
public class StoreInOutRecordVO {
    /**
     * 服务单id
     */
    private Long serviceId;
    /**
     * 订单id
     */
    private Long orderId;
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone="GMT+8")
    private Date createTime;
@@ -44,6 +55,16 @@
     * 单据编号
     */
    private String orderNo;
    /**
     * 原单据号
     */
    private String sourceOrderNo;
    /**
     * 客户姓名
     */
    private String vipName;
    /**
     * 单据类型
     */
@@ -86,165 +107,5 @@
    private Long id;
    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 getCode() {
        return code;
    }
    public void setCode(String code) {
        this.code = code;
    }
    public String getName() {
        return name;
    }
    public void setName(String name) {
        this.name = name;
    }
    public String getTypeName() {
        return typeName;
    }
    public void setTypeName(String typeName) {
        this.typeName = typeName;
    }
    public Double getAmount() {
        return amount;
    }
    public void setAmount(Double amount) {
        this.amount = amount;
    }
    public Double getGoodsPrice() {
        return goodsPrice;
    }
    public void setGoodsPrice(Double goodsPrice) {
        this.goodsPrice = goodsPrice;
    }
    public Double getTotalPrice() {
        return totalPrice;
    }
    public void setTotalPrice(Double totalPrice) {
        this.totalPrice = totalPrice;
    }
    public String getOrderNo() {
        return orderNo;
    }
    public void setOrderNo(String orderNo) {
        this.orderNo = orderNo;
    }
    public String getOrderType() {
        return orderType;
    }
    public void setOrderType(String orderType) {
        this.orderType = orderType;
    }
    public String getBatch() {
        return batch;
    }
    public void setBatch(String batch) {
        this.batch = batch;
    }
    public String getUserName() {
        return userName;
    }
    public void setUserName(String userName) {
        this.userName = userName;
    }
    public String getShopName() {
        return shopName;
    }
    public void setShopName(String shopName) {
        this.shopName = shopName;
    }
    public String getRemark() {
        return remark;
    }
    public void setRemark(String remark) {
        this.remark = remark;
    }
    public Date getEndTime() {
        return endTime;
    }
    public void setEndTime(Date endTime) {
        this.endTime = endTime;
    }
    public Long getShopId() {
        return shopId;
    }
    public void setShopId(Long shopId) {
        this.shopId = shopId;
    }
    public Long getUserId() {
        return userId;
    }
    public void setUserId(Long userId) {
        this.userId = userId;
    }
    public Date getBeginTime() {
        return beginTime;
    }
    public void setBeginTime(Date beginTime) {
        this.beginTime = beginTime;
    }
    public Long getGoodsSortId() {
        return goodsSortId;
    }
    public void setGoodsSortId(Long goodsSortId) {
        this.goodsSortId = goodsSortId;
    }
    public Long getCompanyId() {
        return companyId;
    }
    public void setCompanyId(Long companyId) {
        this.companyId = companyId;
    }
}
zq-erp/src/main/java/com/matrix/system/hive/service/SysOrderService.java
@@ -145,4 +145,5 @@
    BigDecimal findVipArrearsByVipId(Long vipId);
    List<SysOrder> findByIds(List<Long> orderIds);
}
zq-erp/src/main/java/com/matrix/system/hive/service/SysProjServicesService.java
@@ -62,6 +62,8 @@
     */
    public SysProjServices findById(Long id);
    public List<SysProjServices> findByIds(List<Long> id);
    /**
     * 排班
     */
zq-erp/src/main/java/com/matrix/system/hive/service/imp/SysOrderServiceImpl.java
@@ -183,11 +183,17 @@
    }
    @Override
    public SysOrder findById(Long id) {
    public  SysOrder  findById(Long id) {
        return sysOrderDao.selectById(id);
    }
    @Override
    public List<SysOrder> findByIds(List<Long> ids) {
        return sysOrderDao.selectByIds(ids);
    }
    @Override
    @Transactional(rollbackFor = Exception.class)
zq-erp/src/main/java/com/matrix/system/hive/service/imp/SysProjServicesServiceImpl.java
@@ -341,7 +341,12 @@
        return sysProjServicesDao.selectById(id);
    }
    @Override
    public List<SysProjServices> findByIds(List<Long> ids) {
        return sysProjServicesDao.selectByIds(ids);
    }
    /**
     * TODO 做成配置项目 校验服务单中的项目是否存在欠款
zq-erp/src/main/resources/mybatis/mapper/hive/SysOrderDao.xml
@@ -360,6 +360,27 @@
        where a.id=#{id}
    </select>
    <!-- 根据id查询 -->
    <select id="selectByIds" resultMap="SysOrderMap">
        select
            a.*,
            c.su_name as STAFF_NAME, e.su_name as cashierName,
            d.SHOP_NAME,
            d.shop_short_name,
            b.PHONE,
            b.VIP_NAME
        from sys_order a
                 LEFT JOIN sys_vip_info b on b.ID=a.VIP_ID
                 left JOIN sys_users c on c.su_id=a.STAFF_ID
                 left JOIN sys_users e on e.su_id=a.cashier_id
                 left JOIN sys_shop_info d on d.ID=a.SHOP_ID
        where a.id  in
        <foreach collection="list" index="index" item="item" open="("
                 separator="," close=")">
            #{item}
        </foreach>
    </select>
    <!-- 根据对象查询 -->
    <select id="selectByModel" resultMap="SysOrderMap">
zq-erp/src/main/resources/mybatis/mapper/hive/SysProjServicesDao.xml
@@ -446,6 +446,30 @@
        where  a.ID=#{id}
    </select>
    <!-- 根据id查询-->
    <select id="selectByIds" resultMap="SysProjServicesMap">
        select    distinct
            a.*,
            b.PHONE ,
            b.VIP_Name ,
            b.VIP_NO,
            (select  su_name from  sys_users f where  a.CREATE_STAFF_ID=f.su_id ) as  createStaffName,
            (select  su_name from  sys_users j where  a.BEAUTICIAN_ID=j.su_id ) as  beautiName,
            (select  su_name from  sys_users k where  a.devision_id=k.su_id ) as plsName,
            (select  su_name from  sys_users l where  a.cashier_id=l.su_id ) as cashierName,
            (select  shop_name from  sys_shop_info h where  a.SHOP_ID=h.ID ) as shopName,
            (select  bed_name from  sys_bed_info i where  a.BED_ID=i.ID ) as bedName
        FROM sys_proj_services a
                 LEFT JOIN sys_vip_info b on b.ID=a.VIP_ID
                 left join sys_beautician_state c on a.id=c.SERVICES_ID
        where  a.ID in
        <foreach collection="list" index="index" item="item" open="("
                 separator="," close=")">
            #{item}
        </foreach>
    </select>
    <select id="selectNeedNoticeService" resultMap="SysProjServicesMap">
    select
        a.id,
zq-erp/src/main/resources/mybatis/mapper/hive/SysStoreInfoDao.xml
@@ -679,7 +679,9 @@
        b.remark,
        b.TYPE AS orderType ,
        c.su_name as userName,
        d.SHOP_NAME as shopName
        d.SHOP_NAME as shopName,
        b.SERVICE_ID as serviceId,
        b.ORDER_ID as orderId
    FROM
        sys_out_store_item a
        LEFT JOIN sys_out_store b ON a.OUT_STORE_ID = b.id
@@ -731,7 +733,9 @@
        t2_b.remark,
        t2_b.instore_type,
        t2_c.su_name,
        t2_d.SHOP_NAME
        t2_d.SHOP_NAME,
        '' as serviceId,
        '' as orderId
    FROM
        sys_instore_detail t2_a
        LEFT JOIN sys_instore_info t2_b ON t2_a.INSTORE_ID = t2_b.id
zq-erp/src/main/resources/templates/views/admin/hive-erp/statistics/store-inout-sum.html
@@ -84,6 +84,8 @@
            <th data-field="amount" data-footer-formatter="countColumn">出库数量</th>
            <th data-field="goodsPrice" >出库单价</th>
            <th data-field="totalPrice" data-footer-formatter="countColumn">出库金额</th>
            <th data-field="sourceOrderNo">来源单据</th>
            <th data-field="vipName">下单客户</th>
            <th data-field="orderNo">单据编号</th>
            <th data-field="orderType">单据类型</th>
            <th data-field="batch">库存批次</th>