|
|
@@ -304,7 +304,7 @@ public class StaffService extends BaseService<Staff> {
|
|
|
role.setRoleName(m.get("roleName").toString());
|
|
|
role.setDisplayNo((Integer) m.get("displayNo"));
|
|
|
role.setCpId(cpId);
|
|
|
- role.setOpCreateUserId(m.get("opCreateUserId").toString());
|
|
|
+ role.setOpCreateUserId(staffId);
|
|
|
listR.add(role);
|
|
|
}
|
|
|
roleMapper.insertBatch(listR);
|
|
|
@@ -322,128 +322,144 @@ public class StaffService extends BaseService<Staff> {
|
|
|
// 仓库
|
|
|
List<Map<String, Object>> listWarehouses = map.get("warehouses");
|
|
|
List<Warehouse> listW = new ArrayList<>();
|
|
|
- for (int i = 0; i < listWarehouses.size(); i++) {
|
|
|
- Map<String, Object> m = listWarehouses.get(i);
|
|
|
- Warehouse warehouse = new Warehouse();
|
|
|
- warehouse.setWhCode(m.get("whCode").toString());
|
|
|
- warehouse.setWhName(m.get("whName").toString());
|
|
|
- warehouse.setDisplayNo((Integer) m.get("displayNo"));
|
|
|
- warehouse.setFlgDefault((Boolean) m.get("flgDefault"));
|
|
|
- warehouse.setCpId(cpId);
|
|
|
- warehouse.setOpCreateUserId(m.get("opCreateUserId").toString());
|
|
|
- listW.add(warehouse);
|
|
|
+ if (listWarehouses != null && listWarehouses.size() > 0) {
|
|
|
+ for (int i = 0; i < listWarehouses.size(); i++) {
|
|
|
+ Map<String, Object> m = listWarehouses.get(i);
|
|
|
+ Warehouse warehouse = new Warehouse();
|
|
|
+ warehouse.setWhCode(m.get("whCode").toString());
|
|
|
+ warehouse.setWhName(m.get("whName").toString());
|
|
|
+ warehouse.setDisplayNo((Integer) m.get("displayNo"));
|
|
|
+ warehouse.setFlgDefault((Boolean) m.get("flgDefault"));
|
|
|
+ warehouse.setCpId(cpId);
|
|
|
+ warehouse.setOpCreateUserId(staffId);
|
|
|
+ listW.add(warehouse);
|
|
|
+ }
|
|
|
+ warehouseMapper.insertBatch(listW);
|
|
|
}
|
|
|
- warehouseMapper.insertBatch(listW);
|
|
|
+
|
|
|
// 渠道
|
|
|
List<Map<String, Object>> listSaleChannels = map.get("saleChannels");
|
|
|
List<SaleChannel> listSc = new ArrayList<>();
|
|
|
- for (int i = 0; i < listSaleChannels.size(); i++) {
|
|
|
- Map<String, Object> m = listSaleChannels.get(i);
|
|
|
- SaleChannel saleChannel = new SaleChannel();
|
|
|
- saleChannel.setChannelCode(m.get("channelCode").toString());
|
|
|
- saleChannel.setChannelName(m.get("channelName").toString());
|
|
|
- saleChannel.setDisplayNo((Integer) m.get("displayNo"));
|
|
|
- saleChannel.setFlgDefault((Boolean) m.get("flgDefault"));
|
|
|
- saleChannel.setCpId(cpId);
|
|
|
- saleChannel.setOpCreateUserId(m.get("opCreateUserId").toString());
|
|
|
- listSc.add(saleChannel);
|
|
|
+ if (listSaleChannels != null && listSaleChannels.size() > 0) {
|
|
|
+ for (int i = 0; i < listSaleChannels.size(); i++) {
|
|
|
+ Map<String, Object> m = listSaleChannels.get(i);
|
|
|
+ SaleChannel saleChannel = new SaleChannel();
|
|
|
+ saleChannel.setChannelCode(m.get("channelCode").toString());
|
|
|
+ saleChannel.setChannelName(m.get("channelName").toString());
|
|
|
+ saleChannel.setDisplayNo((Integer) m.get("displayNo"));
|
|
|
+ saleChannel.setFlgDefault((Boolean) m.get("flgDefault"));
|
|
|
+ saleChannel.setCpId(cpId);
|
|
|
+ saleChannel.setOpCreateUserId(staffId);
|
|
|
+ listSc.add(saleChannel);
|
|
|
+ }
|
|
|
+ saleChannelMapper.insertBatch(listSc);
|
|
|
}
|
|
|
- saleChannelMapper.insertBatch(listSc);
|
|
|
+
|
|
|
// 基础资料
|
|
|
List<Map<String, Object>> listDictionaryDatas = map.get("dictionaryDatas");
|
|
|
List<DictionaryData> listDD = new ArrayList<>();
|
|
|
- for (int i = 0; i < listDictionaryDatas.size(); i++) {
|
|
|
- Map<String, Object> m = listDictionaryDatas.get(i);
|
|
|
- DictionaryData dictionaryData = new DictionaryData();
|
|
|
- dictionaryData.setDictCode(m.get("dictCode").toString());
|
|
|
- dictionaryData.setDataCode(m.get("dataCode").toString());
|
|
|
- dictionaryData.setDataValue(m.get("dataValue").toString());
|
|
|
- dictionaryData.setDisplayNo((Integer) m.get("displayNo"));
|
|
|
- dictionaryData.setFlgDefault((Boolean) m.get("flgDefault"));
|
|
|
- dictionaryData.setCpId(cpId);
|
|
|
- dictionaryData.setOpCreateUserId(m.get("opCreateUserId").toString());
|
|
|
- listDD.add(dictionaryData);
|
|
|
+ if (listDictionaryDatas != null && listDictionaryDatas.size() > 0) {
|
|
|
+ for (int i = 0; i < listDictionaryDatas.size(); i++) {
|
|
|
+ Map<String, Object> m = listDictionaryDatas.get(i);
|
|
|
+ DictionaryData dictionaryData = new DictionaryData();
|
|
|
+ dictionaryData.setDictCode(m.get("dictCode").toString());
|
|
|
+ dictionaryData.setDataCode(m.get("dataCode").toString());
|
|
|
+ dictionaryData.setDataValue(m.get("dataValue").toString());
|
|
|
+ dictionaryData.setDisplayNo((Integer) m.get("displayNo"));
|
|
|
+ dictionaryData.setFlgDefault((Boolean) m.get("flgDefault"));
|
|
|
+ dictionaryData.setCpId(cpId);
|
|
|
+ dictionaryData.setOpCreateUserId(staffId);
|
|
|
+ listDD.add(dictionaryData);
|
|
|
+ }
|
|
|
+ dictionaryDataMapper.insertBatch(listDD);
|
|
|
}
|
|
|
- dictionaryDataMapper.insertBatch(listDD);
|
|
|
+
|
|
|
// 资金账户
|
|
|
List<Map<String, Object>> listMoneyAccounts = map.get("moneyAccounts");
|
|
|
List<MoneyAccount> listMa = new ArrayList<>();
|
|
|
- for (int i = 0; i < listMoneyAccounts.size(); i++) {
|
|
|
- Map<String, Object> m = listMoneyAccounts.get(i);
|
|
|
- MoneyAccount moneyAccount = new MoneyAccount();
|
|
|
- moneyAccount.setMacCode(m.get("macCode").toString());
|
|
|
- moneyAccount.setMacName(m.get("macName").toString());
|
|
|
- moneyAccount.setMacType(m.get("macType").toString());
|
|
|
- moneyAccount.setBalance((BigDecimal) m.get("balance"));
|
|
|
- moneyAccount.setFlgDefault((Boolean) m.get("flgDefault"));
|
|
|
- moneyAccount.setDisplayNo((Integer) m.get("displayNo"));
|
|
|
- moneyAccount.setCpId(cpId);
|
|
|
- listMa.add(moneyAccount);
|
|
|
+ if (listMoneyAccounts != null && listMoneyAccounts.size() > 0) {
|
|
|
+ for (int i = 0; i < listMoneyAccounts.size(); i++) {
|
|
|
+ Map<String, Object> m = listMoneyAccounts.get(i);
|
|
|
+ MoneyAccount moneyAccount = new MoneyAccount();
|
|
|
+ moneyAccount.setMacCode(m.get("macCode").toString());
|
|
|
+ moneyAccount.setMacName(m.get("macName").toString());
|
|
|
+ moneyAccount.setMacType(m.get("macType").toString());
|
|
|
+ moneyAccount.setBalance((BigDecimal) m.get("balance"));
|
|
|
+ moneyAccount.setFlgDefault((Boolean) m.get("flgDefault"));
|
|
|
+ moneyAccount.setDisplayNo((Integer) m.get("displayNo"));
|
|
|
+ moneyAccount.setCpId(cpId);
|
|
|
+ listMa.add(moneyAccount);
|
|
|
+ }
|
|
|
+ moneyAccountMapper.insertBatch(listMa);
|
|
|
}
|
|
|
- moneyAccountMapper.insertBatch(listMa);
|
|
|
// 计量单位
|
|
|
List<Map<String, Object>> listUnits = map.get("units");
|
|
|
List<Unit> listU = new ArrayList<>();
|
|
|
- for (int i = 0; i < listUnits.size(); i++) {
|
|
|
- Map<String, Object> m = listUnits.get(i);
|
|
|
- Unit unit = new Unit();
|
|
|
- unit.setUnitCode(m.get("unitCode").toString());
|
|
|
- unit.setUnitName(m.get("unitName").toString());
|
|
|
- unit.setDecimalPlaces((Integer) m.get("decimalPlaces"));
|
|
|
- unit.setDisplayNo((Integer) m.get("displayNo"));
|
|
|
- unit.setCpId(cpId);
|
|
|
- unit.setOpCreateUserId(m.get("opCreateUserId").toString());
|
|
|
- listU.add(unit);
|
|
|
+ if (listUnits != null && listUnits.size() > 0) {
|
|
|
+ for (int i = 0; i < listUnits.size(); i++) {
|
|
|
+ Map<String, Object> m = listUnits.get(i);
|
|
|
+ Unit unit = new Unit();
|
|
|
+ unit.setUnitCode(m.get("unitCode").toString());
|
|
|
+ unit.setUnitName(m.get("unitName").toString());
|
|
|
+ unit.setDecimalPlaces((Integer) m.get("decimalPlaces"));
|
|
|
+ unit.setDisplayNo((Integer) m.get("displayNo"));
|
|
|
+ unit.setCpId(cpId);
|
|
|
+ unit.setOpCreateUserId(staffId);
|
|
|
+ listU.add(unit);
|
|
|
+ }
|
|
|
+ unitMapper.insertBatch(listU);
|
|
|
}
|
|
|
- unitMapper.insertBatch(listU);
|
|
|
+
|
|
|
// 种类
|
|
|
List<Map<String, Object>> listGoodsCategorys = map.get("goodsCategorys");
|
|
|
List<GoodsCategory> listG = new ArrayList<>();
|
|
|
- for (int i = 0; i < listGoodsCategorys.size(); i++) {
|
|
|
- Map<String, Object> m = listGoodsCategorys.get(i);
|
|
|
- GoodsCategory goodsCategory = new GoodsCategory();
|
|
|
- goodsCategory.setCatCode(m.get("catCode") + "");
|
|
|
- goodsCategory.setCatName(m.get("catName") + "");
|
|
|
- if (m.get("parentId") != null) {
|
|
|
- goodsCategory.setParentId(m.get("parentId") + "");
|
|
|
- }
|
|
|
- if (m.get("topId") != null) {
|
|
|
- goodsCategory.setTopId(m.get("topId") + "");
|
|
|
- }
|
|
|
- if (m.get("levelUpper") != null) {
|
|
|
- goodsCategory.setLevelUpper(m.get("levelUpper") + "");
|
|
|
- }
|
|
|
- if (m.get("levelLower") != null) {
|
|
|
- goodsCategory.setLevelLower(m.get("levelLower") + "");
|
|
|
+ if (listGoodsCategorys != null && listGoodsCategorys.size() > 0) {
|
|
|
+ for (int i = 0; i < listGoodsCategorys.size(); i++) {
|
|
|
+ Map<String, Object> m = listGoodsCategorys.get(i);
|
|
|
+ GoodsCategory goodsCategory = new GoodsCategory();
|
|
|
+ goodsCategory.setCatCode(m.get("catCode") + "");
|
|
|
+ goodsCategory.setCatName(m.get("catName") + "");
|
|
|
+ if (m.get("parentId") != null) {
|
|
|
+ goodsCategory.setParentId(m.get("parentId") + "");
|
|
|
+ }
|
|
|
+ if (m.get("topId") != null) {
|
|
|
+ goodsCategory.setTopId(m.get("topId") + "");
|
|
|
+ }
|
|
|
+ if (m.get("levelUpper") != null) {
|
|
|
+ goodsCategory.setLevelUpper(m.get("levelUpper") + "");
|
|
|
+ }
|
|
|
+ if (m.get("levelLower") != null) {
|
|
|
+ goodsCategory.setLevelLower(m.get("levelLower") + "");
|
|
|
+ }
|
|
|
+ goodsCategory.setLevelLeaf((Boolean) m.get("levelLeaf"));
|
|
|
+ goodsCategory.setLevelNo((Integer) m.get("levelNo"));
|
|
|
+ goodsCategory.setLevelCode(m.get("levelCode") + "");
|
|
|
+ goodsCategory.setLevelName(m.get("levelName") + "");
|
|
|
+ goodsCategory.setDisplayNo((Integer) m.get("displayNo"));
|
|
|
+ goodsCategory.setCpId(cpId);
|
|
|
+ goodsCategory.setOpCreateUserId(staffId);
|
|
|
+ listG.add(goodsCategory);
|
|
|
}
|
|
|
- goodsCategory.setLevelLeaf((Boolean) m.get("levelLeaf"));
|
|
|
- goodsCategory.setLevelNo((Integer) m.get("levelNo"));
|
|
|
- goodsCategory.setLevelCode(m.get("levelCode") + "");
|
|
|
- goodsCategory.setLevelName(m.get("levelName") + "");
|
|
|
- goodsCategory.setDisplayNo((Integer) m.get("displayNo"));
|
|
|
- goodsCategory.setCpId(cpId);
|
|
|
- goodsCategory.setOpCreateUserId(m.get("opCreateUserId").toString());
|
|
|
- listG.add(goodsCategory);
|
|
|
+ goodsCategoryMapper.insertBatch(listG);
|
|
|
}
|
|
|
- goodsCategoryMapper.insertBatch(listG);
|
|
|
|
|
|
// 打印票据
|
|
|
List<Map<String, Object>> listPrintLayout = map.get("printLayout");
|
|
|
List<PrintLayout> listP = new ArrayList<>();
|
|
|
- for (int i = 0; i < listPrintLayout.size(); i++) {
|
|
|
- Map<String, Object> m = listPrintLayout.get(i);
|
|
|
- PrintLayout printLayout = new PrintLayout();
|
|
|
- printLayout.setLayoutName(m.get("layoutName") + "");
|
|
|
- printLayout.setLayoutData(JSONObject.parseObject(JSONObject.toJSONString(m.get("layoutData"))));
|
|
|
- printLayout.setDisplayNo((Integer) m.get("displayNo"));
|
|
|
- printLayout.setDocName(m.get("docName") + "");
|
|
|
- printLayout.setCpId(cpId);
|
|
|
- printLayout.setOpCreateUserId(m.get("opCreateUserId").toString());
|
|
|
- listP.add(printLayout);
|
|
|
+ if (listPrintLayout != null && listPrintLayout.size() > 0) {
|
|
|
+ for (int i = 0; i < listPrintLayout.size(); i++) {
|
|
|
+ Map<String, Object> m = listPrintLayout.get(i);
|
|
|
+ PrintLayout printLayout = new PrintLayout();
|
|
|
+ printLayout.setLayoutName(m.get("layoutName") + "");
|
|
|
+ printLayout.setLayoutData(JSONObject.parseObject(JSONObject.toJSONString(m.get("layoutData"))));
|
|
|
+ printLayout.setDisplayNo((Integer) m.get("displayNo"));
|
|
|
+ printLayout.setDocName(m.get("docName") + "");
|
|
|
+ printLayout.setCpId(cpId);
|
|
|
+ printLayout.setOpCreateUserId(staffId);
|
|
|
+ listP.add(printLayout);
|
|
|
+ }
|
|
|
+ printLayoutMapper.insertBatch(listP);
|
|
|
}
|
|
|
- printLayoutMapper.insertBatch(listP);
|
|
|
-
|
|
|
-
|
|
|
return ResponseResultUtil.success();
|
|
|
}
|
|
|
|