Commit 70280d53 by 徐高华

日志

parent 4100dc38
......@@ -17,7 +17,6 @@ import com.gic.haoban.manage.web.errCode.HaoBanErrCode;
@RestController
public class HelpController extends WebBaseController{
private static final String LOGIN_URL = "/haoban-manage3-web/yw-login";
private static Logger logger = LoggerFactory.getLogger(HelpController.class);
@Autowired
......
......@@ -7,6 +7,7 @@ import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
......@@ -25,6 +26,7 @@ import com.gic.commons.webapi.reponse.RestResponse;
import com.gic.haoban.base.api.common.pojo.dto.WebLoginDTO;
import com.gic.haoban.common.utils.AuthWebRequestUtil;
import com.gic.haoban.manage.api.dto.hm.HmLinkDTO;
import com.gic.haoban.manage.api.dto.hm.HmLinkStoreDTO;
import com.gic.haoban.manage.api.dto.hm.HmLinkStoreSettingDTO;
import com.gic.haoban.manage.api.dto.hm.HmPageDTO;
import com.gic.haoban.manage.api.dto.hm.WxUserAddLogDTO;
......@@ -107,7 +109,7 @@ public class HmLinkController {
ServiceResponse<String> saveResp = this.hmLinkApiService.save(dto);
if (saveResp.isSuccess()) {
String logContent = this.getUpdateLog(oldDTO, dto);
if(StringUtils.isBlank(logContent)) {
if (StringUtils.isBlank(logContent)) {
GicLogRecordEvaluationContext.noWriteLog();
}
logger.info(logContent);
......@@ -135,7 +137,7 @@ public class HmLinkController {
content.append(c);
}
String d = comp(wxEnterpriseId, enterpriseId, "分配规则", oldDTO.getCustomRuleJson(), newDTO.getCustomRuleJson(),
4);
oldDTO, newDTO);
if (null != d) {
content.append(d);
}
......@@ -155,6 +157,15 @@ public class HmLinkController {
return sb.append(content).toString();
}
public String comp(String wxEnterpriseId, String enterpriseId, String title, String oldValue, String newValue,
HmLinkDTO oldDTO, HmLinkDTO newDTO) {
// 其他门店
JSONObject oldStoreRuleObj = JSONObject.parseObject(oldValue);
JSONObject newStoreRuleObj = JSONObject.parseObject(newValue);
logger.info("{},{}", oldStoreRuleObj, newStoreRuleObj);
return otherStoreRuleLog(oldStoreRuleObj, newStoreRuleObj, oldDTO, newDTO);
}
// type 会员标签1 , 2 欢迎语
public String comp(String wxEnterpriseId, String enterpriseId, String title, String oldValue, String newValue,
int type) {
......@@ -221,17 +232,11 @@ public class HmLinkController {
sb.append(ruleLog(oldXgStore, newXgStore, 2));
return sb.toString();
}
// 其他门店
if (type == 4) {
JSONObject oldStoreRuleObj = JSONObject.parseObject(oldValue);
JSONObject newStoreRuleObj = JSONObject.parseObject(newValue);
logger.info("{},{}", oldStoreRuleObj, newStoreRuleObj);
return otherStoreRuleLog(oldStoreRuleObj, newStoreRuleObj);
}
return null;
}
private String otherStoreRuleLog(JSONObject oldStoreRuleObj, JSONObject newStoreRuleObj) {
private String otherStoreRuleLog(JSONObject oldStoreRuleObj, JSONObject newStoreRuleObj, HmLinkDTO oldDTO,
HmLinkDTO newDTO) {
StringBuilder tempSb = new StringBuilder();
int oldOpenFlag = oldStoreRuleObj.getIntValue("open");
int newOpenFlag = newStoreRuleObj.getIntValue("open");
......@@ -254,6 +259,8 @@ public class HmLinkController {
}
String cityLog = otherOpenLog(newCityStore, 4);
tempSb.append(cityLog);
// 门店
tempSb.append(this.getStoreListLog(null, newDTO, 1));
} else {
if (newStoreType == 1) {
tempSb.append(otherChangeLog(oldtore, newStore, 5));
......@@ -261,11 +268,61 @@ public class HmLinkController {
tempSb.append(otherChangeLog(oldtore, newStore, 6));
}
tempSb.append(ruleLog(oldCityStore, newCityStore, 4));
tempSb.append(this.getStoreListLog(oldDTO, newDTO, 2));
}
}
return tempSb.toString();
}
private String getStoreListLog(HmLinkDTO oldDTO, HmLinkDTO newDTO, int type) {
StringBuilder tempSb = new StringBuilder();
if (1 == type && null != newDTO && CollectionUtils.isNotEmpty(newDTO.getStoreList())) {
tempSb.append("门店为「");
List<String> list = new ArrayList<>();
newDTO.getStoreList().forEach(item -> {
list.add(item.getStoreName() + "(" + item.getStoreCode() + ")");
});
tempSb.append(list.stream().collect(Collectors.joining("、")));
tempSb.append("」");
}
if (2 == type) {
// 本次新加的
List<String> addList = new ArrayList<>();
List<String> delIdList = new ArrayList<>();
List<String> oldStoreIdList = new ArrayList<>();
List<HmLinkStoreDTO> oldList = oldDTO.getStoreList();
List<HmLinkStoreDTO> newList = newDTO.getStoreList();
if (CollectionUtils.isEmpty(oldList) && CollectionUtils.isEmpty(newList)) {
return "";
}
if (CollectionUtils.isNotEmpty(oldList)) {
oldStoreIdList = oldList.stream().map(dto -> dto.getStoreId()).collect(Collectors.toList());
for (HmLinkStoreDTO dto : newList) {
if (!oldStoreIdList.contains(dto.getStoreId())) {
addList.add(dto.getStoreName() + "(" + dto.getStoreCode() + ")");
}
}
tempSb.append("新增门店「").append(addList.stream().collect(Collectors.joining("、")));
tempSb.append("」");
}
if (CollectionUtils.isNotEmpty(newList)) {
List<String> newStoreIdList = newList.stream().map(dto -> dto.getStoreId())
.collect(Collectors.toList());
for (HmLinkStoreDTO item : oldList) {
if (!newStoreIdList.contains(item.getStoreId())) {
delIdList.add(item.getStoreName() + "(" + item.getStoreCode() + ")");
}
}
tempSb.append("删除门店「").append(delIdList.stream().collect(Collectors.joining("、")));
tempSb.append("」");
}
}
// 更新
return tempSb.toString();
}
// 其他门店-开启的日志
private String otherOpenLog(HmLinkStoreSettingDTO newStore, int level) {
StringBuilder tempSb = new StringBuilder();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment