提交 7d776951 authored 作者: 李炎's avatar 李炎

手动同步

上级 2ce2b325
...@@ -109,7 +109,26 @@ public class CategoryDao { ...@@ -109,7 +109,26 @@ public class CategoryDao {
return list; return list;
} }
public Map<String,List<List<Object>>> selectMap(String sFormId, Map<String,String> key,Map<String,String> where){
List<List<Object>> list = null;
Map<String, List<List<Object>>> stringListHashMap = new HashMap<String, List<List<Object>>>();
try {
Boolean result = client.login(dbId, uid, pwd, lang);
if(result){
String content;
if(where!=null){
content= "{\"FormId\":\""+sFormId+"\","+Stringkey(key)+Stringwhere(where)+"}";
}else{
content = "{\"FormId\":\""+sFormId+"\","+Stringkey(key)+"}";
}
list = client.executeBillQuery(content);
stringListHashMap.put(content,list);
}
} catch (Exception e) {
e.printStackTrace();
}
return stringListHashMap;
}
/** /**
* 查询日期 * 查询日期
* @param sFormId * @param sFormId
......
...@@ -50,13 +50,13 @@ public class MaterialinventoryTimed implements Job { ...@@ -50,13 +50,13 @@ public class MaterialinventoryTimed implements Job {
// @Scheduled(cron = "0 0 1 * * ?")//cron表达式每天凌晨一点 // @Scheduled(cron = "0 0 1 * * ?")//cron表达式每天凌晨一点
@Scheduled(fixedDelay = 1000*60) @Scheduled(fixedDelay = 1000*60)
public void Materialinventory() throws IOException, ParseException { public void Materialinventory() throws IOException, ParseException {
Materialinventoryerror synchronization = iMaterialinventoryService.synchronization(null); iMaterialinventoryService.synchronization(null);
} }
@Override @Override
public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException { public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
try { try {
Materialinventoryerror synchronization = iMaterialinventoryService.synchronization(null); iMaterialinventoryService.synchronization(null);
}catch (Exception e){ }catch (Exception e){
e.printStackTrace(); e.printStackTrace();
} }
......
...@@ -30,7 +30,7 @@ public class ProductInventoryTimed implements Job { ...@@ -30,7 +30,7 @@ public class ProductInventoryTimed implements Job {
// @Scheduled(cron = "0 0 1 * * ?")//cron表达式每天凌晨一点 // @Scheduled(cron = "0 0 1 * * ?")//cron表达式每天凌晨一点
@Scheduled(fixedDelay = 1000*60) @Scheduled(fixedDelay = 1000*60)
public void Materialinventory() throws IOException, ParseException { public void Materialinventory() throws IOException, ParseException {
Productinventoryerror synchronization = productInventoryService.synchronization(null); productInventoryService.synchronization(null);
// System.out.println("执行了"); // System.out.println("执行了");
} }
...@@ -38,7 +38,7 @@ public class ProductInventoryTimed implements Job { ...@@ -38,7 +38,7 @@ public class ProductInventoryTimed implements Job {
@Override @Override
public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException { public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
try { try {
Productinventoryerror synchronization = productInventoryService.synchronization(null); productInventoryService.synchronization(null);
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} }
......
...@@ -7,6 +7,8 @@ import org.springframework.scheduling.annotation.EnableScheduling; ...@@ -7,6 +7,8 @@ import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled; import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import java.text.ParseException;
@Slf4j @Slf4j
@Component @Component
@EnableScheduling @EnableScheduling
...@@ -15,7 +17,7 @@ public class ProductionSchedulingTimed { ...@@ -15,7 +17,7 @@ public class ProductionSchedulingTimed {
IProductionSchedulingService productionSchedulingService; IProductionSchedulingService productionSchedulingService;
// @Scheduled(cron = "0 0 1 * * ?")//cron表达式每天凌晨一点 // @Scheduled(cron = "0 0 1 * * ?")//cron表达式每天凌晨一点
@Scheduled(fixedDelay = 1000*60) @Scheduled(fixedDelay = 1000*60)
public void job(){ public void job() throws ParseException {
productionSchedulingService.synchronization(); productionSchedulingService.synchronization(null);
} }
} }
...@@ -14,6 +14,7 @@ import org.springframework.stereotype.Component; ...@@ -14,6 +14,7 @@ import org.springframework.stereotype.Component;
import java.io.IOException; import java.io.IOException;
import java.text.ParseException; import java.text.ParseException;
@Slf4j @Slf4j
@Component @Component
@EnableScheduling @EnableScheduling
...@@ -25,18 +26,20 @@ public class ReserveStockTimed implements Job { ...@@ -25,18 +26,20 @@ public class ReserveStockTimed implements Job {
@Autowired @Autowired
IReserveStockService reserveStockService; IReserveStockService reserveStockService;
/**测试定时*/ /**
* 测试定时
*/
// @Scheduled(cron = "0 0 1 * * ?")//cron表达式每天凌晨一点 // @Scheduled(cron = "0 0 1 * * ?")//cron表达式每天凌晨一点
@Scheduled(fixedDelay = 1000*60) @Scheduled(fixedDelay = 1000 * 60)
public void Materialinventory() throws IOException, ParseException { public void Materialinventory() throws IOException, ParseException {
Reservestockerror synchronization = reserveStockService.synchronization(null); reserveStockService.synchronization(null);
} }
@Override @Override
public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException { public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
try { try {
Reservestockerror synchronization = reserveStockService.synchronization(null); reserveStockService.synchronization(null);
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} }
......
...@@ -17,6 +17,7 @@ import org.springframework.beans.factory.annotation.Autowired; ...@@ -17,6 +17,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import java.text.ParseException;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
...@@ -92,7 +93,7 @@ public class MaterialinventoryController { ...@@ -92,7 +93,7 @@ public class MaterialinventoryController {
@AutoLog(value = "国网供应商重点原材料库存API-同步") @AutoLog(value = "国网供应商重点原材料库存API-同步")
@ApiOperation(value="国网供应商重点原材料库存API-同步", notes="国网供应商重点原材料库存API-同步") @ApiOperation(value="国网供应商重点原材料库存API-同步", notes="国网供应商重点原材料库存API-同步")
@PostMapping(value = "/synchronization") @PostMapping(value = "/synchronization")
public Result<?> synchronization(){ public Result<?> synchronization() throws ParseException {
return Result.OK(iMaterialinventoryService.synchronization(null)); return Result.OK(iMaterialinventoryService.synchronization(null));
} }
} }
...@@ -70,12 +70,12 @@ public class PhysicalIDerrorController { ...@@ -70,12 +70,12 @@ public class PhysicalIDerrorController {
/** /**
* 销售订单-查询 * 销售订单-查询
* @param map * @param
* @return * @return
*/ */
@GetMapping(value = "/select") @GetMapping(value = "/select")
public Result<?> select(@RequestBody Map<String,String> map) throws ParseException { public Result<?> select() throws ParseException {
return Result.OK(physicalIDService.select(map)); return Result.OK(physicalIDService.selectInList(null));
} }
/** /**
......
...@@ -17,6 +17,7 @@ import org.springframework.beans.factory.annotation.Autowired; ...@@ -17,6 +17,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import java.text.ParseException;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
...@@ -97,7 +98,7 @@ public class ProductInventoryController { ...@@ -97,7 +98,7 @@ public class ProductInventoryController {
@AutoLog(value = "国网产成品库存信息API-同步今天的产成品") @AutoLog(value = "国网产成品库存信息API-同步今天的产成品")
@ApiOperation(value="国网产成品库存信息API-同步今天的产成品", notes="国网产成品库存信息API-同步今天的产成品") @ApiOperation(value="国网产成品库存信息API-同步今天的产成品", notes="国网产成品库存信息API-同步今天的产成品")
@PostMapping(value = "/synchronization") @PostMapping(value = "/synchronization")
public Result<?> synchronization(){ public Result<?> synchronization() throws ParseException {
return Result.OK(productInventoryService.synchronization(null)); return Result.OK(productInventoryService.synchronization(null));
} }
} }
...@@ -18,6 +18,7 @@ import org.springframework.web.bind.annotation.*; ...@@ -18,6 +18,7 @@ import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import java.io.IOException; import java.io.IOException;
import java.text.ParseException;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
...@@ -63,8 +64,8 @@ public class ProductionSchedulingController { ...@@ -63,8 +64,8 @@ public class ProductionSchedulingController {
@AutoLog(value = "排产计划API-同步至国网") @AutoLog(value = "排产计划API-同步至国网")
@ApiOperation(value="排产计划API-同步至国网", notes="排产计划API-同步至国网") @ApiOperation(value="排产计划API-同步至国网", notes="排产计划API-同步至国网")
@PostMapping(value = "/synchronization") @PostMapping(value = "/synchronization")
public Result<?> synchronization(){ public Result<?> synchronization() throws ParseException {
productionSchedulingService.synchronization(); productionSchedulingService.synchronization(null);
return Result.OK("同步成功"); return Result.OK("同步成功");
} }
......
...@@ -17,13 +17,14 @@ import org.springframework.beans.factory.annotation.Autowired; ...@@ -17,13 +17,14 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import java.text.ParseException;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
/** /**
* @Description: 备品备件库存 * @Description: 备品备件库存
*/ */
@Api(tags="备品备件库存") @Api(tags = "备品备件库存")
@RestController @RestController
@RequestMapping("/API/eip_spare_product") @RequestMapping("/API/eip_spare_product")
@Slf4j @Slf4j
...@@ -32,6 +33,7 @@ public class ReserveStockController { ...@@ -32,6 +33,7 @@ public class ReserveStockController {
IReserveStockService reserveStockService; IReserveStockService reserveStockService;
@Autowired @Autowired
ReserveStockWebapi reserveStockWebapi; ReserveStockWebapi reserveStockWebapi;
/** /**
* 分页列表查询 * 分页列表查询
* *
...@@ -53,48 +55,52 @@ public class ReserveStockController { ...@@ -53,48 +55,52 @@ public class ReserveStockController {
IPage<Reservestockerror> pageList = reserveStockService.page(page, queryWrapper); IPage<Reservestockerror> pageList = reserveStockService.page(page, queryWrapper);
return Result.OK(pageList); return Result.OK(pageList);
} }
/** /**
* 添加 * 添加
* *
* @param object * @param object
* @return * @return
*/ */
@AutoLog(value = "国网产成品库存信息API-添加") @AutoLog(value = "国网产成品库存信息API-添加")
@ApiOperation(value="国网产成品库存信息API-添加", notes="国网产成品库存信息API-添加") @ApiOperation(value = "国网产成品库存信息API-添加", notes = "国网产成品库存信息API-添加")
@PostMapping(value = "/add") @PostMapping(value = "/add")
public Result<?> add(@RequestBody Object object) { public Result<?> add(@RequestBody Object object) {
return Result.OK("添加成功!"); return Result.OK("添加成功!");
} }
/** /**
* 备品备件库存-查询 * 备品备件库存-查询
*
* @param map * @param map
* @return * @return
*/ */
@GetMapping(value = "/select") @GetMapping(value = "/select")
public Result<?> select(@RequestBody Map<String,String> map){ public Result<?> select(@RequestBody Map<String, String> map) {
return Result.OK(reserveStockService.select(map)); return Result.OK(reserveStockService.select(map));
} }
/** /**
* 备品备件库存web-查询 * 备品备件库存web-查询
*
* @param map * @param map
* @return * @return
*/ */
@GetMapping(value = "/selectwebapi") @GetMapping(value = "/selectwebapi")
public Result<?> selectwebapi(@RequestBody Map<String,String> map){ public Result<?> selectwebapi(@RequestBody Map<String, String> map) {
List<Map<String, String>>list = reserveStockWebapi.select(map,null); List<Map<String, String>> list = reserveStockWebapi.select(map, null);
return Result.OK(list); return Result.OK(list);
} }
/** /**
* 从金蝶生产入库单获取备品添加到国网 * 从金蝶生产入库单获取备品添加到国网
*
* @return * @return
*/ */
@AutoLog(value = "国网备品库存信息API-同步") @AutoLog(value = "国网备品库存信息API-同步")
@ApiOperation(value="国网备品库存信息API-同步", notes="国网备品库存信息API-同步") @ApiOperation(value = "国网备品库存信息API-同步", notes = "国网备品库存信息API-同步")
@PostMapping(value = "/synchronization") @PostMapping(value = "/synchronization")
public Result<?> synchronization(){ public Result<?> synchronization() throws ParseException {
return Result.OK( reserveStockService.synchronization(null)); return Result.OK(reserveStockService.synchronization(null));
} }
} }
...@@ -31,13 +31,21 @@ public class KingdeeJournalController { ...@@ -31,13 +31,21 @@ public class KingdeeJournalController {
@Autowired @Autowired
private KingdeeJournalService kingdeeJournalService; private KingdeeJournalService kingdeeJournalService;
@Autowired @Autowired
private IPhysicalIDerrorService physicalIDerrorService;
@Autowired
private ISupplyListIService supplyListIService; private ISupplyListIService supplyListIService;
@Autowired @Autowired
private ISalesOrderService salesOrderService; private ISalesOrderService salesOrderService;
@Autowired @Autowired
private IProductionOrderService productionOrderService; private IProductionOrderService productionOrderService;
@Autowired
private IProductionSchedulingService productionSchedulingService;
@Autowired
private IMaterialinventoryService iMaterialinventoryService;
@Autowired
private IPhysicalIDerrorService physicalIDerrorService;
@Autowired
private IReserveStockService reserveStockService;
@Autowired
private IProductInventoryService productInventoryService;
/** /**
* 分页列表查询 * 分页列表查询
* *
...@@ -64,46 +72,75 @@ public class KingdeeJournalController { ...@@ -64,46 +72,75 @@ public class KingdeeJournalController {
* *
*/ */
@PostMapping(value = "manual") @PostMapping(value = "manual")
public Result<?> synchronization(@RequestParam(name = "id", required = false) String id, @RequestParam(name = "name", required = false) String name, @RequestBody String king) throws ParseException { public Result<?> synchronization(@RequestParam(name = "id", required = false) String id, @RequestParam(name = "businessNo", required = false) Integer businessNo, @RequestBody String king) throws ParseException {
Result ok = new Result(); Result ok = new Result();
JSONObject jsonObject = null; JSONObject jsonObject = null;
Boolean success = false; Boolean success = false;
List<List<Object>> lists; List<List<Object>> lists;
if (name != null) { if (businessNo != null) {
switch (name) { switch (businessNo) {
case "获取合同和采购订单信息,生成销售订单": case 1:
String synchronization1 = kingdeeJournalService.synchronizationAdd(name, king); String synchronization1 = kingdeeJournalService.synchronizationAdd(businessNo, king);
jsonObject = JSONObject.fromObject(synchronization1); jsonObject = JSONObject.fromObject(synchronization1);
ok = Result.OK(jsonObject); ok = Result.OK(jsonObject);
break; break;
case "供货单": case 2:
lists = kingdeeJournalService.synchronizationSelect(name, king); lists = kingdeeJournalService.synchronizationSelect(king);
success = supplyListIService.synchronization(new HashMap<String, List<List<Object>>>() {{ success = supplyListIService.synchronization(new HashMap<String, List<List<Object>>>() {{
put(king, lists); put(king, lists);
}}); }});
ok = Result.OK(success); ok = Result.OK(success);
break; break;
case "推送销售订单": case 3:
lists = kingdeeJournalService.synchronizationSelect(name, king); lists = kingdeeJournalService.synchronizationSelect(king);
success = salesOrderService.synchronization(new HashMap<String, List<List<Object>>>() {{ success = salesOrderService.synchronization(new HashMap<String, List<List<Object>>>() {{
put(king, lists); put(king, lists);
}}); }});
ok = Result.OK(success); ok = Result.OK(success);
break; break;
case "推送生产订单": case 4:
lists = kingdeeJournalService.synchronizationSelect(name, king); lists = kingdeeJournalService.synchronizationSelect(king);
success = productionOrderService.synchronization(new HashMap<String, List<List<Object>>>() {{ success = productionOrderService.synchronization(new HashMap<String, List<List<Object>>>() {{
put(king, lists); put(king, lists);
}}); }});
ok = Result.OK(success); ok = Result.OK(success);
break; break;
case "推送实物ID信息": case 5:
lists = kingdeeJournalService.synchronizationSelect(name, king); lists = kingdeeJournalService.synchronizationSelect(king);
success = productionSchedulingService.synchronization(new HashMap<String, List<List<Object>>>() {{
put(king, lists);
}});
ok = Result.OK(success);
break;
case 6:
lists = kingdeeJournalService.synchronizationSelect(king);
success = iMaterialinventoryService.synchronization(new HashMap<String, List<List<Object>>>() {{
put(king, lists);
}});
ok = Result.OK(success);
break;
case 7:
lists = kingdeeJournalService.synchronizationSelect(king);
success = physicalIDerrorService.synchronization(new HashMap<String, List<List<Object>>>() {{ success = physicalIDerrorService.synchronization(new HashMap<String, List<List<Object>>>() {{
put(king, lists); put(king, lists);
}}); }});
ok = Result.OK(success); ok = Result.OK(success);
break; break;
case 8:
lists = kingdeeJournalService.synchronizationSelect(king);
success = reserveStockService.synchronization(new HashMap<String, List<List<Object>>>() {{
put(king, lists);
}});
ok = Result.OK(success);
break;
case 9:
lists = kingdeeJournalService.synchronizationSelect(king);
success = productInventoryService.synchronization(new HashMap<String, List<List<Object>>>() {{
put(king, lists);
}});
ok = Result.OK(success);
break;
} }
} }
......
...@@ -29,16 +29,23 @@ public class KingdeeJournal { ...@@ -29,16 +29,23 @@ public class KingdeeJournal {
private String request; private String request;
//金蝶响应信息 //金蝶响应信息
private String response; private String response;
/**创建日期*/ /**
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss") * 创建日期
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") */
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@ApiModelProperty(value = "创建日期") @ApiModelProperty(value = "创建日期")
private java.util.Date createtime; private java.util.Date createtime;
/**数据同步:失败:0,成功:1*/ /**
* 数据同步:失败:0,成功:1
*/
private Integer synchronization; private Integer synchronization;
/**是否已成功:失败:0,成功:1*/ /**
* 是否已成功:失败:0,成功:1
*/
private Integer successagain; private Integer successagain;
/**业务编号**/
private Integer businessNo;
} }
...@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.extension.service.IService; ...@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.extension.service.IService;
import net.sf.json.JSONObject; import net.sf.json.JSONObject;
import org.jeecg.modules.iost.API.entity.Materialinventoryerror; import org.jeecg.modules.iost.API.entity.Materialinventoryerror;
import java.text.ParseException;
import java.util.Map; import java.util.Map;
/** /**
...@@ -22,5 +23,5 @@ public interface IMaterialinventoryService extends IService<Materialinventoryerr ...@@ -22,5 +23,5 @@ public interface IMaterialinventoryService extends IService<Materialinventoryerr
public JSONObject select(Map<String,String> map); public JSONObject select(Map<String,String> map);
public Materialinventoryerror synchronization(Object object); public Boolean synchronization(Object object) throws ParseException;
} }
...@@ -6,6 +6,7 @@ import net.sf.json.JSONObject; ...@@ -6,6 +6,7 @@ import net.sf.json.JSONObject;
import org.jeecg.modules.iost.API.entity.Materialinventoryerror; import org.jeecg.modules.iost.API.entity.Materialinventoryerror;
import org.jeecg.modules.iost.API.entity.Productinventoryerror; import org.jeecg.modules.iost.API.entity.Productinventoryerror;
import java.text.ParseException;
import java.util.Map; import java.util.Map;
/** /**
...@@ -16,5 +17,5 @@ public interface IProductInventoryService extends IService<Productinventoryerror ...@@ -16,5 +17,5 @@ public interface IProductInventoryService extends IService<Productinventoryerror
public JSONObject select(Map<String,String> map); public JSONObject select(Map<String,String> map);
public Productinventoryerror synchronization(Object object); public Boolean synchronization(Object object) throws ParseException;
} }
...@@ -6,6 +6,7 @@ import net.sf.json.JSONObject; ...@@ -6,6 +6,7 @@ import net.sf.json.JSONObject;
import org.jeecg.modules.iost.API.entity.Productionordererror; import org.jeecg.modules.iost.API.entity.Productionordererror;
import org.jeecg.modules.iost.API.entity.Productionschedulingerror; import org.jeecg.modules.iost.API.entity.Productionschedulingerror;
import java.text.ParseException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Map; import java.util.Map;
...@@ -20,7 +21,7 @@ public interface IProductionSchedulingService extends IService<Productionschedul ...@@ -20,7 +21,7 @@ public interface IProductionSchedulingService extends IService<Productionschedul
public JSONObject select(Map<String,String> map); public JSONObject select(Map<String,String> map);
public void synchronization(); public Boolean synchronization(Object object) throws ParseException;
public void addProductionscheduling(String rs,Map<String,String> stringStringMap,ArrayList<Productionschedulingerror> productionschedulingerrors); public void addProductionscheduling(String rs,Map<String,String> stringStringMap,ArrayList<Productionschedulingerror> productionschedulingerrors);
} }
...@@ -5,6 +5,7 @@ import net.sf.json.JSONObject; ...@@ -5,6 +5,7 @@ import net.sf.json.JSONObject;
import org.jeecg.modules.iost.API.entity.Materialinventoryerror; import org.jeecg.modules.iost.API.entity.Materialinventoryerror;
import org.jeecg.modules.iost.API.entity.Reservestockerror; import org.jeecg.modules.iost.API.entity.Reservestockerror;
import java.text.ParseException;
import java.util.Map; import java.util.Map;
/** /**
...@@ -18,5 +19,5 @@ public interface IReserveStockService extends IService<Reservestockerror> { ...@@ -18,5 +19,5 @@ public interface IReserveStockService extends IService<Reservestockerror> {
public JSONObject select(Map<String,String> map); public JSONObject select(Map<String,String> map);
public Reservestockerror synchronization(Object object); public Boolean synchronization(Object object) throws ParseException;
} }
...@@ -6,6 +6,6 @@ import org.jeecg.modules.iost.API.entity.kingdeejournal.KingdeeJournal; ...@@ -6,6 +6,6 @@ import org.jeecg.modules.iost.API.entity.kingdeejournal.KingdeeJournal;
import java.util.List; import java.util.List;
public interface KingdeeJournalService extends IService<KingdeeJournal> { public interface KingdeeJournalService extends IService<KingdeeJournal> {
public String synchronizationAdd(String name,String request); public String synchronizationAdd(Integer businessNo,String request);
public List<List<Object>> synchronizationSelect(String name, String request); public List<List<Object>> synchronizationSelect( String request);
} }
...@@ -22,16 +22,16 @@ public class KingdeeJournalServiceImpl extends ServiceImpl<KingdeeJournalMapper, ...@@ -22,16 +22,16 @@ public class KingdeeJournalServiceImpl extends ServiceImpl<KingdeeJournalMapper,
private CategoryDao categoryDao; private CategoryDao categoryDao;
@Override @Override
public String synchronizationAdd(String name, String request) { public String synchronizationAdd(Integer businessNo, String request) {
String add = null; String add = null;
if (name != null) { if (businessNo != null) {
add = salesOrderWebapi.add(request); add = salesOrderWebapi.add(request);
} }
return add; return add;
} }
@Override @Override
public List<List<Object>> synchronizationSelect(String name, String request) { public List<List<Object>> synchronizationSelect( String request) {
List<List<Object>> select = categoryDao.select(request); List<List<Object>> select = categoryDao.select(request);
......
...@@ -13,9 +13,11 @@ import org.jeecg.modules.iost.API.service.KingdeeJournalService; ...@@ -13,9 +13,11 @@ import org.jeecg.modules.iost.API.service.KingdeeJournalService;
import org.jeecg.modules.iost.API.service.pojo.MaterialinventoryPojoService; import org.jeecg.modules.iost.API.service.pojo.MaterialinventoryPojoService;
import org.jeecg.modules.iost.API.webapi.MaterialWebapi; import org.jeecg.modules.iost.API.webapi.MaterialWebapi;
import org.jeecg.modules.iost.API.webapi.MaterialinventoryWebapi; import org.jeecg.modules.iost.API.webapi.MaterialinventoryWebapi;
import org.jeecg.modules.iost.API.webapi.Util.WebApiLog;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.text.ParseException;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.*; import java.util.*;
...@@ -27,6 +29,8 @@ import java.util.*; ...@@ -27,6 +29,8 @@ import java.util.*;
*/ */
@Service @Service
public class MaterialinventoryServiceImpl extends ServiceImpl<MaterialinventoryMapeer, Materialinventoryerror> implements IMaterialinventoryService { public class MaterialinventoryServiceImpl extends ServiceImpl<MaterialinventoryMapeer, Materialinventoryerror> implements IMaterialinventoryService {
private final String name = "重点材料";
private final Integer BusinessNo = 6;
@Autowired @Autowired
MaterialinventoryApi materialinventoryApi; MaterialinventoryApi materialinventoryApi;
@Autowired @Autowired
...@@ -58,13 +62,26 @@ public class MaterialinventoryServiceImpl extends ServiceImpl<MaterialinventoryM ...@@ -58,13 +62,26 @@ public class MaterialinventoryServiceImpl extends ServiceImpl<MaterialinventoryM
* @return * @return
*/ */
@Override @Override
public Materialinventoryerror synchronization(Object object) { public Boolean synchronization(Object object) throws ParseException {
List<Materialinventoryerror> lists=new ArrayList<>(); List<Materialinventoryerror> lists=new ArrayList<>();
List<Materialinventory> pojolist=new ArrayList<>(); List<Materialinventory> pojolist=new ArrayList<>();
//查询今天的入库单数据 //查询今天的入库单数据
List<Map<String, String>> list = materialinventoryWebapi.select(null,null ); Boolean success = true;
//设置金蝶日志 Map<String, List<List<Object>>> synchronization = null;
KingdeeLog(list); //拆解select-获取金蝶云星空的响应信息数据
List<Map<String, String>> list = null;
if (object == null) {
synchronization = materialinventoryWebapi.synchronization(null, null);
} else {
synchronization = (Map<String, List<List<Object>>>) object;
}
//保存金蝶云操作的日志记录
list = KingdeeLog(synchronization);
if (list == null || list.size() < 1) return false;
// List<Map<String, String>> list = materialinventoryWebapi.select(null,null );
// //设置金蝶日志
// KingdeeLog(list);
//遍历集合拿到所有的MAP //遍历集合拿到所有的MAP
for(Map<String,String> data:list){ for(Map<String,String> data:list){
//设置同步代码的同步信息 //设置同步代码的同步信息
...@@ -120,7 +137,7 @@ public class MaterialinventoryServiceImpl extends ServiceImpl<MaterialinventoryM ...@@ -120,7 +137,7 @@ public class MaterialinventoryServiceImpl extends ServiceImpl<MaterialinventoryM
if (this.saveBatch(lists)){ if (this.saveBatch(lists)){
} }
return null; return success;
} }
/** /**
...@@ -140,4 +157,21 @@ public class MaterialinventoryServiceImpl extends ServiceImpl<MaterialinventoryM ...@@ -140,4 +157,21 @@ public class MaterialinventoryServiceImpl extends ServiceImpl<MaterialinventoryM
} }
kingdeeJournalService.save(kingdeeJournal); kingdeeJournalService.save(kingdeeJournal);
} }
//设置金蝶的请求日志
public List<Map<String, String>> KingdeeLog(Map<String, List<List<Object>>> synchronization) throws ParseException {
List<List<Object>> selectInList = null;
List<Map<String, String>> list = null;
if (synchronization != null)
for (String key : synchronization.keySet()) {
selectInList = synchronization.get(key);
WebApiLog webApiLog = new WebApiLog();
Boolean ny = webApiLog.setKingdeeJournal(key, name,BusinessNo, selectInList);
if (ny) {//记录金蝶日志并判断是否转换国网字段
list = materialinventoryWebapi.Materialinventory(selectInList);
}
break;
}
return list;
}
} }
...@@ -34,6 +34,8 @@ import java.util.*; ...@@ -34,6 +34,8 @@ import java.util.*;
@Slf4j @Slf4j
@Service @Service
public class PhysicalIDerrorServiceImpl extends ServiceImpl<PhysicaliderrorMapper, Physicaliderror> implements IPhysicalIDerrorService { public class PhysicalIDerrorServiceImpl extends ServiceImpl<PhysicaliderrorMapper, Physicaliderror> implements IPhysicalIDerrorService {
private final String name = "推送实物ID信息";
private final Integer BusinessNo = 7;
@Autowired @Autowired
PhysicalIDApi physicalIDApi; PhysicalIDApi physicalIDApi;
@Autowired @Autowired
...@@ -56,10 +58,10 @@ public class PhysicalIDerrorServiceImpl extends ServiceImpl<PhysicaliderrorMappe ...@@ -56,10 +58,10 @@ public class PhysicalIDerrorServiceImpl extends ServiceImpl<PhysicaliderrorMappe
@Override @Override
public JSONObject selectInList(Map<String, String> map) throws ParseException { public JSONObject selectInList(Map<String, String> map) throws ParseException {
Map<String, List<List<Object>>> list = physicalIDWebapi.selectInList(null, new HashMap<String, String>() {{ Map<String, List<List<Object>>> list = physicalIDWebapi.selectInList(null, new LinkedHashMap<String, String>() {{
// put("FApproveDate >", "2018-11-26T15:00:37.217");beforeDayByNowDay // put("FApproveDate >", "2018-11-26T15:00:37.217");beforeDayByNowDay
// put("FApproveDate >", new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date()));
put("FApproveDate >", beforeDayByNowDay()); put("FApproveDate >", beforeDayByNowDay());
put("FApproveDate =<", new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS").format(new Date()));
}}); }});
System.out.println("list" + list); System.out.println("list" + list);
return null; return null;
...@@ -73,6 +75,7 @@ public class PhysicalIDerrorServiceImpl extends ServiceImpl<PhysicaliderrorMappe ...@@ -73,6 +75,7 @@ public class PhysicalIDerrorServiceImpl extends ServiceImpl<PhysicaliderrorMappe
if (object == null) { if (object == null) {
stringListMap = physicalIDWebapi.selectInList(null, new HashMap<String, String>() {{ stringListMap = physicalIDWebapi.selectInList(null, new HashMap<String, String>() {{
put("FApproveDate >", getTime()); put("FApproveDate >", getTime());
put("FApproveDate =<", new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS").format(new Date()));
}}); }});
} else { } else {
stringListMap = (Map<String, List<List<Object>>>) object; stringListMap = (Map<String, List<List<Object>>>) object;
...@@ -161,7 +164,7 @@ public class PhysicalIDerrorServiceImpl extends ServiceImpl<PhysicaliderrorMappe ...@@ -161,7 +164,7 @@ public class PhysicalIDerrorServiceImpl extends ServiceImpl<PhysicaliderrorMappe
for (String key : stringListMap.keySet()) { for (String key : stringListMap.keySet()) {
List<List<Object>> list = stringListMap.get(key); List<List<Object>> list = stringListMap.get(key);
WebApiLog webApiLog = new WebApiLog(); WebApiLog webApiLog = new WebApiLog();
Boolean ny = webApiLog.setKingdeeJournal(key, "推送实物ID信息", list); Boolean ny = webApiLog.setKingdeeJournal(key, name,BusinessNo, list);
if (ny) {//记录金蝶日志并判断是否转换国网字段 if (ny) {//记录金蝶日志并判断是否转换国网字段
selectInList = physicalIDWebapi.PhysicalID(list);//字段转换 selectInList = physicalIDWebapi.PhysicalID(list);//字段转换
} }
......
...@@ -15,9 +15,11 @@ import org.jeecg.modules.iost.API.service.KingdeeJournalService; ...@@ -15,9 +15,11 @@ import org.jeecg.modules.iost.API.service.KingdeeJournalService;
import org.jeecg.modules.iost.API.service.pojo.ProductinventoryPojoService; import org.jeecg.modules.iost.API.service.pojo.ProductinventoryPojoService;
import org.jeecg.modules.iost.API.webapi.MaterialWebapi; import org.jeecg.modules.iost.API.webapi.MaterialWebapi;
import org.jeecg.modules.iost.API.webapi.ProductInventoryWebapi; import org.jeecg.modules.iost.API.webapi.ProductInventoryWebapi;
import org.jeecg.modules.iost.API.webapi.Util.WebApiLog;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.text.ParseException;
import java.util.*; import java.util.*;
/** /**
...@@ -25,6 +27,8 @@ import java.util.*; ...@@ -25,6 +27,8 @@ import java.util.*;
*/ */
@Service @Service
public class ProductInventoryServiceImpl extends ServiceImpl<ProductInventoryMapper, Productinventoryerror> implements IProductInventoryService { public class ProductInventoryServiceImpl extends ServiceImpl<ProductInventoryMapper, Productinventoryerror> implements IProductInventoryService {
private final String name = "备品备件";
private final Integer BusinessNo = 8;
@Autowired @Autowired
ProductInventoryApi productInventoryApi; ProductInventoryApi productInventoryApi;
...@@ -56,14 +60,27 @@ public class ProductInventoryServiceImpl extends ServiceImpl<ProductInventoryMap ...@@ -56,14 +60,27 @@ public class ProductInventoryServiceImpl extends ServiceImpl<ProductInventoryMap
* @return * @return
*/ */
@Override @Override
public Productinventoryerror synchronization(Object object) { public Boolean synchronization(Object object) throws ParseException {
//将返回信息保存在集合 //将返回信息保存在集合
List<Productinventoryerror> lists=new ArrayList<>(); List<Productinventoryerror> lists=new ArrayList<>();
List<Productinventory> pojolist=new ArrayList<>(); List<Productinventory> pojolist=new ArrayList<>();
//查询今天更新的产成品 //查询今天更新的产成品
List<Map<String, String>> list = productInventoryWebapi.select(null,null); // List<Map<String, String>> list = productInventoryWebapi.select(null,null);
Boolean success = true;
Map<String, List<List<Object>>> synchronization = null;
//拆解select-获取金蝶云星空的响应信息数据
List<Map<String, String>> list = null;
if (object == null) {
synchronization = productInventoryWebapi.synchronization(null, null);
} else {
synchronization = (Map<String, List<List<Object>>>) object;
}
//保存金蝶云操作的日志记录
list = KingdeeLog(synchronization);
if (list == null || list.size() < 1) return false;
//设置金蝶日志 //设置金蝶日志
KingdeeLog(list); // KingdeeLog(list);
//遍历集合 将每个产成品的信息同步到国网 //遍历集合 将每个产成品的信息同步到国网
for (Map<String,String> data:list) { for (Map<String,String> data:list) {
Productinventoryerror physicaliderror = new Productinventoryerror(); Productinventoryerror physicaliderror = new Productinventoryerror();
...@@ -112,7 +129,7 @@ public class ProductInventoryServiceImpl extends ServiceImpl<ProductInventoryMap ...@@ -112,7 +129,7 @@ public class ProductInventoryServiceImpl extends ServiceImpl<ProductInventoryMap
if (this.saveBatch(lists)){ if (this.saveBatch(lists)){
} }
return null; return success;
} }
/** /**
...@@ -132,4 +149,21 @@ public class ProductInventoryServiceImpl extends ServiceImpl<ProductInventoryMap ...@@ -132,4 +149,21 @@ public class ProductInventoryServiceImpl extends ServiceImpl<ProductInventoryMap
} }
kingdeeJournalService.save(kingdeeJournal); kingdeeJournalService.save(kingdeeJournal);
} }
//设置金蝶的请求日志
public List<Map<String, String>> KingdeeLog(Map<String, List<List<Object>>> synchronization) throws ParseException {
List<List<Object>> selectInList = null;
List<Map<String, String>> list = null;
if (synchronization != null)
for (String key : synchronization.keySet()) {
selectInList = synchronization.get(key);
WebApiLog webApiLog = new WebApiLog();
Boolean ny = webApiLog.setKingdeeJournal(key, name,BusinessNo, selectInList);
if (ny) {//记录金蝶日志并判断是否转换国网字段
list = productInventoryWebapi.ProductInventory(selectInList);
}
break;
}
return list;
}
} }
...@@ -30,6 +30,8 @@ import java.util.Map; ...@@ -30,6 +30,8 @@ import java.util.Map;
@Service @Service
@Slf4j @Slf4j
public class ProductionOrderServiceImpl extends ServiceImpl<ProductionOrderMapper, Productionordererror> implements IProductionOrderService { public class ProductionOrderServiceImpl extends ServiceImpl<ProductionOrderMapper, Productionordererror> implements IProductionOrderService {
private final String name = "推送生产订单";
private final Integer BusinessNo = 4;
@Autowired @Autowired
ProductionOrderApi productionOrderApi; ProductionOrderApi productionOrderApi;
@Autowired @Autowired
...@@ -130,7 +132,7 @@ public class ProductionOrderServiceImpl extends ServiceImpl<ProductionOrderMappe ...@@ -130,7 +132,7 @@ public class ProductionOrderServiceImpl extends ServiceImpl<ProductionOrderMappe
//保存金蝶云操作的日志记录 //保存金蝶云操作的日志记录
public void addKingdeeJournalProductionOrder(String content,List<List<Object>>lists) throws ParseException { public void addKingdeeJournalProductionOrder(String content,List<List<Object>>lists) throws ParseException {
try { try {
webApiLog.setKingdeeJournal(content, "推送生产订单", lists); webApiLog.setKingdeeJournal(content, name,BusinessNo, lists);
} catch (ParseException e) { } catch (ParseException e) {
e.printStackTrace(); e.printStackTrace();
} }
...@@ -144,7 +146,7 @@ public class ProductionOrderServiceImpl extends ServiceImpl<ProductionOrderMappe ...@@ -144,7 +146,7 @@ public class ProductionOrderServiceImpl extends ServiceImpl<ProductionOrderMappe
for (String key : synchronization.keySet()) { for (String key : synchronization.keySet()) {
selectInList = synchronization.get(key); selectInList = synchronization.get(key);
Boolean ny = webApiLog.setKingdeeJournal(key, "推送生产订单", selectInList); Boolean ny = webApiLog.setKingdeeJournal(key, name,BusinessNo, selectInList);
if (ny) {//记录金蝶日志并判断是否转换国网字段 if (ny) {//记录金蝶日志并判断是否转换国网字段
list = productionOrderWebapi.ProductionOrder(selectInList); list = productionOrderWebapi.ProductionOrder(selectInList);
} }
......
...@@ -30,6 +30,8 @@ import java.util.Map; ...@@ -30,6 +30,8 @@ import java.util.Map;
@Service @Service
@Slf4j @Slf4j
public class ProductionSchedulingServiceImpl extends ServiceImpl<ProductionSchedulingMapper, Productionschedulingerror> implements IProductionSchedulingService { public class ProductionSchedulingServiceImpl extends ServiceImpl<ProductionSchedulingMapper, Productionschedulingerror> implements IProductionSchedulingService {
private final String name = "推送排产计划";
private final Integer BusinessNo = 5;
@Autowired @Autowired
ProductionSchedulingApi productionSchedulingApi; ProductionSchedulingApi productionSchedulingApi;
@Autowired @Autowired
...@@ -51,18 +53,33 @@ public class ProductionSchedulingServiceImpl extends ServiceImpl<ProductionSched ...@@ -51,18 +53,33 @@ public class ProductionSchedulingServiceImpl extends ServiceImpl<ProductionSched
/* 同步-(从金蝶云同步数据到国网端,并且对两方操作创建同步日志,明细实体保存) */ /* 同步-(从金蝶云同步数据到国网端,并且对两方操作创建同步日志,明细实体保存) */
@Override @Override
public void synchronization() { public Boolean synchronization(Object object) throws ParseException{
Boolean success = true;
Map<String, List<List<Object>>> synchronization = null;
//拆解select-获取金蝶云星空的响应信息数据
List<Map<String, String>> list = null;
if (object == null) {
synchronization = productionSchedulingWebapi.synchronization(null, null);
} else {
synchronization = (Map<String, List<List<Object>>>) object;
}
//保存金蝶云操作的日志记录
list = addKingdeeJournalProductionScheduling(synchronization);
if (list == null || list.size() < 1) return false;
//从金蝶云查询数据(传给国网用) //从金蝶云查询数据(传给国网用)
List<Object> select = productionSchedulingWebapi.selectObject(null, null); // List<Object> select = productionSchedulingWebapi.selectObject(null, null);
//拆解select-获取传入金蝶云星空请求的条件数据 //拆解select-获取传入金蝶云星空请求的条件数据
String content = (String) select.get(0); // String content = (String) select.get(0);
//拆解select-获取金蝶云星空的响应信息数据 //拆解select-获取金蝶云星空的响应信息数据
List<Map<String, String>> list = (List<Map<String, String>>) select.get(1); // List<Map<String, String>> list = (List<Map<String, String>>) select.get(1);
//List<Map<String, String>> 转化成 List<List<Object>> //List<Map<String, String>> 转化成 List<List<Object>>
List<List<Object>> Lists = ListInsideMapChangeListInsideList(list); // List<List<Object>> Lists = ListInsideMapChangeListInsideList(list);
//保存金蝶云操作的日志记录 //保存金蝶云操作的日志记录
addKingdeeJournalProductionScheduling(content, Lists); // addKingdeeJournalProductionScheduling(content, Lists);
//创建list对象 //创建list对象
ArrayList<Productionschedulingerror> productionschedulingerrors = new ArrayList<>(); ArrayList<Productionschedulingerror> productionschedulingerrors = new ArrayList<>();
ArrayList<Productionscheduling> productionschedulings = new ArrayList<>(); ArrayList<Productionscheduling> productionschedulings = new ArrayList<>();
for (Map<String, String> stringStringMap : list) { for (Map<String, String> stringStringMap : list) {
...@@ -77,6 +94,7 @@ public class ProductionSchedulingServiceImpl extends ServiceImpl<ProductionSched ...@@ -77,6 +94,7 @@ public class ProductionSchedulingServiceImpl extends ServiceImpl<ProductionSched
productionschedulingPojoService.saveBatch(productionschedulings); productionschedulingPojoService.saveBatch(productionschedulings);
//国网日志保存操作 //国网日志保存操作
this.saveBatch(productionschedulingerrors); this.saveBatch(productionschedulingerrors);
return success;
} }
/*List<Map<String, String>> 转化成 List<List<Object>>*/ /*List<Map<String, String>> 转化成 List<List<Object>>*/
public List<List<Object>> ListInsideMapChangeListInsideList(List<Map<String, String>> ListMap) public List<List<Object>> ListInsideMapChangeListInsideList(List<Map<String, String>> ListMap)
...@@ -111,13 +129,29 @@ public class ProductionSchedulingServiceImpl extends ServiceImpl<ProductionSched ...@@ -111,13 +129,29 @@ public class ProductionSchedulingServiceImpl extends ServiceImpl<ProductionSched
//保存金蝶云操作的日志记录 //保存金蝶云操作的日志记录
public void addKingdeeJournalProductionScheduling(String content, List<List<Object>> lists) { public void addKingdeeJournalProductionScheduling(String content, List<List<Object>> lists) {
try { try {
webApiLog.setKingdeeJournal(content, "推送排产计划", lists); webApiLog.setKingdeeJournal(content, name,BusinessNo, lists);
} catch (ParseException e) { } catch (ParseException e) {
e.printStackTrace(); e.printStackTrace();
} }
} }
//保存金蝶云操作的日志记录
public List<Map<String, String>> addKingdeeJournalProductionScheduling(Map<String, List<List<Object>>> synchronization) throws ParseException {
List<List<Object>> selectInList = null;
List<Map<String, String>> list = null;
if (synchronization != null)
for (String key : synchronization.keySet()) {
selectInList = synchronization.get(key);
Boolean ny = webApiLog.setKingdeeJournal(key, name,BusinessNo, selectInList);
if (ny) {//记录金蝶日志并判断是否转换国网字段
list = productionSchedulingWebapi.ProductionScheduling(selectInList);
}
break;
}
return list;
}
/*明细实体类信息保存*/ /*明细实体类信息保存*/
public void pojosave(Map<String, String> stringStringMap,ArrayList<Productionscheduling> productionschedulings) { public void pojosave(Map<String, String> stringStringMap,ArrayList<Productionscheduling> productionschedulings) {
Productionscheduling p = new Productionscheduling(); Productionscheduling p = new Productionscheduling();
......
...@@ -35,7 +35,8 @@ import java.util.*; ...@@ -35,7 +35,8 @@ import java.util.*;
*/ */
@Service @Service
public class PurchaseorderServiceImpl extends ServiceImpl<PurchaseorderMapper, Purchaseorder> implements IPurchaseorderService { public class PurchaseorderServiceImpl extends ServiceImpl<PurchaseorderMapper, Purchaseorder> implements IPurchaseorderService {
private final String name = "获取合同和采购订单信息,生成销售订单";
private final Integer BusinessNo = 1;
@Autowired @Autowired
private PurchaseorderApi purchaseorderApi; private PurchaseorderApi purchaseorderApi;
...@@ -156,7 +157,7 @@ public class PurchaseorderServiceImpl extends ServiceImpl<PurchaseorderMapper, P ...@@ -156,7 +157,7 @@ public class PurchaseorderServiceImpl extends ServiceImpl<PurchaseorderMapper, P
JSONObject ResponseStatus = JSONObject.fromObject(JSONObject.fromObject(Result.get("Result")).get("ResponseStatus")); JSONObject ResponseStatus = JSONObject.fromObject(JSONObject.fromObject(Result.get("Result")).get("ResponseStatus"));
//记录金蝶日志 //记录金蝶日志
System.out.println(); System.out.println();
setKingdeeJournal(JsonUtil.Objectjson(SAL_SaleOrder), "获取合同和采购订单信息,生成销售订单", rswebapi, ResponseStatus); setKingdeeJournal(JsonUtil.Objectjson(SAL_SaleOrder), name, rswebapi, ResponseStatus);
List<Map<String, String>> SuccessEntitys = (List<Map<String, String>>) ResponseStatus.get("SuccessEntitys");//金蝶云返回值SuccessEntitys List<Map<String, String>> SuccessEntitys = (List<Map<String, String>>) ResponseStatus.get("SuccessEntitys");//金蝶云返回值SuccessEntitys
Map<String, String> stringStringMap = SuccessEntitys.get(0); Map<String, String> stringStringMap = SuccessEntitys.get(0);
if (stringStringMap.get("Id") != null && stringStringMap.get("Number") != null) { if (stringStringMap.get("Id") != null && stringStringMap.get("Number") != null) {
...@@ -179,6 +180,7 @@ public class PurchaseorderServiceImpl extends ServiceImpl<PurchaseorderMapper, P ...@@ -179,6 +180,7 @@ public class PurchaseorderServiceImpl extends ServiceImpl<PurchaseorderMapper, P
kingdeeJournal.setName(setName); kingdeeJournal.setName(setName);
kingdeeJournal.setResponse(setResponse); kingdeeJournal.setResponse(setResponse);
kingdeeJournal.setCreatetime(new Date()); kingdeeJournal.setCreatetime(new Date());
kingdeeJournal.setBusinessNo(BusinessNo);
if (setResponse == null || !(Boolean) ResponseStatus.get("IsSuccess") || null == (Boolean) ResponseStatus.get("IsSuccess")) {//判断请求是否错误 if (setResponse == null || !(Boolean) ResponseStatus.get("IsSuccess") || null == (Boolean) ResponseStatus.get("IsSuccess")) {//判断请求是否错误
kingdeeJournal.setSynchronization(0); kingdeeJournal.setSynchronization(0);
ny = false; ny = false;
......
...@@ -16,9 +16,11 @@ import org.jeecg.modules.iost.API.service.KingdeeJournalService; ...@@ -16,9 +16,11 @@ import org.jeecg.modules.iost.API.service.KingdeeJournalService;
import org.jeecg.modules.iost.API.service.pojo.ReservestockPojoService; import org.jeecg.modules.iost.API.service.pojo.ReservestockPojoService;
import org.jeecg.modules.iost.API.webapi.MaterialWebapi; import org.jeecg.modules.iost.API.webapi.MaterialWebapi;
import org.jeecg.modules.iost.API.webapi.ReserveStockWebapi; import org.jeecg.modules.iost.API.webapi.ReserveStockWebapi;
import org.jeecg.modules.iost.API.webapi.Util.WebApiLog;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.text.ParseException;
import java.util.*; import java.util.*;
/** /**
...@@ -29,6 +31,8 @@ import java.util.*; ...@@ -29,6 +31,8 @@ import java.util.*;
*/ */
@Service @Service
public class ReserveStockServiceImpl extends ServiceImpl<ReserveStrockMapper, Reservestockerror> implements IReserveStockService { public class ReserveStockServiceImpl extends ServiceImpl<ReserveStrockMapper, Reservestockerror> implements IReserveStockService {
private final String name = "产成品";
private final Integer BusinessNo = 9;
@Autowired @Autowired
ReserveStockApi reserveStockApi; ReserveStockApi reserveStockApi;
@Autowired @Autowired
...@@ -56,12 +60,27 @@ public class ReserveStockServiceImpl extends ServiceImpl<ReserveStrockMapper, Re ...@@ -56,12 +60,27 @@ public class ReserveStockServiceImpl extends ServiceImpl<ReserveStrockMapper, Re
* @return * @return
*/ */
@Override @Override
public Reservestockerror synchronization(Object object) { public Boolean synchronization(Object object) throws ParseException {
//将返回信息保存在集合 //将返回信息保存在集合
List<Reservestockerror> lists=new ArrayList<>(); List<Reservestockerror> lists=new ArrayList<>();
List<Reservestock> pojolist=new ArrayList<>(); List<Reservestock> pojolist=new ArrayList<>();
//查询今天更新的备品 //查询今天更新的备品
List<Map<String, String>> list = reserveStockWebapi.select(null,null); // List<Map<String, String>> list = reserveStockWebapi.select(null,null);
//查询今天的入库单数据
Boolean success = true;
Map<String, List<List<Object>>> synchronization = null;
//拆解select-获取金蝶云星空的响应信息数据
List<Map<String, String>> list = null;
if (object == null) {
synchronization = reserveStockWebapi.synchronization(null, null);
} else {
synchronization = (Map<String, List<List<Object>>>) object;
}
//保存金蝶云操作的日志记录
list = KingdeeLog(synchronization);
if (list == null || list.size() < 1) return false;
//遍历集合 将每个备品的信息同步到国网 //遍历集合 将每个备品的信息同步到国网
for (Map<String,String> data:list) { for (Map<String,String> data:list) {
Reservestockerror reservestockerror = new Reservestockerror(); Reservestockerror reservestockerror = new Reservestockerror();
...@@ -112,7 +131,7 @@ public class ReserveStockServiceImpl extends ServiceImpl<ReserveStrockMapper, Re ...@@ -112,7 +131,7 @@ public class ReserveStockServiceImpl extends ServiceImpl<ReserveStrockMapper, Re
if (this.saveBatch(lists)){ if (this.saveBatch(lists)){
} }
return null; return success;
} }
/** /**
* 设置金蝶的请求日志 * 设置金蝶的请求日志
...@@ -131,4 +150,21 @@ public class ReserveStockServiceImpl extends ServiceImpl<ReserveStrockMapper, Re ...@@ -131,4 +150,21 @@ public class ReserveStockServiceImpl extends ServiceImpl<ReserveStrockMapper, Re
} }
kingdeeJournalService.save(kingdeeJournal); kingdeeJournalService.save(kingdeeJournal);
} }
//设置金蝶的请求日志
public List<Map<String, String>> KingdeeLog(Map<String, List<List<Object>>> synchronization) throws ParseException {
List<List<Object>> selectInList = null;
List<Map<String, String>> list = null;
if (synchronization != null)
for (String key : synchronization.keySet()) {
selectInList = synchronization.get(key);
WebApiLog webApiLog = new WebApiLog();
Boolean ny = webApiLog.setKingdeeJournal(key, name,BusinessNo, selectInList);
if (ny) {//记录金蝶日志并判断是否转换国网字段
list = reserveStockWebapi.ReserveStock(selectInList);
}
break;
}
return list;
}
} }
...@@ -34,6 +34,8 @@ import java.util.Map; ...@@ -34,6 +34,8 @@ import java.util.Map;
@Service @Service
@Slf4j @Slf4j
public class SalesOrderServiceImpl extends ServiceImpl<SalesOrderMapper, Salesordererror> implements ISalesOrderService { public class SalesOrderServiceImpl extends ServiceImpl<SalesOrderMapper, Salesordererror> implements ISalesOrderService {
private final String name = "推送销售订单";
private final Integer BusinessNo = 3;
@Autowired @Autowired
private SalesOrderApi salesOrderApi; private SalesOrderApi salesOrderApi;
@Autowired @Autowired
...@@ -154,7 +156,7 @@ public class SalesOrderServiceImpl extends ServiceImpl<SalesOrderMapper, Salesor ...@@ -154,7 +156,7 @@ public class SalesOrderServiceImpl extends ServiceImpl<SalesOrderMapper, Salesor
for (String key : synchronization.keySet()) { for (String key : synchronization.keySet()) {
selectInList = synchronization.get(key); selectInList = synchronization.get(key);
WebApiLog webApiLog = new WebApiLog(); WebApiLog webApiLog = new WebApiLog();
Boolean ny = webApiLog.setKingdeeJournal(key, "推送销售订单", selectInList); Boolean ny = webApiLog.setKingdeeJournal(key, name,BusinessNo, selectInList);
if (ny) {//记录金蝶日志并判断是否转换国网字段 if (ny) {//记录金蝶日志并判断是否转换国网字段
list = salesOrderWebapi.SalesOrder(selectInList); list = salesOrderWebapi.SalesOrder(selectInList);
} }
......
...@@ -29,6 +29,8 @@ import java.util.*; ...@@ -29,6 +29,8 @@ import java.util.*;
*/ */
@Service @Service
public class SupplyListIServiceImpl extends ServiceImpl<SupplyListIMapper, Supplylisterror> implements ISupplyListIService { public class SupplyListIServiceImpl extends ServiceImpl<SupplyListIMapper, Supplylisterror> implements ISupplyListIService {
private final String name = "供货单";
private final Integer BusinessNo = 2;
@Autowired @Autowired
SupplyListIApi supplyListIApi; SupplyListIApi supplyListIApi;
@Autowired @Autowired
...@@ -75,7 +77,7 @@ public class SupplyListIServiceImpl extends ServiceImpl<SupplyListIMapper, Suppl ...@@ -75,7 +77,7 @@ public class SupplyListIServiceImpl extends ServiceImpl<SupplyListIMapper, Suppl
for (String key : synchronization.keySet()) { for (String key : synchronization.keySet()) {
selectInList = synchronization.get(key); selectInList = synchronization.get(key);
WebApiLog webApiLog = new WebApiLog(); WebApiLog webApiLog = new WebApiLog();
Boolean ny = webApiLog.setKingdeeJournal(key, "供货单", selectInList); Boolean ny = webApiLog.setKingdeeJournal(key, name,BusinessNo, selectInList);
if (ny) {//记录金蝶日志并判断是否转换国网字段 if (ny) {//记录金蝶日志并判断是否转换国网字段
list = supplyListWebapi.SalesOrder(selectInList); list = supplyListWebapi.SalesOrder(selectInList);
} }
......
...@@ -46,11 +46,22 @@ public class MaterialinventoryWebapi implements web_api { ...@@ -46,11 +46,22 @@ public class MaterialinventoryWebapi implements web_api {
}}); }});
return Materialinventory(list); return Materialinventory(list);
} }
public Map<String, List<List<Object>>> synchronization(Map<String, String> map, String where) {
Map<String, List<List<Object>>> stringListMap = categoryDao.selectMap(sFormId, key,new HashMap<String,String>(){{
//只拿今天的数据
// put("FBILLNO","CGRK29429");
SimpleDateFormat sdf1 =new SimpleDateFormat("yyyy-MM-dd" );
Date d1= new Date();
String str1 = sdf1.format(d1);
put("FDate",str1);
}});
return stringListMap;
}
/** /**
* 重点原材料字段转换国网字段 * 重点原材料字段转换国网字段
* @return * @return
*/ */
private List<Map<String,String>> Materialinventory(List<List<Object>> list){ public List<Map<String,String>> Materialinventory(List<List<Object>> list){
List<Map<String,String>> salesorderlist = new ArrayList<>(); List<Map<String,String>> salesorderlist = new ArrayList<>();
for (List<Object> list1:list) { for (List<Object> list1:list) {
Map<String,String> salesordermap = new HashMap<>(); Map<String,String> salesordermap = new HashMap<>();
......
...@@ -68,13 +68,26 @@ public class ProductInventoryWebapi implements web_api { ...@@ -68,13 +68,26 @@ public class ProductInventoryWebapi implements web_api {
} }
return ProductInventory(lists); return ProductInventory(lists);
} }
public Map<String, List<List<Object>>> synchronization(Map<String, String> map, String where) {
SimpleDateFormat sdf1 =new SimpleDateFormat("yyyy-MM-dd" );
Date d1= new Date();
String str1 = sdf1.format(d1);
//根据查询日期拿到明天
Calendar calendar = Calendar.getInstance();
calendar.setTime(d1);
calendar.add(Calendar.DATE,1);
String date=sdf1.format(calendar.getTime());
Map<String, List<List<Object>>> list = categoryDao.selectdate(sFormId,key,new HashMap<String,String>(){{
put("FUpdateTime",str1);
}},date);
return list;
}
/** /**
* 转换国网字段 * 转换国网字段
* @param list * @param list
* @return * @return
*/ */
private List<Map<String,String>> ProductInventory(List<List<Object>> list){ public List<Map<String,String>> ProductInventory(List<List<Object>> list){
List<Map<String,String>> salesorderlist = new ArrayList<>(); List<Map<String,String>> salesorderlist = new ArrayList<>();
for (List<Object> list1:list) { for (List<Object> list1:list) {
Map<String,String> salesordermap = new HashMap<>(); Map<String,String> salesordermap = new HashMap<>();
......
...@@ -42,7 +42,11 @@ public class ProductionSchedulingWebapi implements web_api { ...@@ -42,7 +42,11 @@ public class ProductionSchedulingWebapi implements web_api {
return ProductionScheduling(list);*/ return ProductionScheduling(list);*/
return null; return null;
} }
public Map<String, List<List<Object>>> synchronization(Map<String, String> map, String where) {
Map<String, List<List<Object>>> stringListMap = categoryDao.selectTodayAndReturnNew(sFormId, key);
return stringListMap;
}
public List<Object>selectObject(Map<String,String> map,String where) { public List<Object>selectObject(Map<String,String> map,String where) {
List<Object> lists = categoryDao.selectTodayAndReturn(sFormId, key); List<Object> lists = categoryDao.selectTodayAndReturn(sFormId, key);
String content = (String)lists.get(0); String content = (String)lists.get(0);
...@@ -61,7 +65,7 @@ public class ProductionSchedulingWebapi implements web_api { ...@@ -61,7 +65,7 @@ public class ProductionSchedulingWebapi implements web_api {
* @return * @return
* *
*/ */
private List<Map<String,String>> ProductionScheduling(List<List<Object>> list){ public List<Map<String,String>> ProductionScheduling(List<List<Object>> list){
List<Map<String,String>> ProductionSchedulinglist = new ArrayList<>(); List<Map<String,String>> ProductionSchedulinglist = new ArrayList<>();
if(!list.isEmpty()) { if(!list.isEmpty()) {
for (List<Object> list1 : list) { for (List<Object> list1 : list) {
......
...@@ -64,11 +64,31 @@ public class ReserveStockWebapi implements web_api { ...@@ -64,11 +64,31 @@ public class ReserveStockWebapi implements web_api {
} }
/** /**
* 从生产订单获取今天的物料信息
*/
public Map<String, List<List<Object>>> synchronization(Map<String, String> map, String where) {
SimpleDateFormat sdf1 = new SimpleDateFormat("yyyy-MM-dd");
Date d1 = new Date();
String str1 = sdf1.format(d1);
//根据查询日期拿到明天
Calendar calendar = Calendar.getInstance();
calendar.setTime(d1);
calendar.add(Calendar.DATE, 1);
String date = sdf1.format(calendar.getTime());
Map<String, List<List<Object>>> list=null;
list= categoryDao.selectdate(sFormId, key, new HashMap<String, String>() {{
put("FCreateDate", str1);
}}, date);
return list;
}
/**
* 备品备件库存字段转换国网字段 * 备品备件库存字段转换国网字段
* *
* @return * @return
*/ */
private List<Map<String, String>> ReserveStock(List<List<Object>> list) { public List<Map<String, String>> ReserveStock(List<List<Object>> list) {
List<Map<String, String>> salesorderlist = new ArrayList<>(); List<Map<String, String>> salesorderlist = new ArrayList<>();
for (List<Object> list1 : list) { for (List<Object> list1 : list) {
Map<String, String> salesordermap = new HashMap<>(); Map<String, String> salesordermap = new HashMap<>();
......
...@@ -35,12 +35,13 @@ public class WebApiLog { ...@@ -35,12 +35,13 @@ public class WebApiLog {
uploadRooms.kingdeeJournalService = this.kingdeeJournalService; uploadRooms.kingdeeJournalService = this.kingdeeJournalService;
} }
public Boolean setKingdeeJournal(String setRequest, String setName, List<List<Object>> setResponse) throws ParseException { public Boolean setKingdeeJournal(String setRequest, String setName,Integer businessNo ,List<List<Object>> setResponse) throws ParseException {
boolean ny = false; boolean ny = false;
KingdeeJournal kingdeeJournal = new KingdeeJournal(); KingdeeJournal kingdeeJournal = new KingdeeJournal();
kingdeeJournal.setRequest(setRequest); kingdeeJournal.setRequest(setRequest);
kingdeeJournal.setName(setName); kingdeeJournal.setName(setName);
kingdeeJournal.setResponse(JsonUtil.Listjson(setResponse)); kingdeeJournal.setResponse(JsonUtil.Listjson(setResponse));
kingdeeJournal.setBusinessNo(businessNo);
kingdeeJournal.setCreatetime(new Date()); kingdeeJournal.setCreatetime(new Date());
if (setResponse == null || setResponse.size() < 1 || setResponse.get(0).size() <= 1) {//判断请求是否错误 if (setResponse == null || setResponse.size() < 1 || setResponse.get(0).size() <= 1) {//判断请求是否错误
kingdeeJournal.setSynchronization(0); kingdeeJournal.setSynchronization(0);
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论