商品导入优化
parent
5424650b3d
commit
5aa681f8aa
|
@ -31,6 +31,7 @@ import org.jeecgframework.poi.excel.annotation.Excel;
|
||||||
@SuppressWarnings("serial")
|
@SuppressWarnings("serial")
|
||||||
public class BaGoodsCategoryEntity implements java.io.Serializable {
|
public class BaGoodsCategoryEntity implements java.io.Serializable {
|
||||||
/**id*/
|
/**id*/
|
||||||
|
@Excel(name="类目id")
|
||||||
private Integer id;
|
private Integer id;
|
||||||
/**创建人名称*/
|
/**创建人名称*/
|
||||||
private String createName;
|
private String createName;
|
||||||
|
|
|
@ -238,15 +238,15 @@ public class MdGoodsController extends BaseController {
|
||||||
// TODO: handle exception
|
// TODO: handle exception
|
||||||
}
|
}
|
||||||
//查询当前商品类型的商品数量
|
//查询当前商品类型的商品数量
|
||||||
Map<String, Object> countMap = systemService.findOneForJdbc("select right(shp_bian_ma,7) shp_bian_ma from md_goods where chp_shu_xing=? and suo_shu_ke_hu = ? and shp_bian_ma like ? ORDER BY shp_bian_ma desc LIMIT 1",mdGoods.getChpShuXing(),mdGoods.getSuoShuKeHu(),mdGoods.getSuoShuKeHu()+"&"+mdGoods.getChpShuXing()+"%");
|
Map<String, Object> countMap = systemService.findOneForJdbc("select right(shp_bian_ma,7) shp_bian_ma from md_goods where chp_shu_xing=? and suo_shu_ke_hu = ? and shp_bian_ma like ? ORDER BY shp_bian_ma desc LIMIT 1",mdGoods.getChpShuXing(),mdGoods.getSuoShuKeHu(),mdGoods.getSuoShuKeHu()+mdGoods.getChpShuXing()+"%");
|
||||||
if (countMap == null) {
|
if (countMap == null) {
|
||||||
mdGoods.setShpBianMa(mdGoods.getSuoShuKeHu()+"&"+mdGoods.getChpShuXing()+String.format("%07d", 1));
|
mdGoods.setShpBianMa(mdGoods.getSuoShuKeHu()+mdGoods.getChpShuXing()+String.format("%07d", 1));
|
||||||
}else {
|
}else {
|
||||||
Object goodsCode = countMap.get("shp_bian_ma");
|
Object goodsCode = countMap.get("shp_bian_ma");
|
||||||
if (goodsCode != null) {
|
if (goodsCode != null) {
|
||||||
mdGoods.setShpBianMa(mdGoods.getSuoShuKeHu()+"&"+mdGoods.getChpShuXing()+String.format("%07d",Integer.parseInt(((String) goodsCode))+1));
|
mdGoods.setShpBianMa(mdGoods.getSuoShuKeHu()+mdGoods.getChpShuXing()+String.format("%07d",Integer.parseInt(((String) goodsCode))+1));
|
||||||
}else {
|
}else {
|
||||||
mdGoods.setShpBianMa(mdGoods.getSuoShuKeHu()+"&"+mdGoods.getChpShuXing()+String.format("%07d", 1));
|
mdGoods.setShpBianMa(mdGoods.getSuoShuKeHu()+mdGoods.getChpShuXing()+String.format("%07d", 1));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
mdGoodsService.save(mdGoods);
|
mdGoodsService.save(mdGoods);
|
||||||
|
@ -454,15 +454,15 @@ public class MdGoodsController extends BaseController {
|
||||||
// j.setMsg("产品属性错误:"+mdGoods.getChpShuXing());
|
// j.setMsg("产品属性错误:"+mdGoods.getChpShuXing());
|
||||||
// return j;
|
// return j;
|
||||||
// }
|
// }
|
||||||
Map<String, Object> countMap = systemService.findOneForJdbc("select right(shp_bian_ma,7) shp_bian_ma from md_goods where chp_shu_xing=? and suo_shu_ke_hu = ? and shp_bian_ma like ? ORDER BY shp_bian_ma desc LIMIT 1",mdGoods.getChpShuXing(),mdGoods.getSuoShuKeHu(),mdGoods.getSuoShuKeHu()+"&"+mdGoods.getChpShuXing()+"%");
|
Map<String, Object> countMap = systemService.findOneForJdbc("select right(shp_bian_ma,7) shp_bian_ma from md_goods where chp_shu_xing=? and suo_shu_ke_hu = ? and shp_bian_ma like ? ORDER BY shp_bian_ma desc LIMIT 1",mdGoods.getChpShuXing(),mdGoods.getSuoShuKeHu(),mdGoods.getSuoShuKeHu()+mdGoods.getChpShuXing()+"%");
|
||||||
if (countMap == null) {
|
if (countMap == null) {
|
||||||
mdGoods.setShpBianMa(mdGoods.getSuoShuKeHu()+"&"+mdGoods.getChpShuXing()+String.format("%07d", 1));
|
mdGoods.setShpBianMa(mdGoods.getSuoShuKeHu()+mdGoods.getChpShuXing()+String.format("%07d", 1));
|
||||||
}else {
|
}else {
|
||||||
Object goodsCode = countMap.get("shp_bian_ma");
|
Object goodsCode = countMap.get("shp_bian_ma");
|
||||||
if (goodsCode != null) {
|
if (goodsCode != null) {
|
||||||
mdGoods.setShpBianMa(mdGoods.getSuoShuKeHu()+"&"+mdGoods.getChpShuXing()+String.format("%07d",Integer.parseInt(((String) goodsCode))+1));
|
mdGoods.setShpBianMa(mdGoods.getSuoShuKeHu()+mdGoods.getChpShuXing()+String.format("%07d",Integer.parseInt(((String) goodsCode))+1));
|
||||||
}else {
|
}else {
|
||||||
mdGoods.setShpBianMa(mdGoods.getSuoShuKeHu()+"&"+mdGoods.getChpShuXing()+String.format("%07d", 1));
|
mdGoods.setShpBianMa(mdGoods.getSuoShuKeHu()+mdGoods.getChpShuXing()+String.format("%07d", 1));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -147,10 +147,24 @@ public class MdGoodsEntity implements java.io.Serializable {
|
||||||
private java.lang.String zhuangTai;
|
private java.lang.String zhuangTai;
|
||||||
private java.lang.String minStock;
|
private java.lang.String minStock;
|
||||||
|
|
||||||
|
@Excel(name="sku")
|
||||||
private String sku;
|
private String sku;
|
||||||
|
|
||||||
|
// @Excel(name="类目id")
|
||||||
private Integer categoryId;
|
private Integer categoryId;
|
||||||
|
|
||||||
|
private String categoryCode;
|
||||||
|
|
||||||
|
@Column(name ="category_code",nullable=false,length=50)
|
||||||
|
public String getCategoryCode() {
|
||||||
|
return categoryCode;
|
||||||
|
}
|
||||||
|
|
||||||
|
public MdGoodsEntity setCategoryCode(String categoryCode) {
|
||||||
|
this.categoryCode = categoryCode;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
@Column(name ="category_id",nullable=false,length=36)
|
@Column(name ="category_id",nullable=false,length=36)
|
||||||
public Integer getCategoryId() {
|
public Integer getCategoryId() {
|
||||||
return categoryId;
|
return categoryId;
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
package com.zzjee.wm.controller;
|
package com.zzjee.wm.controller;
|
||||||
|
|
||||||
|
import com.zzjee.ba.entity.BaGoodsCategoryEntity;
|
||||||
import com.zzjee.ba.entity.BaGoodsTypeEntity;
|
import com.zzjee.ba.entity.BaGoodsTypeEntity;
|
||||||
|
import com.zzjee.ba.service.BaGoodsCategoryServiceI;
|
||||||
import com.zzjee.ba.service.BaGoodsTypeServiceI;
|
import com.zzjee.ba.service.BaGoodsTypeServiceI;
|
||||||
import com.zzjee.md.entity.MdBinEntity;
|
import com.zzjee.md.entity.MdBinEntity;
|
||||||
import com.zzjee.md.entity.MdCusEntity;
|
import com.zzjee.md.entity.MdCusEntity;
|
||||||
|
@ -21,6 +23,7 @@ import com.zzjee.wm.page.WmOmNoticeHPage;
|
||||||
import com.zzjee.wm.service.WmImNoticeHServiceI;
|
import com.zzjee.wm.service.WmImNoticeHServiceI;
|
||||||
import com.zzjee.wm.service.WmOmNoticeHServiceI;
|
import com.zzjee.wm.service.WmOmNoticeHServiceI;
|
||||||
import com.zzjee.wmutil.wmUtil;
|
import com.zzjee.wmutil.wmUtil;
|
||||||
|
import org.apache.commons.lang.StringUtils;
|
||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
import org.jeecgframework.core.common.exception.BusinessException;
|
import org.jeecgframework.core.common.exception.BusinessException;
|
||||||
import org.jeecgframework.core.common.hibernate.qbc.CriteriaQuery;
|
import org.jeecgframework.core.common.hibernate.qbc.CriteriaQuery;
|
||||||
|
@ -83,6 +86,8 @@ public class WmsApiController {
|
||||||
private WmOmNoticeHServiceI wmOmNoticeHService;
|
private WmOmNoticeHServiceI wmOmNoticeHService;
|
||||||
@Autowired
|
@Autowired
|
||||||
private BaGoodsTypeServiceI baGoodsTypeService;
|
private BaGoodsTypeServiceI baGoodsTypeService;
|
||||||
|
@Autowired
|
||||||
|
private BaGoodsCategoryServiceI baGoodsCategoryService;
|
||||||
|
|
||||||
@RequestMapping(params = "getToken")
|
@RequestMapping(params = "getToken")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
|
@ -138,17 +143,22 @@ public class WmsApiController {
|
||||||
try {
|
try {
|
||||||
MdGoodsEntity mdGoods1 = systemService.findUniqueByProperty(
|
MdGoodsEntity mdGoods1 = systemService.findUniqueByProperty(
|
||||||
MdGoodsEntity.class, "sku", mdGoods.getSku());
|
MdGoodsEntity.class, "sku", mdGoods.getSku());
|
||||||
|
if (StringUtils.isEmpty(mdGoods.getCategoryCode())) {
|
||||||
|
j.setSuccess(false);
|
||||||
|
j.setMsg("类目编码为空");
|
||||||
|
return j;
|
||||||
|
}
|
||||||
|
|
||||||
if(mdGoods1 ==null ){
|
if(mdGoods1 ==null ){
|
||||||
Map<String, Object> countMap = systemService.findOneForJdbc("select right(shp_bian_ma,7) shp_bian_ma from md_goods where chp_shu_xing=? and suo_shu_ke_hu = ? and shp_bian_ma like ? ORDER BY shp_bian_ma desc LIMIT 1",mdGoods.getChpShuXing(),mdGoods.getSuoShuKeHu(),mdGoods.getSuoShuKeHu()+"&"+mdGoods.getChpShuXing()+"%");
|
Map<String, Object> countMap = systemService.findOneForJdbc("select right(shp_bian_ma,7) shp_bian_ma from md_goods where category_code =? and suo_shu_ke_hu = ? and shp_bian_ma like ? ORDER BY shp_bian_ma desc LIMIT 1",mdGoods.getCategoryCode(),mdGoods.getSuoShuKeHu(),mdGoods.getSuoShuKeHu()+mdGoods.getCategoryCode()+"%");
|
||||||
if (countMap == null) {
|
if (countMap == null) {
|
||||||
mdGoods.setShpBianMa(mdGoods.getSuoShuKeHu()+"&"+mdGoods.getChpShuXing()+String.format("%07d", 1));
|
mdGoods.setShpBianMa(mdGoods.getSuoShuKeHu()+mdGoods.getCategoryCode()+String.format("%07d", 1));
|
||||||
}else {
|
}else {
|
||||||
Object goodsCode = countMap.get("shp_bian_ma");
|
Object goodsCode = countMap.get("shp_bian_ma");
|
||||||
if (goodsCode != null) {
|
if (goodsCode != null) {
|
||||||
mdGoods.setShpBianMa(mdGoods.getSuoShuKeHu()+"&"+mdGoods.getChpShuXing()+String.format("%07d",Integer.parseInt(((String) goodsCode))+1));
|
mdGoods.setShpBianMa(mdGoods.getSuoShuKeHu()+mdGoods.getCategoryCode()+String.format("%07d",Integer.parseInt(((String) goodsCode))+1));
|
||||||
}else {
|
}else {
|
||||||
mdGoods.setShpBianMa(mdGoods.getSuoShuKeHu()+"&"+mdGoods.getChpShuXing()+String.format("%07d", 1));
|
mdGoods.setShpBianMa(mdGoods.getSuoShuKeHu()+mdGoods.getCategoryCode()+String.format("%07d", 1));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(StringUtil.isEmpty(mdGoods.getChlKongZhi()) ){
|
if(StringUtil.isEmpty(mdGoods.getChlKongZhi()) ){
|
||||||
|
@ -442,7 +452,7 @@ public class WmsApiController {
|
||||||
for (WmImNoticeIEntity wmImNoticeIEntity : wmImNoticeIList) {
|
for (WmImNoticeIEntity wmImNoticeIEntity : wmImNoticeIList) {
|
||||||
if(!StringUtil.isEmpty(wmImNoticeIEntity.getGoodsCode())){
|
if(!StringUtil.isEmpty(wmImNoticeIEntity.getGoodsCode())){
|
||||||
try {
|
try {
|
||||||
MvGoodsEntity mvgoods = systemService.findUniqueByProperty(MvGoodsEntity.class,"goodsName",wmImNoticeIEntity.getGoodsCode());
|
MvGoodsEntity mvgoods = systemService.findUniqueByProperty(MvGoodsEntity.class,"goodsId",wmImNoticeIEntity.getGoodsCode());
|
||||||
// String date[]=wmImNoticeIEntity.getGoodsCode().split("-");
|
// String date[]=wmImNoticeIEntity.getGoodsCode().split("-");
|
||||||
|
|
||||||
long hiti = 0;
|
long hiti = 0;
|
||||||
|
@ -588,7 +598,7 @@ public class WmsApiController {
|
||||||
try {
|
try {
|
||||||
|
|
||||||
|
|
||||||
MvGoodsEntity mvgoods = systemService.findUniqueByProperty(MvGoodsEntity.class,"goodsName",wmomNoticeIEntity.getGoodsId());
|
MvGoodsEntity mvgoods = systemService.findUniqueByProperty(MvGoodsEntity.class,"goodsId",wmomNoticeIEntity.getGoodsId());
|
||||||
|
|
||||||
// String date[]=wmImNoticeIEntity.getGoodsCode().split("-");
|
// String date[]=wmImNoticeIEntity.getGoodsCode().split("-");
|
||||||
// wmImNoticeIEntity.setGoodsCode(mvgoods.getGoodsCode());
|
// wmImNoticeIEntity.setGoodsCode(mvgoods.getGoodsCode());
|
||||||
|
@ -812,4 +822,51 @@ public class WmsApiController {
|
||||||
return j;
|
return j;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@RequestMapping(params = "goodsCategoryList")
|
||||||
|
public void datagrid(BaGoodsCategoryEntity baGoodsCategory, HttpServletRequest request, HttpServletResponse response, DataGrid dataGrid) {
|
||||||
|
CriteriaQuery cq = new CriteriaQuery(BaGoodsCategoryEntity.class, dataGrid);
|
||||||
|
//查询条件组装器
|
||||||
|
org.jeecgframework.core.extend.hqlsearch.HqlGenerateUtil.installHql(cq, baGoodsCategory, request.getParameterMap());
|
||||||
|
try{
|
||||||
|
//自定义追加查询条件
|
||||||
|
String query_createTime_begin = request.getParameter("createTime_begin");
|
||||||
|
String query_createTime_end = request.getParameter("createTime_end");
|
||||||
|
if(StringUtil.isNotEmpty(query_createTime_begin)){
|
||||||
|
cq.ge("createTime", new SimpleDateFormat("yyyy-MM-dd").parse(query_createTime_begin));
|
||||||
|
}
|
||||||
|
if(StringUtil.isNotEmpty(query_createTime_end)){
|
||||||
|
cq.le("createTime", new SimpleDateFormat("yyyy-MM-dd").parse(query_createTime_end));
|
||||||
|
}
|
||||||
|
}catch (Exception e) {
|
||||||
|
throw new BusinessException(e.getMessage());
|
||||||
|
}
|
||||||
|
cq.add();
|
||||||
|
this.baGoodsCategoryService.getDataGridReturn(cq, true);
|
||||||
|
TagUtil.datagrid(response, dataGrid);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 添加商品类目
|
||||||
|
*
|
||||||
|
* @param ids
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@RequestMapping(params = "addGoodsCategory")
|
||||||
|
@ResponseBody
|
||||||
|
public AjaxJson doAdd(BaGoodsCategoryEntity baGoodsCategory, HttpServletRequest request) {
|
||||||
|
String message = null;
|
||||||
|
AjaxJson j = new AjaxJson();
|
||||||
|
message = "商品类目添加成功";
|
||||||
|
try{
|
||||||
|
baGoodsCategoryService.save(baGoodsCategory);
|
||||||
|
systemService.addLog(message, Globals.Log_Type_INSERT, Globals.Log_Leavel_INFO);
|
||||||
|
}catch(Exception e){
|
||||||
|
e.printStackTrace();
|
||||||
|
message = "商品类目添加失败";
|
||||||
|
throw new BusinessException(e.getMessage());
|
||||||
|
}
|
||||||
|
j.setMsg(message);
|
||||||
|
return j;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue