|
@@ -21,6 +21,7 @@ import com.zjugis.module.system.api.user.AdminUserApi;
|
|
|
import com.zjugis.module.system.api.user.dto.AdminUserRespDTO;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
+import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
import java.math.BigDecimal;
|
|
|
import java.time.LocalDate;
|
|
@@ -66,18 +67,18 @@ public class FlowContractInvoiceService {
|
|
|
CommonResult<IFlowInstance> flowResult = workflowClient.flowInstance(flowInstanceId);
|
|
|
if(flowResult.isSuccess()){
|
|
|
ContractInvoice entity = contractInvoiceService.selectByInstanceId(flowInstanceId);
|
|
|
- if(Objects.isNull(entity)){
|
|
|
- entity = new ContractInvoice();
|
|
|
- entity.setInstanceId(flowInstanceId);
|
|
|
- entity.setWorkerId(userId);
|
|
|
- entity.setApplyDate(LocalDate.now());
|
|
|
- entity.setFlowStatus(FlowStatusConstants.FLOW_NOT_START);
|
|
|
- CommonResult<AdminUserRespDTO> result = adminUserApi.getUser(userId);
|
|
|
- entity.setApplyWorkerName(result.getCheckedData().getNickname());
|
|
|
- entity.setApplyWorkerDept(result.getCheckedData().getDeptName());
|
|
|
- entity.setApplyWorkerDeptId(result.getCheckedData().getDeptId());
|
|
|
- contractInvoiceService.insert(entity);
|
|
|
- }
|
|
|
+ if(Objects.isNull(entity)){
|
|
|
+ entity = new ContractInvoice();
|
|
|
+ entity.setInstanceId(flowInstanceId);
|
|
|
+ entity.setWorkerId(userId);
|
|
|
+ entity.setApplyDate(LocalDate.now());
|
|
|
+ entity.setFlowStatus(FlowStatusConstants.FLOW_NOT_START);
|
|
|
+ CommonResult<AdminUserRespDTO> result = adminUserApi.getUser(userId);
|
|
|
+ entity.setApplyWorkerName(result.getCheckedData().getNickname());
|
|
|
+ entity.setApplyWorkerDept(result.getCheckedData().getDeptName());
|
|
|
+ entity.setApplyWorkerDeptId(result.getCheckedData().getDeptId());
|
|
|
+ contractInvoiceService.insert(entity);
|
|
|
+ }
|
|
|
return createMap(entity);
|
|
|
}
|
|
|
return createModelMap();
|
|
@@ -131,7 +132,15 @@ public class FlowContractInvoiceService {
|
|
|
return map;
|
|
|
}
|
|
|
|
|
|
+ @Transactional
|
|
|
public int updateById(ContractInvoice entity) {
|
|
|
- return contractInvoiceMapper.updateById(entity);
|
|
|
+ int res = contractInvoiceMapper.updateById(entity);
|
|
|
+ List<ContractInvoiceRelation> relations = contractInvoiceRelationService.selectDOByInvoiceId(entity.getId());
|
|
|
+ if(relations.size() == 1){
|
|
|
+ ContractInvoiceRelation relation = relations.get(0);
|
|
|
+ relation.setInvoiceAmount(entity.getInvoiceAmount());
|
|
|
+ contractInvoiceRelationService.updateById(relation);
|
|
|
+ }
|
|
|
+ return res;
|
|
|
}
|
|
|
}
|