This commit is contained in:
parent
db51ea4fad
commit
e6c17411c6
|
@ -0,0 +1,8 @@
|
|||
package com.hzya.frame.wms_21.basemdm.dao;
|
||||
|
||||
import com.hzya.frame.basedao.dao.IBaseDao;
|
||||
import com.hzya.frame.wms_21.basemdm.entity.CustomerEntity;
|
||||
|
||||
public interface IBaseMdmCustomerDao extends IBaseDao<CustomerEntity,String> {
|
||||
int insertCustomer(CustomerEntity customer);
|
||||
}
|
|
@ -0,0 +1,8 @@
|
|||
package com.hzya.frame.wms_21.basemdm.dao;
|
||||
|
||||
import com.hzya.frame.basedao.dao.IBaseDao;
|
||||
import com.hzya.frame.wms_21.basemdm.entity.ProductEntity;
|
||||
|
||||
public interface IBaseMdmProductDao extends IBaseDao<ProductEntity,String> {
|
||||
int insertPruduct(ProductEntity product);
|
||||
}
|
|
@ -0,0 +1,20 @@
|
|||
package com.hzya.frame.wms_21.basemdm.dao.impl;
|
||||
|
||||
|
||||
import com.baomidou.dynamic.datasource.annotation.DS;
|
||||
import com.hzya.frame.basedao.dao.MybatisGenericDao;
|
||||
import com.hzya.frame.wms_21.basemdm.dao.IBaseMdmCustomerDao;
|
||||
import com.hzya.frame.wms_21.basemdm.dao.IBaseMdmProductDao;
|
||||
import com.hzya.frame.wms_21.basemdm.entity.CustomerEntity;
|
||||
import com.hzya.frame.wms_21.basemdm.entity.ProductEntity;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
@Repository(value = "BaseMdmCustomerDaoImpl")
|
||||
public class BaseMdmCustomerDaoImpl extends MybatisGenericDao<CustomerEntity,String> implements IBaseMdmCustomerDao {
|
||||
|
||||
@DS("#customer.dataSourceCode")
|
||||
@Override
|
||||
public int insertCustomer(CustomerEntity customer) {
|
||||
return super.insert("com.hzya.frame.wms_21.basemdm.entity.CustomerEntity.CustomerEntity_insert",customer);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,20 @@
|
|||
package com.hzya.frame.wms_21.basemdm.dao.impl;
|
||||
|
||||
|
||||
import com.baomidou.dynamic.datasource.annotation.DS;
|
||||
import com.hzya.frame.basedao.dao.MybatisGenericDao;
|
||||
import com.hzya.frame.wms_21.basemdm.dao.IBaseMdmProductDao;
|
||||
import com.hzya.frame.wms_21.basemdm.entity.ProductEntity;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Repository(value = "BaseMdmProductDaoImpl")
|
||||
public class BaseMdmProductDaoImpl extends MybatisGenericDao<ProductEntity,String> implements IBaseMdmProductDao {
|
||||
|
||||
@DS("#product.dataSourceCode")
|
||||
@Override
|
||||
public int insertPruduct(ProductEntity product) {
|
||||
return super.insert("com.hzya.frame.wms_21.basemdm.entity.ProductEntity.ProductEntity_insert",product);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,24 @@
|
|||
package com.hzya.frame.wms_21.basemdm.entity;
|
||||
|
||||
import com.hzya.frame.web.entity.BaseEntity;
|
||||
|
||||
public class CustomerEntity extends BaseEntity {
|
||||
private String custNo;
|
||||
private String custDesc;
|
||||
|
||||
public String getCustNo() {
|
||||
return custNo;
|
||||
}
|
||||
|
||||
public void setCustNo(String custNo) {
|
||||
this.custNo = custNo;
|
||||
}
|
||||
|
||||
public String getCustDesc() {
|
||||
return custDesc;
|
||||
}
|
||||
|
||||
public void setCustDesc(String custDesc) {
|
||||
this.custDesc = custDesc;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,12 @@
|
|||
<?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.hzya.frame.wms_21.basemdm.entity.CustomerEntity">
|
||||
|
||||
<insert id="CustomerEntity_insert" parameterType="com.hzya.frame.wms_21.basemdm.entity.CustomerEntity">
|
||||
delete from EW_CUSTOMER where CUST_NO = #{custNo};
|
||||
insert into EW_CUSTOMER(
|
||||
CUST_NO,KIND,CUST_DESC,CREATION_DATE
|
||||
)values
|
||||
(#{custNo},'I',#{custDesc},getdate())
|
||||
</insert>
|
||||
</mapper>
|
|
@ -0,0 +1,60 @@
|
|||
package com.hzya.frame.wms_21.basemdm.entity;
|
||||
|
||||
import com.hzya.frame.web.entity.BaseEntity;
|
||||
|
||||
public class ProductEntity extends BaseEntity {
|
||||
private String prodId;
|
||||
private String kind;
|
||||
private String prodDesc;
|
||||
private String spec;
|
||||
private String uom;
|
||||
private String prodClass;
|
||||
|
||||
public String getProdId() {
|
||||
return prodId;
|
||||
}
|
||||
|
||||
public void setProdId(String prodId) {
|
||||
this.prodId = prodId;
|
||||
}
|
||||
|
||||
public String getKind() {
|
||||
return kind;
|
||||
}
|
||||
|
||||
public void setKind(String kind) {
|
||||
this.kind = kind;
|
||||
}
|
||||
|
||||
public String getProdDesc() {
|
||||
return prodDesc;
|
||||
}
|
||||
|
||||
public void setProdDesc(String prodDesc) {
|
||||
this.prodDesc = prodDesc;
|
||||
}
|
||||
|
||||
public String getSpec() {
|
||||
return spec;
|
||||
}
|
||||
|
||||
public void setSpec(String spec) {
|
||||
this.spec = spec;
|
||||
}
|
||||
|
||||
public String getUom() {
|
||||
return uom;
|
||||
}
|
||||
|
||||
public void setUom(String uom) {
|
||||
this.uom = uom;
|
||||
}
|
||||
|
||||
public String getProdClass() {
|
||||
return prodClass;
|
||||
}
|
||||
|
||||
public void setProdClass(String prodClass) {
|
||||
this.prodClass = prodClass;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,12 @@
|
|||
<?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.hzya.frame.wms_21.basemdm.entity.ProductEntity">
|
||||
|
||||
<insert id="ProductEntity_insert" parameterType="com.hzya.frame.wms_21.basemdm.entity.ProductEntity">
|
||||
delete from EW_PROD where prod_id = #{prodId};
|
||||
insert into EW_PROD(
|
||||
[PROD_ID],[KIND],[PROD_DESC],[SPEC],[UOM],[PROD_CLASS],[CREATION_DATE]
|
||||
)values
|
||||
(#{prodId},#{kind},#{prodDesc},#{spec},#{uom},#{prodClass},getdate())
|
||||
</insert>
|
||||
</mapper>
|
|
@ -0,0 +1,14 @@
|
|||
package com.hzya.frame.wms_21.basemdm.service;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.hzya.frame.web.entity.JsonResultEntity;
|
||||
|
||||
/**
|
||||
* 用于wms的中间库接收主数据并写入
|
||||
*/
|
||||
public interface IBaseMdmService {
|
||||
|
||||
JsonResultEntity CreateProduct(JSONObject requestData);
|
||||
|
||||
JsonResultEntity CreateCustomer(JSONObject requestData);
|
||||
}
|
|
@ -0,0 +1,68 @@
|
|||
package com.hzya.frame.wms_21.basemdm.service.impl;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.hzya.frame.web.entity.JsonResultEntity;
|
||||
import com.hzya.frame.wms_21.basemdm.dao.IBaseMdmCustomerDao;
|
||||
import com.hzya.frame.wms_21.basemdm.dao.IBaseMdmProductDao;
|
||||
import com.hzya.frame.wms_21.basemdm.entity.CustomerEntity;
|
||||
import com.hzya.frame.wms_21.basemdm.entity.ProductEntity;
|
||||
import com.hzya.frame.wms_21.basemdm.service.IBaseMdmService;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@Service(value = "BaseMdmServiceImpl")
|
||||
public class BaseMdmServiceImpl implements IBaseMdmService {
|
||||
private static final Logger logger = LoggerFactory.getLogger(BaseMdmServiceImpl.class);
|
||||
@Autowired
|
||||
private IBaseMdmProductDao productDao;
|
||||
@Autowired
|
||||
private IBaseMdmCustomerDao customerDao;
|
||||
|
||||
@Override
|
||||
public JsonResultEntity CreateProduct(JSONObject requestData) {
|
||||
List<String> count =new ArrayList<>();
|
||||
JSONObject jsonStrObj = requestData.getJSONObject("jsonStr");
|
||||
String prodClass = jsonStrObj.getString("prodClass");
|
||||
if(StrUtil.isEmpty(prodClass)){
|
||||
return new JsonResultEntity("类型不能为空",false);
|
||||
}
|
||||
|
||||
//通过表单编号获取表单字段信息
|
||||
ProductEntity product = new ProductEntity();
|
||||
product.setDataSourceCode("WMS");
|
||||
product.setProdId(jsonStrObj.getString("prodId"));
|
||||
product.setKind(jsonStrObj.getString("kind"));
|
||||
product.setProdDesc(jsonStrObj.getString("prodDesc"));
|
||||
product.setSpec(jsonStrObj.getString("spec"));
|
||||
product.setUom(jsonStrObj.getString("uom"));
|
||||
product.setProdClass(jsonStrObj.getString("prodClass"));
|
||||
|
||||
productDao.insertPruduct(product);
|
||||
|
||||
return new JsonResultEntity("插入成功:"+ JSON.toJSONString(product),true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public JsonResultEntity CreateCustomer(JSONObject requestData) {
|
||||
List<String> count =new ArrayList<>();
|
||||
JSONObject jsonStrObj = requestData.getJSONObject("jsonStr");
|
||||
|
||||
//通过表单编号获取表单字段信息
|
||||
CustomerEntity customer = new CustomerEntity();
|
||||
customer.setDataSourceCode("WMS");
|
||||
customer.setCustNo(jsonStrObj.getString("custNo"));
|
||||
customer.setCustDesc(jsonStrObj.getString("custDesc"));
|
||||
|
||||
customerDao.insertCustomer(customer);
|
||||
|
||||
return new JsonResultEntity("插入成功:"+ JSON.toJSONString(customer),true);
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue