|
@@ -11,6 +11,7 @@ import org.springframework.web.context.request.ServletRequestAttributes;
|
|
|
|
|
|
import javax.annotation.PostConstruct;
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
|
+import java.math.BigDecimal;
|
|
|
import java.util.Date;
|
|
|
|
|
|
/**
|
|
@@ -21,14 +22,10 @@ import java.util.Date;
|
|
|
*/
|
|
|
@Component
|
|
|
public class JXKHUtils {
|
|
|
+ private static RedisService redisService;
|
|
|
@Autowired
|
|
|
private RedisService autoRedisService;
|
|
|
- private static RedisService redisService;
|
|
|
- @PostConstruct
|
|
|
- public void init() {
|
|
|
|
|
|
- redisService = autoRedisService;
|
|
|
- }
|
|
|
/**
|
|
|
* 获取当前的登陆人信息
|
|
|
*
|
|
@@ -49,6 +46,7 @@ public class JXKHUtils {
|
|
|
}
|
|
|
return currUser;
|
|
|
}
|
|
|
+
|
|
|
public static <T extends BaseDo> void initModelGeneralParameters(T t, SysUserDo userVo) {
|
|
|
if (userVo == null) {
|
|
|
userVo = getCurrentUser();
|
|
@@ -61,4 +59,20 @@ public class JXKHUtils {
|
|
|
t.setModifyusername(userVo.getName());
|
|
|
t.setDeleted("0");
|
|
|
}
|
|
|
+
|
|
|
+ public static BigDecimal calculateY3(BigDecimal x1, BigDecimal y1, BigDecimal x2, BigDecimal y2, BigDecimal x3) {
|
|
|
+ // 检查x1是否等于x2,以避免除以零的错误
|
|
|
+ if (x1.compareTo(x2) == 0) {
|
|
|
+ throw new IllegalArgumentException("x1 和 x2 不能相等,因为这将导致除以零的错误。");
|
|
|
+ }
|
|
|
+ // 使用两点式方程计算y3值
|
|
|
+ return y1.add(y2.subtract(y1)).divide(x3.subtract(x1)).multiply(x2.subtract(x1));
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ @PostConstruct
|
|
|
+ public void init() {
|
|
|
+
|
|
|
+ redisService = autoRedisService;
|
|
|
+ }
|
|
|
}
|