销售订单同步OA代码
This commit is contained in:
parent
f11dba5d41
commit
11431c76b7
|
@ -0,0 +1,36 @@
|
|||
package com.hzya.frame.u8c.sosale.dao;
|
||||
|
||||
import com.hzya.frame.basedao.dao.IBaseDao;
|
||||
import com.hzya.frame.u8c.sosale.entity.SoSaleEntity;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 脚本表(u8c_sales_billing: table)表数据库访问层
|
||||
*
|
||||
* @author makejava
|
||||
* @since 2024-08-02 11:07:43
|
||||
*/
|
||||
public interface ISoSaleDao extends IBaseDao<SoSaleEntity, String> {
|
||||
/**
|
||||
*
|
||||
* @content 获取U8C主表数据
|
||||
* @className: Administrator
|
||||
* @author laborer
|
||||
* @date 2024-10-16 15:30
|
||||
*
|
||||
*/
|
||||
|
||||
List<SoSaleEntity> getU8cSale(SoSaleEntity entity);
|
||||
/**
|
||||
*
|
||||
* @content 修改推送状态
|
||||
* @className: Administrator
|
||||
* @author laborer
|
||||
* @date 2024-10-16 16:00
|
||||
*
|
||||
*/
|
||||
|
||||
int updateState(SoSaleEntity sale);
|
||||
}
|
||||
|
|
@ -0,0 +1,28 @@
|
|||
package com.hzya.frame.u8c.sosale.dao;
|
||||
|
||||
import com.hzya.frame.basedao.dao.IBaseDao;
|
||||
import com.hzya.frame.u8c.sosale.entity.SoSaleEntity;
|
||||
import com.hzya.frame.u8c.sosale.entity.SoSaleLineEntity;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 脚本表(u8c_sales_billing: table)表数据库访问层
|
||||
*
|
||||
* @author makejava
|
||||
* @since 2024-08-02 11:07:43
|
||||
*/
|
||||
public interface ISoSaleLineDao extends IBaseDao<SoSaleLineEntity, String> {
|
||||
/**
|
||||
*
|
||||
* @content 获取U8C明细数据
|
||||
* @className: Administrator
|
||||
* @author laborer
|
||||
* @date 2024-10-16 15:52
|
||||
*
|
||||
*/
|
||||
|
||||
List<SoSaleLineEntity> getU8cSaleLine(SoSaleLineEntity line);
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,32 @@
|
|||
package com.hzya.frame.u8c.sosale.dao.impl;
|
||||
|
||||
import com.baomidou.dynamic.datasource.annotation.DS;
|
||||
import com.hzya.frame.basedao.dao.MybatisGenericDao;
|
||||
import com.hzya.frame.u8c.sosale.dao.ISoSaleDao;
|
||||
import com.hzya.frame.u8c.sosale.entity.SoSaleEntity;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Repository(value = "SoSaleDaoImpl")
|
||||
public class SoSaleDaoImpl extends MybatisGenericDao<SoSaleEntity, String> implements ISoSaleDao {
|
||||
/**
|
||||
*
|
||||
* @content 获取UC8C销售订单表头数据
|
||||
* @className: Administrator
|
||||
* @author laborer
|
||||
* @date 2024-10-16 15:30
|
||||
*
|
||||
*/
|
||||
@DS("#entity.dataSourceCode")
|
||||
@Override
|
||||
public List<SoSaleEntity> getU8cSale(SoSaleEntity entity) {
|
||||
return (List<SoSaleEntity>) super.selectList("com.hzya.frame.u8c.sosale.dao.impl.SoSaleDaoImpl.querySaleMain",entity);
|
||||
}
|
||||
@DS("#entity.dataSourceCode")
|
||||
@Override
|
||||
public int updateState(SoSaleEntity entity) {
|
||||
return super.update("com.hzya.frame.u8c.sosale.dao.impl.SoSaleDaoImpl.updateState",entity);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,21 @@
|
|||
package com.hzya.frame.u8c.sosale.dao.impl;
|
||||
|
||||
import com.baomidou.dynamic.datasource.annotation.DS;
|
||||
import com.hzya.frame.basedao.dao.MybatisGenericDao;
|
||||
import com.hzya.frame.u8c.sosale.dao.ISoSaleDao;
|
||||
import com.hzya.frame.u8c.sosale.dao.ISoSaleLineDao;
|
||||
import com.hzya.frame.u8c.sosale.entity.SoSaleEntity;
|
||||
import com.hzya.frame.u8c.sosale.entity.SoSaleLineEntity;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Repository(value = "SoSaleLineDaoImpl")
|
||||
public class SoSaleLineDaoImpl extends MybatisGenericDao<SoSaleLineEntity, String> implements ISoSaleLineDao {
|
||||
@DS("#entity.dataSourceCode")
|
||||
@Override
|
||||
public List<SoSaleLineEntity> getU8cSaleLine(SoSaleLineEntity entity) {
|
||||
return (List<SoSaleLineEntity>) super.selectList("com.hzya.frame.u8c.sosale.dao.impl.SoSaleLineDaoImpl.querySaleLine", entity);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,245 @@
|
|||
package com.hzya.frame.u8c.sosale.entity;
|
||||
|
||||
|
||||
import com.hzya.frame.web.entity.BaseEntity;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class SoSaleEntity extends BaseEntity {
|
||||
private String csaleId;//销售订单主表ID
|
||||
private String billCode;//单据编号
|
||||
private String state;
|
||||
private String vreceiptcode;// 单据编号
|
||||
private String user_code; // 审核人编码
|
||||
private String user_name; // 审核人名称
|
||||
private String dapprovedate; // 审核日期
|
||||
private String custcode;// 客户编码
|
||||
private String custname;// 客户名称
|
||||
private String vsalestrucode;// 销售组织编码
|
||||
private String vsalestruname;// 销售组织名称
|
||||
private String bodycode; // 库存组织编码
|
||||
private String bodyname; // 库存组织名称
|
||||
private String creceiptcustomerid ;// 收货单位
|
||||
private String shcode;// 收货单位编码
|
||||
private String shname;// 收货单位名称
|
||||
private String creceiptcorpid ;// 开票单位
|
||||
private String kpcode;// 开票单位编码
|
||||
private String kpname;// 开票单位名称
|
||||
private String ctransmodeid;// 运输方式
|
||||
private String busicode;//业务类型编码
|
||||
private String businame;//业务类型名称
|
||||
private String vnote;// 备注
|
||||
private String unitname;//
|
||||
private String unitcode;//
|
||||
|
||||
public String getUnitname() {
|
||||
return unitname;
|
||||
}
|
||||
|
||||
public void setUnitname(String unitname) {
|
||||
this.unitname = unitname;
|
||||
}
|
||||
|
||||
public String getUnitcode() {
|
||||
return unitcode;
|
||||
}
|
||||
|
||||
public void setUnitcode(String unitcode) {
|
||||
this.unitcode = unitcode;
|
||||
}
|
||||
|
||||
public String getVreceiptcode() {
|
||||
return vreceiptcode;
|
||||
}
|
||||
|
||||
public void setVreceiptcode(String vreceiptcode) {
|
||||
this.vreceiptcode = vreceiptcode;
|
||||
}
|
||||
|
||||
public String getUser_code() {
|
||||
return user_code;
|
||||
}
|
||||
|
||||
public void setUser_code(String user_code) {
|
||||
this.user_code = user_code;
|
||||
}
|
||||
|
||||
public String getUser_name() {
|
||||
return user_name;
|
||||
}
|
||||
|
||||
public void setUser_name(String user_name) {
|
||||
this.user_name = user_name;
|
||||
}
|
||||
|
||||
public String getDapprovedate() {
|
||||
return dapprovedate;
|
||||
}
|
||||
|
||||
public void setDapprovedate(String dapprovedate) {
|
||||
this.dapprovedate = dapprovedate;
|
||||
}
|
||||
|
||||
public String getCustcode() {
|
||||
return custcode;
|
||||
}
|
||||
|
||||
public void setCustcode(String custcode) {
|
||||
this.custcode = custcode;
|
||||
}
|
||||
|
||||
public String getCustname() {
|
||||
return custname;
|
||||
}
|
||||
|
||||
public void setCustname(String custname) {
|
||||
this.custname = custname;
|
||||
}
|
||||
|
||||
public String getVsalestrucode() {
|
||||
return vsalestrucode;
|
||||
}
|
||||
|
||||
public void setVsalestrucode(String vsalestrucode) {
|
||||
this.vsalestrucode = vsalestrucode;
|
||||
}
|
||||
|
||||
public String getVsalestruname() {
|
||||
return vsalestruname;
|
||||
}
|
||||
|
||||
public void setVsalestruname(String vsalestruname) {
|
||||
this.vsalestruname = vsalestruname;
|
||||
}
|
||||
|
||||
public String getBodycode() {
|
||||
return bodycode;
|
||||
}
|
||||
|
||||
public void setBodycode(String bodycode) {
|
||||
this.bodycode = bodycode;
|
||||
}
|
||||
|
||||
public String getBodyname() {
|
||||
return bodyname;
|
||||
}
|
||||
|
||||
public void setBodyname(String bodyname) {
|
||||
this.bodyname = bodyname;
|
||||
}
|
||||
|
||||
public String getCreceiptcustomerid() {
|
||||
return creceiptcustomerid;
|
||||
}
|
||||
|
||||
public void setCreceiptcustomerid(String creceiptcustomerid) {
|
||||
this.creceiptcustomerid = creceiptcustomerid;
|
||||
}
|
||||
|
||||
public String getShcode() {
|
||||
return shcode;
|
||||
}
|
||||
|
||||
public void setShcode(String shcode) {
|
||||
this.shcode = shcode;
|
||||
}
|
||||
|
||||
public String getShname() {
|
||||
return shname;
|
||||
}
|
||||
|
||||
public void setShname(String shname) {
|
||||
this.shname = shname;
|
||||
}
|
||||
|
||||
public String getCreceiptcorpid() {
|
||||
return creceiptcorpid;
|
||||
}
|
||||
|
||||
public void setCreceiptcorpid(String creceiptcorpid) {
|
||||
this.creceiptcorpid = creceiptcorpid;
|
||||
}
|
||||
|
||||
public String getKpcode() {
|
||||
return kpcode;
|
||||
}
|
||||
|
||||
public void setKpcode(String kpcode) {
|
||||
this.kpcode = kpcode;
|
||||
}
|
||||
|
||||
public String getKpname() {
|
||||
return kpname;
|
||||
}
|
||||
|
||||
public void setKpname(String kpname) {
|
||||
this.kpname = kpname;
|
||||
}
|
||||
|
||||
public String getCtransmodeid() {
|
||||
return ctransmodeid;
|
||||
}
|
||||
|
||||
public void setCtransmodeid(String ctransmodeid) {
|
||||
this.ctransmodeid = ctransmodeid;
|
||||
}
|
||||
|
||||
public String getBusicode() {
|
||||
return busicode;
|
||||
}
|
||||
|
||||
public void setBusicode(String busicode) {
|
||||
this.busicode = busicode;
|
||||
}
|
||||
|
||||
public String getBusiname() {
|
||||
return businame;
|
||||
}
|
||||
|
||||
public void setBusiname(String businame) {
|
||||
this.businame = businame;
|
||||
}
|
||||
|
||||
public String getVnote() {
|
||||
return vnote;
|
||||
}
|
||||
|
||||
public void setVnote(String vnote) {
|
||||
this.vnote = vnote;
|
||||
}
|
||||
|
||||
public String getState() {
|
||||
return state;
|
||||
}
|
||||
|
||||
public void setState(String state) {
|
||||
this.state = state;
|
||||
}
|
||||
|
||||
private List<SoSaleLineEntity>saleLineList;
|
||||
|
||||
public List<SoSaleLineEntity> getSaleLineList() {
|
||||
return saleLineList;
|
||||
}
|
||||
|
||||
public void setSaleLineList(List<SoSaleLineEntity> saleLineList) {
|
||||
this.saleLineList = saleLineList;
|
||||
}
|
||||
|
||||
public String getCsaleId() {
|
||||
return csaleId;
|
||||
}
|
||||
|
||||
public void setCsaleId(String csaleId) {
|
||||
this.csaleId = csaleId;
|
||||
}
|
||||
|
||||
public String getBillCode() {
|
||||
return billCode;
|
||||
}
|
||||
|
||||
public void setBillCode(String billCode) {
|
||||
this.billCode = billCode;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,82 @@
|
|||
<?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.u8c.sosale.dao.impl.SoSaleDaoImpl">
|
||||
|
||||
<resultMap id="get-SoSaleEntity-result" type="com.hzya.frame.u8c.sosale.entity.SoSaleEntity" >
|
||||
<result property="vreceiptcode" column="vreceiptcode" jdbcType="VARCHAR"/>
|
||||
<result property="user_code" column="user_code" jdbcType="VARCHAR"/>
|
||||
<result property="user_name" column="user_name" jdbcType="VARCHAR"/>
|
||||
<result property="dapprovedate" column="dapprovedate" jdbcType="VARCHAR"/>
|
||||
<result property="custcode" column="custcode" jdbcType="VARCHAR"/>
|
||||
<result property="custname" column="custname" jdbcType="VARCHAR"/>
|
||||
<result property="vsalestrucode" column="vsalestrucode" jdbcType="VARCHAR"/>
|
||||
<result property="vsalestruname" column="vsalestruname" jdbcType="VARCHAR"/>
|
||||
<result property="bodycode" column="bodycode" jdbcType="VARCHAR"/>
|
||||
<result property="bodyname" column="bodyname" jdbcType="VARCHAR"/>
|
||||
<result property="shcode" column="shcode" jdbcType="VARCHAR"/>
|
||||
<result property="shname" column="shname" jdbcType="VARCHAR"/>
|
||||
<result property="kpcode" column="kpcode" jdbcType="VARCHAR"/>
|
||||
<result property="kpname" column="kpname" jdbcType="VARCHAR"/>
|
||||
<result property="busicode" column="busicode" jdbcType="VARCHAR"/>
|
||||
<result property="businame" column="businame" jdbcType="VARCHAR"/>
|
||||
<result property="vnote" column="vnote" jdbcType="VARCHAR"/>
|
||||
<result property="csaleId" column="csaleid" jdbcType="VARCHAR"/>
|
||||
<result property="unitcode" column="unitcode" jdbcType="VARCHAR"/>
|
||||
<result property="unitname" column="unitname" jdbcType="VARCHAR"/>
|
||||
<result property="billCode" column="bill_code" jdbcType="VARCHAR"/>
|
||||
|
||||
</resultMap>
|
||||
<!-- 查询的字段-->
|
||||
|
||||
<!-- 分页查询列表 采用like格式 -->
|
||||
<select id="querySaleMain" resultType="com.hzya.frame.u8c.sosale.entity.SoSaleEntity" parameterType = "com.hzya.frame.u8c.sosale.entity.SoSaleEntity">
|
||||
select
|
||||
corp.unitcode,
|
||||
corp.unitname,
|
||||
csaleid,-- 单据编号
|
||||
vreceiptcode as bill_code,-- 单据编号
|
||||
sm_user.user_code, -- 审核人编码
|
||||
sm_user.user_name, -- 审核人名称
|
||||
dapprovedate, -- 审核日期
|
||||
cubas.custcode,-- 客户编码
|
||||
cubas.custname,-- 客户名称
|
||||
vsalestrucode,-- 销售组织编码
|
||||
vsalestruname,-- 销售组织名称
|
||||
calbody.bodycode, -- 库存组织编码
|
||||
calbody.bodyname, -- 库存组织名称
|
||||
creceiptcustomerid ,-- 收货单位
|
||||
cubas1.custcode as shcode,-- 收货单位编码
|
||||
cubas1.custname as shname,-- 收货单位名称
|
||||
creceiptcorpid ,-- 开票单位
|
||||
cubas2.custcode as kpcode,-- 开票单位编码
|
||||
cubas2.custname as kpname,-- 开票单位名称
|
||||
ctransmodeid,-- 运输方式
|
||||
busicode,--业务类型编码
|
||||
businame,--业务类型名称
|
||||
main.vnote-- 备注
|
||||
|
||||
from so_sale main
|
||||
left join sm_user sm_user on main.capproveid = sm_user.cuserid
|
||||
left join bd_cumandoc bd_cum on main.ccustomerid = bd_cum.pk_cumandoc
|
||||
left join bd_cubasdoc cubas on bd_cum.pk_cubasdoc = cubas.pk_cubasdoc
|
||||
left join bd_salestru bd_salees on main.csalecorpid = bd_salees.csalestruid
|
||||
left join bd_calbody calbody on main.ccalbodyid = calbody.pk_calbody
|
||||
left join bd_busitype busi on cbiztype = busi.pk_busitype
|
||||
|
||||
left join bd_cumandoc bd_cum1 on main.creceiptcustomerid = bd_cum1.pk_cumandoc
|
||||
left join bd_cubasdoc cubas1 on bd_cum1.pk_cubasdoc = cubas1.pk_cubasdoc
|
||||
|
||||
left join bd_cumandoc bd_cum2 on main.creceiptcorpid = bd_cum2.pk_cumandoc
|
||||
left join bd_cubasdoc cubas2 on bd_cum2.pk_cubasdoc = cubas2.pk_cubasdoc
|
||||
left join bd_corp corp on corp.pk_corp = main.pk_corp
|
||||
where vdef1 is null
|
||||
and capproveid is not null
|
||||
<if test="csaleId!=null and csaleId!=''"> and csaleid = #{csaleId} </if>
|
||||
</select>
|
||||
<update id="updateState" parameterType="com.hzya.frame.u8c.sosale.entity.SoSaleEntity">
|
||||
update so_sale set
|
||||
vdef1 = #{state}
|
||||
where csaleid = #{csaleId}
|
||||
</update>
|
||||
</mapper>
|
||||
|
|
@ -0,0 +1,143 @@
|
|||
package com.hzya.frame.u8c.sosale.entity;
|
||||
|
||||
|
||||
import com.hzya.frame.web.entity.BaseEntity;
|
||||
|
||||
public class SoSaleLineEntity extends BaseEntity {
|
||||
private String csaleId;//销售订单主表ID
|
||||
private String cinvbasdocid;
|
||||
private String invcode;
|
||||
private String invname;
|
||||
private String invspec;
|
||||
private String invtype;
|
||||
private String measname ;
|
||||
private String nnumber;// 数量
|
||||
private String noriginalcurprice;// 无税单价
|
||||
private String ntaxrate; // 税率
|
||||
private String noriginalcurtaxprice; // 含税单价
|
||||
private String noriginalcurmny; // 无税金额
|
||||
private String noriginalcursummny; // 价税合计
|
||||
private String blargessflag; // 是否赠品
|
||||
private String frownote;
|
||||
|
||||
public String getCinvbasdocid() {
|
||||
return cinvbasdocid;
|
||||
}
|
||||
|
||||
public void setCinvbasdocid(String cinvbasdocid) {
|
||||
this.cinvbasdocid = cinvbasdocid;
|
||||
}
|
||||
|
||||
public String getInvcode() {
|
||||
return invcode;
|
||||
}
|
||||
|
||||
public void setInvcode(String invcode) {
|
||||
this.invcode = invcode;
|
||||
}
|
||||
|
||||
public String getInvname() {
|
||||
return invname;
|
||||
}
|
||||
|
||||
public void setInvname(String invname) {
|
||||
this.invname = invname;
|
||||
}
|
||||
|
||||
public String getInvspec() {
|
||||
return invspec;
|
||||
}
|
||||
|
||||
public void setInvspec(String invspec) {
|
||||
this.invspec = invspec;
|
||||
}
|
||||
|
||||
public String getInvtype() {
|
||||
return invtype;
|
||||
}
|
||||
|
||||
public void setInvtype(String invtype) {
|
||||
this.invtype = invtype;
|
||||
}
|
||||
|
||||
public String getMeasname() {
|
||||
return measname;
|
||||
}
|
||||
|
||||
public void setMeasname(String measname) {
|
||||
this.measname = measname;
|
||||
}
|
||||
|
||||
public String getNnumber() {
|
||||
return nnumber;
|
||||
}
|
||||
|
||||
public void setNnumber(String nnumber) {
|
||||
this.nnumber = nnumber;
|
||||
}
|
||||
|
||||
public String getNoriginalcurprice() {
|
||||
return noriginalcurprice;
|
||||
}
|
||||
|
||||
public void setNoriginalcurprice(String noriginalcurprice) {
|
||||
this.noriginalcurprice = noriginalcurprice;
|
||||
}
|
||||
|
||||
public String getNtaxrate() {
|
||||
return ntaxrate;
|
||||
}
|
||||
|
||||
public void setNtaxrate(String ntaxrate) {
|
||||
this.ntaxrate = ntaxrate;
|
||||
}
|
||||
|
||||
public String getNoriginalcurtaxprice() {
|
||||
return noriginalcurtaxprice;
|
||||
}
|
||||
|
||||
public void setNoriginalcurtaxprice(String noriginalcurtaxprice) {
|
||||
this.noriginalcurtaxprice = noriginalcurtaxprice;
|
||||
}
|
||||
|
||||
public String getNoriginalcurmny() {
|
||||
return noriginalcurmny;
|
||||
}
|
||||
|
||||
public void setNoriginalcurmny(String noriginalcurmny) {
|
||||
this.noriginalcurmny = noriginalcurmny;
|
||||
}
|
||||
|
||||
public String getNoriginalcursummny() {
|
||||
return noriginalcursummny;
|
||||
}
|
||||
|
||||
public void setNoriginalcursummny(String noriginalcursummny) {
|
||||
this.noriginalcursummny = noriginalcursummny;
|
||||
}
|
||||
|
||||
public String getBlargessflag() {
|
||||
return blargessflag;
|
||||
}
|
||||
|
||||
public void setBlargessflag(String blargessflag) {
|
||||
this.blargessflag = blargessflag;
|
||||
}
|
||||
|
||||
public String getFrownote() {
|
||||
return frownote;
|
||||
}
|
||||
|
||||
public void setFrownote(String frownote) {
|
||||
this.frownote = frownote;
|
||||
}
|
||||
|
||||
public String getCsaleId() {
|
||||
return csaleId;
|
||||
}
|
||||
|
||||
public void setCsaleId(String csaleId) {
|
||||
this.csaleId = csaleId;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,53 @@
|
|||
<?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.u8c.sosale.dao.impl.SoSaleLineDaoImpl">
|
||||
|
||||
<resultMap id="get-SoSaleLineEntity-result" type="com.hzya.frame.u8c.sosale.entity.SoSaleLineEntity" >
|
||||
<result property="csaleid" column="csaleid" jdbcType="VARCHAR"/>
|
||||
<result property="cinvbasdocid" column="cinvbasdocid" jdbcType="VARCHAR"/>
|
||||
<result property="invcode" column="invcode" jdbcType="VARCHAR"/>
|
||||
<result property="invname" column="invname" jdbcType="VARCHAR"/>
|
||||
<result property="invspec" column="invspec" jdbcType="VARCHAR"/>
|
||||
<result property="invtype" column="invtype" jdbcType="VARCHAR"/>
|
||||
<result property="measname" column="measname" jdbcType="VARCHAR"/>
|
||||
<result property="nnumber" column="nnumber" jdbcType="VARCHAR"/>
|
||||
<result property="noriginalcurprice" column="noriginalcurprice" jdbcType="VARCHAR"/>
|
||||
<result property="ntaxrate" column="ntaxrate" jdbcType="VARCHAR"/>
|
||||
<result property="noriginalcurtaxprice" column="noriginalcurtaxprice" jdbcType="VARCHAR"/>
|
||||
<result property="noriginalcurmny" column="noriginalcurmny" jdbcType="VARCHAR"/>
|
||||
<result property="blargessflag" column="blargessflag" jdbcType="VARCHAR"/>
|
||||
<result property="frownote" column="frownote" jdbcType="VARCHAR"/>
|
||||
|
||||
|
||||
</resultMap>
|
||||
<!-- 查询的字段-->
|
||||
|
||||
<!-- 分页查询列表 采用like格式 -->
|
||||
<select id="querySaleLine" resultType="com.hzya.frame.u8c.sosale.entity.SoSaleLineEntity" parameterType = "com.hzya.frame.u8c.sosale.entity.SoSaleLineEntity">
|
||||
select
|
||||
csaleid,
|
||||
cinvbasdocid,
|
||||
basdoc.invcode,
|
||||
basdoc.invname,
|
||||
basdoc.invspec,
|
||||
basdoc.invtype,
|
||||
measdoc.measname ,
|
||||
nnumber,-- 数量
|
||||
noriginalcurprice,-- 无税单价
|
||||
ntaxrate, -- 税率
|
||||
noriginalcurtaxprice, -- 含税单价
|
||||
noriginalcurmny, -- 无税金额
|
||||
noriginalcursummny, -- 价税合计
|
||||
case
|
||||
when blargessflag ='N' then '否'
|
||||
when blargessflag ='Y' then '是'
|
||||
else blargessflag end as blargessflag, -- 是否赠品
|
||||
frownote
|
||||
from so_saleorder_b order_b
|
||||
left join bd_invbasdoc basdoc on order_b.cinvbasdocid = basdoc.pk_invbasdoc
|
||||
left join bd_measdoc measdoc on measdoc.pk_measdoc = basdoc.pk_measdoc
|
||||
<if test="csaleId!=null and csaleId!=''"> where csaleid = #{csaleId} </if>
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
|
|
@ -0,0 +1,22 @@
|
|||
package com.hzya.frame.u8c.sosale.service;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.hzya.frame.basedao.service.IBaseService;
|
||||
import com.hzya.frame.u8c.sosale.entity.SoSaleEntity;
|
||||
import com.hzya.frame.web.entity.JsonResultEntity;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface ISoSaleService extends IBaseService<SoSaleEntity, String> {
|
||||
|
||||
/**
|
||||
*
|
||||
* @content 获取U8C销售订单同步OA销售合同
|
||||
* @className: Administrator
|
||||
* @author laborer
|
||||
* @date 2024-10-16 15:22
|
||||
*
|
||||
*/
|
||||
|
||||
JsonResultEntity getU8cSaleToOa(JSONObject requestJson);
|
||||
}
|
|
@ -0,0 +1,328 @@
|
|||
package com.hzya.frame.u8c.sosale.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.basedao.service.impl.BaseService;
|
||||
import com.hzya.frame.bip.v3.v2207.util.BipUtil;
|
||||
import com.hzya.frame.seeyon.util.RestUtil;
|
||||
import com.hzya.frame.sysnew.integtationTaskLivingDetails.entity.IntegrationTaskLivingDetailsEntity;
|
||||
import com.hzya.frame.sysnew.integtationTaskLivingDetails.service.IIntegrationTaskLivingDetailsService;
|
||||
import com.hzya.frame.u8c.sosale.dao.ISoSaleDao;
|
||||
import com.hzya.frame.u8c.sosale.dao.ISoSaleLineDao;
|
||||
import com.hzya.frame.u8c.sosale.entity.SoSaleEntity;
|
||||
import com.hzya.frame.u8c.sosale.entity.SoSaleLineEntity;
|
||||
import com.hzya.frame.u8c.sosale.service.ISoSaleService;
|
||||
import com.hzya.frame.web.entity.JsonResultEntity;
|
||||
import org.apache.commons.collections.CollectionUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
@Service(value = "SoSaleServiceImpl")
|
||||
public class SoSaleServiceImpl extends BaseService<SoSaleEntity, String> implements ISoSaleService {
|
||||
Logger logger = LoggerFactory.getLogger(SoSaleServiceImpl.class);
|
||||
@Autowired
|
||||
private ISoSaleDao u8cSaleDao;
|
||||
@Autowired
|
||||
private ISoSaleLineDao saleLineDao;
|
||||
@Autowired
|
||||
private IIntegrationTaskLivingDetailsService taskLivingDetailsService;
|
||||
|
||||
/**
|
||||
*
|
||||
* @content 获取U8C销售订单同步OA销售合同
|
||||
* @className: Administrator
|
||||
* @author laborer
|
||||
* @date 2024-10-16 15:22
|
||||
*
|
||||
*/
|
||||
@Override
|
||||
public JsonResultEntity getU8cSaleToOa(JSONObject requestJson) {
|
||||
|
||||
//获取重推信息id,并记录日志
|
||||
JSONObject requestJsonObj = JSON.parseObject(requestJson.toString(),JSONObject.class);
|
||||
String interId = requestJsonObj.getString("integration_task_living_details_id");
|
||||
logger.info("U8C销售订单推送OA重推解析后:"+requestJsonObj.toString());
|
||||
logger.info("U8C销售订单推送OA重新执行的任务主键:"+interId);
|
||||
|
||||
//更换数据源
|
||||
JsonResultEntity resultEntity = new JsonResultEntity();
|
||||
SoSaleEntity entity = new SoSaleEntity();
|
||||
requestJson.put("db_code","dongjinU8C");
|
||||
entity.setDataSourceCode(requestJson.getString("db_code"));
|
||||
|
||||
//根据重推信息id,查询该条重推记录信息
|
||||
IntegrationTaskLivingDetailsEntity oldMsg = new IntegrationTaskLivingDetailsEntity();
|
||||
if(StrUtil.isNotEmpty(interId)){
|
||||
oldMsg = taskLivingDetailsService.get(interId);
|
||||
}
|
||||
String rootAppPk = oldMsg.getRootAppPk();
|
||||
entity.setId(rootAppPk);
|
||||
StrUtil.isEmpty(rootAppPk);//entity.setQueryState("查询");
|
||||
//如果是重推,是否通过entity传入的id,只能查到一条数据。
|
||||
//entity.setId("-8845102890648320822");
|
||||
List<SoSaleEntity> soleList = u8cSaleDao.getU8cSale(entity);
|
||||
logger.info("销售订单查询数据{}",JSONObject.toJSONString(soleList));
|
||||
if(CollectionUtils.isNotEmpty(soleList)){
|
||||
soleList.forEach(sale -> {
|
||||
try{
|
||||
//获取明细数据进行拼接
|
||||
String csaleId = sale.getCsaleId();
|
||||
if(!StrUtil.isEmpty(csaleId)){
|
||||
SoSaleLineEntity line = new SoSaleLineEntity();
|
||||
line.setCsaleId(csaleId);
|
||||
line.setDataSourceCode(requestJson.getString("db_code"));
|
||||
List<SoSaleLineEntity> lineList = saleLineDao.getU8cSaleLine(line);
|
||||
logger.info("销售订单明细查询数据{}",JSONObject.toJSONString(lineList));
|
||||
sale.setSaleLineList(lineList);
|
||||
logger.info("组装数据");
|
||||
JSONObject main = bindingAdd(sale);
|
||||
logger.info("销售订单推送数据:"+main.toString());
|
||||
String result = RestUtil.sendU8CToOA(main.toString(),"8000340003",sale.getUser_code());
|
||||
logger.info("销售订单推送结果:"+result);
|
||||
IntegrationTaskLivingDetailsEntity logDetails = new IntegrationTaskLivingDetailsEntity();
|
||||
logDetails.setRootAppPk(sale.getCsaleId());
|
||||
logDetails.setRootAppBill(sale.getBillCode());
|
||||
logDetails.setNewTransmitInfo(result);
|
||||
logDetails.setNewPushDate(new Date());
|
||||
logDetails.setRootAppNewData(JSON.toJSONString(sale));
|
||||
logDetails.setPluginId("SaleConPlugin");
|
||||
|
||||
JSONObject resultObj = JSON.parseObject(result);
|
||||
boolean flag = resultObj.getString("code").equals("0");
|
||||
if(flag){
|
||||
// 推送成功,更新状态
|
||||
sale.setState("Y");
|
||||
}else{
|
||||
// 推送失败
|
||||
sale.setState("N");
|
||||
}
|
||||
sale.setDataSourceCode(requestJson.getString("db_code"));
|
||||
try{
|
||||
if(StrUtil.isEmpty(interId)){
|
||||
if(flag){
|
||||
//首推成功
|
||||
taskLivingDetailsService.saveLogToSuccess(logDetails);
|
||||
}else{
|
||||
//首推失败
|
||||
taskLivingDetailsService.saveLogToFail(logDetails);
|
||||
}
|
||||
}else{
|
||||
logDetails.setId(interId);
|
||||
if(flag){
|
||||
//重推成功
|
||||
taskLivingDetailsService.saveLogFailToSuccess(logDetails);
|
||||
}else{
|
||||
//重推失败,把失败信息,更新到重推表中
|
||||
taskLivingDetailsService.updateLogFailToSuccess(logDetails);
|
||||
}
|
||||
}
|
||||
}catch (Exception e){
|
||||
logger.info("保存日志失败"+e.getMessage());
|
||||
u8cSaleDao.updateState(sale);
|
||||
e.printStackTrace();
|
||||
}
|
||||
u8cSaleDao.updateState(sale);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
logger.info("销售订单执行失败"+e.getMessage());
|
||||
e.printStackTrace();
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
return new JsonResultEntity("成功",true,resultEntity);
|
||||
}
|
||||
/**
|
||||
*
|
||||
* @content 组装销售订单数据
|
||||
* @className: Administrator
|
||||
* @author laborer
|
||||
* @date 2024-10-16 15:34
|
||||
*
|
||||
*/
|
||||
|
||||
private JSONObject bindingAdd(SoSaleEntity rec) {
|
||||
JSONObject main = new JSONObject();
|
||||
main.put("formCode","formmain_0047");
|
||||
// main.put("loginName",rec.getUser_code());
|
||||
main.put("loginName","yuqh");
|
||||
main.put("rightId","-8974880151631871438.3094438342688065626");
|
||||
JSONArray dataList = new JSONArray();
|
||||
JSONObject dataListObj = new JSONObject();
|
||||
|
||||
JSONObject masterTable = new JSONObject();
|
||||
JSONArray subTables = new JSONArray();
|
||||
dataListObj.put("masterTable", masterTable);
|
||||
masterTable.put("name","formmain_0047");
|
||||
JSONObject record = new JSONObject();
|
||||
record.put("id","-4921737319255610298");
|
||||
JSONArray fields = new JSONArray();
|
||||
JSONObject field0001 = new JSONObject();//单据号
|
||||
field0001.put("showValue",rec.getBillCode());
|
||||
field0001.put("name","field0001");
|
||||
field0001.put("value",rec.getBillCode());
|
||||
fields.add(field0001);
|
||||
|
||||
JSONObject field0004 = new JSONObject();//单据日期
|
||||
field0004.put("showValue",rec.getDapprovedate());
|
||||
field0004.put("name","field0004");
|
||||
field0004.put("value",rec.getDapprovedate());
|
||||
fields.add(field0004);
|
||||
|
||||
JSONObject field0033 = new JSONObject();//合同编号
|
||||
field0033.put("showValue",rec.getBillCode());
|
||||
field0033.put("name","field0033");
|
||||
field0033.put("value",rec.getBillCode());
|
||||
fields.add(field0033);
|
||||
|
||||
JSONObject field0014 = new JSONObject();//客户名称
|
||||
field0014.put("showValue",rec.getCustname());
|
||||
field0014.put("name","field0014");
|
||||
field0014.put("value",rec.getBillCode());
|
||||
fields.add(field0014);
|
||||
|
||||
JSONObject field0045 = new JSONObject();//客户编码
|
||||
field0045.put("showValue",rec.getCustcode());
|
||||
field0045.put("name","field0045");
|
||||
field0045.put("value",rec.getCustcode());
|
||||
fields.add(field0045);
|
||||
|
||||
JSONObject field0005 = new JSONObject();//销售组织
|
||||
field0005.put("showValue",rec.getVsalestruname());
|
||||
field0005.put("name","field0005");
|
||||
field0005.put("value",rec.getBillCode());
|
||||
fields.add(field0005);
|
||||
|
||||
JSONObject field0006 = new JSONObject();//库存组织
|
||||
field0006.put("showValue",rec.getBodyname());
|
||||
field0006.put("name","field0006");
|
||||
field0006.put("value",rec.getBodyname());
|
||||
fields.add(field0006);
|
||||
|
||||
JSONObject field0007 = new JSONObject();//收货单位
|
||||
field0007.put("showValue",rec.getShname());
|
||||
field0007.put("name","field0007");
|
||||
field0007.put("value",rec.getShname());
|
||||
fields.add(field0007);
|
||||
|
||||
JSONObject field0009 = new JSONObject();//开票单位
|
||||
field0009.put("showValue",rec.getKpname());
|
||||
field0009.put("name","field0009");
|
||||
field0009.put("value",rec.getKpname());
|
||||
fields.add(field0009);
|
||||
|
||||
JSONObject field0013 = new JSONObject();//业务流程
|
||||
field0013.put("showValue",rec.getBusiname());
|
||||
field0013.put("name","field0013");
|
||||
field0013.put("value",rec.getBusiname());
|
||||
fields.add(field0013);
|
||||
|
||||
JSONObject field0018 = new JSONObject();//备注
|
||||
field0018.put("showValue",rec.getVnote());
|
||||
field0018.put("name","field0018");
|
||||
field0018.put("value",rec.getVnote());
|
||||
fields.add(field0018);
|
||||
|
||||
record.put("fields",fields);
|
||||
masterTable.put("record",record);
|
||||
if(CollectionUtils.isNotEmpty(rec.getSaleLineList())){
|
||||
rec.getSaleLineList().forEach(line->{
|
||||
JSONObject subTablesObj = new JSONObject();
|
||||
JSONArray records = new JSONArray();
|
||||
|
||||
JSONObject field0020 = new JSONObject();//存货编号
|
||||
field0020.put("showValue",line.getInvcode());
|
||||
field0020.put("name","field0020");
|
||||
field0020.put("value",line.getInvcode());
|
||||
records.add(field0020);
|
||||
|
||||
JSONObject field0021 = new JSONObject();//存货名称
|
||||
field0021.put("showValue",line.getInvname());
|
||||
field0021.put("name","field0021");
|
||||
field0021.put("value",line.getInvname());
|
||||
records.add(field0021);
|
||||
|
||||
|
||||
JSONObject field0022 = new JSONObject();//规格
|
||||
field0022.put("showValue",line.getInvspec());
|
||||
field0022.put("name","field0022");
|
||||
field0022.put("value",line.getInvspec());
|
||||
records.add(field0022);
|
||||
|
||||
JSONObject field0023 = new JSONObject();//型号
|
||||
field0023.put("showValue",line.getInvtype());
|
||||
field0023.put("name","field0023");
|
||||
field0023.put("value",line.getInvtype());
|
||||
records.add(field0023);
|
||||
|
||||
JSONObject field0024 = new JSONObject();//单位
|
||||
field0024.put("showValue",line.getMeasname());
|
||||
field0024.put("name","field0024");
|
||||
field0024.put("value",line.getMeasname());
|
||||
records.add(field0024);
|
||||
|
||||
JSONObject field0025 = new JSONObject();//数量
|
||||
field0025.put("showValue",line.getNnumber());
|
||||
field0025.put("name","field0025");
|
||||
field0025.put("value",line.getNnumber());
|
||||
records.add(field0025);
|
||||
|
||||
JSONObject field0026 = new JSONObject();//无税单价
|
||||
field0026.put("showValue",line.getNoriginalcurprice());
|
||||
field0026.put("name","field0026");
|
||||
field0026.put("value",line.getNoriginalcurprice());
|
||||
records.add(field0026);
|
||||
|
||||
JSONObject field0027 = new JSONObject();//税率
|
||||
field0027.put("showValue",line.getNtaxrate());
|
||||
field0027.put("name","field0027");
|
||||
field0027.put("value",line.getNtaxrate());
|
||||
records.add(field0027);
|
||||
|
||||
JSONObject field0028 = new JSONObject();//含税单价
|
||||
field0028.put("showValue",line.getNoriginalcurtaxprice());
|
||||
field0028.put("name","field0028");
|
||||
field0028.put("value",line.getNoriginalcurtaxprice());
|
||||
records.add(field0028);
|
||||
|
||||
JSONObject field0029 = new JSONObject();//无税金额
|
||||
field0029.put("showValue",line.getNoriginalcurmny());
|
||||
field0029.put("name","field0029");
|
||||
field0029.put("value",line.getNoriginalcurmny());
|
||||
records.add(field0029);
|
||||
|
||||
JSONObject field0030 = new JSONObject();//价税合计
|
||||
field0030.put("showValue",line.getNoriginalcursummny());
|
||||
field0030.put("name","field0030");
|
||||
field0030.put("value",line.getNoriginalcursummny());
|
||||
records.add(field0030);
|
||||
|
||||
JSONObject field0031 = new JSONObject();//是否赠品
|
||||
field0031.put("showValue",line.getBlargessflag());
|
||||
field0031.put("name","field0031");
|
||||
field0031.put("value",line.getBlargessflag());
|
||||
records.add(field0031);
|
||||
|
||||
JSONObject field0032 = new JSONObject();//合同编号
|
||||
field0032.put("showValue",line.getFrownote());
|
||||
field0032.put("name","field0032");
|
||||
field0032.put("value",line.getFrownote());
|
||||
records.add(field0032);
|
||||
subTablesObj.put("name","formson_0048");
|
||||
subTablesObj.put("records",records);
|
||||
subTables.add(subTablesObj);
|
||||
});
|
||||
}
|
||||
dataListObj.put("subTables", subTables);
|
||||
dataList.add(dataListObj);
|
||||
main.put("dataList",dataList);
|
||||
return main;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue