接口修改

jg-waiwang-pro
胡川虎 6 months ago
parent 5dfca2436d
commit cac85f4436

@ -1,13 +1,18 @@
package jnpf.controller;
import cn.hutool.core.util.ObjectUtil;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import jnpf.base.ActionResult;
import jnpf.base.UserInfo;
import jnpf.exception.DataException;
import jnpf.model.yunguan.YunguanCustomerModel;
import jnpf.permission.entity.OrganizeEntity;
import jnpf.permission.entity.UserEntity;
import jnpf.permission.service.OrganizeService;
import jnpf.service.*;
import jnpf.entity.*;
import jnpf.util.*;
@ -15,7 +20,15 @@ import jnpf.model.subjectbasic.*;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.servlet.ServletException;
import javax.servlet.ServletInputStream;
import javax.servlet.http.HttpServletRequest;
import javax.validation.Valid;
import java.math.BigDecimal;
import java.nio.charset.StandardCharsets;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.*;
import jnpf.annotation.JnpfField;
import jnpf.base.vo.PageListVO;
@ -79,8 +92,14 @@ public class SubjectbasicController {
private SubjectcontactsService subjectcontactsService;
@Autowired
private SubjectproductblacklistService subjectproductblacklistService;
@Autowired
private OrganizeService organizeService;
@Autowired
private ContractLService contractLService;
@Autowired
private ProductWarehouseService productWarehouseService;
@Autowired
private ContractLCommodityService contractLCommodityService;
@Autowired
private ConfigValueUtil configValueUtil;
@ -92,7 +111,7 @@ public class SubjectbasicController {
*/
@Operation(summary = "获取列表")
@PostMapping("/getList")
public ActionResult list(@RequestBody SubjectbasicPagination subjectbasicPagination)throws IOException{
public ActionResult list(@RequestBody SubjectbasicPagination subjectbasicPagination) throws IOException, ServletException {
List<SubjectbasicEntity> list= subjectbasicService.getList(subjectbasicPagination);
List<Map<String, Object>> realList=new ArrayList<>();
for (SubjectbasicEntity entity : list) {
@ -746,4 +765,183 @@ public class SubjectbasicController {
return ActionResult.success(subjectbasicMap);
}
public ActionResult syncContractHead(HttpServletRequest httpRequest) throws IOException {
/*ServletInputStream inputStream = httpRequest.getInputStream();
byte[] bytes = new byte[httpRequest.getContentLength()];
inputStream.read(bytes);
String str = new String(bytes, StandardCharsets.UTF_8);
System.out.println(str);*/
String str = "{\"CURRENCY_TY\":\"CNY\",\"CONTR_TY\":\"01\",\"ORG_NM\":\"JT1济钢集团有限公司广东分公司\",\"ID\":\"15A1FA661049C68BE0634A0110AC7D40\",\"CANCLE_YN\":\"0\",\"DEPT_CD\":\"1101160\",\"CONTR_CD\":\"11011600124040802\",\"ESB_STATUS\":\"N\",\"COMP_CD\":\"1101\",\"SUPPLIER_SITE_ID\":\"296134\",\"ESB_DTM\":\"2024-04-25T14:48:41\",\"CREATE_EMP_ID\":\"33F6989D2A574057BDB8E3C31741CC8B\",\"CONTR_FORM\":\"1\",\"CREATE_DTM\":\"2024-04-08T00:00:00\",\"SUPPLIER_NM\":\"安徽省茂鑫金属制品有限公司\",\"REMARK\":\"加盖合同章时已并加盖广东分公司负责人签名章\",\"CONTR_INSTANCE_STATUS\":\"普通审批结束\",\"DEPT_NM\":\"广东分公司\",\"CONTR_NO\":\"JGGDFGA2403185\",\"ESB_MESSAGE\":\"Success\",\"DELV_DATE\":\"2024-04-20T00:00:00\",\"RESERVE9\":\"否\",\"MODIFY_DTM\":\"2024-04-08T15:46:54\",\"MODIFY_EMP_ID\":\"33F6989D2A574057BDB8E3C31741CC8B\",\"RESERVE5\":\"否\",\"RESERVE4\":\"废钢类\",\"SUPPLIER_CD\":\"234000067\",\"RESERVE3\":\"否\",\"CONTR_NM\":\"废不锈钢买卖合同(第贰拾捌批次)JGGDFGA2403185\",\"RESERVE2\":\"500.000\",\"STOCK_TYPE\":\"A\",\"CONTR_PRICE\":\"2388475\",\"RESERVE17\":\"钢贸一部\",\"RESERVE15\":\"否\",\"TRADE_TYPE\":\"B\",\"ORG_CD\":\"JT1\",\"CONTR_EX_RATE\":\"1\"}";
JSONObject jsonObject = JSON.parseObject(str);
return ActionResult.success("运管推送合同信息到智慧成功");
}
public ActionResult syncSupplier(HttpServletRequest httpRequest) throws IOException, ServletException, ParseException {
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
/*ServletInputStream inputStream = httpRequest.getInputStream();
byte[] bytes = new byte[httpRequest.getContentLength()];
inputStream.read(bytes);
String str = new String(bytes, StandardCharsets.UTF_8);
System.out.println(str);*/
String str = "{\"ID\":\"FFA0B9F0396338FFE0534A0110AC753D\",\"ESB_STATUS\":\"N\",\"ESB_DTM\":\"2024-04-25T13:34:40\",\"ATTRIBUTE6\":\"231084\",\"VENDOR_SITE_CODE\":\"国贸部\",\"ADD_ID\":\"SYSTEM\",\"ORG_NAME\":\"山钢集团江苏经贸有限公司\",\"CANCEL_FLAG\":\"0\",\"VENDOR_NUM\":\"300000193\",\"MODIFY_ID\":\"SYSTEM\",\"INTF_STATUS\":\"S\",\"VENDOR_NAME\":\"TURNING RESOURCES PRIVATE LIMITED\",\"ORG_ID\":\"1004\",\"MODIFY_TIME\":\"2023-08-03T10:34:33\",\"BELONG_ID\":\"D\",\"ESB_MESSAGE\":\"没有权限操作\",\"ATTR1\":\"A级\",\"ATTR4\":\"1004\",\"READ_FLAG\":\"N\",\"ATTR3\":\"JT3\",\"ADD_TIME\":\"2023-07-04T10:07:24\"}";
JSONObject jsonObject = JSON.parseObject(str);
ContractLEntity contractLEntity = new ContractLEntity();
contractLEntity.setCurrency(jsonObject.get("CURRENCY_TY").toString());//币种
contractLEntity.setContractType(jsonObject.get("CONTR_TY").toString());
if(ObjectUtil.equal("01", jsonObject.get("CONTR_TY").toString())){
contractLEntity.setContractType("1");
}else if(ObjectUtil.equal("02", jsonObject.get("CONTR_TY").toString())){
contractLEntity.setContractType("2");
}
contractLEntity.setContractNumber(jsonObject.get("CONTR_CD").toString());
contractLEntity.setContractNo(jsonObject.get("CONTR_NO").toString());
contractLEntity.setSupplierSiteId(jsonObject.get("SUPPLIER_SITE_ID").toString());
contractLEntity.setSupplierSiteName(jsonObject.get("RESERVE17").toString());
contractLEntity.setRemark(jsonObject.get("REMARK").toString());
contractLEntity.setContrForm(jsonObject.get("CONTR_FORM").toString());
Date parse = dateFormat.parse(jsonObject.get("DELV_DATE").toString());
contractLEntity.setDeliveryTime(parse);
contractLEntity.setReserve4(jsonObject.get("RESERVE4").toString());
contractLEntity.setReserve5(jsonObject.get("RESERVE5").toString());
contractLEntity.setReserve9(jsonObject.get("RESERVE9").toString());
contractLEntity.setContractName(jsonObject.get("CONTR_NM").toString());
contractLEntity.setReserve2(jsonObject.get("RESERVE2").toString());
contractLEntity.setReserve3(jsonObject.get("RESERVE3").toString());
contractLEntity.setStockType(jsonObject.get("STOCK_TYPE").toString());
contractLEntity.setTotalAmount(new BigDecimal(jsonObject.get("CONTR_PRICE").toString()));
if(ObjectUtil.equal("否", jsonObject.get("RESERVE15").toString())){
contractLEntity.setIsLongAgreement("2");
}else {
contractLEntity.setIsLongAgreement("1");
}
if(ObjectUtil.equal("B", jsonObject.get("TRADE_TYPE").toString())){
contractLEntity.setProcurementModel("2");
}else {
contractLEntity.setProcurementModel("1");
}
contractLEntity.setKucunOrgCode(jsonObject.get("ORG_CD").toString());//库存组织编码
if(ObjectUtil.equal("CK0", contractLEntity.getKucunOrgCode())){
contractLEntity.setKucunOrgName("济钢城市矿产科技有限公司");
}else if(ObjectUtil.equal("CK1", contractLEntity.getKucunOrgCode())){
contractLEntity.setKucunOrgName("济钢城市矿产科技有限公司(日照)");
}else if(ObjectUtil.equal("CK2", contractLEntity.getKucunOrgCode())){
contractLEntity.setKucunOrgName("山东济钢愿景工业科技有限公司");
}else if(ObjectUtil.equal("CK3", contractLEntity.getKucunOrgCode())){
contractLEntity.setKucunOrgName("济钢城市矿产科技(佛山)有限公司");
}else if(ObjectUtil.equal("RJ0", contractLEntity.getKucunOrgCode())){
contractLEntity.setKucunOrgName("日照济钢金属科技有限公司");
}else if(ObjectUtil.equal("RJ1", contractLEntity.getKucunOrgCode())){
contractLEntity.setKucunOrgName("日照济钢金属科技有限公司(生产)");
}else if(ObjectUtil.equal("JT1", contractLEntity.getKucunOrgCode())){
contractLEntity.setKucunOrgName("济钢集团有限公司广东分公司");
}
QueryWrapper<OrganizeEntity> queryWrapper = new QueryWrapper<>();
queryWrapper.lambda().eq(OrganizeEntity::getEnCode, jsonObject.get("DEPT_CD").toString());
List<OrganizeEntity> orgList = organizeService.list(queryWrapper);
if(orgList != null && orgList.size() > 0){
List<String> conpanyIdList = Arrays.asList(orgList.get(0).getCompanyIdTree().split(","));
String organizeId = JSON.toJSONString(conpanyIdList);
contractLEntity.setOrganizeJsonId(organizeId);//分支机构编码
}
jsonObject.get("SUPPLIER_CD").toString();
QueryWrapper<SubjectbasicEntity> subjectbasicQueryWrapper = new QueryWrapper<>();
subjectbasicQueryWrapper.lambda().eq(SubjectbasicEntity::getCode, jsonObject.get("SUPPLIER_CD").toString());
subjectbasicQueryWrapper.lambda().isNull(SubjectbasicEntity::getDeleteMark);
List<SubjectbasicEntity> subjectbasicList = subjectbasicService.list(subjectbasicQueryWrapper);
if(subjectbasicList != null && subjectbasicList.size() > 0){
contractLEntity.setSubject(subjectbasicList.get(0).getId());
}
contractLService.save(contractLEntity);
return ActionResult.success("运管推送供应商数据到智慧成功");
}
public ActionResult syncCustomer() throws IOException, ServletException {
/*ServletInputStream inputStream = httpRequest.getInputStream();
byte[] bytes = new byte[httpRequest.getContentLength()];
inputStream.read(bytes);
String str = new String(bytes, StandardCharsets.UTF_8);*/
String str = "{\"CUST_FULL_NAME\":\"SOCIETE PROMETAL SARL\",\"ID\":\"FF9F8D24DA93F45DE0534A0110AC4F09\",\"CUST_NUMBER\":\"900000076\",\"ESB_STATUS\":\"N\",\"ESB_DTM\":\"2024-04-23T16:55:32\",\"ORGANIZATION_CODE\":\"RJ1\",\"ADD_ID\":\"SYSTEM\",\"CANCEL_FLAG\":\"0\",\"INTF_STATUS\":\"S\",\"OU_NAME\":\"济钢供应链(济南)有限公司\",\"BELONG_ID\":\"D\",\"ESB_MESSAGE\":\"验证请求超时\",\"ATTR2\":\"A级\",\"ATTR1\":\"1304\",\"READ_FLAG\":\"N\",\"ATTR3\":\"1104040\",\"ADD_TIME\":\"2023-07-04T08:42:11\"}";
System.out.println(str);
JSONObject jsonObject = JSON.parseObject(str);
if(!ObjectUtil.equal(jsonObject.get("INTF_STATUS").toString(), "S")){
return ActionResult.fail("请推送状态为S的客户");
}
SubjectbasicEntity subjectbasicEntity = new SubjectbasicEntity();
subjectbasicEntity.setName(jsonObject.get("CUST_FULL_NAME").toString());//名称
subjectbasicEntity.setCalssify("1");//一级
subjectbasicEntity.setSubjectBasicType("1");//客户
subjectbasicEntity.setCode(jsonObject.get("CUST_NUMBER").toString());//编码
subjectbasicEntity.setKucunOrgCode(jsonObject.get("ORGANIZATION_CODE").toString());//库存组织编码
if(ObjectUtil.equal("CK0", subjectbasicEntity.getKucunOrgCode())){
subjectbasicEntity.setKucunOrgName("济钢城市矿产科技有限公司");
}else if(ObjectUtil.equal("CK1", subjectbasicEntity.getKucunOrgCode())){
subjectbasicEntity.setKucunOrgName("济钢城市矿产科技有限公司(日照)");
}else if(ObjectUtil.equal("CK2", subjectbasicEntity.getKucunOrgCode())){
subjectbasicEntity.setKucunOrgName("山东济钢愿景工业科技有限公司");
}else if(ObjectUtil.equal("CK3", subjectbasicEntity.getKucunOrgCode())){
subjectbasicEntity.setKucunOrgName("济钢城市矿产科技(佛山)有限公司");
}else if(ObjectUtil.equal("RJ0", subjectbasicEntity.getKucunOrgCode())){
subjectbasicEntity.setKucunOrgName("日照济钢金属科技有限公司");
}else if(ObjectUtil.equal("RJ1", subjectbasicEntity.getKucunOrgCode())){
subjectbasicEntity.setKucunOrgName("日照济钢金属科技有限公司(生产)");
}else if(ObjectUtil.equal("JT1", subjectbasicEntity.getKucunOrgCode())){
subjectbasicEntity.setKucunOrgName("济钢集团有限公司广东分公司");
}
if(ObjectUtil.equal("A级", jsonObject.get("ATTR2").toString())){
subjectbasicEntity.setReservedFields3("1");
}else if(ObjectUtil.equal("B级", jsonObject.get("ATTR2").toString())){
subjectbasicEntity.setReservedFields3("2");
}else if(ObjectUtil.equal("C级", jsonObject.get("ATTR2").toString())){
subjectbasicEntity.setReservedFields3("3");
}else if(ObjectUtil.equal("D级", jsonObject.get("ATTR2").toString())){
subjectbasicEntity.setReservedFields3("4");
}
QueryWrapper<OrganizeEntity> queryWrapper = new QueryWrapper<>();
queryWrapper.lambda().eq(OrganizeEntity::getEnCode, jsonObject.get("ATTR3").toString());
List<OrganizeEntity> orgList = organizeService.list(queryWrapper);
if(orgList != null && orgList.size() > 0){
List<String> conpanyIdList = Arrays.asList(orgList.get(0).getCompanyIdTree().split(","));
String organizeId = JSON.toJSONString(conpanyIdList);
subjectbasicEntity.setOrganizeJsonId(organizeId);//分支机构编码
}
subjectbasicService.save(subjectbasicEntity);
return ActionResult.success("运管推送客户数据到智慧成功");
}
public ActionResult syncContractLine(HttpServletRequest httpRequest) throws IOException {
/*ServletInputStream inputStream = httpRequest.getInputStream();
byte[] bytes = new byte[httpRequest.getContentLength()];
inputStream.read(bytes);
String str = new String(bytes, StandardCharsets.UTF_8);
System.out.println(str);*/
String str = "{\"ITEM_NM\":\"400系废不锈钢(430胶纸料)\",\"TAX_PRICE\":\"4776.95\",\"TAX_RATE\":\"13\",\"CONTR_ID\":\"158D8934E4A9961EE063480110AC94BE\",\"UOM\":\"吨\",\"CONTR_LINE_ID\":\"01\",\"PRICE\":\"4227.3893805309\",\"ID\":\"15A1FA66104AC68BE0634A0110AC7D40\",\"TAX_RATE_CODE\":\"VAT_IN_13\",\"AMOUNT\":\"2113694.69\",\"RESERVE1\":\"正算\",\"WEIGHT\":\"500\",\"CANCLE_YN\":\"1\",\"ITEM_CD\":\"1011110110FG01000G0318\",\"CONTR_CD\":\"11011600124040802\",\"TOTAL_AMOUNT\":\"2388475\",\"ESB_STATUS\":\"N\",\"CREATE_EMP_ID\":\"33F6989D2A574057BDB8E3C31741CC8B\",\"CREATE_DTM\":\"2024-04-08T15:46:35\"}";
JSONObject jsonObject = JSON.parseObject(str);
ContractLCommodityEntity contractLCommodityEntity = new ContractLCommodityEntity();
QueryWrapper<ContractLEntity> queryWrapper = new QueryWrapper<>();
queryWrapper.lambda().eq(ContractLEntity::getContractNumber, jsonObject.get("CONTR_CD").toString());
List<ContractLEntity> contractLEntityList = contractLService.list(queryWrapper);
if(contractLEntityList != null && contractLEntityList.size() > 0){
contractLCommodityEntity.setContractId(contractLEntityList.get(0).getId());
contractLCommodityEntity.setOrganizeJsonId(contractLEntityList.get(0).getOrganizeJsonId());
}
QueryWrapper<ProductWarehouseEntity> productWarehouseEntityWrapper = new QueryWrapper<>();
productWarehouseEntityWrapper.lambda().eq(ProductWarehouseEntity::getCode, jsonObject.get("ITEM_CD").toString());
List<ProductWarehouseEntity> productWarehouseEntityList = productWarehouseService.list(productWarehouseEntityWrapper);
if(productWarehouseEntityList != null && productWarehouseEntityList.size() > 0){
contractLCommodityEntity.setProductId(productWarehouseEntityList.get(0).getId());
contractLCommodityEntity.setCommodityCode(jsonObject.get("ITEM_CD").toString());
contractLCommodityEntity.setCommodityName(jsonObject.get("ITEM_NM").toString());
contractLCommodityEntity.setCommodityPhone(productWarehouseEntityList.get(0).getPhoto());
contractLCommodityEntity.setSpecifications(productWarehouseEntityList.get(0).getSpec());
contractLCommodityEntity.setInventoryUnitId(productWarehouseEntityList.get(0).getInventoryUnitId());
}
contractLCommodityEntity.setNumber(new BigDecimal(jsonObject.get("WEIGHT").toString()));
contractLCommodityEntity.setTaxRate(new BigDecimal(jsonObject.get("TAX_RATE").toString()));
contractLCommodityEntity.setPriceRate(new BigDecimal(jsonObject.get("TAX_PRICE").toString()));
contractLCommodityEntity.setTotalRate(new BigDecimal(jsonObject.get("TOTAL_AMOUNT").toString()));
contractLCommodityService.save(contractLCommodityEntity);
return ActionResult.success("运管推送合同信息到智慧成功");
}
}

@ -8,10 +8,16 @@ import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import jnpf.base.ActionResult;
import jnpf.constant.PermissionConst;
import jnpf.entity.ContractLCommodityEntity;
import jnpf.entity.ContractLEntity;
import jnpf.entity.ProductWarehouseEntity;
import jnpf.entity.SubjectbasicEntity;
import jnpf.model.yunguan.YunguanCustomerModel;
import jnpf.permission.entity.OrganizeEntity;
import jnpf.permission.service.OrganizeService;
import jnpf.service.ContractLCommodityService;
import jnpf.service.ContractLService;
import jnpf.service.ProductWarehouseService;
import jnpf.service.SubjectbasicService;
import jnpf.util.JsonUtil;
import lombok.extern.slf4j.Slf4j;
@ -24,9 +30,13 @@ import javax.servlet.ServletInputStream;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.Part;
import java.io.IOException;
import java.math.BigDecimal;
import java.nio.charset.StandardCharsets;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Arrays;
import java.util.Collection;
import java.util.Date;
import java.util.List;
/**
@ -46,6 +56,12 @@ public class YunguanInterfaceController {
private OrganizeService organizeService;
@Autowired
private SubjectbasicService subjectbasicService;
@Autowired
private ContractLService contractLService;
@Autowired
private ProductWarehouseService productWarehouseService;
@Autowired
private ContractLCommodityService contractLCommodityService;
/**
*
*
@ -54,7 +70,7 @@ public class YunguanInterfaceController {
*/
@Operation(summary = "运管推送客户数据到智慧")
@PostMapping("/syncCustomer")
public ActionResult syncCustomer(HttpServletRequest httpRequest) throws IOException, ServletException {
public ActionResult syncCustomer(HttpServletRequest httpRequest) throws IOException {
ServletInputStream inputStream = httpRequest.getInputStream();
byte[] bytes = new byte[httpRequest.getContentLength()];
inputStream.read(bytes);
@ -114,13 +130,55 @@ public class YunguanInterfaceController {
*/
@Operation(summary = "运管推送供应商数据到智慧")
@PostMapping("/syncSupplier")
public ActionResult syncSupplier(HttpServletRequest httpRequest) throws IOException, ServletException {
public ActionResult syncSupplier(HttpServletRequest httpRequest) throws IOException {
ServletInputStream inputStream = httpRequest.getInputStream();
byte[] bytes = new byte[httpRequest.getContentLength()];
inputStream.read(bytes);
String str = new String(bytes, StandardCharsets.UTF_8);
System.out.println(str);
YunguanCustomerModel yunguanCustomerModel = JsonUtil.getJsonToBean(str, YunguanCustomerModel.class);
JSONObject jsonObject = JSON.parseObject(str);
if(!ObjectUtil.equal(jsonObject.get("INTF_STATUS").toString(), "S")){
return ActionResult.fail("请推送状态为S的供应商");
}
SubjectbasicEntity subjectbasicEntity = new SubjectbasicEntity();
subjectbasicEntity.setName(jsonObject.get("VENDOR_NAME").toString());//名称
subjectbasicEntity.setCalssify("1");//一级
subjectbasicEntity.setSubjectBasicType("2");//供应商
subjectbasicEntity.setCode(jsonObject.get("VENDOR_NUM").toString());//编码
subjectbasicEntity.setKucunOrgCode(jsonObject.get("ATTR3").toString());//库存组织编码
if(ObjectUtil.equal("CK0", subjectbasicEntity.getKucunOrgCode())){
subjectbasicEntity.setKucunOrgName("济钢城市矿产科技有限公司");
}else if(ObjectUtil.equal("CK1", subjectbasicEntity.getKucunOrgCode())){
subjectbasicEntity.setKucunOrgName("济钢城市矿产科技有限公司(日照)");
}else if(ObjectUtil.equal("CK2", subjectbasicEntity.getKucunOrgCode())){
subjectbasicEntity.setKucunOrgName("山东济钢愿景工业科技有限公司");
}else if(ObjectUtil.equal("CK3", subjectbasicEntity.getKucunOrgCode())){
subjectbasicEntity.setKucunOrgName("济钢城市矿产科技(佛山)有限公司");
}else if(ObjectUtil.equal("RJ0", subjectbasicEntity.getKucunOrgCode())){
subjectbasicEntity.setKucunOrgName("日照济钢金属科技有限公司");
}else if(ObjectUtil.equal("RJ1", subjectbasicEntity.getKucunOrgCode())){
subjectbasicEntity.setKucunOrgName("日照济钢金属科技有限公司(生产)");
}else if(ObjectUtil.equal("JT1", subjectbasicEntity.getKucunOrgCode())){
subjectbasicEntity.setKucunOrgName("济钢集团有限公司广东分公司");
}
if(ObjectUtil.equal("A级", jsonObject.get("ATTR1").toString())){
subjectbasicEntity.setReservedFields3("1");
}else if(ObjectUtil.equal("B级", jsonObject.get("ATTR1").toString())){
subjectbasicEntity.setReservedFields3("2");
}else if(ObjectUtil.equal("C级", jsonObject.get("ATTR1").toString())){
subjectbasicEntity.setReservedFields3("3");
}else if(ObjectUtil.equal("D级", jsonObject.get("ATTR1").toString())){
subjectbasicEntity.setReservedFields3("4");
}
QueryWrapper<OrganizeEntity> queryWrapper = new QueryWrapper<>();
queryWrapper.lambda().eq(OrganizeEntity::getEnCode, jsonObject.get("ORG_ID").toString());
List<OrganizeEntity> orgList = organizeService.list(queryWrapper);
if(orgList != null && orgList.size() > 0){
List<String> conpanyIdList = Arrays.asList(orgList.get(0).getCompanyIdTree().split(","));
String organizeId = JSON.toJSONString(conpanyIdList);
subjectbasicEntity.setOrganizeJsonId(organizeId);//分支机构编码
}
subjectbasicService.save(subjectbasicEntity);
return ActionResult.success("运管推送供应商数据到智慧成功");
}
@ -132,13 +190,81 @@ public class YunguanInterfaceController {
*/
@Operation(summary = "运管推送合同信息到智慧")
@PostMapping("/syncContractHead")
public ActionResult syncContractHead(HttpServletRequest httpRequest) throws IOException, ServletException {
public ActionResult syncContractHead(HttpServletRequest httpRequest) throws IOException, ParseException {
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
ServletInputStream inputStream = httpRequest.getInputStream();
byte[] bytes = new byte[httpRequest.getContentLength()];
inputStream.read(bytes);
String str = new String(bytes, StandardCharsets.UTF_8);
System.out.println(str);
YunguanCustomerModel yunguanCustomerModel = JsonUtil.getJsonToBean(str, YunguanCustomerModel.class);
JSONObject jsonObject = JSON.parseObject(str);
ContractLEntity contractLEntity = new ContractLEntity();
contractLEntity.setCurrency(jsonObject.get("CURRENCY_TY").toString());//币种
contractLEntity.setContractType(jsonObject.get("CONTR_TY").toString());
if(ObjectUtil.equal("01", jsonObject.get("CONTR_TY").toString())){
contractLEntity.setContractType("1");
}else if(ObjectUtil.equal("02", jsonObject.get("CONTR_TY").toString())){
contractLEntity.setContractType("2");
}
contractLEntity.setContractNumber(jsonObject.get("CONTR_CD").toString());
contractLEntity.setContractNo(jsonObject.get("CONTR_NO").toString());
contractLEntity.setSupplierSiteId(jsonObject.get("SUPPLIER_SITE_ID").toString());
contractLEntity.setSupplierSiteName(jsonObject.get("RESERVE17").toString());
contractLEntity.setRemark(jsonObject.get("REMARK").toString());
contractLEntity.setContrForm(jsonObject.get("CONTR_FORM").toString());
Date parse = dateFormat.parse(jsonObject.get("DELV_DATE").toString());
contractLEntity.setDeliveryTime(parse);
contractLEntity.setReserve4(jsonObject.get("RESERVE4").toString());
contractLEntity.setReserve5(jsonObject.get("RESERVE5").toString());
contractLEntity.setReserve9(jsonObject.get("RESERVE9").toString());
contractLEntity.setContractName(jsonObject.get("CONTR_NM").toString());
contractLEntity.setReserve2(jsonObject.get("RESERVE2").toString());
contractLEntity.setReserve3(jsonObject.get("RESERVE3").toString());
contractLEntity.setStockType(jsonObject.get("STOCK_TYPE").toString());
contractLEntity.setTotalAmount(new BigDecimal(jsonObject.get("CONTR_PRICE").toString()));
if(ObjectUtil.equal("否", jsonObject.get("RESERVE15").toString())){
contractLEntity.setIsLongAgreement("2");
}else {
contractLEntity.setIsLongAgreement("1");
}
if(ObjectUtil.equal("B", jsonObject.get("TRADE_TYPE").toString())){
contractLEntity.setProcurementModel("2");
}else {
contractLEntity.setProcurementModel("1");
}
contractLEntity.setKucunOrgCode(jsonObject.get("ORG_CD").toString());//库存组织编码
if(ObjectUtil.equal("CK0", contractLEntity.getKucunOrgCode())){
contractLEntity.setKucunOrgName("济钢城市矿产科技有限公司");
}else if(ObjectUtil.equal("CK1", contractLEntity.getKucunOrgCode())){
contractLEntity.setKucunOrgName("济钢城市矿产科技有限公司(日照)");
}else if(ObjectUtil.equal("CK2", contractLEntity.getKucunOrgCode())){
contractLEntity.setKucunOrgName("山东济钢愿景工业科技有限公司");
}else if(ObjectUtil.equal("CK3", contractLEntity.getKucunOrgCode())){
contractLEntity.setKucunOrgName("济钢城市矿产科技(佛山)有限公司");
}else if(ObjectUtil.equal("RJ0", contractLEntity.getKucunOrgCode())){
contractLEntity.setKucunOrgName("日照济钢金属科技有限公司");
}else if(ObjectUtil.equal("RJ1", contractLEntity.getKucunOrgCode())){
contractLEntity.setKucunOrgName("日照济钢金属科技有限公司(生产)");
}else if(ObjectUtil.equal("JT1", contractLEntity.getKucunOrgCode())){
contractLEntity.setKucunOrgName("济钢集团有限公司广东分公司");
}
QueryWrapper<OrganizeEntity> queryWrapper = new QueryWrapper<>();
queryWrapper.lambda().eq(OrganizeEntity::getEnCode, jsonObject.get("DEPT_CD").toString());
List<OrganizeEntity> orgList = organizeService.list(queryWrapper);
if(orgList != null && orgList.size() > 0){
List<String> conpanyIdList = Arrays.asList(orgList.get(0).getCompanyIdTree().split(","));
String organizeId = JSON.toJSONString(conpanyIdList);
contractLEntity.setOrganizeJsonId(organizeId);//分支机构编码
}
jsonObject.get("SUPPLIER_CD").toString();
QueryWrapper<SubjectbasicEntity> subjectbasicQueryWrapper = new QueryWrapper<>();
subjectbasicQueryWrapper.lambda().eq(SubjectbasicEntity::getCode, jsonObject.get("SUPPLIER_CD").toString());
subjectbasicQueryWrapper.lambda().isNull(SubjectbasicEntity::getDeleteMark);
List<SubjectbasicEntity> subjectbasicList = subjectbasicService.list(subjectbasicQueryWrapper);
if(subjectbasicList != null && subjectbasicList.size() > 0){
contractLEntity.setSubject(subjectbasicList.get(0).getId());
}
contractLService.save(contractLEntity);
return ActionResult.success("运管推送合同信息到智慧成功");
}
@ -150,13 +276,37 @@ public class YunguanInterfaceController {
*/
@Operation(summary = "运管推送合同行信息到智慧")
@PostMapping("/syncContractLine")
public ActionResult syncContractLine(HttpServletRequest httpRequest) throws IOException, ServletException {
public ActionResult syncContractLine(HttpServletRequest httpRequest) throws IOException {
ServletInputStream inputStream = httpRequest.getInputStream();
byte[] bytes = new byte[httpRequest.getContentLength()];
inputStream.read(bytes);
String str = new String(bytes, StandardCharsets.UTF_8);
System.out.println(str);
YunguanCustomerModel yunguanCustomerModel = JsonUtil.getJsonToBean(str, YunguanCustomerModel.class);
JSONObject jsonObject = JSON.parseObject(str);
ContractLCommodityEntity contractLCommodityEntity = new ContractLCommodityEntity();
QueryWrapper<ContractLEntity> queryWrapper = new QueryWrapper<>();
queryWrapper.lambda().eq(ContractLEntity::getContractNumber, jsonObject.get("CONTR_CD").toString());
List<ContractLEntity> contractLEntityList = contractLService.list(queryWrapper);
if(contractLEntityList != null && contractLEntityList.size() > 0){
contractLCommodityEntity.setContractId(contractLEntityList.get(0).getId());
contractLCommodityEntity.setOrganizeJsonId(contractLEntityList.get(0).getOrganizeJsonId());
}
QueryWrapper<ProductWarehouseEntity> productWarehouseEntityWrapper = new QueryWrapper<>();
productWarehouseEntityWrapper.lambda().eq(ProductWarehouseEntity::getCode, jsonObject.get("ITEM_CD").toString());
List<ProductWarehouseEntity> productWarehouseEntityList = productWarehouseService.list(productWarehouseEntityWrapper);
if(productWarehouseEntityList != null && productWarehouseEntityList.size() > 0){
contractLCommodityEntity.setProductId(productWarehouseEntityList.get(0).getId());
contractLCommodityEntity.setCommodityCode(jsonObject.get("ITEM_CD").toString());
contractLCommodityEntity.setCommodityName(jsonObject.get("ITEM_NM").toString());
contractLCommodityEntity.setCommodityPhone(productWarehouseEntityList.get(0).getPhoto());
contractLCommodityEntity.setSpecifications(productWarehouseEntityList.get(0).getSpec());
contractLCommodityEntity.setInventoryUnitId(productWarehouseEntityList.get(0).getInventoryUnitId());
}
contractLCommodityEntity.setNumber(new BigDecimal(jsonObject.get("WEIGHT").toString()));
contractLCommodityEntity.setTaxRate(new BigDecimal(jsonObject.get("TAX_RATE").toString()));
contractLCommodityEntity.setPriceRate(new BigDecimal(jsonObject.get("TAX_PRICE").toString()));
contractLCommodityEntity.setTotalRate(new BigDecimal(jsonObject.get("TOTAL_AMOUNT").toString()));
contractLCommodityService.save(contractLCommodityEntity);
return ActionResult.success("运管推送合同信息到智慧成功");
}
@ -168,7 +318,7 @@ public class YunguanInterfaceController {
*/
@Operation(summary = "运管推送效益测算到智慧")
@PostMapping("/syncXYCS")
public ActionResult syncXYCS(HttpServletRequest httpRequest) throws IOException, ServletException {
public ActionResult syncXYCS(HttpServletRequest httpRequest) throws IOException {
ServletInputStream inputStream = httpRequest.getInputStream();
byte[] bytes = new byte[httpRequest.getContentLength()];
inputStream.read(bytes);
@ -186,7 +336,7 @@ public class YunguanInterfaceController {
*/
@Operation(summary = "运管推送签约请示到智慧")
@PostMapping("/syncQYQS")
public ActionResult syncQYQS(HttpServletRequest httpRequest) throws IOException, ServletException {
public ActionResult syncQYQS(HttpServletRequest httpRequest) throws IOException {
ServletInputStream inputStream = httpRequest.getInputStream();
byte[] bytes = new byte[httpRequest.getContentLength()];
inputStream.read(bytes);

@ -156,4 +156,28 @@ public class ContractLEntity {
@TableField(exist = false)
private List<ProductByContractModel> productByContractModelList;
@TableField("kucun_org_code")
private String kucunOrgCode;
@TableField("kucun_org_name")
private String kucunOrgName;
@TableField("supplier_site_id")
private String supplierSiteId;
@TableField("supplier_site_name")
private String supplierSiteName;
@TableField("CONTR_FORM")
private String contrForm;
@TableField("RESERVE9")
private String reserve9;
@TableField("RESERVE5")
private String reserve5;
@TableField("RESERVE4")
private String reserve4;
@TableField("RESERVE3")
private String reserve3;
@TableField("RESERVE2")
private String reserve2;
@TableField("STOCK_TYPE")
private String stockType;
}

Loading…
Cancel
Save