|
@@ -5,14 +5,17 @@ import cn.com.ty.lift.business.contract.dao.entity.Contracts;
|
|
|
import cn.com.ty.lift.business.contract.dao.entity.ContractsHistory;
|
|
|
import cn.com.ty.lift.business.contract.dao.entity.model.request.ContractRequest;
|
|
|
import cn.com.ty.lift.business.contract.dao.mapper.ContractsHistoryMapper;
|
|
|
+import cn.hutool.core.map.MapUtil;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
+import lombok.extern.slf4j.Slf4j;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
import java.time.LocalDateTime;
|
|
|
+import java.util.HashMap;
|
|
|
import java.util.Map;
|
|
|
|
|
|
/**
|
|
@@ -21,6 +24,7 @@ import java.util.Map;
|
|
|
* @description 合同历史记录业务层
|
|
|
*/
|
|
|
@Service
|
|
|
+@Slf4j
|
|
|
public class ContractHistoryService extends ServiceImpl<ContractsHistoryMapper, ContractsHistory> {
|
|
|
|
|
|
@Resource
|
|
@@ -40,14 +44,20 @@ public class ContractHistoryService extends ServiceImpl<ContractsHistoryMapper,
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * @param oldEntry 原有大修项目
|
|
|
- * @param newEntry 修改后的大修项目
|
|
|
+ * @param oldEntry 原有合同
|
|
|
+ * @param newEntry 修改后的合同
|
|
|
* @return
|
|
|
- * @description 保存大修项目操作记录
|
|
|
+ * @description 保存合同操作记录
|
|
|
* @date 2020/4/28 9:52 上午
|
|
|
*/
|
|
|
- public void saveOperaHistory(Contracts oldEntry, Contracts newEntry) throws NoSuchFieldException {
|
|
|
- Map<String, String> resultMap = utils.compareAttribute(oldEntry, newEntry);
|
|
|
+ public boolean saveOperaHistory(Contracts oldEntry, Contracts newEntry){
|
|
|
+ Map<String, String> resultMap = new HashMap<>();
|
|
|
+ try {
|
|
|
+ resultMap = utils.compareAttribute(oldEntry, newEntry);
|
|
|
+ if (MapUtil.isEmpty(resultMap)) return false;
|
|
|
+ } catch (NoSuchFieldException e) {
|
|
|
+ log.error("合同操作记录保存异常", e);
|
|
|
+ }
|
|
|
ContractsHistory contractsHistory = new ContractsHistory();
|
|
|
contractsHistory.setContractsId(oldEntry.getId());
|
|
|
contractsHistory.setCode(oldEntry.getCode());
|
|
@@ -56,6 +66,6 @@ public class ContractHistoryService extends ServiceImpl<ContractsHistoryMapper,
|
|
|
contractsHistory.setAfterContent(resultMap.get("after"));
|
|
|
contractsHistory.setOperatorId(10000L);
|
|
|
contractsHistory.setOperateDate(LocalDateTime.now());
|
|
|
- save(contractsHistory);
|
|
|
+ return save(contractsHistory);
|
|
|
}
|
|
|
}
|