12.10
This commit is contained in:
@@ -27,7 +27,7 @@ public class GoodsSkuRest {
|
||||
|
||||
@ApiOperation("分页列表")
|
||||
@PostMapping("/listPage")
|
||||
public ResultBean<PagerVo<GoodsSkuVo>> listPage(@RequestBody PagerQuery<GoodsSkuQuery> pq) {
|
||||
public ResultBean<PagerVo<GoodsSkuVo1>> listPage(@RequestBody PagerQuery<GoodsSkuQuery> pq) {
|
||||
return goodsSkuService.listPage(pq);
|
||||
}
|
||||
@ApiOperation("查询组织下所有商品")
|
||||
@@ -75,9 +75,9 @@ public class GoodsSkuRest {
|
||||
|
||||
@ApiOperation("入库添加商品列表")
|
||||
@PostMapping("/getSelectList")
|
||||
ResultBean<PagerVo<SkuSelectList>> getSelectList(@RequestBody PagerQuery<GoodsSkuSelectQuery> pagerQuery) {
|
||||
ResultBean<PagerVo<SkuSelectList>> rb = ResultBean.fireFail();
|
||||
PagerVo<SkuSelectList> pv = goodsSkuService.getSelectList(pagerQuery);
|
||||
ResultBean<PagerVo<SkuSelectList1>> getSelectList(@RequestBody PagerQuery<GoodsSkuSelectQuery> pagerQuery) {
|
||||
ResultBean<PagerVo<SkuSelectList1>> rb = ResultBean.fireFail();
|
||||
PagerVo<SkuSelectList1> pv = goodsSkuService.getSelectList(pagerQuery);
|
||||
return rb.success().setData(pv);
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,73 @@
|
||||
package com.yxt.goods.apiadmin;
|
||||
|
||||
import com.yxt.common.core.query.PagerQuery;
|
||||
import com.yxt.common.core.result.ResultBean;
|
||||
import com.yxt.common.core.vo.PagerVo;
|
||||
import com.yxt.goods.biz.goodsskusubunit.*;
|
||||
import com.yxt.goods.utils.OrgPathQuery;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author wangpengfei
|
||||
* @date 2024/2/26 15:49
|
||||
*/
|
||||
@Api(tags = "商品品牌")
|
||||
@RestController
|
||||
@RequestMapping("/apiadmin/base/goodsskusubunit")
|
||||
public class GoodsSkuSubunitRest {
|
||||
|
||||
@Autowired
|
||||
GoodsSkuSubunitService baseBrandInfoService;
|
||||
|
||||
@ApiOperation("分页列表")
|
||||
@PostMapping("/listPage")
|
||||
public ResultBean<PagerVo<GoodsSkuSubunitVo>> listPage(@RequestBody PagerQuery<GoodsSkuSubunitQuery> pq) {
|
||||
return baseBrandInfoService.listPage(pq);
|
||||
}
|
||||
@ApiOperation("查询所有的品牌")
|
||||
@PostMapping("/listAll")
|
||||
public ResultBean<List<GoodsSkuSubunitVo>> listAll(@RequestBody OrgPathQuery query) {
|
||||
return baseBrandInfoService.listAll(query);
|
||||
}
|
||||
@ApiOperation("保存修改")
|
||||
@PostMapping("/saveOrUpdate")
|
||||
public ResultBean<String> saveOrUpdate(@RequestBody GoodsSkuSubunitDto dto) {
|
||||
return baseBrandInfoService.saveOrUpdate(dto);
|
||||
}
|
||||
|
||||
@ApiOperation("初始化")
|
||||
@GetMapping("/initialization/{sid}")
|
||||
public ResultBean<GoodsSkuSubunitVo> initialization(@PathVariable("sid") String sid) {
|
||||
return baseBrandInfoService.initialization(sid);
|
||||
}
|
||||
|
||||
@ApiOperation("删除")
|
||||
@DeleteMapping("/delete/{sid}")
|
||||
public ResultBean delete(@PathVariable("sid") String sid) {
|
||||
return baseBrandInfoService.delete(sid);
|
||||
}
|
||||
|
||||
@ApiOperation("根据sid批量删除")
|
||||
@DeleteMapping("/delBySids")
|
||||
public ResultBean delBySids(@RequestBody String[] sids){
|
||||
ResultBean rb = ResultBean.fireFail();
|
||||
baseBrandInfoService.delAll(sids);
|
||||
return rb.success();
|
||||
}
|
||||
|
||||
@ApiOperation("更改可用状态")
|
||||
@GetMapping("/updateIsEnable/{sid}/{isEnable}")
|
||||
public ResultBean updateIsEnable(@PathVariable("sid") String sid,@PathVariable("isEnable")String isEnable) {
|
||||
return baseBrandInfoService.updateIsEnable(sid,isEnable);
|
||||
}
|
||||
@ApiOperation("根据品牌名查询")
|
||||
@GetMapping("/getBrandByName/{name}")
|
||||
public ResultBean<GoodsSkuSubunit> getBrandByName(@PathVariable("name") String name) {
|
||||
return baseBrandInfoService.getBrandByName(name);
|
||||
}
|
||||
}
|
||||
@@ -55,6 +55,12 @@ public class GoodsSpuRest {
|
||||
public ResultBean<String> saveOrUpdate(@RequestBody GoodsSpuDto dto) {
|
||||
return goodsSpuService.saveOrUpdate(dto);
|
||||
}
|
||||
@ApiOperation("保存修改")
|
||||
@PostMapping("/saveOrUpdateByName")
|
||||
public ResultBean<String> saveOrUpdateByName(@RequestBody GoodsSpuDto dto) {
|
||||
return goodsSpuService.saveOrUpdateByName(dto);
|
||||
}
|
||||
|
||||
@ApiOperation("保存")
|
||||
@PostMapping("/batchSave")
|
||||
public ResultBean<String> batchSave(@RequestBody List<GoodsSpuDto> dtos,@RequestParam("orgPath") String orgPath) {
|
||||
|
||||
@@ -38,7 +38,7 @@
|
||||
<foreach collection="names" item="item" index="index" open="(" separator="," close=")">
|
||||
#{item}
|
||||
</foreach>
|
||||
and s.orgSidPath like concat('%',#{orgPath},'%')
|
||||
and s.orgSidPath like concat('%',#{orgPath},'%') and a.isDelete !='1'
|
||||
</where>
|
||||
</select>
|
||||
</mapper>
|
||||
@@ -78,8 +78,17 @@ public class GoodsBrandInfoService extends MybatisBaseService<GoodsBrandInfoMapp
|
||||
public ResultBean<String> saveOrUpdate(GoodsBrandInfoDto dto) {
|
||||
ResultBean rb = ResultBean.fireFail();
|
||||
String sid = "";
|
||||
List<String> strings=new ArrayList<>();
|
||||
strings.add(dto.getBrandName());
|
||||
List<GoodsBrandInfo> brandInfos=baseMapper.selectBrandNotIn(strings,dto.getUseOrgSid());
|
||||
if (StringUtils.isNotBlank(dto.getSid())) {
|
||||
sid = dto.getSid();
|
||||
// GoodsBrandInfo goods=baseMapper.selectOne(new QueryWrapper<GoodsBrandInfo>().eq("brandName",dto.getBrandName()));
|
||||
if(brandInfos.size()!=0){
|
||||
if(!brandInfos.get(0).getSid().equals(sid)){
|
||||
return rb.setMsg("商品名不能重复");
|
||||
}
|
||||
}
|
||||
GoodsBrandInfo wmsGoodsBrand = fetchBySid(dto.getSid());
|
||||
BeanUtil.copyProperties(dto, wmsGoodsBrand, "id", "sid");
|
||||
if (StringUtils.isBlank(dto.getImage())) {
|
||||
@@ -88,8 +97,8 @@ public class GoodsBrandInfoService extends MybatisBaseService<GoodsBrandInfoMapp
|
||||
wmsGoodsBrand.setModifyTime(new Date());
|
||||
baseMapper.updateById(wmsGoodsBrand);
|
||||
} else {
|
||||
GoodsBrandInfo goods=baseMapper.selectOne(new QueryWrapper<GoodsBrandInfo>().eq("brandName",dto.getBrandName()));
|
||||
if(null!=goods){
|
||||
|
||||
if(brandInfos.size()!=0){
|
||||
return rb.setMsg("商品名不能重复");
|
||||
}
|
||||
GoodsBrandInfo wmsGoodsBrand = new GoodsBrandInfo();
|
||||
@@ -144,7 +153,7 @@ public class GoodsBrandInfoService extends MybatisBaseService<GoodsBrandInfoMapp
|
||||
GoodsBrandInfo type=baseMapper.selectOne(new QueryWrapper<GoodsBrandInfo>().eq("brandName",name));
|
||||
return rb.success().setData(type);
|
||||
}
|
||||
public ResultBean saveBrand(List<GoodsSpuDto> dtos, String orgPath) {
|
||||
public void saveBrand(List<GoodsSpuDto> dtos, String orgPath) {
|
||||
ResultBean rb = ResultBean.fireFail();
|
||||
|
||||
List<GoodsSpuDto> dtos1=new ArrayList<>();
|
||||
@@ -155,7 +164,7 @@ public class GoodsBrandInfoService extends MybatisBaseService<GoodsBrandInfoMapp
|
||||
if(goodsType.size()!=0){
|
||||
for (GoodsSpuDto dto : dtos) {
|
||||
for (GoodsBrandInfo type : goodsType) {
|
||||
if(dto.getGoodsTypeName().equals(type.getBrandName())){
|
||||
if(dto.getBrandName().equals(type.getBrandName())){
|
||||
dtos1.remove(dto);
|
||||
type.setIsEnable(1);
|
||||
type.setIsDelete(0);
|
||||
@@ -172,7 +181,5 @@ public class GoodsBrandInfoService extends MybatisBaseService<GoodsBrandInfoMapp
|
||||
goodsTypes.add(type);
|
||||
}
|
||||
this.saveBatch(goodsTypes);
|
||||
|
||||
return rb.success().setMsg("成功");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -43,7 +43,7 @@
|
||||
<foreach collection="names" item="item" index="index" open="(" separator="," close=")">
|
||||
#{item}
|
||||
</foreach>
|
||||
and s.orgSidPath like concat('%',#{orgPath},'%')
|
||||
and s.orgSidPath like concat('%',#{orgPath},'%') and a.isDelete !='1'
|
||||
</where>
|
||||
</select>
|
||||
</mapper>
|
||||
@@ -155,7 +155,7 @@ public class GoodsManufacturerService extends MybatisBaseService<GoodsManufactur
|
||||
GoodsManufacturer type=baseMapper.selectOne(new QueryWrapper<GoodsManufacturer>().eq("manufacturerName",name));
|
||||
return rb.success().setData(type);
|
||||
}
|
||||
public ResultBean saveManufacturer(List<GoodsSpuDto> dtos, String orgPath) {
|
||||
public void saveManufacturer(List<GoodsSpuDto> dtos, String orgPath) {
|
||||
ResultBean rb = ResultBean.fireFail();
|
||||
|
||||
List<GoodsSpuDto> dtos1=new ArrayList<>();
|
||||
@@ -166,7 +166,7 @@ public class GoodsManufacturerService extends MybatisBaseService<GoodsManufactur
|
||||
if(goodsType.size()!=0){
|
||||
for (GoodsSpuDto dto : dtos) {
|
||||
for (GoodsManufacturer type : goodsType) {
|
||||
if(dto.getGoodsTypeName().equals(type.getManufacturerName())){
|
||||
if(dto.getManufacturerName().equals(type.getManufacturerName())){
|
||||
dtos1.remove(dto);
|
||||
type.setIsEnable(1);
|
||||
type.setIsDelete(0);
|
||||
@@ -183,7 +183,5 @@ public class GoodsManufacturerService extends MybatisBaseService<GoodsManufactur
|
||||
goodsTypes.add(type);
|
||||
}
|
||||
this.saveBatch(goodsTypes);
|
||||
|
||||
return rb.success().setMsg("成功");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,5 +19,7 @@ public class GoodsSku extends BaseEntity {
|
||||
private String ownSpec;//sku的特有规格参数键值对,json格式,反序列化时请使用linkedHashMap,保证有序
|
||||
private String barCode;//条形码
|
||||
private String aidBarCode;//辅助条码
|
||||
@TableField(exist = false)
|
||||
private String signSid;
|
||||
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.yxt.goods.biz.goodsskuextend.GoodsSkuExtendDto;
|
||||
import com.yxt.common.core.dto.Dto;
|
||||
import com.yxt.goods.biz.goodsskusubunit.GoodsSkuSubunitDto;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Date;
|
||||
@@ -30,4 +31,6 @@ public class GoodsSkuDto implements Dto {
|
||||
private GoodsSkuExtendDto baseGoodsSkuExtend;//sku扩展
|
||||
private String barCode;//条形码
|
||||
private String aidBarCode;//辅助条码
|
||||
private GoodsSkuSubunitDto goodsSkuSubunit;
|
||||
private String signSid;
|
||||
}
|
||||
|
||||
@@ -16,13 +16,13 @@ import java.util.List;
|
||||
@Mapper
|
||||
public interface GoodsSkuMapper extends BaseMapper<GoodsSku> {
|
||||
|
||||
IPage<GoodsSkuVo> listPage(IPage<GoodsSku> page, @Param(Constants.WRAPPER) QueryWrapper<GoodsSku> qw);
|
||||
IPage<GoodsSkuVo1> listPage(IPage<GoodsSku> page, @Param(Constants.WRAPPER) QueryWrapper<GoodsSku> qw);
|
||||
List<GoodsSkuVo> listAllByOrg(@Param("orgPath")String orgPath);
|
||||
|
||||
List<GoodsSkuVo> getSkusBySpuSid(@Param("spuSid")String spuSid);
|
||||
GoodsSkuVo getSkuBySid(@Param("sid")String sid);
|
||||
|
||||
IPage<SkuSelectList> getSelectList(IPage<GoodsSku> page, @Param(Constants.WRAPPER)QueryWrapper<GoodsSku> qw);
|
||||
IPage<SkuSelectList1> getSelectList(IPage<GoodsSku> page, @Param(Constants.WRAPPER)QueryWrapper<GoodsSku> qw);
|
||||
|
||||
IPage<GoodsSkuPurSelectList> purGoodsListPage(IPage<GoodsSku> page, @Param(Constants.WRAPPER) QueryWrapper<GoodsSku> qw);
|
||||
}
|
||||
|
||||
@@ -4,10 +4,33 @@
|
||||
<!-- <where> ${ew.sqlSegment} </where>-->
|
||||
<!-- ${ew.customSqlSegment} -->
|
||||
|
||||
<select id="listPage" resultType="com.yxt.goods.biz.goodssku.GoodsSkuVo">
|
||||
select s.*,s.own_spec as ownSpec,a.goodsName
|
||||
from goods_sku s
|
||||
left join goods_spu a on a.sid=s.goodsSpuSid
|
||||
<select id="listPage" resultType="com.yxt.goods.biz.goodssku.GoodsSkuVo1">
|
||||
SELECT
|
||||
b.title,
|
||||
b.sid as skuSid,
|
||||
b.goodsSkuCode,
|
||||
a.barCode ,
|
||||
b.createTime,
|
||||
f.picUrl,
|
||||
f.salesPrice,
|
||||
a.sortNo,
|
||||
a.goodsName,
|
||||
a.goodsCode,
|
||||
a.sid as spuSid,
|
||||
e.unitName,
|
||||
e.sid as unitSid,
|
||||
d.goodsTypeName ,
|
||||
d.sid typeSid,
|
||||
c.brandName ,
|
||||
c.sid as brandSid
|
||||
FROM
|
||||
goods_sku b
|
||||
LEFT JOIN goods_spu a ON a.sid = b.goodsSpuSid
|
||||
LEFT JOIN ss_user.sys_organization as s ON a.useOrgSid = s.sid
|
||||
left join goods_brand_info as c on c.sid =a.brandSid
|
||||
left join goods_type as d on d.sid =a.goodsTypeSid
|
||||
left join goods_unit as e on e.sid =a.goodsUnitSid
|
||||
left join goods_sku_extend f on f.goodsSkuSid =b.sid
|
||||
<where>
|
||||
${ew.sqlSegment}
|
||||
</where>
|
||||
@@ -18,7 +41,7 @@
|
||||
left join goods_spu b on b.sid =a.goodsSpuSid
|
||||
LEFT JOIN ss_user.sys_organization as s ON b.useOrgSid = s.sid
|
||||
<where>
|
||||
s.orgSidPath like concat('%',#{orgPath},'%') and a.isDelete !='1' and a.isEnable='1'
|
||||
s.orgSidPath like concat('%',#{orgPath},'%') and a.isDelete !='1' and a.isEnable='1' and b.isDelete!='1'
|
||||
</where>
|
||||
</select>
|
||||
|
||||
@@ -35,18 +58,27 @@
|
||||
where s.sid = #{sid}
|
||||
</select>
|
||||
|
||||
<select id="getSelectList" resultType="com.yxt.goods.biz.goodssku.SkuSelectList">
|
||||
<select id="getSelectList" resultType="com.yxt.goods.biz.goodssku.SkuSelectList1">
|
||||
select
|
||||
sku.sid goodsSkuSid,
|
||||
|
||||
spu.sid AS goodsSpuSid,
|
||||
spu.goodsName goodsSpuName,
|
||||
spu.goodsName goodsName,
|
||||
spu.goodsCode goodsCode,
|
||||
spu.barCode barCode,
|
||||
sku.sid goodsSkuSid,
|
||||
sku.goodsSkuCode,
|
||||
sku.title AS goodsSkuTitle,
|
||||
spu.goodsUnitSid,
|
||||
spu.goodsUnitName,
|
||||
ex.costPrice,
|
||||
spu.shelfLife,
|
||||
sku.own_spec as ownSpec
|
||||
sku.title AS title,
|
||||
sku.own_spec as ownSpec,
|
||||
d.sid as typeSid,
|
||||
d.goodsTypeName as typeName,
|
||||
b.sid as brandSid,
|
||||
b.brandName,
|
||||
c.manufacturerName,
|
||||
c.sid as manufacturerSid,
|
||||
spu.factoryCode,
|
||||
spu.goodsUnitSid as unitSid,
|
||||
spu.goodsUnitName as unit,
|
||||
ex.salesPrice
|
||||
from goods_sku sku
|
||||
left join goods_spu spu on spu.sid = sku.goodsSpuSid
|
||||
LEFT JOIN goods_sku_extend ex ON ex.goodsSkuSid = sku.sid
|
||||
@@ -71,7 +103,25 @@
|
||||
e.salesPrice as cost1,
|
||||
a.shelfLife,
|
||||
a.taxRate,
|
||||
a.factoryCode as itemNumber
|
||||
a.factoryCode as itemNumber,
|
||||
a.sid AS goodsSpuSid,
|
||||
a.goodsName goodsName,
|
||||
a.goodsCode goodsCode,
|
||||
a.barCode barCode,
|
||||
s.sid goodsSkuSid,
|
||||
s.goodsSkuCode,
|
||||
s.title AS title,
|
||||
s.own_spec as ownSpec,
|
||||
d.sid as typeSid,
|
||||
d.goodsTypeName as typeName,
|
||||
b.sid as brandSid,
|
||||
b.brandName,
|
||||
c.manufacturerName,
|
||||
c.sid as manufacturerSid,
|
||||
a.factoryCode,
|
||||
a.goodsUnitSid as unitSid,
|
||||
a.goodsUnitName as unit,
|
||||
e.salesPrice
|
||||
FROM
|
||||
goods_sku s
|
||||
LEFT JOIN goods_spu a
|
||||
|
||||
@@ -36,4 +36,31 @@ public class GoodsSkuPurSelectList {
|
||||
private BigDecimal taxRate;
|
||||
//货号
|
||||
private String itemNumber;
|
||||
|
||||
|
||||
|
||||
private String goodsSkuSid;
|
||||
//spusid
|
||||
private String goodsSpuSid;
|
||||
//商品编码
|
||||
private String goodsCode;
|
||||
//规格型号
|
||||
private String title;
|
||||
//具体规格
|
||||
private String ownSpec;
|
||||
//分类
|
||||
private String typeName;
|
||||
private String typeSid;
|
||||
//品牌
|
||||
private String brandName;
|
||||
private String brandSid;
|
||||
//厂家名
|
||||
private String manufacturerSid;
|
||||
private String manufacturerName;
|
||||
//厂家货号
|
||||
private String factoryCode;
|
||||
|
||||
private String unitSid;
|
||||
//销售单价
|
||||
private BigDecimal salesPrice=new BigDecimal(0);
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.yxt.goods.biz.goodssku;
|
||||
|
||||
import com.yxt.common.core.query.Query;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
@@ -12,4 +13,12 @@ public class GoodsSkuQuery implements Query {
|
||||
private String name;
|
||||
private String userOrgSid;
|
||||
private String createOrgSid;//创建组织sid
|
||||
private String orgLevelKey;//权限等级
|
||||
@ApiModelProperty("菜单路由")
|
||||
private String menuUrl;
|
||||
@ApiModelProperty("组织全路径sid")
|
||||
private String orgPath;
|
||||
@ApiModelProperty("用户sid")
|
||||
private String userSid;
|
||||
private int index;
|
||||
}
|
||||
|
||||
@@ -4,12 +4,15 @@ import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.date.DateTime;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.yxt.goods.biz.goodsmanufacturer.GoodsManufacturerVo;
|
||||
import com.yxt.goods.biz.goodsskuextend.GoodsSkuExtend;
|
||||
import com.yxt.goods.biz.goodsskuextend.GoodsSkuExtendService;
|
||||
import com.yxt.goods.biz.goodsskuextend.GoodsSkuExtendVo;
|
||||
import com.yxt.goods.biz.goodsskusubunit.GoodsSkuSubunitService;
|
||||
import com.yxt.goods.biz.goodsspu.GoodsSpu;
|
||||
import com.yxt.goods.biz.goodsspu.GoodsSpuDto;
|
||||
import com.yxt.goods.biz.goodsspu.GoodsSpuService;
|
||||
import com.yxt.goods.biz.goodsspu.GoodsSpuVo;
|
||||
import com.yxt.goods.biz.goodsspudetail.BaseGoodsSpuDetailService;
|
||||
import com.yxt.goods.biz.goodstype.GoodsType;
|
||||
import com.yxt.goods.biz.goodstype.GoodsTypeService;
|
||||
@@ -28,6 +31,7 @@ import org.springframework.transaction.annotation.Transactional;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* @author wangpengfei
|
||||
@@ -42,23 +46,47 @@ public class GoodsSkuService extends MybatisBaseService<GoodsSkuMapper, GoodsSku
|
||||
@Autowired
|
||||
GoodsSkuExtendService goodsSkuExtendService;
|
||||
@Autowired
|
||||
GoodsSkuSubunitService goodsSkuSubunitService;
|
||||
@Autowired
|
||||
private GoodsSpuService goodsSpuService;
|
||||
@Autowired
|
||||
GoodsTypeService goodsTypeService;
|
||||
|
||||
public ResultBean<PagerVo<GoodsSkuVo>> listPage(PagerQuery<GoodsSkuQuery> pq) {
|
||||
public ResultBean<PagerVo<GoodsSkuVo1>> listPage(PagerQuery<GoodsSkuQuery> pq) {
|
||||
ResultBean rb = ResultBean.fireFail();
|
||||
GoodsSkuQuery query = pq.getParams();
|
||||
QueryWrapper<GoodsSku> qw = new QueryWrapper<>();
|
||||
if (StringUtils.isNotBlank(query.getName())) {
|
||||
qw.like("goodsName", query.getName());
|
||||
if (StringUtils.isNotBlank(query.getOrgLevelKey())) {
|
||||
//数据权限ID(1全部、2本部门及子部门、3本部门、4个人)
|
||||
String orgLevelKey=query.getOrgLevelKey();
|
||||
String orgSidPath=query.getOrgPath();
|
||||
int index=query.getIndex();
|
||||
if ("1".equals(orgLevelKey)) {
|
||||
orgSidPath = orgSidPath.substring(0, index);
|
||||
qw.like("s.orgSidPath", orgSidPath);
|
||||
} else if ("2".equals(orgLevelKey)) {
|
||||
orgSidPath = orgSidPath.substring(0, index);
|
||||
qw.like("s.orgSidPath", orgSidPath);
|
||||
} else if ("3".equals(orgLevelKey)) {
|
||||
orgSidPath = orgSidPath.substring(0, index);
|
||||
qw.apply("s.orgSidPath like('"+orgSidPath+"')");
|
||||
} else if ("4".equals(orgLevelKey)) {
|
||||
qw.eq("s.createBySid", query.getUserSid());
|
||||
} else {
|
||||
PagerVo<GoodsManufacturerVo> p = new PagerVo<>();
|
||||
return rb.success().setData(p);
|
||||
}
|
||||
} else {
|
||||
PagerVo<GoodsManufacturerVo> p = new PagerVo<>();
|
||||
return rb.success().setData(p);
|
||||
}
|
||||
// if(StringUtils.isNotBlank(query.getUserOrgSid())){
|
||||
// qw.eq("userOrgSid",query.getUserOrgSid());
|
||||
// }
|
||||
if (StringUtils.isNotBlank(query.getName())) {
|
||||
qw.like("b.title", query.getName());
|
||||
}
|
||||
qw.orderByAsc("sortNo");
|
||||
IPage<GoodsSku> page = PagerUtil.queryToPage(pq);
|
||||
IPage<GoodsSkuVo> pagging = baseMapper.listPage(page, qw);
|
||||
PagerVo<GoodsSkuVo> p = PagerUtil.pageToVo(pagging, null);
|
||||
IPage<GoodsSkuVo1> pagging = baseMapper.listPage(page, qw);
|
||||
PagerVo<GoodsSkuVo1> p = PagerUtil.pageToVo(pagging, null);
|
||||
return rb.success().setData(p);
|
||||
}
|
||||
|
||||
@@ -111,7 +139,7 @@ public class GoodsSkuService extends MybatisBaseService<GoodsSkuMapper, GoodsSku
|
||||
}
|
||||
|
||||
@Transactional
|
||||
public ResultBean<String> saveOrUpdate(List<GoodsSkuDto> dtos) {
|
||||
public ResultBean<List<GoodsSku>> saveOrUpdate(List<GoodsSkuDto> dtos) {
|
||||
ResultBean rb = ResultBean.fireFail();
|
||||
if(dtos.size()!=0){
|
||||
List<GoodsSku> skus=baseMapper.selectList(new QueryWrapper<GoodsSku>().eq("goodsSpuSid",dtos.get(0).getGoodsSpuSid()));
|
||||
@@ -121,6 +149,7 @@ public class GoodsSkuService extends MybatisBaseService<GoodsSkuMapper, GoodsSku
|
||||
goodsSkuExtendService.delete(extend.getSid());
|
||||
}
|
||||
}
|
||||
List<GoodsSku> skus=new ArrayList<>();
|
||||
for (GoodsSkuDto dto : dtos) {
|
||||
GoodsSku sku = baseMapper.selectOne(new QueryWrapper<GoodsSku>().eq("sid", dto.getSid()));
|
||||
String sid = "";
|
||||
@@ -131,18 +160,29 @@ public class GoodsSkuService extends MybatisBaseService<GoodsSkuMapper, GoodsSku
|
||||
wmsGoods.setModifyTime(new Date());
|
||||
baseMapper.updateById(wmsGoods);
|
||||
dto.getBaseGoodsSkuExtend().setGoodsSkuSid(wmsGoods.getSid());
|
||||
if(dto.getGoodsSkuSubunit()!=null){
|
||||
dto.getGoodsSkuSubunit().setSkuSid(wmsGoods.getSid());
|
||||
goodsSkuSubunitService.saveOrUpdate(dto.getGoodsSkuSubunit());
|
||||
}
|
||||
goodsSkuExtendService.saveOrUpdate(dto.getBaseGoodsSkuExtend());
|
||||
skus.add(wmsGoods);
|
||||
} else {
|
||||
GoodsSku wmsGoods = new GoodsSku();
|
||||
BeanUtil.copyProperties(dto, wmsGoods);
|
||||
wmsGoods.setCreateTime(new DateTime());
|
||||
wmsGoods.setSid(UUID.randomUUID().toString());
|
||||
baseMapper.insert(wmsGoods);
|
||||
dto.getBaseGoodsSkuExtend().setGoodsSkuSid(wmsGoods.getSid());
|
||||
if(dto.getGoodsSkuSubunit()!=null){
|
||||
dto.getGoodsSkuSubunit().setSkuSid(wmsGoods.getSid());
|
||||
goodsSkuSubunitService.saveOrUpdate(dto.getGoodsSkuSubunit());
|
||||
}
|
||||
goodsSkuExtendService.saveOrUpdate(dto.getBaseGoodsSkuExtend());
|
||||
skus.add(wmsGoods);
|
||||
}
|
||||
}
|
||||
|
||||
return rb.success().setMsg("成功");
|
||||
return rb.success().setMsg("成功").setData(skus);
|
||||
}
|
||||
|
||||
public ResultBean<GoodsSkuVo> initialization(String sid) {
|
||||
@@ -155,6 +195,7 @@ public class GoodsSkuService extends MybatisBaseService<GoodsSkuMapper, GoodsSku
|
||||
vo.setBaseGoodsSkuExtend(vo1);
|
||||
return rb.success().setData(vo);
|
||||
}
|
||||
|
||||
public ResultBean<GoodsSku> getSkuByCode(String code,String title) {
|
||||
ResultBean rb = ResultBean.fireFail();
|
||||
GoodsSku sku=baseMapper.selectOne(new QueryWrapper<GoodsSku>().eq("goodsSkuCode",code).eq("title",title));
|
||||
@@ -205,7 +246,7 @@ public class GoodsSkuService extends MybatisBaseService<GoodsSkuMapper, GoodsSku
|
||||
return rb.success().setData(goodsSkuDetailsVo);
|
||||
}
|
||||
|
||||
public PagerVo<SkuSelectList> getSelectList(PagerQuery<GoodsSkuSelectQuery> pagerQuery) {
|
||||
public PagerVo<SkuSelectList1> getSelectList(PagerQuery<GoodsSkuSelectQuery> pagerQuery) {
|
||||
GoodsSkuSelectQuery query = pagerQuery.getParams();
|
||||
QueryWrapper<GoodsSku> qw = new QueryWrapper<>();
|
||||
if (query != null) {
|
||||
@@ -240,14 +281,14 @@ public class GoodsSkuService extends MybatisBaseService<GoodsSkuMapper, GoodsSku
|
||||
|
||||
}
|
||||
if (StringUtils.isNotBlank(query.getManufacturerCode())) {
|
||||
qw.like("c.manufacturerCode", query.getManufacturerCode());
|
||||
qw.like("spu.factoryCode", query.getManufacturerCode());
|
||||
}
|
||||
qw.eq("spu.createOrgSid",query.getCreateOrgSid());
|
||||
}
|
||||
qw.ne("spu.isDelete","1");
|
||||
IPage<GoodsSku> page = PagerUtil.queryToPage(pagerQuery);
|
||||
IPage<SkuSelectList> pagging = baseMapper.getSelectList(page, qw);
|
||||
PagerVo<SkuSelectList> p = PagerUtil.pageToVo(pagging, null);
|
||||
IPage<SkuSelectList1> pagging = baseMapper.getSelectList(page, qw);
|
||||
PagerVo<SkuSelectList1> p = PagerUtil.pageToVo(pagging, null);
|
||||
return p;
|
||||
}
|
||||
|
||||
@@ -285,7 +326,7 @@ public class GoodsSkuService extends MybatisBaseService<GoodsSkuMapper, GoodsSku
|
||||
qw.like("d.goodsTypeName", query.getTypeName());
|
||||
}
|
||||
if (StringUtils.isNotBlank(query.getManufacturerCode())) {
|
||||
qw.like("c.manufacturerCode", query.getManufacturerCode());
|
||||
qw.like("a.factoryCode", query.getManufacturerCode());
|
||||
}
|
||||
qw.eq("a.isEnable","1");
|
||||
IPage<GoodsSku> page = PagerUtil.queryToPage(pq);
|
||||
|
||||
41
src/main/java/com/yxt/goods/biz/goodssku/GoodsSkuVo1.java
Normal file
41
src/main/java/com/yxt/goods/biz/goodssku/GoodsSkuVo1.java
Normal file
@@ -0,0 +1,41 @@
|
||||
package com.yxt.goods.biz.goodssku;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @author wangpengfei
|
||||
* @date 2024/12/5 9:01
|
||||
*/
|
||||
@Data
|
||||
public class GoodsSkuVo1 {
|
||||
private String id;
|
||||
private String sid;
|
||||
private String lockVersion;
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||
private Date createTime;
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||
private Date modifyTime;
|
||||
private String remarks;
|
||||
private String isEnable;
|
||||
private String state;
|
||||
private String isDelete;
|
||||
private String title;//商品Skutitle
|
||||
private String skuSid;//
|
||||
private String goodsSkuCode;//skuCode
|
||||
private String barCode;//条码
|
||||
private String picUrl;//图片
|
||||
private String salesPrice;//销售价格
|
||||
private String sortNo;//排序
|
||||
private String goodsName;//spuName
|
||||
private String goodsCode;//spuName
|
||||
private String spuSid;//
|
||||
private String unitName;//单位
|
||||
private String unitSid;//
|
||||
private String goodsTypeName;//分类
|
||||
private String typeSid;//
|
||||
private String brandName;//品牌
|
||||
private String brandSid;//
|
||||
}
|
||||
48
src/main/java/com/yxt/goods/biz/goodssku/SkuSelectList1.java
Normal file
48
src/main/java/com/yxt/goods/biz/goodssku/SkuSelectList1.java
Normal file
@@ -0,0 +1,48 @@
|
||||
package com.yxt.goods.biz.goodssku;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* @description:
|
||||
* @author: dimengzhe
|
||||
* @date: 2024/3/21
|
||||
**/
|
||||
@Data
|
||||
public class SkuSelectList1 {
|
||||
|
||||
//spusid
|
||||
private String goodsSpuSid;
|
||||
//商品编码
|
||||
private String goodsCode;
|
||||
//商品名称
|
||||
private String goodsName;
|
||||
//条形码
|
||||
private String barCode;
|
||||
//规格编码
|
||||
private String goodsSkuCode;
|
||||
private String goodsSkuSid;
|
||||
//规格型号
|
||||
private String title;
|
||||
//具体规格
|
||||
private String ownSpec;
|
||||
//分类
|
||||
private String typeName;
|
||||
private String typeSid;
|
||||
//品牌
|
||||
private String brandName;
|
||||
private String brandSid;
|
||||
//厂家名
|
||||
private String manufacturerSid;
|
||||
private String manufacturerName;
|
||||
//厂家货号
|
||||
private String factoryCode;
|
||||
//单位
|
||||
private String unit;
|
||||
private String unitSid;
|
||||
//销售单价
|
||||
private BigDecimal salesPrice=new BigDecimal(0);
|
||||
|
||||
|
||||
}
|
||||
@@ -20,10 +20,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* @author wangpengfei
|
||||
@@ -106,6 +103,7 @@ public class GoodsSkuExtendService extends MybatisBaseService<GoodsSkuExtendMapp
|
||||
sid = wmsGoods.getSid();
|
||||
BeanUtil.copyProperties(dto, wmsGoods);
|
||||
wmsGoods.setCreateTime(new DateTime());
|
||||
wmsGoods.setSid(UUID.randomUUID().toString());
|
||||
baseMapper.insert(wmsGoods);
|
||||
}
|
||||
return rb.success().setMsg("成功");
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
package com.yxt.goods.biz.goodsskusubunit;
|
||||
|
||||
import com.yxt.common.core.domain.BaseEntity;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @author wangpengfei
|
||||
* @date 2024/2/26 13:36
|
||||
*/
|
||||
@Data
|
||||
public class GoodsSkuSubunit extends BaseEntity {
|
||||
|
||||
private String skuSid;//
|
||||
private String unitName;//计量单位名称
|
||||
private String unitBarCode;//计量单位名称
|
||||
private String ruler;//换算规则(该单位与基础单位的量级关系)数字类型
|
||||
private String price;//销售价格后续害应该包括采购价、销售价、批发价、参考成本等多个价格字段
|
||||
private String weight;//重量
|
||||
private String volume;//体积
|
||||
private String vLength;//长
|
||||
private String vWidth;//宽
|
||||
private String vHeight;//高
|
||||
private String useOrgSid;//使用组织sid
|
||||
private String createOrgSid;//创建组织sid
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
package com.yxt.goods.biz.goodsskusubunit;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.yxt.common.core.dto.Dto;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @author wangpengfei
|
||||
* @date 2024/2/26 13:38
|
||||
*/
|
||||
@Data
|
||||
public class GoodsSkuSubunitDto implements Dto {
|
||||
private String id;
|
||||
private String sid;
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||
private Date createTime;
|
||||
private String remarks;
|
||||
private String isEnable;
|
||||
private String skuSid;//
|
||||
private String unitName;//计量单位名称
|
||||
private String unitBarCode;//计量单位名称
|
||||
private String ruler;//换算规则(该单位与基础单位的量级关系)数字类型
|
||||
private String price;//销售价格后续害应该包括采购价、销售价、批发价、参考成本等多个价格字段
|
||||
private String weight;//重量
|
||||
private String volume;//体积
|
||||
private String vLength;//长
|
||||
private String vWidth;//宽
|
||||
private String vHeight;//高
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
package com.yxt.goods.biz.goodsskusubunit;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Constants;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author wangpengfei
|
||||
* @date 2024/2/26 13:40
|
||||
*/
|
||||
@Mapper
|
||||
public interface GoodsSkuSubunitMapper extends BaseMapper<GoodsSkuSubunit> {
|
||||
int updateBySidIsDelete(List<String> list);
|
||||
IPage<GoodsSkuSubunitVo> listPage(IPage<GoodsSkuSubunit> page, @Param(Constants.WRAPPER) QueryWrapper<GoodsSkuSubunit> qw);
|
||||
List<GoodsSkuSubunitVo> listAll(@Param("orgPath")String orgPath);
|
||||
List<GoodsSkuSubunit> selectBrandNotIn(@Param("names")List<String> names, @Param("orgPath")String orgPath);
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.yxt.goods.biz.goodsskusubunit.GoodsSkuSubunitMapper">
|
||||
<!-- <where> ${ew.sqlSegment} </where>-->
|
||||
<!-- ${ew.customSqlSegment} -->
|
||||
|
||||
<select id="listPage" resultType="com.yxt.goods.biz.goodsskusubunit.GoodsSkuSubunitVo">
|
||||
select
|
||||
*
|
||||
from goods_brand_info a
|
||||
LEFT JOIN ss_user.sys_organization as s ON a.useOrgSid = s.sid
|
||||
<where>
|
||||
${ew.sqlSegment}
|
||||
</where>
|
||||
</select>
|
||||
<select id="listAll" resultType="com.yxt.goods.biz.goodsskusubunit.GoodsSkuSubunitVo">
|
||||
select
|
||||
*
|
||||
from goods_brand_info a
|
||||
LEFT JOIN ss_user.sys_organization as s ON a.useOrgSid = s.sid
|
||||
<where>
|
||||
s.orgSidPath like concat('%',#{orgPath},'%') and a.isDelete !='1' and a.isEnable='1'
|
||||
</where>
|
||||
</select>
|
||||
<update id="updateBySidIsDelete">
|
||||
UPDATE goods_brand_info
|
||||
SET isDelete=1
|
||||
where sid in
|
||||
<foreach collection="list" item="item" index="index" open="(" separator="," close=")">
|
||||
#{item}
|
||||
</foreach>
|
||||
</update>
|
||||
<select id="selectBrandNotIn" resultType="com.yxt.goods.biz.goodsskusubunit.GoodsSkuSubunit">
|
||||
select a.* from goods_brand_info a
|
||||
LEFT JOIN ss_user.sys_organization as s ON a.useOrgSid = s.sid
|
||||
<where>
|
||||
a.brandName in
|
||||
<foreach collection="names" item="item" index="index" open="(" separator="," close=")">
|
||||
#{item}
|
||||
</foreach>
|
||||
and s.orgSidPath like concat('%',#{orgPath},'%') and a.isDelete !='1'
|
||||
</where>
|
||||
</select>
|
||||
</mapper>
|
||||
@@ -0,0 +1,24 @@
|
||||
package com.yxt.goods.biz.goodsskusubunit;
|
||||
|
||||
import com.yxt.common.core.query.Query;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @author wangpengfei
|
||||
* @date 2024/2/26 13:37
|
||||
*/
|
||||
@Data
|
||||
public class GoodsSkuSubunitQuery implements Query {
|
||||
private String name;
|
||||
private String userOrgSid;
|
||||
private String createOrgSid;//创建组织sid
|
||||
private String orgLevelKey;//权限等级
|
||||
@ApiModelProperty("菜单路由")
|
||||
private String menuUrl;
|
||||
@ApiModelProperty("组织全路径sid")
|
||||
private String orgPath;
|
||||
@ApiModelProperty("用户sid")
|
||||
private String userSid;
|
||||
private int index;
|
||||
}
|
||||
@@ -0,0 +1,131 @@
|
||||
package com.yxt.goods.biz.goodsskusubunit;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.date.DateTime;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.yxt.common.base.config.component.FileUploadComponent;
|
||||
import com.yxt.common.base.service.MybatisBaseService;
|
||||
import com.yxt.common.base.utils.PagerUtil;
|
||||
import com.yxt.common.base.utils.StringUtils;
|
||||
import com.yxt.common.core.query.PagerQuery;
|
||||
import com.yxt.common.core.result.ResultBean;
|
||||
import com.yxt.common.core.vo.PagerVo;
|
||||
import com.yxt.goods.biz.goodsspu.GoodsSpuDto;
|
||||
import com.yxt.goods.utils.OrgPathQuery;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @author wangpengfei
|
||||
* @date 2024/2/26 13:40
|
||||
*/
|
||||
@Service
|
||||
public class GoodsSkuSubunitService extends MybatisBaseService<GoodsSkuSubunitMapper, GoodsSkuSubunit> {
|
||||
@Autowired
|
||||
private FileUploadComponent fileUploadComponent;
|
||||
|
||||
public ResultBean<PagerVo<GoodsSkuSubunitVo>> listPage(PagerQuery<GoodsSkuSubunitQuery> pq) {
|
||||
ResultBean rb = ResultBean.fireFail();
|
||||
GoodsSkuSubunitQuery query = pq.getParams();
|
||||
QueryWrapper<GoodsSkuSubunit> qw = new QueryWrapper<>();
|
||||
if (StringUtils.isNotBlank(query.getOrgLevelKey())) {
|
||||
//数据权限ID(1全部、2本部门及子部门、3本部门、4个人)
|
||||
String orgLevelKey=query.getOrgLevelKey();
|
||||
String orgSidPath=query.getOrgPath();
|
||||
int index=query.getIndex();
|
||||
if ("1".equals(orgLevelKey)) {
|
||||
orgSidPath = orgSidPath.substring(0, index);
|
||||
qw.like("s.orgSidPath", orgSidPath);
|
||||
} else if ("2".equals(orgLevelKey)) {
|
||||
orgSidPath = orgSidPath.substring(0, index);
|
||||
qw.like("s.orgSidPath", orgSidPath);
|
||||
} else if ("3".equals(orgLevelKey)) {
|
||||
orgSidPath = orgSidPath.substring(0, index);
|
||||
qw.apply("s.orgSidPath like('"+orgSidPath+"')");
|
||||
} else if ("4".equals(orgLevelKey)) {
|
||||
qw.eq("a.createBySid", query.getUserSid());
|
||||
} else {
|
||||
PagerVo<GoodsSkuSubunitVo> p = new PagerVo<>();
|
||||
return rb.success().setData(p);
|
||||
}
|
||||
} else {
|
||||
PagerVo<GoodsSkuSubunitVo> p = new PagerVo<>();
|
||||
return rb.success().setData(p);
|
||||
}
|
||||
if(StringUtils.isNotBlank(query.getName())){
|
||||
qw.like("a.brandName",query.getName());
|
||||
}
|
||||
qw.ne("a.isDelete","1");
|
||||
IPage<GoodsSkuSubunit> page = PagerUtil.queryToPage(pq);
|
||||
IPage<GoodsSkuSubunitVo> pagging = baseMapper.listPage(page, qw);
|
||||
PagerVo<GoodsSkuSubunitVo> p = PagerUtil.pageToVo(pagging, null);
|
||||
List<GoodsSkuSubunitVo> records = pagging.getRecords();
|
||||
records.removeAll(Collections.singleton(null));
|
||||
return rb.success().setData(p);
|
||||
}
|
||||
public ResultBean<List<GoodsSkuSubunitVo>> listAll(OrgPathQuery query) {
|
||||
ResultBean rb = ResultBean.fireFail();
|
||||
List<GoodsSkuSubunitVo> pagging = baseMapper.listAll(query.getOrgPath());
|
||||
return rb.success().setData(pagging);
|
||||
}
|
||||
public ResultBean<String> saveOrUpdate(GoodsSkuSubunitDto dto) {
|
||||
ResultBean rb = ResultBean.fireFail();
|
||||
String sid = dto.getSid();
|
||||
if (StringUtils.isNotBlank(dto.getSid())) {
|
||||
GoodsSkuSubunit wmsGoodsBrand = fetchBySid(dto.getSid());
|
||||
BeanUtil.copyProperties(dto, wmsGoodsBrand, "id", "sid");
|
||||
wmsGoodsBrand.setModifyTime(new Date());
|
||||
baseMapper.updateById(wmsGoodsBrand);
|
||||
} else {
|
||||
GoodsSkuSubunit wmsGoodsBrand = new GoodsSkuSubunit();
|
||||
sid = wmsGoodsBrand.getSid();
|
||||
BeanUtil.copyProperties(dto, wmsGoodsBrand, "id", "sid");
|
||||
wmsGoodsBrand.setCreateTime(new DateTime());
|
||||
baseMapper.insert(wmsGoodsBrand);
|
||||
}
|
||||
return rb.success().setMsg("成功");
|
||||
}
|
||||
|
||||
public ResultBean<GoodsSkuSubunitVo> initialization(String sid) {
|
||||
ResultBean rb = ResultBean.fireFail();
|
||||
GoodsSkuSubunitVo vo = new GoodsSkuSubunitVo();
|
||||
GoodsSkuSubunit wmsGoodsBrand = fetchBySid(sid);
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
||||
BeanUtil.copyProperties(wmsGoodsBrand, vo);
|
||||
return rb.success().setData(vo);
|
||||
}
|
||||
|
||||
|
||||
|
||||
public ResultBean delete(String sid) {
|
||||
ResultBean rb = ResultBean.fireFail();
|
||||
GoodsSkuSubunit wmsGoodsBrand = fetchBySid(sid);
|
||||
if (null != wmsGoodsBrand) {
|
||||
baseMapper.deleteById(wmsGoodsBrand.getId());
|
||||
}
|
||||
return rb.success().setMsg("成功");
|
||||
}
|
||||
public void delAll(String[] sids) {
|
||||
int count = baseMapper.updateBySidIsDelete(Arrays.stream(sids).collect(Collectors.toList()));
|
||||
}
|
||||
public ResultBean updateIsEnable(String sid,String isEnable) {
|
||||
ResultBean rb = ResultBean.fireFail();
|
||||
GoodsSkuSubunit wmsGoodsBrand = fetchBySid(sid);
|
||||
if (null != wmsGoodsBrand) {
|
||||
wmsGoodsBrand.setIsEnable(Integer.parseInt(isEnable));
|
||||
baseMapper.updateById(wmsGoodsBrand);
|
||||
}
|
||||
return rb.success().setMsg("成功");
|
||||
}
|
||||
public ResultBean<GoodsSkuSubunit> getBrandByName(String name) {
|
||||
ResultBean rb = ResultBean.fireFail();
|
||||
GoodsSkuSubunit type=baseMapper.selectOne(new QueryWrapper<GoodsSkuSubunit>().eq("brandName",name));
|
||||
return rb.success().setData(type);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
package com.yxt.goods.biz.goodsskusubunit;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.yxt.common.core.vo.Vo;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @author wangpengfei
|
||||
* @date 2024/2/26 13:37
|
||||
*/
|
||||
@Data
|
||||
public class GoodsSkuSubunitVo implements Vo {
|
||||
private String id;
|
||||
private String sid;
|
||||
private String lockVersion;
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||
private Date createTime;
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||
private Date modifyTime;
|
||||
private String remarks;
|
||||
private String isEnable;
|
||||
private String state;
|
||||
private String isDelete;
|
||||
private String skuSid;//
|
||||
private String unitName;//计量单位名称
|
||||
private String unitBarCode;//计量单位名称
|
||||
private String ruler;//换算规则(该单位与基础单位的量级关系)数字类型
|
||||
private String price;//销售价格后续害应该包括采购价、销售价、批发价、参考成本等多个价格字段
|
||||
private String weight;//重量
|
||||
private String volume;//体积
|
||||
private String vLength;//长
|
||||
private String vWidth;//宽
|
||||
private String vHeight;//高
|
||||
}
|
||||
@@ -70,7 +70,7 @@
|
||||
from goods_spu a
|
||||
LEFT JOIN ss_user.sys_organization as s ON a.useOrgSid = s.sid
|
||||
<where>
|
||||
s.orgSidPath like concat('%',#{orgPath},'%') and a.goodsCode=#{goodsCode}
|
||||
s.orgSidPath like concat('%',#{orgPath},'%') and a.goodsCode=#{goodsCode} and a.isDelete !='1'
|
||||
</where>
|
||||
</select>
|
||||
<update id="updateBySidIsDelete">
|
||||
|
||||
@@ -284,6 +284,95 @@ public class GoodsSpuService extends MybatisBaseService<GoodsSpuMapper, GoodsSpu
|
||||
goodsSkuService.skuBatchSave(dtos);
|
||||
return rb.success().setMsg("成功");
|
||||
}
|
||||
@Transactional
|
||||
public ResultBean<String> saveOrUpdateByName(GoodsSpuDto dto) {
|
||||
ResultBean rb = ResultBean.fireFail();
|
||||
String sid = "";
|
||||
// GoodsSkuVo data = goodsSkuService.initialization(dto.getSid()).getData();
|
||||
GoodsSpu spun = baseMapper.selectOne(new QueryWrapper<GoodsSpu>().eq("sid", dto.getSid()));
|
||||
|
||||
GoodsUnit goodsUnit = goodsUnitService.getOne(new QueryWrapper<GoodsUnit>().eq("sid", dto.getGoodsUnitSid()));
|
||||
GoodsSpu spu1 = baseMapper.selectOne(new QueryWrapper<GoodsSpu>().eq("goodsName", dto.getGoodsName()));
|
||||
if (null != goodsUnit) {
|
||||
dto.setGoodsUnitName(goodsUnit.getUnitName());
|
||||
}
|
||||
if(StringUtils.isBlank(dto.getIsListed())){
|
||||
dto.setIsListed("1");
|
||||
}
|
||||
if (StringUtils.isBlank(dto.getTaxRate())){
|
||||
dto.setTaxRate("0");
|
||||
}
|
||||
if(StringUtils.isBlank(dto.getShelfLife())){
|
||||
dto.setShelfLife("0");
|
||||
}
|
||||
if(StringUtils.isBlank(dto.getSortNo())){
|
||||
dto.setSortNo("0");
|
||||
}
|
||||
String skuSid="";
|
||||
List<GoodsSku> skus=new ArrayList<>();
|
||||
if (spun != null) {
|
||||
if(spu1!=null){
|
||||
if (!spu1.getSid().equals(spun.getSid())) {
|
||||
return rb.setMsg("商品名称重复");
|
||||
}
|
||||
}
|
||||
for (GoodsSkuDto baseGoodsSkus : dto.getBaseGoodsSkus()) {
|
||||
if(StringUtils.isNotBlank(baseGoodsSkus.getTitle())){
|
||||
GoodsSku sku=goodsSkuService.getOne(new QueryWrapper<GoodsSku>().eq("title",baseGoodsSkus.getTitle()));
|
||||
if(sku!=null){
|
||||
if(!baseGoodsSkus.getSid().equals(sku.getSid())){
|
||||
return rb.setMsg("商品sku名重复");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
sid = dto.getSid();
|
||||
GoodsSpu wmsGoods = fetchBySid(dto.getSid());
|
||||
BeanUtil.copyProperties(dto, wmsGoods,"id","sid");
|
||||
wmsGoods.setModifyTime(new Date());
|
||||
// wmsGoods.setGoodsPY(PinYinUtils.getPinYinName(wmsGoods.getGoodsName()));
|
||||
wmsGoods.setGoodsPY(PinYinUtils.sx(wmsGoods.getGoodsName()));;
|
||||
//spu详情
|
||||
dto.getBaseGoodsSpuDetail().setGoodSpuSid(wmsGoods.getSid());
|
||||
//商品sku
|
||||
dto.getBaseGoodsSkus().forEach(s -> {
|
||||
s.setGoodsSpuSid(wmsGoods.getSid());
|
||||
});
|
||||
skus=goodsSkuService.saveOrUpdate(dto.getBaseGoodsSkus()).getData();
|
||||
baseGoodsSpuDetailService.saveOrUpdate(dto.getBaseGoodsSpuDetail());
|
||||
baseMapper.updateById(wmsGoods);
|
||||
} else {
|
||||
|
||||
if (spu1 != null) {
|
||||
return rb.setMsg("商品spu名重复");
|
||||
}
|
||||
for (GoodsSkuDto baseGoodsSkus : dto.getBaseGoodsSkus()) {
|
||||
GoodsSku sku1=goodsSkuService.getOne(new QueryWrapper<GoodsSku>().eq("title",baseGoodsSkus.getTitle()));
|
||||
if(sku1!=null){
|
||||
return rb.setMsg("商品sku名重复");
|
||||
}
|
||||
}
|
||||
GoodsSpu wmsGoods = new GoodsSpu();
|
||||
sid = wmsGoods.getSid();
|
||||
BeanUtil.copyProperties(dto, wmsGoods);
|
||||
wmsGoods.setCreateTime(new DateTime());
|
||||
wmsGoods.setGoodsPY(PinYinUtils.sx(wmsGoods.getGoodsName()));;
|
||||
wmsGoods.setCreateBySid(dto.getUserSid());
|
||||
wmsGoods.setSid(UUID.randomUUID().toString());
|
||||
//spu详情
|
||||
dto.getBaseGoodsSpuDetail().setGoodSpuSid(wmsGoods.getSid());
|
||||
|
||||
//商品sku
|
||||
dto.getBaseGoodsSkus().forEach(s -> {
|
||||
s.setGoodsSpuSid(wmsGoods.getSid());
|
||||
});
|
||||
skus=goodsSkuService.saveOrUpdate(dto.getBaseGoodsSkus()).getData();
|
||||
baseGoodsSpuDetailService.saveOrUpdate(dto.getBaseGoodsSpuDetail());
|
||||
baseMapper.insert(wmsGoods);
|
||||
}
|
||||
return rb.success().setData(skus);
|
||||
}
|
||||
|
||||
public ResultBean<GoodsSpuVo> initialization(String sid) {
|
||||
ResultBean rb = ResultBean.fireFail();
|
||||
GoodsSpuVo vo = baseMapper.initialization(sid);
|
||||
|
||||
@@ -57,11 +57,11 @@ public class BaseGoodsSpuDetailService extends MybatisBaseService<GoodsSpuDetail
|
||||
|
||||
public ResultBean<String> saveOrUpdate(GoodsSpuDetailDto dto) {
|
||||
ResultBean rb = ResultBean.fireFail();
|
||||
GoodsSpuDetail detail=baseMapper.selectOne(new QueryWrapper<GoodsSpuDetail>().eq("sid",dto.getSid()));
|
||||
GoodsSpuDetail detail=baseMapper.selectOne(new QueryWrapper<GoodsSpuDetail>().eq("goodSpuSid",dto.getGoodSpuSid()));
|
||||
String sid = "";
|
||||
if (null!=detail) {
|
||||
sid = dto.getSid();
|
||||
GoodsSpuDetail goodsSpuDetail = fetchBySid(dto.getSid());
|
||||
GoodsSpuDetail goodsSpuDetail = fetchBySid(detail.getSid());
|
||||
BeanUtil.copyProperties(dto, goodsSpuDetail);
|
||||
goodsSpuDetail.setModifyTime(new Date());
|
||||
baseMapper.updateById(goodsSpuDetail);
|
||||
|
||||
@@ -6,7 +6,11 @@
|
||||
|
||||
<select id="listPage" resultType="com.yxt.goods.biz.goodstype.GoodsTypeVo">
|
||||
select
|
||||
*
|
||||
a.*,case a.outStockRule
|
||||
when 0 then '先进先出'
|
||||
when 1 then '先进后出'
|
||||
when 3 then '保质期优先'
|
||||
end as outStockRuleVaule
|
||||
from goods_type a
|
||||
LEFT JOIN ss_user.sys_organization as s ON a.useOrgSid = s.sid
|
||||
<where>
|
||||
@@ -30,7 +34,7 @@
|
||||
<foreach collection="names" item="item" index="index" open="(" separator="," close=")">
|
||||
#{item}
|
||||
</foreach>
|
||||
and s.orgSidPath like concat('%',#{orgPath},'%')
|
||||
and s.orgSidPath like concat('%',#{orgPath},'%') and a.isDelete !='1'
|
||||
</where>
|
||||
</select>
|
||||
<update id="updateBySidIsDelete">
|
||||
|
||||
@@ -10,6 +10,7 @@ import com.yxt.common.base.utils.StringUtils;
|
||||
import com.yxt.common.core.query.PagerQuery;
|
||||
import com.yxt.common.core.result.ResultBean;
|
||||
import com.yxt.common.core.vo.PagerVo;
|
||||
import com.yxt.goods.biz.goodsbrandinfo.GoodsBrandInfo;
|
||||
import com.yxt.goods.biz.goodsmanufacturer.GoodsManufacturerVo;
|
||||
import com.yxt.goods.biz.goodsspu.GoodsSpuDto;
|
||||
import com.yxt.goods.biz.goodsunit.GoodsUnit;
|
||||
@@ -87,15 +88,6 @@ public class GoodsTypeService extends MybatisBaseService<GoodsTypeMapper, GoodsT
|
||||
}
|
||||
record.setSids(record.getPSid());
|
||||
}
|
||||
if(record.getOutStockRule().equals("0")){
|
||||
record.setOutStockRuleVaule("先进先出");
|
||||
}
|
||||
else if(record.getOutStockRule().equals("1")){
|
||||
record.setOutStockRuleVaule("先进后出");
|
||||
}
|
||||
else if(record.getOutStockRule().equals("3")){
|
||||
record.setOutStockRuleVaule("保质期优先");
|
||||
}
|
||||
}
|
||||
return rb.success().setData(p);
|
||||
}
|
||||
@@ -107,22 +99,30 @@ public class GoodsTypeService extends MybatisBaseService<GoodsTypeMapper, GoodsT
|
||||
|
||||
public ResultBean<String> saveOrUpdate(GoodsTypeDto dto) {
|
||||
ResultBean rb = ResultBean.fireFail();
|
||||
String sid = "";
|
||||
String sid = dto.getSid();
|
||||
dto.setPSid(dto.getSids());
|
||||
if (StringUtils.isBlank(dto.getPercentageRate())){
|
||||
dto.setPercentageRate("0");
|
||||
}
|
||||
if (StringUtils.isBlank(dto.getIsGoodsID())){
|
||||
dto.setIsGoodsID("0");
|
||||
}
|
||||
if (StringUtils.isBlank(dto.getPercentageAmount())){
|
||||
dto.setPercentageAmount("0");
|
||||
}
|
||||
if(StringUtils.isBlank(dto.getSortNo())){
|
||||
dto.setSortNo("0");
|
||||
}
|
||||
GoodsType type=baseMapper.selectOne(new QueryWrapper<GoodsType>().eq("goodsTypeCode",dto.getGoodsTypeCode()));
|
||||
if(type!=null){
|
||||
return rb.success().setMsg("编码重复");
|
||||
}
|
||||
List<String> strings=new ArrayList<>();
|
||||
strings.add(dto.getGoodsTypeName());
|
||||
List<GoodsType> types=baseMapper.selectTypeNotIn(strings,dto.getUseOrgSid());
|
||||
// GoodsType type=baseMapper.selectOne(new QueryWrapper<GoodsType>().eq("goodsTypeCode",dto.getGoodsTypeCode()));
|
||||
if (StringUtils.isNotBlank(dto.getSid())) {
|
||||
if(types.size()!=0){
|
||||
if(!types.get(0).getSid().equals(sid)){
|
||||
return rb.setMsg("分类名不能重复");
|
||||
}
|
||||
}
|
||||
sid = dto.getSid();
|
||||
GoodsType wmsGoodsType = fetchBySid(dto.getSid());
|
||||
BeanUtil.copyProperties(dto, wmsGoodsType, "id", "sid");
|
||||
@@ -133,6 +133,9 @@ public class GoodsTypeService extends MybatisBaseService<GoodsTypeMapper, GoodsT
|
||||
}
|
||||
baseMapper.updateById(wmsGoodsType);
|
||||
} else {
|
||||
if(types.size()!=0){
|
||||
return rb.setMsg("分类名不能重复");
|
||||
}
|
||||
GoodsType wmsGoods = new GoodsType();
|
||||
sid = wmsGoods.getSid();
|
||||
BeanUtil.copyProperties(dto, wmsGoods, "id", "sid");
|
||||
@@ -167,14 +170,16 @@ public class GoodsTypeService extends MybatisBaseService<GoodsTypeMapper, GoodsT
|
||||
}
|
||||
//先进先出0、先进后出1、保质期优先2
|
||||
vo.setSids(wmsGoodsType.getPSid());
|
||||
if(vo.getOutStockRule().equals("0")){
|
||||
vo.setOutStockRuleVaule("先进先出");
|
||||
}
|
||||
else if(vo.getOutStockRule().equals("1")){
|
||||
vo.setOutStockRuleVaule("先进后出");
|
||||
}
|
||||
else if(vo.getOutStockRule().equals("3")){
|
||||
vo.setOutStockRuleVaule("保质期优先");
|
||||
if(StringUtils.isNotBlank(vo.getOutStockRule())){
|
||||
if(vo.getOutStockRule().equals("0")){
|
||||
vo.setOutStockRuleVaule("先进先出");
|
||||
}
|
||||
else if(vo.getOutStockRule().equals("1")){
|
||||
vo.setOutStockRuleVaule("先进后出");
|
||||
}
|
||||
else if(vo.getOutStockRule().equals("3")){
|
||||
vo.setOutStockRuleVaule("保质期优先");
|
||||
}
|
||||
}
|
||||
}
|
||||
return rb.success().setData(vo);
|
||||
@@ -216,7 +221,7 @@ public class GoodsTypeService extends MybatisBaseService<GoodsTypeMapper, GoodsT
|
||||
}
|
||||
return rb.success().setMsg("成功");
|
||||
}
|
||||
public ResultBean saveType(List<GoodsSpuDto> dtos,String orgPath) {
|
||||
public void saveType(List<GoodsSpuDto> dtos,String orgPath) {
|
||||
ResultBean rb = ResultBean.fireFail();
|
||||
List<GoodsSpuDto> dtos1=new ArrayList<>();
|
||||
List<GoodsType> goodsTypes=new ArrayList<>();
|
||||
@@ -243,7 +248,6 @@ public class GoodsTypeService extends MybatisBaseService<GoodsTypeMapper, GoodsT
|
||||
goodsTypes.add(type);
|
||||
}
|
||||
this.saveBatch(goodsTypes);
|
||||
return rb.success().setMsg("成功");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -38,7 +38,7 @@
|
||||
<foreach collection="names" item="item" index="index" open="(" separator="," close=")">
|
||||
#{item}
|
||||
</foreach>
|
||||
and s.orgSidPath like concat('%',#{orgPath},'%')
|
||||
and s.orgSidPath like concat('%',#{orgPath},'%') and a.isDelete !='1'
|
||||
</where>
|
||||
</select>
|
||||
</mapper>
|
||||
@@ -81,14 +81,25 @@ public class GoodsUnitService extends MybatisBaseService<GoodsUnitMapper, GoodsU
|
||||
|
||||
public ResultBean<String> saveOrUpdate(GoodsUnitDto dto) {
|
||||
ResultBean rb = ResultBean.fireFail();
|
||||
String sid = "";
|
||||
String sid = dto.getSid();
|
||||
List<String> strings=new ArrayList<>();
|
||||
strings.add(dto.getUnitName());
|
||||
List<GoodsUnit> list=baseMapper.selectUnitNotIn(strings,dto.getOrgPath());
|
||||
if (StringUtils.isNotBlank(dto.getSid())) {
|
||||
if(list.size()!=0){
|
||||
if(!list.get(0).getSid().equals(sid)){
|
||||
return rb.setMsg("单位名不能重复");
|
||||
}
|
||||
}
|
||||
sid = dto.getSid();
|
||||
GoodsUnit wmsGoodsType = fetchBySid(dto.getSid());
|
||||
BeanUtil.copyProperties(dto, wmsGoodsType, "id", "sid");
|
||||
wmsGoodsType.setModifyTime(new Date());
|
||||
baseMapper.updateById(wmsGoodsType);
|
||||
} else {
|
||||
if(list.size()!=0){
|
||||
return rb.setMsg("单位名不能重复");
|
||||
}
|
||||
GoodsUnit wmsGoods = new GoodsUnit();
|
||||
sid = wmsGoods.getSid();
|
||||
BeanUtil.copyProperties(dto, wmsGoods, "id", "sid");
|
||||
@@ -151,7 +162,7 @@ public class GoodsUnitService extends MybatisBaseService<GoodsUnitMapper, GoodsU
|
||||
GoodsUnit type=baseMapper.selectOne(new QueryWrapper<GoodsUnit>().eq("unitName",name));
|
||||
return rb.success().setData(type);
|
||||
}
|
||||
public ResultBean saveUnit(List<GoodsSpuDto> dtos, String orgPath) {
|
||||
public void saveUnit(List<GoodsSpuDto> dtos, String orgPath) {
|
||||
ResultBean rb = ResultBean.fireFail();
|
||||
|
||||
List<GoodsSpuDto> dtos1=new ArrayList<>();
|
||||
@@ -162,7 +173,7 @@ public class GoodsUnitService extends MybatisBaseService<GoodsUnitMapper, GoodsU
|
||||
if(goodsType.size()!=0){
|
||||
for (GoodsSpuDto dto : dtos) {
|
||||
for (GoodsUnit type : goodsType) {
|
||||
if(dto.getGoodsTypeName().equals(type.getUnitName())){
|
||||
if(dto.getGoodsUnitName().equals(type.getUnitName())){
|
||||
dtos1.remove(dto);
|
||||
type.setIsEnable(1);
|
||||
type.setIsDelete(0);
|
||||
@@ -179,6 +190,5 @@ public class GoodsUnitService extends MybatisBaseService<GoodsUnitMapper, GoodsU
|
||||
goodsTypes.add(type);
|
||||
}
|
||||
this.saveBatch(goodsTypes);
|
||||
return rb.success().setMsg("成功");
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user