From 6be859f745beaa13a831f3291147612f66b9d776 Mon Sep 17 00:00:00 2001
From: liukangdong <898885815@qq.com>
Date: 星期二, 26 十一月 2024 09:42:21 +0800
Subject: [PATCH] ll
---
server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/YwContractServiceImpl.java | 134 +++++++++++++++++++++++++++++++++++++++++++-
1 files changed, 130 insertions(+), 4 deletions(-)
diff --git a/server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/YwContractServiceImpl.java b/server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/YwContractServiceImpl.java
index 52dfa4f..4d2465c 100644
--- a/server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/YwContractServiceImpl.java
+++ b/server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/YwContractServiceImpl.java
@@ -51,6 +51,8 @@
@Autowired
private MultifileMapper multifileMapper;
@Autowired
+ private YwWorkorderLogMapper ywWorkorderLogMapper;
+ @Autowired
private CompanyMapper companyMapper;
@Autowired
private YwProjectMapper projectMapper;
@@ -80,7 +82,70 @@
ywContractMapper.insert(model);
dealDetailListBiz(model);//澶勭悊鏉℃淇℃伅
dealMultifileBiz(model);//澶勭悊闄勪欢淇℃伅
+ dealLogBiz(model,Constants.YwLogType.CONTRACT_CREATE,null,null);//璁板綍鏂板缓鏃ュ織
return model.getId();
+ }
+ /**
+ * 閫�绉熸彁浜�
+ * @param param
+ * @return
+ */
+ @Override
+ @Transactional(rollbackFor = {BusinessException.class,Exception.class})
+ public Integer backRent(YwContract param){
+ isParamValidBackRent(param);
+ //澶勭悊
+ dealBackRentBillBiz(param);
+ YwContract update = new YwContract();
+ update.setEditDate(new Date());
+ update.setEditor(param.getLoginUserInfo().getId());
+ update.setBtActDate(update.getEditDate());
+ update.setBtActUserId(update.getEditor());
+ update.setStatus(Constants.THREE);
+ update.setBtInfo(param.getBtInfo());
+ update.setBtDate(param.getBtDate());
+ update.setBtType(param.getBtType());
+ update.setBtUserId(param.getBtUserId());
+ update.setBtFee(param.getBtFee());
+ ywContractMapper.updateById(update);
+ dealLogBiz(param,Constants.YwLogType.CONTRACT_BACK,null,null);
+ return param.getId();
+ }
+
+ private void dealBackRentBillBiz(YwContract param) {
+ }
+
+ private void isParamValidBackRent(YwContract param) {
+ if(param.getId()==null
+ || param.getBtType() == null
+ || param.getBtDate() == null
+ || param.getBtUserId() == null
+ || param.getBtSignDate() == null
+ ||StringUtils.isBlank( param.getBtInfo())){
+ throw new BusinessException(ResponseStatus.BAD_REQUEST);
+ }
+ YwContract model = ywContractMapper.selectById(param.getId());
+ if(model==null || Constants.equalsInteger(model.getIsdeleted(),Constants.ONE)){
+ throw new BusinessException(ResponseStatus.DATA_EMPTY.getCode(),"瀵逛笉璧凤紝鍚堝悓淇℃伅涓嶅瓨鍦紝璇疯繑鍥炲垪琛ㄥ埛鏂伴噸璇曪紒");
+ }
+
+ SystemUser user = systemUserMapper.selectById(param.getUserId());
+ if(user ==null || (user.getDeleted()!=null&& user.getDeleted() )){
+ throw new BusinessException(ResponseStatus.DATA_EMPTY.getCode(),"瀵逛笉璧凤紝缁忓姙浜轰俊鎭笉瀛樺湪锛�");
+ }
+ if(param.getAddBillList()!=null && param.getAddBillList().size()>0){
+ for(YwContractBill bill: param.getAddBillList()){
+ if(bill.getCostType() == null
+ ||bill.getFeeType() == null
+ ||bill.getReceivableFee() == null
+ ||bill.getCompanyId() == null
+ ||bill.getPlanPayDate() == null
+ ||(Constants.equalsInteger(bill.getFeeType(),Constants.ZERO)
+ && (bill.getStartDate() ==null || bill.getEndDate() ==null) )){
+
+ }
+ }
+ }
}
private void dealDetailListBiz(YwContract model) {
@@ -185,10 +250,10 @@
bill.setStatus(Constants.ZERO);
bill.setStartDate(model.getStartDate());
bill.setEndDate(model.getEndDate());
- bill.setType(type);
+ bill.setType(Constants.ZERO);
+ bill.setCostType(type);
bill.setTotleFee(type==Constants.THREE?model.getZlDeposit():model.getWyDeposit());//鎶奸噾璐圭敤
bill.setSortnum(0);
- bill.setTitle(type==Constants.THREE?"绉熻祦鎶奸噾":"鐗╀笟鎶奸噾" );
return bill;
}
@@ -390,7 +455,8 @@
bill.setContractId(model.getId());
bill.setStatus(Constants.ZERO);
bill.setDetailId(d.getId());
- bill.setType(d.getType());
+ bill.setCostType(d.getType());
+ bill.setType(Constants.ZERO);
return bill;
}
@@ -618,7 +684,19 @@
this.updateById(ywContract);
}
}
-
+ private void dealLogBiz(YwContract model,Constants.YwLogType type,String param1,String param2) {
+ YwWorkorderLog log = new YwWorkorderLog();
+ log.setCreateDate(model.getEditDate());
+ log.setCreator(model.getCreator());
+ log.setJobId(model.getId());
+ log.setIsdeleted(Constants.ZERO);
+ log.setObjId(model.getId()+"");
+ log.setObjType(type.getKey());
+ log.setParam1(param1);
+ log.setParam2(param2);
+ log.setTitle(type.getNoteinfo());
+ ywWorkorderLogMapper.insert(log);
+ }
@Override
public YwContract findById(Integer id) {
MPJLambdaWrapper<YwContract> queryWrapper = new MPJLambdaWrapper<>();
@@ -635,7 +713,55 @@
.leftJoin(YwCustomer.class,YwCustomer::getId,YwContract::getRenterId);
YwContract model = ywContractMapper.selectJoinOne(YwContract.class,queryWrapper);
if(model != null){
+ //鍚堝悓闄勪欢
initFiles(model);
+ //鏌ヨ鎴挎簮淇℃伅鏁版嵁
+ MPJLambdaWrapper<YwRoom> rw = new MPJLambdaWrapper<>();
+ rw.selectAll(YwRoom.class )
+ .selectAs(YwProject::getName,YwRoom::getProjectName)
+ .selectAs(YwFloor::getName,YwRoom::getFloorName)
+ .selectAs(YwBuilding::getName,YwRoom::getBuildingName)
+ .leftJoin(YwProject.class,YwProject::getId,YwRoom::getProjectId)
+ .leftJoin(YwBuilding.class,YwBuilding::getId,YwRoom::getBuildingId)
+ .leftJoin(YwFloor.class,YwFloor::getId,YwRoom::getFloor)
+ .eq(YwRoom::getIsdeleted,Constants.ZERO)
+ .exists("(select a.id from yw_contract_room a where a.isdeleted=1 and a.room_id=t.id and a.contract_id="+model.getId()+")");
+ model.setRoomList(roomMapper.selectJoinList(YwRoom.class,rw));
+
+ //鏌ヨ绉熻硟鏉℃淇℃伅
+ MPJLambdaWrapper<YwContractDetail> dw = new MPJLambdaWrapper<>();
+ dw.selectAll(YwContractDetail.class )
+ .eq(YwContractDetail::getIsdeleted,Constants.ZERO)
+ .eq(YwContractDetail::getContractId,model.getId())
+ .in(YwContractDetail::getType,Constants.ZERO,Constants.TWO)
+ .orderByAsc(YwContractDetail::getSortnum);
+ model.setZlDetailList(ywContractDetailMapper.selectJoinList(YwContractDetail.class,dw));
+ //鏌ヨ鐗╂キ鏉℃淇℃伅
+ dw = new MPJLambdaWrapper<>();
+ dw.selectAll(YwContractDetail.class )
+ .eq(YwContractDetail::getIsdeleted,Constants.ZERO)
+ .eq(YwContractDetail::getContractId,model.getId())
+ .in(YwContractDetail::getType,Constants.ONE,Constants.THREE)
+ .orderByAsc(YwContractDetail::getSortnum);
+ model.setWyDetailList(ywContractDetailMapper.selectJoinList(YwContractDetail.class,dw));
+
+ //鏌ヨ鎿嶄綔鏃ュ織璁板綍
+ YwWorkorderLog log = new YwWorkorderLog();
+ log.setJobId(model.getId());
+ log.setIsdeleted(Constants.ZERO);
+ model.setLogList(ywWorkorderLogMapper.selectList(new QueryWrapper<YwWorkorderLog>(log)
+ .lambda()
+ .in(YwWorkorderLog::getObjType,Constants.YwLogType.CONTRACT_BACK.getKey()
+ ,Constants.YwLogType.CONTRACT_CREATE.getKey()
+ ,Constants.YwLogType.CONTRACT_UPDATE.getKey())
+ .orderByAsc(YwWorkorderLog::getCreateDate)));
+
+ //鏌ヨ璐﹀崟闆嗗悎
+ model.setBillList(ywContractBillMapper.selectJoinList(YwContractBill.class,new MPJLambdaWrapper<YwContractBill>()
+ .selectAll(YwContractBill.class )
+ .eq( YwContractBill::getContractId,model.getId())
+ .eq(YwContractBill::getIsdeleted,Constants.ZERO)
+ .orderByAsc(YwContractBill::getSortnum,YwContractBill::getCreateDate)));
}
return model;
--
Gitblit v1.9.3