fix:客户管理中“产品清单”和“销售记录”接口开发
This commit is contained in:
parent
9f405b5aa0
commit
d979b30aca
@ -191,4 +191,16 @@ public class WmProductSalseController extends BaseController
|
|||||||
wmProductSalseService.updateWmProductSalse(salse);
|
wmProductSalseService.updateWmProductSalse(salse);
|
||||||
return AjaxResult.success();
|
return AjaxResult.success();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@GetMapping("/getItem/{clientId}")
|
||||||
|
@Log(title = "根据客户 id 获取产品清单数据")
|
||||||
|
public AjaxResult getItem(@PathVariable Long clientId) {
|
||||||
|
return wmProductSalseService.getItem(clientId);
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/getSaleRecord/{clientId}")
|
||||||
|
@Log(title = "根据客户 id 获取销售记录数据")
|
||||||
|
public AjaxResult getSaleRecord(@PathVariable Long clientId) {
|
||||||
|
return wmProductSalseService.getSaleRecord(clientId);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,99 @@
|
|||||||
|
package com.ktg.mes.wm.domain.vo;
|
||||||
|
|
||||||
|
import com.ktg.common.annotation.Excel;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class SaleRecordVO {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/** 行ID */
|
||||||
|
private Long lineId;
|
||||||
|
|
||||||
|
/** 出库记录ID */
|
||||||
|
@Excel(name = "出库记录ID")
|
||||||
|
private Long salseId;
|
||||||
|
|
||||||
|
/** 库存记录ID */
|
||||||
|
@Excel(name = "库存记录ID")
|
||||||
|
private Long materialStockId;
|
||||||
|
|
||||||
|
/** 产品物料ID */
|
||||||
|
@Excel(name = "产品物料ID")
|
||||||
|
private Long itemId;
|
||||||
|
|
||||||
|
/** 产品物料编码 */
|
||||||
|
@Excel(name = "产品物料编码")
|
||||||
|
private String itemCode;
|
||||||
|
|
||||||
|
/** 产品物料名称 */
|
||||||
|
@Excel(name = "产品物料名称")
|
||||||
|
private String itemName;
|
||||||
|
|
||||||
|
/** 规格型号 */
|
||||||
|
@Excel(name = "规格型号")
|
||||||
|
private String specification;
|
||||||
|
|
||||||
|
/** 单位 */
|
||||||
|
@Excel(name = "单位")
|
||||||
|
private String unitOfMeasure;
|
||||||
|
|
||||||
|
/** 出库数量 */
|
||||||
|
@Excel(name = "出库数量")
|
||||||
|
private BigDecimal quantitySalse;
|
||||||
|
|
||||||
|
/** 批次号 */
|
||||||
|
@Excel(name = "批次号")
|
||||||
|
private String batchCode;
|
||||||
|
|
||||||
|
/** 仓库ID */
|
||||||
|
@Excel(name = "仓库ID")
|
||||||
|
private Long warehouseId;
|
||||||
|
|
||||||
|
/** 仓库编码 */
|
||||||
|
@Excel(name = "仓库编码")
|
||||||
|
private String warehouseCode;
|
||||||
|
|
||||||
|
/** 仓库名称 */
|
||||||
|
@Excel(name = "仓库名称")
|
||||||
|
private String warehouseName;
|
||||||
|
|
||||||
|
/** 出库单编号 */
|
||||||
|
@Excel(name = "出库单编号")
|
||||||
|
private String salseCode;
|
||||||
|
|
||||||
|
/** 出库单名称 */
|
||||||
|
@Excel(name = "出库单名称")
|
||||||
|
private String salseName;
|
||||||
|
|
||||||
|
/** 出货检验单ID */
|
||||||
|
@Excel(name = "出货检验单ID")
|
||||||
|
private Long oqcId;
|
||||||
|
|
||||||
|
/** 出货检验单编号 */
|
||||||
|
@Excel(name = "出货检验单编号")
|
||||||
|
private String oqcCode;
|
||||||
|
|
||||||
|
/** 销售订单编号 */
|
||||||
|
@Excel(name = "销售订单编号")
|
||||||
|
private String soCode;
|
||||||
|
|
||||||
|
/** 客户ID */
|
||||||
|
@Excel(name = "客户ID")
|
||||||
|
private Long clientId;
|
||||||
|
|
||||||
|
/** 客户编码 */
|
||||||
|
@Excel(name = "客户编码")
|
||||||
|
private String clientCode;
|
||||||
|
|
||||||
|
/** 客户名称 */
|
||||||
|
@Excel(name = "客户名称")
|
||||||
|
private String clientName;
|
||||||
|
|
||||||
|
/** 客户简称 */
|
||||||
|
@Excel(name = "客户简称")
|
||||||
|
private String clientNick;
|
||||||
|
}
|
@ -2,7 +2,10 @@ package com.ktg.mes.wm.mapper;
|
|||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import com.ktg.mes.wm.domain.WmProductSalse;
|
import com.ktg.mes.wm.domain.WmProductSalse;
|
||||||
|
import com.ktg.mes.wm.domain.WmProductSalseLine;
|
||||||
import com.ktg.mes.wm.domain.tx.ProductSalseTxBean;
|
import com.ktg.mes.wm.domain.tx.ProductSalseTxBean;
|
||||||
|
import com.ktg.mes.wm.domain.vo.SaleRecordVO;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 销售出库单Mapper接口
|
* 销售出库单Mapper接口
|
||||||
@ -73,4 +76,18 @@ public interface WmProductSalseMapper
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public List<ProductSalseTxBean> getTxBeans(Long salseId);
|
public List<ProductSalseTxBean> getTxBeans(Long salseId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据客户id获取出库产品信息
|
||||||
|
* @param clientId
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
List<WmProductSalseLine> getItem(@Param("clientId") Long clientId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据客户 id 获取销售记录数据
|
||||||
|
* @param clientId
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
List<SaleRecordVO> getSaleRecord(@Param("clientId") Long clientId);
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
package com.ktg.mes.wm.service;
|
package com.ktg.mes.wm.service;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import com.ktg.common.core.domain.AjaxResult;
|
||||||
import com.ktg.mes.wm.domain.WmProductSalse;
|
import com.ktg.mes.wm.domain.WmProductSalse;
|
||||||
import com.ktg.mes.wm.domain.tx.ProductSalseTxBean;
|
import com.ktg.mes.wm.domain.tx.ProductSalseTxBean;
|
||||||
|
|
||||||
@ -74,4 +76,18 @@ public interface IWmProductSalseService
|
|||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
public int deleteWmProductSalseBySalseId(Long salseId);
|
public int deleteWmProductSalseBySalseId(Long salseId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据客户 id 获取产品清单数据
|
||||||
|
* @param clientId
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
AjaxResult getItem(Long clientId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据客户 id 获取销售记录数据
|
||||||
|
* @param clientId
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
AjaxResult getSaleRecord(Long clientId);
|
||||||
}
|
}
|
||||||
|
@ -1,11 +1,16 @@
|
|||||||
package com.ktg.mes.wm.service.impl;
|
package com.ktg.mes.wm.service.impl;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.function.Function;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
import com.ktg.common.constant.UserConstants;
|
import com.ktg.common.constant.UserConstants;
|
||||||
|
import com.ktg.common.core.domain.AjaxResult;
|
||||||
import com.ktg.common.utils.DateUtils;
|
import com.ktg.common.utils.DateUtils;
|
||||||
import com.ktg.common.utils.StringUtils;
|
import com.ktg.common.utils.StringUtils;
|
||||||
|
import com.ktg.mes.wm.domain.WmProductSalseLine;
|
||||||
import com.ktg.mes.wm.domain.tx.ProductSalseTxBean;
|
import com.ktg.mes.wm.domain.tx.ProductSalseTxBean;
|
||||||
|
import com.ktg.mes.wm.domain.vo.SaleRecordVO;
|
||||||
import org.apache.catalina.User;
|
import org.apache.catalina.User;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
@ -114,5 +119,31 @@ public class WmProductSalseServiceImpl implements IWmProductSalseService
|
|||||||
return wmProductSalseMapper.deleteWmProductSalseBySalseId(salseId);
|
return wmProductSalseMapper.deleteWmProductSalseBySalseId(salseId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据客户 id 获取产品清单数据
|
||||||
|
* @param clientId
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public AjaxResult getItem(Long clientId) {
|
||||||
|
List<WmProductSalseLine> salseLines = wmProductSalseMapper.getItem(clientId);
|
||||||
|
List<WmProductSalseLine> collect = salseLines.stream()
|
||||||
|
.collect(Collectors.toMap(
|
||||||
|
WmProductSalseLine::getItemId,
|
||||||
|
Function.identity(),
|
||||||
|
(existing, replacement) -> existing
|
||||||
|
)).values().stream().collect(Collectors.toList());
|
||||||
|
return AjaxResult.success(collect);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据客户 id 获取销售记录数据
|
||||||
|
* @param clientId
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public AjaxResult getSaleRecord(Long clientId) {
|
||||||
|
List<SaleRecordVO> saleRecordVOS = wmProductSalseMapper.getSaleRecord(clientId);
|
||||||
|
return AjaxResult.success(saleRecordVOS);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -37,6 +37,36 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
<result property="updateTime" column="update_time" />
|
<result property="updateTime" column="update_time" />
|
||||||
</resultMap>
|
</resultMap>
|
||||||
|
|
||||||
|
<resultMap id="SaleRecordVOResult" type="SaleRecordVO">
|
||||||
|
<result property="lineId" column="line_id" />
|
||||||
|
<result property="salseId" column="salse_id" />
|
||||||
|
<result property="materialStockId" column="material_stock_id" />
|
||||||
|
<result property="itemId" column="item_id" />
|
||||||
|
<result property="itemCode" column="item_code" />
|
||||||
|
<result property="itemName" column="item_name" />
|
||||||
|
<result property="specification" column="specification" />
|
||||||
|
<result property="unitOfMeasure" column="unit_of_measure" />
|
||||||
|
<result property="quantitySalse" column="quantity_salse" />
|
||||||
|
<result property="batchCode" column="batch_code" />
|
||||||
|
<result property="warehouseId" column="warehouse_id" />
|
||||||
|
<result property="warehouseCode" column="warehouse_code" />
|
||||||
|
<result property="warehouseName" column="warehouse_name" />
|
||||||
|
<result property="oqcId" column="oqc_id"></result>
|
||||||
|
<result property="oqcCode" column="oqc_code"></result>
|
||||||
|
<result property="salseId" column="salse_id" />
|
||||||
|
<result property="salseCode" column="salse_code" />
|
||||||
|
<result property="salseName" column="salse_name" />
|
||||||
|
<result property="oqcId" column="oqc_id" />
|
||||||
|
<result property="oqcCode" column="oqc_code" />
|
||||||
|
<result property="soCode" column="so_code" />
|
||||||
|
<result property="clientId" column="client_id" />
|
||||||
|
<result property="clientCode" column="client_code" />
|
||||||
|
<result property="clientName" column="client_name" />
|
||||||
|
<result property="clientNick" column="client_nick" />
|
||||||
|
<result property="warehouseId" column="warehouse_id" />
|
||||||
|
<result property="warehouseCode" column="warehouse_code" />
|
||||||
|
<result property="warehouseName" column="warehouse_name" />
|
||||||
|
</resultMap>
|
||||||
|
|
||||||
<resultMap id="ProductSalseTxBeanResult" type="ProductSalseTxBean">
|
<resultMap id="ProductSalseTxBeanResult" type="ProductSalseTxBean">
|
||||||
<result property="materialStockId" column="material_stock_id"></result>
|
<result property="materialStockId" column="material_stock_id"></result>
|
||||||
@ -72,6 +102,40 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
<result property="updateTime" column="update_time" />
|
<result property="updateTime" column="update_time" />
|
||||||
</resultMap>
|
</resultMap>
|
||||||
|
|
||||||
|
<resultMap type="WmProductSalseLine" id="WmProductSalseLineResult">
|
||||||
|
<result property="lineId" column="line_id" />
|
||||||
|
<result property="salseId" column="salse_id" />
|
||||||
|
<result property="materialStockId" column="material_stock_id" />
|
||||||
|
<result property="itemId" column="item_id" />
|
||||||
|
<result property="itemCode" column="item_code" />
|
||||||
|
<result property="itemName" column="item_name" />
|
||||||
|
<result property="specification" column="specification" />
|
||||||
|
<result property="unitOfMeasure" column="unit_of_measure" />
|
||||||
|
<result property="quantitySalse" column="quantity_salse" />
|
||||||
|
<result property="batchCode" column="batch_code" />
|
||||||
|
<result property="warehouseId" column="warehouse_id" />
|
||||||
|
<result property="warehouseCode" column="warehouse_code" />
|
||||||
|
<result property="warehouseName" column="warehouse_name" />
|
||||||
|
<result property="locationId" column="location_id" />
|
||||||
|
<result property="locationCode" column="location_code" />
|
||||||
|
<result property="locationName" column="location_name" />
|
||||||
|
<result property="areaId" column="area_id" />
|
||||||
|
<result property="areaCode" column="area_code" />
|
||||||
|
<result property="areaName" column="area_name" />
|
||||||
|
<result property="oqcCheck" column="oqc_check"></result>
|
||||||
|
<result property="oqcId" column="oqc_id"></result>
|
||||||
|
<result property="oqcCode" column="oqc_code"></result>
|
||||||
|
<result property="remark" column="remark" />
|
||||||
|
<result property="attr1" column="attr1" />
|
||||||
|
<result property="attr2" column="attr2" />
|
||||||
|
<result property="attr3" column="attr3" />
|
||||||
|
<result property="attr4" column="attr4" />
|
||||||
|
<result property="createBy" column="create_by" />
|
||||||
|
<result property="createTime" column="create_time" />
|
||||||
|
<result property="updateBy" column="update_by" />
|
||||||
|
<result property="updateTime" column="update_time" />
|
||||||
|
</resultMap>
|
||||||
|
|
||||||
<sql id="selectWmProductSalseVo">
|
<sql id="selectWmProductSalseVo">
|
||||||
select salse_id, salse_code, salse_name, oqc_id, oqc_code, so_code, client_id, client_code, client_name, client_nick, warehouse_id, warehouse_code, warehouse_name, location_id, location_code, location_name, area_id, area_code, area_name, salse_date, status, remark, attr1, attr2, attr3, attr4, create_by, create_time, update_by, update_time from wm_product_salse
|
select salse_id, salse_code, salse_name, oqc_id, oqc_code, so_code, client_id, client_code, client_name, client_nick, warehouse_id, warehouse_code, warehouse_name, location_id, location_code, location_name, area_id, area_code, area_name, salse_date, status, remark, attr1, attr2, attr3, attr4, create_by, create_time, update_by, update_time from wm_product_salse
|
||||||
</sql>
|
</sql>
|
||||||
@ -125,6 +189,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
ON ir.salse_id = irl.`salse_id`
|
ON ir.salse_id = irl.`salse_id`
|
||||||
WHERE ir.`salse_id` = #{salseId}
|
WHERE ir.`salse_id` = #{salseId}
|
||||||
</select>
|
</select>
|
||||||
|
<select id="getItem" resultType="com.ktg.mes.wm.domain.WmProductSalseLine" resultMap="WmProductSalseLineResult">
|
||||||
|
select * from wm_product_salse_line
|
||||||
|
where salse_id in ( select salse_id from wm_product_salse where client_id = #{clientId} )
|
||||||
|
</select>
|
||||||
|
<select id="getSaleRecord" resultType="com.ktg.mes.wm.domain.vo.SaleRecordVO" resultMap="SaleRecordVOResult">
|
||||||
|
SELECT * FROM wm_product_salse_line wl
|
||||||
|
LEFT JOIN (select * from wm_product_salse) ws ON ws.salse_id = wl.salse_id
|
||||||
|
WHERE
|
||||||
|
ws.client_id = #{clientId}
|
||||||
|
</select>
|
||||||
|
|
||||||
<insert id="insertWmProductSalse" parameterType="WmProductSalse" useGeneratedKeys="true" keyProperty="salseId">
|
<insert id="insertWmProductSalse" parameterType="WmProductSalse" useGeneratedKeys="true" keyProperty="salseId">
|
||||||
insert into wm_product_salse
|
insert into wm_product_salse
|
||||||
|
Loading…
Reference in New Issue
Block a user