|
@@ -2,6 +2,7 @@ package com.jeeplus.ccpm.approvalInfo.service;
|
|
|
|
|
|
import cn.hutool.core.util.ObjectUtil;
|
|
|
import cn.hutool.extra.spring.SpringUtil;
|
|
|
+import com.alibaba.fastjson.JSON;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
@@ -61,6 +62,9 @@ public class CcpmReimbursementInfoService {
|
|
|
@Resource
|
|
|
private CcpmReimbursementAmountInfoMapper amountInfoMapper;
|
|
|
|
|
|
+ @Resource
|
|
|
+ private CcpmReimbursementInfoUpHiMapper reimbursementInfoUpHiMapper;
|
|
|
+
|
|
|
// @Resource
|
|
|
// private OssServiceMapper ossServiceMapper;
|
|
|
|
|
@@ -370,6 +374,17 @@ public class CcpmReimbursementInfoService {
|
|
|
}
|
|
|
|
|
|
public CcpmReimbursementInfo update(CcpmSaveInfoDto dto, UserDTO userDTO) {
|
|
|
+ boolean admin = userDTO.isAdmin();
|
|
|
+ //判断当前登录人是否是管理员,管理员修改时需要生成一条历史记录
|
|
|
+ if (admin){
|
|
|
+ CcpmSaveInfoDto byId = this.findById(dto.getId());
|
|
|
+ String data=JSON.toJSONString(byId);
|
|
|
+ CcpmReimbursementInfoUpHi cwReimbursementInfoUpHi = new CcpmReimbursementInfoUpHi();
|
|
|
+ cwReimbursementInfoUpHi.setCreateTime(new Date());
|
|
|
+ cwReimbursementInfoUpHi.setInfoId(dto.getId());
|
|
|
+ cwReimbursementInfoUpHi.setJsonData(data);
|
|
|
+ reimbursementInfoUpHiMapper.insert(cwReimbursementInfoUpHi);
|
|
|
+ }
|
|
|
// 修改基础信息
|
|
|
CcpmReimbursementInfo info = new CcpmReimbursementInfo();
|
|
|
BeanUtils.copyProperties(dto, info);
|
|
@@ -804,4 +819,29 @@ public class CcpmReimbursementInfoService {
|
|
|
return list;
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 查询有无历史数据
|
|
|
+ * @param id
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public List<CcpmReimbursementInfoUpHi> findHistory(String id) {
|
|
|
+
|
|
|
+ List<CcpmReimbursementInfoUpHi> list = reimbursementInfoUpHiMapper.findHistory(id);
|
|
|
+ return list;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 根据id查询历史数据
|
|
|
+ * @param id
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public CcpmSaveInfoDto findHiById(String id) {
|
|
|
+ CcpmSaveInfoDto reimbursementInfoUpHi = new CcpmSaveInfoDto();
|
|
|
+ CcpmReimbursementInfoUpHi cwReimbursementInfoUpHi = reimbursementInfoUpHiMapper.selectById(id);
|
|
|
+ if (ObjectUtil.isNotEmpty(cwReimbursementInfoUpHi) && org.apache.commons.lang3.StringUtils.isNotBlank(cwReimbursementInfoUpHi.getJsonData())){
|
|
|
+ reimbursementInfoUpHi = JSON.parseObject(cwReimbursementInfoUpHi.getJsonData(),CcpmSaveInfoDto.class);
|
|
|
+ }
|
|
|
+ return reimbursementInfoUpHi;
|
|
|
+ }
|
|
|
+
|
|
|
}
|