jg-waiwang-pro
XI_TENG\xixi_ 6 months ago
commit fbdc47deb1

@ -1,17 +1,9 @@
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.*;
@ -22,39 +14,23 @@ 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;
import jnpf.base.vo.PaginationVO;
import jnpf.base.vo.DownloadVO;
import jnpf.config.ConfigValueUtil;
import jnpf.base.entity.ProvinceEntity;
import java.io.IOException;
import java.util.stream.Collectors;
import jnpf.engine.entity.FlowTaskEntity;
import jnpf.exception.WorkFlowException;
import org.springframework.web.multipart.MultipartFile;
import cn.afterturn.easypoi.excel.ExcelExportUtil;
import cn.afterturn.easypoi.excel.ExcelImportUtil;
import cn.afterturn.easypoi.excel.entity.ExportParams;
import cn.afterturn.easypoi.excel.entity.ImportParams;
import cn.afterturn.easypoi.excel.entity.params.ExcelExportEntity;
import cn.afterturn.easypoi.excel.entity.enmus.ExcelType;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.apache.poi.ss.usermodel.Workbook;
import java.io.File;
import jnpf.onlinedev.model.ExcelImFieldModel;
import jnpf.onlinedev.model.OnlineImport.ImportDataModel;
import jnpf.onlinedev.model.OnlineImport.ImportFormCheckUniqueModel;
import jnpf.onlinedev.model.OnlineImport.ExcelImportModel;
import jnpf.onlinedev.model.OnlineImport.VisualImportModel;
import cn.xuyanwu.spring.file.storage.FileInfo;
import lombok.Cleanup;
import jnpf.model.visualJson.config.HeaderModel;
@ -111,7 +87,7 @@ public class SubjectbasicController {
*/
@Operation(summary = "获取列表")
@PostMapping("/getList")
public ActionResult list(@RequestBody SubjectbasicPagination subjectbasicPagination) throws IOException, ServletException {
public ActionResult list(@RequestBody SubjectbasicPagination subjectbasicPagination) throws IOException, ServletException, ParseException {
List<SubjectbasicEntity> list= subjectbasicService.getList(subjectbasicPagination);
List<Map<String, Object>> realList=new ArrayList<>();
for (SubjectbasicEntity entity : list) {
@ -765,183 +741,4 @@ 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("运管推送合同信息到智慧成功");
}
}

@ -199,7 +199,7 @@ public class YunguanInterfaceController {
System.out.println(str);
JSONObject jsonObject = JSON.parseObject(str);
ContractLEntity contractLEntity = new ContractLEntity();
contractLEntity.setCurrency(jsonObject.get("CURRENCY_TY").toString());//币种
contractLEntity.setCurrency("1");//币种
contractLEntity.setContractType(jsonObject.get("CONTR_TY").toString());
if(ObjectUtil.equal("01", jsonObject.get("CONTR_TY").toString())){
contractLEntity.setContractType("1");
@ -256,7 +256,6 @@ public class YunguanInterfaceController {
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);

Loading…
Cancel
Save