姜永辉 1 год назад
Родитель
Сommit
34c5d00584
1 измененных файлов с 44 добавлено и 31 удалено
  1. 44 31
      src/main/java/com/dk/mdm/service/mst/StaffService.java

+ 44 - 31
src/main/java/com/dk/mdm/service/mst/StaffService.java

@@ -25,11 +25,13 @@ import com.dk.common.service.BaseService;
 import com.dk.common.mapper.BaseMapper;
 import com.dk.mdm.model.query.ivt.InboundItemQuery;
 import com.dk.mdm.model.query.mst.ComMenuQuery;
+import com.dk.mdm.model.query.mst.DictionaryDataQuery;
 import com.dk.mdm.model.query.mst.GoodsCategoryQuery;
 import com.dk.mdm.model.query.mst.StaffQuery;
 import com.dk.common.model.response.mst.StaffResponse;
 import com.dk.common.model.vo.mst.StaffVO;
 import com.dk.mdm.model.response.mst.ComMenuResponse;
+import com.dk.mdm.model.response.mst.DictionaryDataResponse;
 import com.dk.mdm.model.vo.mst.ComMenuVO;
 import com.dk.mdm.service.common.CommonService;
 import lombok.extern.slf4j.Slf4j;
@@ -216,14 +218,14 @@ public class StaffService extends BaseService<Staff> {
                         ErrorCodeEnum.USER_REGISTER_ERROR.getMessage());
             } else {
                 Map<String, Object> mp = (Map<String, Object>) resultMaxnum.getData();
-                int intWebMaxnum =0;
-                if(mp.get("web_max_num") != null ){
-                    intWebMaxnum =  Integer.parseInt(mp.get("web_max_num") + "");
+                int intWebMaxnum = 0;
+                if (mp.get("web_max_num") != null) {
+                    intWebMaxnum = Integer.parseInt(mp.get("web_max_num") + "");
                 }
 
                 int intWxMaxnum = 0;
-                if(mp.get("wx_max_num") != null ){
-                    intWxMaxnum =  Integer.parseInt(mp.get("wx_max_num") + "");
+                if (mp.get("wx_max_num") != null) {
+                    intWxMaxnum = Integer.parseInt(mp.get("wx_max_num") + "");
                 }
                 staffQuery = new StaffQuery();
                 staffQuery.setFlgCanLogin(true);
@@ -418,7 +420,7 @@ public class StaffService extends BaseService<Staff> {
                 role.setFlgNolimitFun(true);
                 role.setFlgNolimitPvw(true);
                 role.setFlgNolimitSen(true);
-            }else{
+            } else {
                 role.setFlgNolimitFun(false);
                 role.setFlgNolimitPvw(false);
                 role.setFlgNolimitSen(false);
@@ -480,6 +482,7 @@ public class StaffService extends BaseService<Staff> {
             for (int i = 0; i < listDictionaryDatas.size(); i++) {
                 Map<String, Object> m = listDictionaryDatas.get(i);
                 DictionaryData dictionaryData = new DictionaryData();
+                dictionaryData.setDataId(UUID.randomUUID().toString());
                 dictionaryData.setDictCode(m.get("dictCode").toString());
                 dictionaryData.setDataCode(m.get("dataCode").toString());
                 dictionaryData.setDataValue(m.get("dataValue").toString());
@@ -501,8 +504,18 @@ public class StaffService extends BaseService<Staff> {
                 MoneyAccount moneyAccount = new MoneyAccount();
                 moneyAccount.setMacCode(m.get("macCode").toString());
                 moneyAccount.setMacName(m.get("macName").toString());
-                moneyAccount.setMacType(m.get("macType").toString());
-                moneyAccount.setAccDate(LocalDate.parse(m.get("accDate").toString()));
+//               从上面数据字典中查询 新的id 240814
+                List<DictionaryData> dictionaryDatas = listDD.stream().filter(it ->
+                        "基础资料-账户".equals(it.getDataCode()) && (m.get("macName") + "").equals(it.getDataValue())
+                ).collect(Collectors.toList());
+
+                if (dictionaryDatas != null && dictionaryDatas.size() > 0) {
+                    moneyAccount.setMacType(dictionaryDatas.get(0).getDataId());
+                } else {
+                    // 该值不正确  要清洗数据
+                    moneyAccount.setMacType(m.get("macType").toString());
+                }
+                moneyAccount.setAccDate(LocalDate.now());
 //                moneyAccount.setBalance((BigDecimal) m.get("balance"));
                 moneyAccount.setBalance(new BigDecimal(m.get("balance").toString()));
                 moneyAccount.setFlgDefault((Boolean) m.get("flgDefault"));
@@ -556,7 +569,7 @@ public class StaffService extends BaseService<Staff> {
                 goodsCategoryMapper.insert(goodsCategory);
                 listG = new ArrayList<>();
                 // 插入子级
-                for(Map<String, Object> c : childList){
+                for (Map<String, Object> c : childList) {
                     GoodsCategory gc = new GoodsCategory();
                     gc.setCatCode(c.get("catCode") + "");
                     gc.setCatName(c.get("catName") + "");
@@ -566,8 +579,9 @@ public class StaffService extends BaseService<Staff> {
                     gc.setCpId(cpId);
                     gc.setOpCreateUserId(staffId);
                     listG.add(gc);
-                };
-                if(listG != null && listG.size() > 0){
+                }
+                ;
+                if (listG != null && listG.size() > 0) {
                     goodsCategoryMapper.insertBatch(listG);
                 }
             }
@@ -676,14 +690,14 @@ public class StaffService extends BaseService<Staff> {
             } else {
                 if (staffResponseOld.getFlgCanLogin() != staffVO.getFlgCanLogin()) {
                     Map<String, Object> mp = (Map<String, Object>) resultMaxnum.getData();
-                    int intWebMaxnum =0;
-                    if(mp.get("web_max_num") != null ){
-                        intWebMaxnum =  Integer.parseInt(mp.get("web_max_num") + "");
+                    int intWebMaxnum = 0;
+                    if (mp.get("web_max_num") != null) {
+                        intWebMaxnum = Integer.parseInt(mp.get("web_max_num") + "");
                     }
 
                     int intWxMaxnum = 0;
-                    if(mp.get("wx_max_num") != null ){
-                        intWxMaxnum =  Integer.parseInt(mp.get("wx_max_num") + "");
+                    if (mp.get("wx_max_num") != null) {
+                        intWxMaxnum = Integer.parseInt(mp.get("wx_max_num") + "");
                     }
                     StaffQuery staffQueryf = new StaffQuery();
                     staffQueryf.setFlgCanLogin(true);
@@ -748,7 +762,7 @@ public class StaffService extends BaseService<Staff> {
      * @author : 姜永辉
      * @date : 2023/1/9 10:49
      */
-    @Transactional(rollbackFor = {Exception.class} )
+    @Transactional(rollbackFor = {Exception.class})
     public ResponseResultVO<Boolean> updateFeignStaffFlgCanLogin(List<String> list) {
         //  FlgCanLogin  登录系统(1:PC端,2:移动端,3:PC+移动端, 4:无)
         staffMapper.updateFeignStaffFlgCanLogin(list);
@@ -915,9 +929,9 @@ public class StaffService extends BaseService<Staff> {
 
 
     /**
-     * @desc   : 生成幽灵标识的数据
+     * @desc : 生成幽灵标识的数据
      * @author : 常皓宁
-     * @date   : 2024/6/19 10:53
+     * @date : 2024/6/19 10:53
      */
     @Transactional(
             rollbackFor = {Exception.class}
@@ -930,9 +944,9 @@ public class StaffService extends BaseService<Staff> {
         staffQuery.setCpId(staff.getCpId());
         List<StaffResponse> staffResponses = staffMapper.selectByCond(staffQuery);
         if (staffResponses == null || staffResponses.size() == 0) {
-            return ResponseResultUtil.error(-200,"绑定员工不存在");
-        }else {
-            for (StaffResponse staffResponse:staffResponses){
+            return ResponseResultUtil.error(-200, "绑定员工不存在");
+        } else {
+            for (StaffResponse staffResponse : staffResponses) {
                 // 获取编码和主键UuId
                 Map<String, Object> codeMap = commonService.getUniqueNoteCode(
                         Constant.docNameConstant.STAFF.getName(), staff.getCpId(), true);
@@ -955,9 +969,9 @@ public class StaffService extends BaseService<Staff> {
     }
 
     /**
-     * @desc   : 删除幽灵标识数据
+     * @desc : 删除幽灵标识数据
      * @author : 常皓宁
-     * @date   : 2024/6/19 10:53
+     * @date : 2024/6/19 10:53
      */
     @Transactional(
             rollbackFor = {Exception.class}
@@ -970,22 +984,21 @@ public class StaffService extends BaseService<Staff> {
         staffQuery.setStaffPhone(staff.getStaffPhone());
         staffQuery.setCpId(staff.getCpId());
         int a = staffMapper.deleteGhostStaff(staffQuery);
-        if (a > 0){
+        if (a > 0) {
             return ResponseResultUtil.success();
-        }
-        else{
-            return ResponseResultUtil.error(-200,"绑定员工不存在");
+        } else {
+            return ResponseResultUtil.error(-200, "绑定员工不存在");
         }
     }
 
     /**
-     * @desc   : 更新负责人标识
+     * @desc : 更新负责人标识
      * @author : 刘尧
-     * @date   : 2024/6/21 16:24
+     * @date : 2024/6/21 16:24
      */
     public ResponseResultVO updateFlgInit(Map<String, Object> params) {
         boolean updateBool = staffMapper.updateFlgInit(params);
-        if (updateBool){
+        if (updateBool) {
             updateBool = staffMapper.updateFlgInitById(String.valueOf(params.get("owner")));
             return ResponseResultUtil.success(updateBool);
         }