|
@@ -16,9 +16,8 @@ import com.dk.mdm.feign.UserFeign;
|
|
|
import com.dk.mdm.infrastructure.convert.mst.StaffConvert;
|
|
import com.dk.mdm.infrastructure.convert.mst.StaffConvert;
|
|
|
import com.dk.mdm.infrastructure.util.AuthUtils;
|
|
import com.dk.mdm.infrastructure.util.AuthUtils;
|
|
|
import com.dk.mdm.mapper.common.CommonMapper;
|
|
import com.dk.mdm.mapper.common.CommonMapper;
|
|
|
-import com.dk.mdm.mapper.mst.ComMenuMapper;
|
|
|
|
|
|
|
+import com.dk.mdm.mapper.mst.*;
|
|
|
import com.dk.mdm.model.pojo.mst.*;
|
|
import com.dk.mdm.model.pojo.mst.*;
|
|
|
-import com.dk.mdm.mapper.mst.StaffMapper;
|
|
|
|
|
import com.dk.common.service.BaseService;
|
|
import com.dk.common.service.BaseService;
|
|
|
import com.dk.common.mapper.BaseMapper;
|
|
import com.dk.common.mapper.BaseMapper;
|
|
|
import com.dk.mdm.model.query.mst.ComMenuQuery;
|
|
import com.dk.mdm.model.query.mst.ComMenuQuery;
|
|
@@ -86,6 +85,21 @@ public class StaffService extends BaseService<Staff> {
|
|
|
|
|
|
|
|
@Autowired
|
|
@Autowired
|
|
|
private AuthUtils authUtils;
|
|
private AuthUtils authUtils;
|
|
|
|
|
+ @Autowired
|
|
|
|
|
+ DictionaryDataMapper dictionaryDataMapper;
|
|
|
|
|
+ @Autowired
|
|
|
|
|
+ GoodsCategoryMapper goodsCategoryMapper;
|
|
|
|
|
+ @Autowired
|
|
|
|
|
+ RoleMapper roleMapper;
|
|
|
|
|
+ @Autowired
|
|
|
|
|
+ RoleFunMapper roleFunMapper;
|
|
|
|
|
+ @Autowired
|
|
|
|
|
+ UnitMapper unitMapper;
|
|
|
|
|
+ @Autowired
|
|
|
|
|
+ SaleChannelMapper saleChannelMapper;
|
|
|
|
|
+ @Autowired
|
|
|
|
|
+ WarehouseMapper warehouseMapper;
|
|
|
|
|
+
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
* @desc : 条件查询
|
|
* @desc : 条件查询
|
|
@@ -95,7 +109,7 @@ public class StaffService extends BaseService<Staff> {
|
|
|
@Pagination
|
|
@Pagination
|
|
|
public ResponseResultVO<PageList<StaffResponse>> selectByCond(StaffQuery staffQuery) {
|
|
public ResponseResultVO<PageList<StaffResponse>> selectByCond(StaffQuery staffQuery) {
|
|
|
// 获取当前公司的cpId
|
|
// 获取当前公司的cpId
|
|
|
- if (staffQuery.getCpId()==null){
|
|
|
|
|
|
|
+ if (staffQuery.getCpId() == null) {
|
|
|
Integer cpId = authUtils.getStaff().getCpId();
|
|
Integer cpId = authUtils.getStaff().getCpId();
|
|
|
staffQuery.setCpId(cpId);
|
|
staffQuery.setCpId(cpId);
|
|
|
}
|
|
}
|
|
@@ -189,14 +203,145 @@ public class StaffService extends BaseService<Staff> {
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
* @desc : 注册商户时候插入 角色 基础资料(仓库 渠道 收入 支出 入库 出库 账户 来源 盈亏原因) 计量单位 种类 打印票据 等等。
|
|
* @desc : 注册商户时候插入 角色 基础资料(仓库 渠道 收入 支出 入库 出库 账户 来源 盈亏原因) 计量单位 种类 打印票据 等等。
|
|
|
- * 返回角色的数据
|
|
|
|
|
|
|
+ * 返回角色的数据
|
|
|
* @author : 姜永辉
|
|
* @author : 姜永辉
|
|
|
* @date : 2023/1/9 10:49
|
|
* @date : 2023/1/9 10:49
|
|
|
*/
|
|
*/
|
|
|
@Transactional(rollbackFor = {Exception.class})
|
|
@Transactional(rollbackFor = {Exception.class})
|
|
|
public ResponseResultVO<?> insertFeignCompanyData(Map<String, List<Map<String, Object>>> map) {
|
|
public ResponseResultVO<?> insertFeignCompanyData(Map<String, List<Map<String, Object>>> map) {
|
|
|
|
|
+ // 公司
|
|
|
|
|
+ List<Map<String, Object>> listCom = map.get("company");
|
|
|
|
|
+ // 版本
|
|
|
|
|
+ String gradeCode = listCom.get(0).get("gradeCode").toString();
|
|
|
|
|
+ // 角色
|
|
|
|
|
+ List<Map<String, Object>> listRoles = map.get("roles");
|
|
|
|
|
+ List<Role> listR = new ArrayList<>();
|
|
|
|
|
+ String roleid = "";
|
|
|
|
|
+ Integer cpid = 0;
|
|
|
|
|
+ String staffid = "";
|
|
|
|
|
+ for (int i = 0; i < listRoles.size(); i++) {
|
|
|
|
|
+ Map<String, Object> m = listRoles.get(i);
|
|
|
|
|
+ Role role = new Role();
|
|
|
|
|
+ //设置编码
|
|
|
|
|
+ Map<String, Object> uniqueNoteCode = commonService.getUniqueNoteCode(Constant.docNameConstant.ROLE.getName(),(Integer) m.get("cpId"), false);
|
|
|
|
|
+ if (Constant.ROLE_DATA.equals(m.get("roleCode").toString())) {
|
|
|
|
|
+ roleid = uniqueNoteCode.get("outId").toString();
|
|
|
|
|
+ cpid = (Integer) m.get("cpId");
|
|
|
|
|
+ staffid = m.get("opCreateUserId").toString();
|
|
|
|
|
+ }
|
|
|
|
|
+ role.setRoleId(uniqueNoteCode.get("outId").toString());
|
|
|
|
|
+ role.setRoleCode(m.get("roleCode").toString());
|
|
|
|
|
+ role.setRoleName(m.get("roleName").toString());
|
|
|
|
|
+ role.setDisplayNo((Integer) m.get("displayNo"));
|
|
|
|
|
+ role.setCpId((Integer) m.get("cpId"));
|
|
|
|
|
+ role.setOpCreateUserId(m.get("opCreateUserId").toString());
|
|
|
|
|
+ listR.add(role);
|
|
|
|
|
+ }
|
|
|
|
|
+ roleMapper.insertBatch(listR);
|
|
|
|
|
+
|
|
|
|
|
+ // 更新用户的角色ids-
|
|
|
|
|
+ List<String> roleids = new ArrayList<>();
|
|
|
|
|
+ roleids.add(roleid);
|
|
|
|
|
+ this.updateByUuid(new Staff().setStaffId(staffid).setRoleIds(roleids));
|
|
|
|
|
+ // 角色权限
|
|
|
|
|
+ RoleFun roleFun = new RoleFun();
|
|
|
|
|
+ roleFun.setRoleId(roleid);
|
|
|
|
|
+ roleFun.setCpId(cpid);
|
|
|
|
|
+ roleFun.setOpCreateUserId(staffid);
|
|
|
|
|
+ roleFunMapper.insertRoleFunFeign(roleFun);
|
|
|
|
|
+ // 仓库
|
|
|
|
|
+ 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((Integer) m.get("cpId"));
|
|
|
|
|
+ warehouse.setOpCreateUserId(m.get("opCreateUserId").toString());
|
|
|
|
|
+ listW.add(warehouse);
|
|
|
|
|
+ }
|
|
|
|
|
+ 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((Integer) m.get("cpId"));
|
|
|
|
|
+ saleChannel.setOpCreateUserId(m.get("opCreateUserId").toString());
|
|
|
|
|
+ listSc.add(saleChannel);
|
|
|
|
|
+ }
|
|
|
|
|
+ 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((Integer) m.get("cpId"));
|
|
|
|
|
+ dictionaryData.setOpCreateUserId(m.get("opCreateUserId").toString());
|
|
|
|
|
+ listDD.add(dictionaryData);
|
|
|
|
|
+ }
|
|
|
|
|
+ dictionaryDataMapper.insertBatch(listDD);
|
|
|
|
|
+ // 计量单位
|
|
|
|
|
+ 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((Integer) m.get("cpId"));
|
|
|
|
|
+ unit.setOpCreateUserId(m.get("opCreateUserId").toString());
|
|
|
|
|
+ listU.add(unit);
|
|
|
|
|
+ }
|
|
|
|
|
+ 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")+ "");
|
|
|
|
|
+ }
|
|
|
|
|
+ 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((Integer) m.get("cpId"));
|
|
|
|
|
+ goodsCategory.setOpCreateUserId(m.get("opCreateUserId").toString());
|
|
|
|
|
+ listG.add(goodsCategory);
|
|
|
|
|
+ }
|
|
|
|
|
+ goodsCategoryMapper.insertBatch(listG);
|
|
|
|
|
|
|
|
- return ResponseResultUtil.success(null);
|
|
|
|
|
|
|
+ return ResponseResultUtil.success();
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@@ -267,9 +412,9 @@ public class StaffService extends BaseService<Staff> {
|
|
|
staffRight.setRightType(1);
|
|
staffRight.setRightType(1);
|
|
|
staffRight.setCpId(cpId);
|
|
staffRight.setCpId(cpId);
|
|
|
}
|
|
}
|
|
|
- if (staffVO.getStaffRightList()!=null && staffVO.getStaffRightList().size() > 0) {
|
|
|
|
|
- staffRightService.saveStaffRight(staffVO.getStaffRightList());
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ if (staffVO.getStaffRightList() != null && staffVO.getStaffRightList().size() > 0) {
|
|
|
|
|
+ staffRightService.saveStaffRight(staffVO.getStaffRightList());
|
|
|
|
|
+ }
|
|
|
return ResponseResultUtil.success();
|
|
return ResponseResultUtil.success();
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -350,7 +495,7 @@ public class StaffService extends BaseService<Staff> {
|
|
|
)
|
|
)
|
|
|
public ResponseResultVO<Dictionary<String, Object>> getInfoAfterLogin(Map<String, Object> param) {
|
|
public ResponseResultVO<Dictionary<String, Object>> getInfoAfterLogin(Map<String, Object> param) {
|
|
|
// 先根据userId查询当前企业的员工信息
|
|
// 先根据userId查询当前企业的员工信息
|
|
|
- StaffResponse staff = staffMapper.selectByUserId(param.get("userId").toString(),Integer.parseInt(param.get("cpId").toString()));
|
|
|
|
|
|
|
+ StaffResponse staff = staffMapper.selectByUserId(param.get("userId").toString(), Integer.parseInt(param.get("cpId").toString()));
|
|
|
if (staff != null) {
|
|
if (staff != null) {
|
|
|
// 存Redis
|
|
// 存Redis
|
|
|
authUtils.saveStaff(new StaffEntity().setStaffId(staff.getStaffId())
|
|
authUtils.saveStaff(new StaffEntity().setStaffId(staff.getStaffId())
|
|
@@ -375,7 +520,7 @@ public class StaffService extends BaseService<Staff> {
|
|
|
Dictionary<String, Object> dic = new Hashtable<>();
|
|
Dictionary<String, Object> dic = new Hashtable<>();
|
|
|
dic.put("menuList", menuList);
|
|
dic.put("menuList", menuList);
|
|
|
dic.put("comMenuList", comMenuList.getData());
|
|
dic.put("comMenuList", comMenuList.getData());
|
|
|
- dic.put("dataKindList", commonMapper.getDataKind(param));
|
|
|
|
|
|
|
+ dic.put("dataKindList", commonMapper.getDataKind(param));
|
|
|
dic.put("settingValue", allSettingValue);
|
|
dic.put("settingValue", allSettingValue);
|
|
|
dic.put("staff", staff);
|
|
dic.put("staff", staff);
|
|
|
return ResponseResultUtil.success(dic);
|
|
return ResponseResultUtil.success(dic);
|