Commit d096d603 authored by 赵汉亭's avatar 赵汉亭

成本中心、固定资产JSON完成

parent d471cbf0
package com.huigou.topsun.sap.costCenter.application.impl;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.huigou.cache.DictUtil;
import com.huigou.context.Operator;
import com.huigou.data.query.model.QueryDescriptor;
import com.huigou.data.query.model.QueryModel;
import com.huigou.topsun.sap.costCenter.application.CostCenterApplication;
import com.huigou.topsun.sap.costCenter.domain.CostCenter;
import com.huigou.topsun.sap.costCenter.domain.query.CostCenterQueryRequest;
import com.huigou.topsun.sap.costCenter.domain.vo.CostCenterReturnVo;
import com.huigou.topsun.sap.costCenter.domain.vo.CostCenterVo;
import com.huigou.topsun.sap.costCenter.repository.CostCenterRepository;
import com.huigou.uasp.bmp.common.BizBillStatus;
......@@ -13,6 +17,7 @@ import com.huigou.uasp.bpm.FlowBroker;
import com.huigou.util.ClassHelper;
import org.activiti.engine.delegate.DelegateExecution;
import org.activiti.engine.delegate.DelegateTask;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
......@@ -84,6 +89,26 @@ public class CostCenterApplicationImpl extends FlowBroker implements CostCenterA
CostCenter costCenter = costCenterRepository.findOne(bizId);
costCenter.setStatusId(status.getId());
costCenterRepository.save(costCenter);
// 封装JSON数据
String returnJSON = getReturnVo(costCenter);
}
/**
* 封装返回JSON
*/
private String getReturnVo(CostCenter costCenter) {
CostCenterReturnVo costCenterReturnVo = new CostCenterReturnVo();
BeanUtils.copyProperties(costCenter, costCenterReturnVo);
// 转换为JSON
ObjectMapper objectMapper = new ObjectMapper();
String returnJson = null;
try {
returnJson = objectMapper.writeValueAsString(costCenterReturnVo);
} catch (JsonProcessingException e) {
throw new RuntimeException(e);
}
return returnJson;
}
@Override
......@@ -115,8 +140,9 @@ public class CostCenterApplicationImpl extends FlowBroker implements CostCenterA
protected String saveBizAndApprovalData() {
super.saveBizAndApprovalData();
CostCenter costCenter = getBizEntity(CostCenter.class);
if (costCenter.isNew()) {
Operator operator = this.getOperator();
BeanUtils.copyProperties(operator, costCenter);
costCenter.setStatusId(BizBillStatus.APPLYING.getId());
} else {
costCenter = (CostCenter) commonDomainService.loadAndFillinProperties(costCenter);
......
......@@ -7,6 +7,7 @@ import lombok.Data;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import java.math.BigDecimal;
import java.util.Date;
/**
......@@ -89,6 +90,40 @@ public class CostCenter extends FlowBillAbstractEntity {
@Column(name = "reason")
private String reason;
/**
* 联系方式
*/
@Column(name = "tele_phone")
private String telePhone;
/**
* ********************************返回接收数据***********************************
*/
/**
* 消息类型: S 成功,E 错误,W 警告,I 信息,A 中断
*/
@Column(name = "TYPE")
private String TYPE;
/**
* 消息类__ID
*/
@Column(name = "message_id")
private String messageId;
/**
* 消息编号
*/
@Column(name = "NUMBER")
private BigDecimal NUMBER;
/**
* 消息文本
*/
@Column(name = "MESSAGE")
private String MESSAGE;
/**
* 应用程序日志,日志号
*/
@Column(name = "LOG_NO")
private String LOG_NO;
@Override
protected String getCodeRuleId() {
return "sapCostCenter";
......
package com.huigou.topsun.sap.costCenter.domain.query;
import com.huigou.data.domain.query.QueryAbstractRequest;
import com.topsunit.query.annotations.Dictionary;
import lombok.Data;
import javax.persistence.Column;
import java.util.Date;
/**
......@@ -100,4 +98,6 @@ public class CostCenterQueryRequest extends QueryAbstractRequest {
private String personMemberId;
private String personMemberName;
private String telePhone;
}
{
"KOSTL": "1",
"DATAB": "2023.12.28",
"DATBI": "2023.12.31",
"KTEXT": "1",
"LTEXT": "1",
"VERAK": "1",
"KOSAR": "E",
"PRCTR": "10001001",
"formType": "add",
"reason": "1",
"fillinDate": 1703821440000,
"deptName": "测试使用部门",
"personMemberName": "系统管理员",
"telePhone": "1"
}
\ No newline at end of file
package com.huigou.topsun.sap.costCenter.domain.vo;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.io.Serializable;
import java.util.Date;
/**
* title:
* author:ZHT
* date:2023/12/29
* description:
*/
@JsonIgnoreProperties
public class CostCenterReturnVo implements Serializable {
/**
* 成本中心编码
*/
@JsonProperty("KOSTL")
private String kostl;
/**
* 有效期自 默认当年1月1日
*/
@JsonProperty("DATAB")
@JsonFormat(pattern = "yyyy.MM.dd", timezone = "GTM-8")
private Date datab;
/**
* 有效截至日 默认9999.12.31
*/
@JsonProperty("DATBI")
@JsonFormat(pattern = "yyyy.MM.dd", timezone = "GTM-8")
private Date datbi;
/**
* 名称
*/
@JsonProperty("KTEXT")
private String ktext;
/**
* 描述
*/
@JsonProperty("LTEXT")
private String ltext;
/**
* 负责人
*/
@JsonProperty("VERAK")
private String verak;
/**
* 成本中心类型
* 管理类 L
* 销售类 V
* 研发类 E
* 间接生产类 G
* 直接生产类 F
*/
@JsonProperty("KOSAR")
private String kosar;
/**
* 利润中心
* 10001000 广州宝绅科技利润中心
* 10001001 广州宝绅RFID利润中心
*/
@JsonProperty("PRCTR")
private String prctr;
/**
* 业务类型
*/
@JsonProperty("formType")
private String formType;
/**
* 创建原因 CHAR 100 手工输入
*/
@JsonProperty("reason")
private String reason;
@JsonProperty("fillinDate")
private Date fillinDate;
@JsonProperty("deptName")
private String deptName;
@JsonProperty("personMemberName")
private String personMemberName;
@JsonProperty("telePhone")
private String telePhone;
public String getKostl() {
return kostl;
}
public void setKostl(String kostl) {
this.kostl = kostl;
}
public Date getDatab() {
return datab;
}
public void setDatab(Date datab) {
this.datab = datab;
}
public Date getDatbi() {
return datbi;
}
public void setDatbi(Date datbi) {
this.datbi = datbi;
}
public String getKtext() {
return ktext;
}
public void setKtext(String ktext) {
this.ktext = ktext;
}
public String getLtext() {
return ltext;
}
public void setLtext(String ltext) {
this.ltext = ltext;
}
public String getVerak() {
return verak;
}
public void setVerak(String verak) {
this.verak = verak;
}
public String getKosar() {
return kosar;
}
public void setKosar(String kosar) {
this.kosar = kosar;
}
public String getPrctr() {
return prctr;
}
public void setPrctr(String prctr) {
this.prctr = prctr;
}
public String getFormType() {
return formType;
}
public void setFormType(String formType) {
this.formType = formType;
}
public String getReason() {
return reason;
}
public void setReason(String reason) {
this.reason = reason;
}
public Date getFillinDate() {
return fillinDate;
}
public void setFillinDate(Date fillinDate) {
this.fillinDate = fillinDate;
}
public String getDeptName() {
return deptName;
}
public void setDeptName(String deptName) {
this.deptName = deptName;
}
public String getPersonMemberName() {
return personMemberName;
}
public void setPersonMemberName(String personMemberName) {
this.personMemberName = personMemberName;
}
public String getTelePhone() {
return telePhone;
}
public void setTelePhone(String telePhone) {
this.telePhone = telePhone;
}
}
......@@ -105,6 +105,8 @@ public class CostCenterVo implements Serializable {
private String personMemberName;
private String telePhone;
public static CostCenterVo getCostCenterVo(CostCenter costCenter) {
return JSON.parseObject(JSON.toJSONString(costCenter), CostCenterVo.class);
}
......
package com.huigou.topsun.sap.fixedAssets.application.impl;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.huigou.context.Operator;
import com.huigou.data.query.model.QueryDescriptor;
import com.huigou.data.query.model.QueryModel;
import com.huigou.topsun.demo.domain.model.Leave;
import com.huigou.topsun.sap.fixedAssets.application.SapFixedAssetsApplication;
import com.huigou.topsun.sap.fixedAssets.domain.SapFixedAssets;
import com.huigou.topsun.sap.fixedAssets.domain.query.SapFixedAssetsQueryRequest;
import com.huigou.topsun.sap.fixedAssets.domain.vo.SapFixedAssetsReturnVo;
import com.huigou.topsun.sap.fixedAssets.domain.vo.SapFixedAssetsVo;
import com.huigou.topsun.sap.fixedAssets.repository.SapFixedAssetsRepository;
import com.huigou.uasp.bmp.common.BizBillStatus;
......@@ -15,12 +17,15 @@ import com.huigou.util.ClassHelper;
import com.huigou.util.StringUtil;
import org.activiti.engine.delegate.DelegateExecution;
import org.activiti.engine.delegate.DelegateTask;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.net.SocketTimeoutException;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.concurrent.locks.ReentrantReadWriteLock;
/**
* @Auther: xin.lu
......@@ -63,19 +68,8 @@ public class SapFixedAssetsApplicationImpl extends FlowBroker implements SapFixe
} else {
// 新增
// 封装填报时间
long timestamp = System.currentTimeMillis();
sapFixedAssets.setFillinDate(new Date(timestamp));
// 封装人员信息
sapFixedAssets.setFullId(operator.getFullId());
sapFixedAssets.setOrganId(operator.getOrgId());
sapFixedAssets.setOrganName(operator.getOrgName());
sapFixedAssets.setDeptId(operator.getDeptId());
sapFixedAssets.setDeptName(operator.getDeptName());
sapFixedAssets.setPositionId(operator.getPositionId());
sapFixedAssets.setPositionName(operator.getPositionName());
sapFixedAssets.setPersonMemberId(operator.getPersonMemberId());
sapFixedAssets.setPersonMemberName(operator.getPersonMemberName());
sapFixedAssets.setStatusId(BizBillStatus.APPLYING.getId());
BeanUtils.copyProperties(operator,sapFixedAssets);
// sapFixedAssets.setStatusId(BizBillStatus.APPLYING.getId());
sapFixedAssets.setZflg(1);
sapFixedAssets = sapFixedAssetsRepository.saveAndFlush(sapFixedAssets);
}
......@@ -90,6 +84,26 @@ public class SapFixedAssetsApplicationImpl extends FlowBroker implements SapFixe
SapFixedAssets fixedAssets = sapFixedAssetsRepository.findOne(bizId);
fixedAssets.setStatusId(status.getId());
sapFixedAssetsRepository.save(fixedAssets);
// 封装返回数据
String returnJSON = getReturnVo(fixedAssets);
}
/**
* 封装返回JSON
*/
private String getReturnVo(SapFixedAssets fixedAssets) {
SapFixedAssetsReturnVo sapFixedAssetsReturnVo = new SapFixedAssetsReturnVo();
BeanUtils.copyProperties(fixedAssets, sapFixedAssetsReturnVo);
// 转JSON
ObjectMapper objectMapper = new ObjectMapper();
String returnJson = null;
try {
returnJson = objectMapper.writeValueAsString(sapFixedAssetsReturnVo);
} catch (JsonProcessingException e) {
throw new RuntimeException(e);
}
return returnJson;
}
@Override
......@@ -121,11 +135,15 @@ public class SapFixedAssetsApplicationImpl extends FlowBroker implements SapFixe
protected String saveBizAndApprovalData() {
super.saveBizAndApprovalData();
SapFixedAssets sapFixedAssets = getBizEntity(SapFixedAssets.class);
Operator operator = this.getOperator();
if (sapFixedAssets.isNew()) {
sapFixedAssets.setStatusId(BizBillStatus.APPLYING.getId());
sapFixedAssets.setZflg(1);
BeanUtils.copyProperties(operator,sapFixedAssets);
sapFixedAssets.setZbpmn(sapFixedAssets.getBillCode());
} else {
sapFixedAssets = (SapFixedAssets) commonDomainService.loadAndFillinProperties(sapFixedAssets);
sapFixedAssets.setZflg(2);
sapFixedAssets = (SapFixedAssets) commonDomainService.loadAndFillinProperties(sapFixedAssets);
}
sapFixedAssets = sapFixedAssetsRepository.save(sapFixedAssets);
return sapFixedAssets.getId();
......
package com.huigou.topsun.sap.fixedAssets.domain;
import java.math.BigDecimal;
import javax.persistence.*;
import com.huigou.data.domain.model.FlowBillAbstractEntity;
import lombok.Data;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import java.math.BigDecimal;
/**
* SAP固定资产主数据
*
* @TableName sap_fixed_assets
*/
@Table(name="sap_fixed_assets")
@Table(name = "sap_fixed_assets")
@Entity
@Data
public class SapFixedAssets extends FlowBillAbstractEntity {
/**
* BPM单号
*/
@Column(name = "zbpmn")
private String zbpmn;
......@@ -30,7 +31,7 @@ public class SapFixedAssets extends FlowBillAbstractEntity {
/**
* 主资产号
;资产编号内部生成,当创建标识为2,即修改时,主资产号为必输。
* ;资产编号内部生成,当创建标识为2,即修改时,主资产号为必输。
*/
@Column(name = "anln1")
private String anln1;
......@@ -85,9 +86,148 @@ public class SapFixedAssets extends FlowBillAbstractEntity {
private String kostlv;
private static final long serialVersionUID = 1L;
/**
* ***********返回接收数据*****************
*/
/**
* 消息类型
*/
@Column(name = "MSGTY")
private String MSGTY;
/**
* 消息文本
*/
@Column(name = "MSGTX")
private String MSGTX;
@Override
protected String getCodeRuleId() {
return "sapFixedAssets";
}
public SapFixedAssets() {
}
public SapFixedAssets(String zbpmn, Integer zflg, String anln1, String anlkl, String bukrs, String txt50, String invnr, BigDecimal menge, String meins, String kostl, String kostlv) {
this.zbpmn = zbpmn;
this.zflg = zflg;
this.anln1 = anln1;
this.anlkl = anlkl;
this.bukrs = bukrs;
this.txt50 = txt50;
this.invnr = invnr;
this.menge = menge;
this.meins = meins;
this.kostl = kostl;
this.kostlv = kostlv;
}
public SapFixedAssets(String MSGTY, String MSGTX) {
this.MSGTY = MSGTY;
this.MSGTX = MSGTX;
}
public String getZbpmn() {
return zbpmn;
}
public void setZbpmn(String zbpmn) {
this.zbpmn = zbpmn;
}
public Integer getZflg() {
return zflg;
}
public void setZflg(Integer zflg) {
this.zflg = zflg;
}
public String getAnln1() {
return anln1;
}
public void setAnln1(String anln1) {
this.anln1 = anln1;
}
public String getAnlkl() {
return anlkl;
}
public void setAnlkl(String anlkl) {
this.anlkl = anlkl;
}
public String getBukrs() {
return bukrs;
}
public void setBukrs(String bukrs) {
this.bukrs = bukrs;
}
public String getTxt50() {
return txt50;
}
public void setTxt50(String txt50) {
this.txt50 = txt50;
}
public String getInvnr() {
return invnr;
}
public void setInvnr(String invnr) {
this.invnr = invnr;
}
public BigDecimal getMenge() {
return menge;
}
public void setMenge(BigDecimal menge) {
this.menge = menge;
}
public String getMeins() {
return meins;
}
public void setMeins(String meins) {
this.meins = meins;
}
public String getKostl() {
return kostl;
}
public void setKostl(String kostl) {
this.kostl = kostl;
}
public String getKostlv() {
return kostlv;
}
public void setKostlv(String kostlv) {
this.kostlv = kostlv;
}
public String getMSGTY() {
return MSGTY;
}
public void setMSGTY(String MSGTY) {
this.MSGTY = MSGTY;
}
public String getMSGTX() {
return MSGTX;
}
public void setMSGTX(String MSGTX) {
this.MSGTX = MSGTX;
}
}
\ No newline at end of file
{
"ZBPMN": null,
"ZFLG": null,
"ANLN1": "1",
"ANLKL": "1",
"BUKRS": "1",
"TXT50": "1",
"INVNR": "1",
"MENGE": 1,
"MEINS": "1",
"KOSTL": "666666",
"KOSTLV": "1"
}
\ No newline at end of file
package com.huigou.topsun.sap.fixedAssets.domain.vo;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.io.Serializable;
import java.math.BigDecimal;
/**
* title:
* author:ZHT
* date:2023/12/29
* description:
*/
@JsonIgnoreProperties
public class SapFixedAssetsReturnVo implements Serializable {
/**
* BPM单号
*/
@JsonProperty("ZBPMN")
private String zbpmn;
/**
* 创建标识
* 用于标识数据是新增或修改,1为新增,2为修改。(必填)
*/
@JsonProperty("ZFLG")
private Integer zflg;
/**
* 主资产号
* ;资产编号内部生成,当创建标识为2,即修改时,主资产号为必输。
*/
@JsonProperty(value = "ANLN1",required = true)
private String anln1;
/**
* 资产分类
* 当创建标识为1,即创建时,资产分类必输。
*/
@JsonProperty(value = "ANLKL",required = true)
private String anlkl;
/**
* 公司代码(必填)
*/
@JsonProperty("BUKRS")
private String bukrs;
/**
* 文本(必填)
*/
@JsonProperty("TXT50")
private String txt50;
/**
* 存货号;存放地点
*/
@JsonProperty(value = "INVNR",required = true)
private String invnr;
/**
* 数量
*/
@JsonProperty(value = "MENGE",required = true)
private BigDecimal menge;
/**
* 基本计量单位
*/
@JsonProperty(value = "MEINS",required = true)
private String meins;
/**
* 成本中心(必填)
*/
@JsonProperty("KOSTL")
private String kostl;
/**
* 责任成本中心
*/
@JsonProperty(value = "KOSTLV",required = true)
private String kostlv;
public String getZbpmn() {
return zbpmn;
}
public void setZbpmn(String zbpmn) {
this.zbpmn = zbpmn;
}
public Integer getZflg() {
return zflg;
}
public void setZflg(Integer zflg) {
this.zflg = zflg;
}
public String getAnln1() {
return anln1;
}
public void setAnln1(String anln1) {
this.anln1 = anln1;
}
public String getAnlkl() {
return anlkl;
}
public void setAnlkl(String anlkl) {
this.anlkl = anlkl;
}
public String getBukrs() {
return bukrs;
}
public void setBukrs(String bukrs) {
this.bukrs = bukrs;
}
public String getTxt50() {
return txt50;
}
public void setTxt50(String txt50) {
this.txt50 = txt50;
}
public String getInvnr() {
return invnr;
}
public void setInvnr(String invnr) {
this.invnr = invnr;
}
public BigDecimal getMenge() {
return menge;
}
public void setMenge(BigDecimal menge) {
this.menge = menge;
}
public String getMeins() {
return meins;
}
public void setMeins(String meins) {
this.meins = meins;
}
public String getKostl() {
return kostl;
}
public void setKostl(String kostl) {
this.kostl = kostl;
}
public String getKostlv() {
return kostlv;
}
public void setKostlv(String kostlv) {
this.kostlv = kostlv;
}
}
......@@ -48,17 +48,17 @@ public class SapPriceMasterDataApplicationImpl extends FlowBroker implements Sap
super.onEnd(delegateExecution);
String bizId = delegateExecution.getProcessBusinessKey();
BizBillStatus status = approvePassed() ? BizBillStatus.COMPLETED : BizBillStatus.ABORTED;
SapPriceMasterData fixedAssets = sapPriceMasterDataRepository.findOne(bizId);
fixedAssets.setStatusId(status.getId());
sapPriceMasterDataRepository.save(fixedAssets);
SapPriceMasterData sapPriceMasterData = sapPriceMasterDataRepository.findOne(bizId);
sapPriceMasterData.setStatusId(status.getId());
sapPriceMasterDataRepository.save(sapPriceMasterData);
String id = fixedAssets.getId();
String id = sapPriceMasterData.getId();
SapPriceMasterDataItem item = new SapPriceMasterDataItem();
item.setPriceMasterDataId(id);
Example<SapPriceMasterDataItem> of = Example.of(item);
List<SapPriceMasterDataItem> sapPriceMasterDataItemList = sapPriceMasterDataItemRepository.findAll(of);
String returnVo = getReturnVo(fixedAssets, sapPriceMasterDataItemList);
String returnVo = getReturnVo(sapPriceMasterData, sapPriceMasterDataItemList);
// System.out.println("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~");
// System.out.println(returnVo);
// TODO 调接口
......@@ -204,7 +204,6 @@ public class SapPriceMasterDataApplicationImpl extends FlowBroker implements Sap
String returnJson = null;
try {
returnJson = objectMapper.writeValueAsString(sapPriceMasterDataReturnVos);
System.out.println(returnJson);
} catch (JsonProcessingException e) {
throw new RuntimeException(e);
}
......
......@@ -16,7 +16,7 @@ import java.util.Date;
* description:
*/
@JsonIgnoreProperties
public class SapPriceMasterDataReturnVo {
public class SapPriceMasterDataReturnVo implements Serializable{
/**
* 单据编号
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment