|
|
@@ -1,6 +1,7 @@
|
|
|
package com.fs.hisStore.service.impl;
|
|
|
|
|
|
import com.alibaba.fastjson.JSONArray;
|
|
|
+import com.fs.common.core.domain.R;
|
|
|
import com.fs.common.exception.CustomException;
|
|
|
import com.fs.common.exception.ServiceException;
|
|
|
import com.fs.common.exception.base.BaseException;
|
|
|
@@ -11,6 +12,7 @@ import com.fs.his.utils.ConfigUtil;
|
|
|
import com.fs.his.utils.StoreMD5PasswordEncoder;
|
|
|
import com.fs.hisStore.domain.FsStoreProductScrm;
|
|
|
import com.fs.hisStore.domain.FsStoreScrm;
|
|
|
+import com.fs.hisStore.dto.FsStoreProductScrmInfoDTO;
|
|
|
import com.fs.hisStore.mapper.FsStoreProductScrmMapper;
|
|
|
import com.fs.hisStore.mapper.FsStoreScrmMapper;
|
|
|
import com.fs.hisStore.param.FsStoreScrmInfoParam;
|
|
|
@@ -123,6 +125,7 @@ public class FsStoreScrmServiceImpl implements IFsStoreScrmService {
|
|
|
String sequence = generateStoreSequence();
|
|
|
fsStore.setMerchantId(merchantId);
|
|
|
fsStore.setStoreSeq(sequence);
|
|
|
+ fsStore.setQualificationUpdateTime(LocalDate.now());
|
|
|
fsStoreMapper.insertFsStore(fsStore);
|
|
|
return fsStore.getStoreId();
|
|
|
}
|
|
|
@@ -205,7 +208,8 @@ public class FsStoreScrmServiceImpl implements IFsStoreScrmService {
|
|
|
Boolean isAudit = configUtil.generateConfigByKey("medicalMall.func.switch").getBoolean("isAudit");
|
|
|
try {
|
|
|
if (isAudit != null && isAudit) {
|
|
|
- if (fsStore.getIsAudit() != null && 1 == fsStore.getIsAudit()) {
|
|
|
+ //驳回修改时,将isAudit设置为0
|
|
|
+ if (fsStore.getIsAudit() != null && (1 == fsStore.getIsAudit() || -1 == fsStore.getIsAudit())) {
|
|
|
Map<String, Object> diff = getDiff(oldFsStore, fsStore);
|
|
|
Set<String> diff_columns = diff.keySet();
|
|
|
JSONArray storeColumns = configUtil.generateConfigByKey("medicalMall.func.switch").getJSONArray("storeColumns");
|
|
|
@@ -225,7 +229,7 @@ public class FsStoreScrmServiceImpl implements IFsStoreScrmService {
|
|
|
} catch (IllegalAccessException e) {
|
|
|
log.error("获取diff出错", e);
|
|
|
}
|
|
|
-
|
|
|
+ fsStore.setQualificationUpdateTime(LocalDate.now());
|
|
|
return fsStoreMapper.updateFsStore(fsStore);
|
|
|
}
|
|
|
|
|
|
@@ -269,9 +273,20 @@ public class FsStoreScrmServiceImpl implements IFsStoreScrmService {
|
|
|
* @return 结果
|
|
|
*/
|
|
|
@Override
|
|
|
- public int deleteFsStoreByStoreIds(Long[] storeIds) {
|
|
|
+ public R deleteFsStoreByStoreIds(Long[] storeIds) {
|
|
|
+ //获取数据
|
|
|
+ List<FsStoreProductScrmInfoDTO> storeInfos = fsStoreMapper.getStoreInfo(storeIds);
|
|
|
storeAuditLogUtil.addBatchAuditArray(storeIds, null, null);
|
|
|
- return fsStoreMapper.deleteFsStoreByStoreIds(storeIds);
|
|
|
+ StringBuilder sb = new StringBuilder();
|
|
|
+ sb.append("删除成功");
|
|
|
+ if(fsStoreMapper.deleteFsStoreByStoreIds(storeIds) > 0){
|
|
|
+ storeInfos.forEach(storeInfo -> {
|
|
|
+ sb.append("删除店铺ID:").append(storeInfo.getStoreId()).append("-")
|
|
|
+ .append("删除店铺:").append(storeInfo.getStoreName()).append("/");
|
|
|
+
|
|
|
+ });
|
|
|
+ }
|
|
|
+ return R.ok(sb.toString());
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
@@ -306,7 +321,10 @@ public class FsStoreScrmServiceImpl implements IFsStoreScrmService {
|
|
|
fsStore.getStoreId(), fsStoreScrm.getBusinessScope(), selectableProductTypes);
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
+ //审核过后更新
|
|
|
+ if(fsStore.getIsAudit() != null && fsStore.getIsAudit() == 1){
|
|
|
+ updateStore.setQualificationUpdateTime(LocalDate.now());
|
|
|
+ }
|
|
|
fsStoreMapper.updateFsStore(updateStore);
|
|
|
//更新日志
|
|
|
storeAuditLogUtil.addAudit(fsStore.getStoreId(), fsStore.getReason(), fsStore.getAttachImage());
|
|
|
@@ -426,12 +444,11 @@ public class FsStoreScrmServiceImpl implements IFsStoreScrmService {
|
|
|
Boolean isAuditEnabled = configUtil.generateConfigByKey("medicalMall.func.switch").getBoolean("isAudit");
|
|
|
try {
|
|
|
// 仅当开启审核功能时才进行判断
|
|
|
- if (Boolean.TRUE.equals(isAuditEnabled) && oldFsStore.getIsAudit() == 1) {
|
|
|
- if (getFullDiff(oldFsStore, fsStore)) {
|
|
|
- fsStore.setIsAudit(0);
|
|
|
- }
|
|
|
- } else {
|
|
|
- fsStore.setIsAudit(1);
|
|
|
+ if (Boolean.TRUE.equals(isAuditEnabled) && (oldFsStore.getIsAudit() == 1 || oldFsStore.getIsAudit() == -1)) {
|
|
|
+// if (getFullDiff(oldFsStore, fsStore)) {
|
|
|
+// fsStore.setIsAudit(0);
|
|
|
+// }
|
|
|
+ fsStore.setIsAudit(0);
|
|
|
}
|
|
|
} catch (Exception e) {
|
|
|
log.error("处理审核状态出错", e);
|
|
|
@@ -460,6 +477,11 @@ public class FsStoreScrmServiceImpl implements IFsStoreScrmService {
|
|
|
return fsStoreMapper.queryValidStoreLastInfo(storeId);
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public R qualificationReminder(Long storeId) {
|
|
|
+ return R.ok().put("check",fsStoreMapper.qualificationReminder(storeId) != null);
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 获取两个对象的所有差异字段(基于旧对象的所有字段,以新对象字段值为准进行对比)
|
|
|
* 只要新旧值不同就视为差异
|