@Service("shippedDailyService")
public class ShippedDailyServiceImpl implements ShippedDailyService{
@Autowired
private ShippedDailyMapper mappers;
@Override
public Integer findShippedDailyCount(Map<String, Object> params) throws SQLException, Exception {
return mappers.findShippedDailyCount(params);
}
@Override
public List<TbShippedDaily> findShippedDaily(Map<String, Object> params) throws SQLException, Exception {
return mappers.findShippedDaily(params);
}
@Override
public void saveShippedDaily(SaveTbShippedDaily save) throws SQLException, Exception {
mappers.saveShippedDaily(save);
}
@Override
public void updateShippedDaily(Map<String, Object> params) throws SQLException, Exception {
mappers.updateShippedDaily(params);
}
@Override
public void deleteShippedDaily(Map<String, Object> params) throws SQLException, Exception {
mappers.deleteShippedDaily(params);
}
@Override
public void saveOrUpdateShippedDaily(SaveTbShippedDaily save) {
//数据验证
try {
/*
if("WY-B3-MJ-70CM".equals(save.getStocksku()) == true && "2022-01".equals(save.getYyyymm()) == true) {
System.out.println("开始断点");
}*/
if(save.getSupplierid() == null) {return;}
if(save.getTableName() == null || save.getTableName().length()<=0) {
int XX = save.getSupplierid()%100;
save.setTableName("tb_shipped_daily"+XX);
}
//先查询,如果没有就增加
Map<String, Object> params_find = new HashMap<String, Object>();
params_find.put("tableName", Sys.isCheckNull(save.getTableName()));
params_find.put("supplierids", Sys.isCheckNull(save.getSupplierid()));
params_find.put("companyids", Sys.isCheckNull(save.getCompanyid()));
params_find.put("warehouseids", Sys.isCheckNull(save.getWarehouseid()));
params_find.put("stockids", Sys.isCheckNull(save.getStockid()));
params_find.put("yyyymms", Sys.isCheckNull(save.getYyyymm()));
params_find.put("findallparams", "all");//时间升序
List<TbShippedDaily> list = this.findShippedDaily(params_find);
if(list != null && list.size() > 0) {
Map<String, Object> params_update = new HashMap<String, Object>();
params_update.put("tableName", Sys.isCheckNull(save.getTableName()));
params_update.put("ids", Sys.isCheckNull(list.get(0).getId()));
if(save.getDay1()!=null){params_update.put("Day1",save.getDay1());};
if(save.getDay2()!=null){params_update.put("Day2",save.getDay2());};
if(save.getDay3()!=null){params_update.put("Day3",save.getDay3());};
if(save.getDay4()!=null){params_update.put("Day4",save.getDay4());};
if(save.getDay5()!=null){params_update.put("Day5",save.getDay5());};
if(save.getDay6()!=null){params_update.put("Day6",save.getDay6());};
if(save.getDay7()!=null){params_update.put("Day7",save.getDay7());};
if(save.getDay8()!=null){params_update.put("Day8",save.getDay8());};
if(save.getDay9()!=null){params_update.put("Day9",save.getDay9());};
if(save.getDay10()!=null){params_update.put("Day10",save.getDay10());};
if(save.getDay11()!=null){params_update.put("Day11",save.getDay11());};
if(save.getDay12()!=null){params_update.put("Day12",save.getDay12());};
if(save.getDay13()!=null){params_update.put("Day13",save.getDay13());};
if(save.getDay14()!=null){params_update.put("Day14",save.getDay14());};
if(save.getDay15()!=null){params_update.put("Day15",save.getDay15());};
if(save.getDay16()!=null){params_update.put("Day16",save.getDay16());};
if(save.getDay17()!=null){params_update.put("Day17",save.getDay17());};
if(save.getDay18()!=null){params_update.put("Day18",save.getDay18());};
if(save.getDay19()!=null){params_update.put("Day19",save.getDay19());};
if(save.getDay20()!=null){params_update.put("Day20",save.getDay20());};
if(save.getDay21()!=null){params_update.put("Day21",save.getDay21());};
if(save.getDay22()!=null){params_update.put("Day22",save.getDay22());};
if(save.getDay23()!=null){params_update.put("Day23",save.getDay23());};
if(save.getDay24()!=null){params_update.put("Day24",save.getDay24());};
if(save.getDay25()!=null){params_update.put("Day25",save.getDay25());};
if(save.getDay26()!=null){params_update.put("Day26",save.getDay26());};
if(save.getDay27()!=null){params_update.put("Day27",save.getDay27());};
if(save.getDay28()!=null){params_update.put("Day28",save.getDay28());};
if(save.getDay29()!=null){params_update.put("Day29",save.getDay29());};
if(save.getDay30()!=null){params_update.put("Day30",save.getDay30());};
if(save.getDay31()!=null){params_update.put("Day31",save.getDay31());};
params_update.put("opertime",Sys.getCtime2());
if(save.getReturn1()!=null){params_update.put("return1",save.getReturn1());};
if(save.getReturn2()!=null){params_update.put("return2",save.getReturn2());};
if(save.getReturn3()!=null){params_update.put("return3",save.getReturn3());};
if(save.getReturn4()!=null){params_update.put("return4",save.getReturn4());};
if(save.getReturn5()!=null){params_update.put("return5",save.getReturn5());};
if(save.getReturn6()!=null){params_update.put("return6",save.getReturn6());};
if(save.getReturn7()!=null){params_update.put("return7",save.getReturn7());};
if(save.getReturn8()!=null){params_update.put("return8",save.getReturn8());};
if(save.getReturn9()!=null){params_update.put("return9",save.getReturn9());};
if(save.getReturn10()!=null){params_update.put("return10",save.getReturn10());};
if(save.getReturn11()!=null){params_update.put("return11",save.getReturn11());};
if(save.getReturn12()!=null){params_update.put("return12",save.getReturn12());};
if(save.getReturn13()!=null){params_update.put("return13",save.getReturn13());};
if(save.getReturn14()!=null){params_update.put("return14",save.getReturn14());};
if(save.getReturn15()!=null){params_update.put("return15",save.getReturn15());};
if(save.getReturn16()!=null){params_update.put("return16",save.getReturn16());};
if(save.getReturn17()!=null){params_update.put("return17",save.getReturn17());};
if(save.getReturn18()!=null){params_update.put("return18",save.getReturn18());};
if(save.getReturn19()!=null){params_update.put("return19",save.getReturn19());};
if(save.getReturn20()!=null){params_update.put("return20",save.getReturn20());};
if(save.getReturn21()!=null){params_update.put("return21",save.getReturn21());};
if(save.getReturn22()!=null){params_update.put("return22",save.getReturn22());};
if(save.getReturn23()!=null){params_update.put("return23",save.getReturn23());};
if(save.getReturn24()!=null){params_update.put("return24",save.getReturn24());};
if(save.getReturn25()!=null){params_update.put("return25",save.getReturn25());};
if(save.getReturn26()!=null){params_update.put("return26",save.getReturn26());};
if(save.getReturn27()!=null){params_update.put("return27",save.getReturn27());};
if(save.getReturn28()!=null){params_update.put("return28",save.getReturn28());};
if(save.getReturn29()!=null){params_update.put("return29",save.getReturn29());};
if(save.getReturn30()!=null){params_update.put("return30",save.getReturn30());};
if(save.getReturn31()!=null){params_update.put("return31",save.getReturn31());};
params_update.put("returntime",Sys.getCtime2());
this.updateShippedDaily(params_update);
}else {
this.saveShippedDaily(save);
}
} catch (SQLException e) {
System.out.println("saveOrUpdateShippedDaily.SQLException异常:"+e.getMessage());
} catch (Exception e) {
System.out.println("saveOrUpdateShippedDaily.Exception异常:"+e.getMessage());
}
}
}
|