1、定时任务中付息金额计算进度问题
错误:本金*利率/360以后先用BigDecimal近行四舍五入后再乘以的投资天数,有的数据造成精度丢失。
改正:本金*利率/360后有除不尽的情况,先转double计算完最后在四舍五入。
2、微信小程序中日期格式不兼容问题
var time = '2019-05-20 00:00:00';//这种日期格式iOS不兼容
var repTime = time.replace(/-/g, '/');//用正则主要是把“2019-05-20 00:00:00”转换成“2019/05/0 00:00:00”兼容ios
console.log("返回时间:" + repTime);
var timeTamp = Date.parse(repTime);
console.log("返回时间戳:" + timeTamp)
3、使用FeignClient进行服务间调用,传递headers信息---token携带问题
import javax.servlet.http.HttpServletRequest;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;
import feign.RequestInterceptor;
import feign.RequestTemplate;
/**
*
* @Description: Feign配置:使用FeignClient进行服务间调用,传递headers信息---token
* @author lzp
* @date :2018年11月21日
*
*/
@Configuration
public class FeignConfig implements RequestInterceptor{
@Override
public void apply(RequestTemplate template) {
ServletRequestAttributes attributes = (ServletRequestAttributes)RequestContextHolder.getRequestAttributes();
HttpServletRequest request = attributes.getRequest();
//添加token
template.header("access_token", request.getHeader("access_token"));
}
}
4、springboot2.0.6集成lcn5.0.2分布式事务失效原因查找
问题描述:crm服务调用admin服务时,如果admin服务异常事务会回滚,反之crm服务异常admin服务事务不回滚?
解决:最终找到是一个MVC的拦截器配置类影响了事务不回滚,屏蔽该配置类即可,换了一种读配置文件的方式,
@Configuration
public class MvcConfig extends WebMvcConfigurationSupport {
@Value("${web.upload.path}")
private String uploadPath;
@Override
public void addResourceHandlers(ResourceHandlerRegistry registry) {
registry.addResourceHandler("/uploads/**").addResourceLocations(
"file:" + uploadPath);
}
}
换成新的方式读取导出文件存储路径:
@Autowired
private Environment env;
String excelPath = env.getProperty("web.upload.excelPath");//获取配置文件中生成的excel临时路径
上网查半天就说springboot 2.0后,使用WebMvcConfigurationSupport静态资源会无效,很多配置不会自动化。具体详细还待研究。
5、nginx服务器安装ssl证书
启动报错:nginx: [emerg] open() "/usr/local/nginx/logs/access.log" failed (21: Is a directory)
查了好多资料说是nginx.conf没有操作权限,我也设置权限了。最后解决nginx目录下没有logs文件夹,创建logs文件夹,启动即可。