|
@@ -10,6 +10,7 @@ import com.zhongshu.card.server.core.domain.org.UserAccount;
|
|
|
import com.zhongshu.card.client.utils.DateUtils;
|
|
import com.zhongshu.card.client.utils.DateUtils;
|
|
|
import com.zhongshu.card.server.core.util.CommonUtil;
|
|
import com.zhongshu.card.server.core.util.CommonUtil;
|
|
|
import jakarta.servlet.http.HttpServletRequest;
|
|
import jakarta.servlet.http.HttpServletRequest;
|
|
|
|
|
+import lombok.extern.slf4j.Slf4j;
|
|
|
import org.apache.commons.lang3.ObjectUtils;
|
|
import org.apache.commons.lang3.ObjectUtils;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
@@ -21,6 +22,7 @@ import java.util.List;
|
|
|
* @author TRX
|
|
* @author TRX
|
|
|
* @date 2024/6/3
|
|
* @date 2024/6/3
|
|
|
*/
|
|
*/
|
|
|
|
|
+@Slf4j
|
|
|
public abstract class SuperService {
|
|
public abstract class SuperService {
|
|
|
|
|
|
|
|
@Autowired
|
|
@Autowired
|
|
@@ -82,17 +84,20 @@ public abstract class SuperService {
|
|
|
entity.setOid(getCurrentOid());
|
|
entity.setOid(getCurrentOid());
|
|
|
}
|
|
}
|
|
|
Assert.hasText(entity.getOid(), "oid不能为空");
|
|
Assert.hasText(entity.getOid(), "oid不能为空");
|
|
|
-
|
|
|
|
|
- UserAccount account = getCurrentUserAccount();
|
|
|
|
|
- if (account != null) {
|
|
|
|
|
- if (StringUtils.isEmpty(entity.getCreateUserId())) {
|
|
|
|
|
- entity.setCreateUserId(account.getUserId());
|
|
|
|
|
- entity.setCreateUserName(account.getName());
|
|
|
|
|
- entity.setCreatePhone(account.getPhone());
|
|
|
|
|
|
|
+ try {
|
|
|
|
|
+ UserAccount account = getCurrentUserAccount();
|
|
|
|
|
+ if (account != null) {
|
|
|
|
|
+ if (StringUtils.isEmpty(entity.getCreateUserId())) {
|
|
|
|
|
+ entity.setCreateUserId(account.getUserId());
|
|
|
|
|
+ entity.setCreateUserName(account.getName());
|
|
|
|
|
+ entity.setCreatePhone(account.getPhone());
|
|
|
|
|
+ }
|
|
|
|
|
+ entity.setUpdateUserId(account.getUserId());
|
|
|
|
|
+ entity.setUpdateUserName(account.getName());
|
|
|
|
|
+ entity.setUpdatePhone(account.getPhone());
|
|
|
}
|
|
}
|
|
|
- entity.setUpdateUserId(account.getUserId());
|
|
|
|
|
- entity.setUpdateUserName(account.getName());
|
|
|
|
|
- entity.setUpdatePhone(account.getPhone());
|
|
|
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
|
+ log.error("initEntity {}", e.getMessage());
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
@@ -104,11 +109,15 @@ public abstract class SuperService {
|
|
|
*/
|
|
*/
|
|
|
public void initUpdateEntity(SuperMain entity) {
|
|
public void initUpdateEntity(SuperMain entity) {
|
|
|
if (entity != null) {
|
|
if (entity != null) {
|
|
|
- UserAccount account = getCurrentUserAccount();
|
|
|
|
|
- if (account != null) {
|
|
|
|
|
- entity.setUpdateUserId(account.getUserId());
|
|
|
|
|
- entity.setUpdateUserName(account.getName());
|
|
|
|
|
- entity.setUpdatePhone(account.getPhone());
|
|
|
|
|
|
|
+ try {
|
|
|
|
|
+ UserAccount account = getCurrentUserAccount();
|
|
|
|
|
+ if (account != null) {
|
|
|
|
|
+ entity.setUpdateUserId(account.getUserId());
|
|
|
|
|
+ entity.setUpdateUserName(account.getName());
|
|
|
|
|
+ entity.setUpdatePhone(account.getPhone());
|
|
|
|
|
+ }
|
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
|
+ log.error("initUpdateEntity {}", e.getMessage());
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
@@ -203,15 +212,7 @@ public abstract class SuperService {
|
|
|
param.setOid(getCurrentOid());
|
|
param.setOid(getCurrentOid());
|
|
|
}
|
|
}
|
|
|
Assert.hasText(param.getOid(), "oid不能为空");
|
|
Assert.hasText(param.getOid(), "oid不能为空");
|
|
|
- List<Long> times = param.getTimes();
|
|
|
|
|
- if (ObjectUtils.isNotEmpty(times) && times.size() == 2) {
|
|
|
|
|
- Long startTime = times.get(0);
|
|
|
|
|
- startTime = DateUtils.getDayStartTime(startTime);
|
|
|
|
|
- Long endTime = times.get(1);
|
|
|
|
|
- endTime = DateUtils.getDayEndTime(endTime);
|
|
|
|
|
- param.setStartTime(startTime);
|
|
|
|
|
- param.setEndTime(endTime);
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ initSearchParam(param);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
public void initOidSearchParamNoCheckOid(SuperSearch param) {
|
|
public void initOidSearchParamNoCheckOid(SuperSearch param) {
|
|
@@ -219,15 +220,7 @@ public abstract class SuperService {
|
|
|
if (StringUtils.isEmpty(oid)) {
|
|
if (StringUtils.isEmpty(oid)) {
|
|
|
param.setOid(getCurrentOid());
|
|
param.setOid(getCurrentOid());
|
|
|
}
|
|
}
|
|
|
- List<Long> times = param.getTimes();
|
|
|
|
|
- if (ObjectUtils.isNotEmpty(times) && times.size() == 2) {
|
|
|
|
|
- Long startTime = times.get(0);
|
|
|
|
|
- startTime = DateUtils.getDayStartTime(startTime);
|
|
|
|
|
- Long endTime = times.get(1);
|
|
|
|
|
- endTime = DateUtils.getDayEndTime(endTime);
|
|
|
|
|
- param.setStartTime(startTime);
|
|
|
|
|
- param.setEndTime(endTime);
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ initSearchParam(param);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
public void initSearchParam(SuperSearch param) {
|
|
public void initSearchParam(SuperSearch param) {
|
|
@@ -242,6 +235,20 @@ public abstract class SuperService {
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 检查是否有 projectOid
|
|
|
|
|
+ *
|
|
|
|
|
+ * @param param
|
|
|
|
|
+ */
|
|
|
|
|
+ public void initSearchParamCheckProjectOid(SuperSearch param) {
|
|
|
|
|
+ checkParamProjectOid(param);
|
|
|
|
|
+ initSearchParam(param);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ public void checkParamProjectOid(SuperSearch param) {
|
|
|
|
|
+ Assert.hasText(param.getProjectOid(), "projectOid不能为空");
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
public OperationLogsAddParam initLog(String userId) {
|
|
public OperationLogsAddParam initLog(String userId) {
|
|
|
return CommonUtil.initLog(request, userId);
|
|
return CommonUtil.initLog(request, userId);
|
|
|
}
|
|
}
|