|
|
@@ -16,13 +16,24 @@
|
|
|
*/
|
|
|
package org.springblade.los.business.locks.service.impl;
|
|
|
|
|
|
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
+import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
+import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
|
|
|
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
+import lombok.AllArgsConstructor;
|
|
|
+import org.springblade.core.secure.utils.AuthUtil;
|
|
|
+import org.springblade.core.tool.api.R;
|
|
|
import org.springblade.los.business.locks.entity.BillLocks;
|
|
|
-import org.springblade.los.business.locks.vo.BillLocksVO;
|
|
|
import org.springblade.los.business.locks.mapper.BillLocksMapper;
|
|
|
import org.springblade.los.business.locks.service.IBillLocksService;
|
|
|
-import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
+import org.springblade.los.business.locks.vo.BillLocksVO;
|
|
|
+import org.springblade.los.business.sea.entity.Bills;
|
|
|
+import org.springblade.los.business.sea.service.IBillsService;
|
|
|
+import org.springblade.system.feign.ISysClient;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
-import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
+
|
|
|
+import java.util.Date;
|
|
|
+import java.util.List;
|
|
|
|
|
|
/**
|
|
|
* 业务-业务加解锁明细,各分公司独立 服务实现类
|
|
|
@@ -31,11 +42,118 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
* @since 2025-06-06
|
|
|
*/
|
|
|
@Service
|
|
|
+@AllArgsConstructor
|
|
|
public class BillLocksServiceImpl extends ServiceImpl<BillLocksMapper, BillLocks> implements IBillLocksService {
|
|
|
|
|
|
+ private final ISysClient sysClient;
|
|
|
+
|
|
|
+ private final IBillsService billsService;
|
|
|
+
|
|
|
@Override
|
|
|
public IPage<BillLocksVO> selectBillLocksPage(IPage<BillLocksVO> page, BillLocksVO billLocks) {
|
|
|
return page.setRecords(baseMapper.selectBillLocksPage(page, billLocks));
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public R submitLock(BillLocks billLocks) {
|
|
|
+ if (ObjectUtils.isNull(billLocks.getSrcId())) {
|
|
|
+ throw new RuntimeException("缺少必要参数");
|
|
|
+ }
|
|
|
+ if (ObjectUtils.isNull(billLocks.getBusinessType())) {
|
|
|
+ throw new RuntimeException("缺少必要参数");
|
|
|
+ }
|
|
|
+ BillLocks detail = baseMapper.selectOne(new LambdaQueryWrapper<BillLocks>()
|
|
|
+ .eq(BillLocks::getTenantId, AuthUtil.getTenantId())
|
|
|
+ .eq(BillLocks::getIsDeleted, 0)
|
|
|
+ .eq(BillLocks::getSrcId, billLocks.getSrcId()));
|
|
|
+ if ("HYCK,HYJK".contains(billLocks.getBusinessType())) {
|
|
|
+ Bills bills = billsService.getById(billLocks.getSrcId());
|
|
|
+ if (bills == null) {
|
|
|
+ throw new RuntimeException("未查到单据信息");
|
|
|
+ }
|
|
|
+ if (detail != null) {
|
|
|
+ detail.setUpdateTime(new Date());
|
|
|
+ detail.setUpdateUser(AuthUtil.getUserId());
|
|
|
+ detail.setUpdateUserName(AuthUtil.getUserName());
|
|
|
+ detail.setBranchId(bills.getBranchId());
|
|
|
+ detail.setBillNo(bills.getBillNo());
|
|
|
+ detail.setBillDate(bills.getBillDate());
|
|
|
+ detail.setBusinessTypeName(billLocks.getBusinessType());
|
|
|
+ detail.setSrcBillNo(bills.getBillNo());
|
|
|
+ detail.setSrcVesselId(bills.getVesselId());
|
|
|
+ detail.setSrcVesselCnName(bills.getVesselCnName());
|
|
|
+ detail.setSrcVesselEnName(bills.getVesselEnName());
|
|
|
+ detail.setSrcVoyageNo(bills.getVoyageNo());
|
|
|
+ detail.setSrcMblno(bills.getMblno());
|
|
|
+ detail.setSrcRefno(bills.getRefno());
|
|
|
+ detail.setSrcTeamId(Long.parseLong(bills.getTeamId()));
|
|
|
+ detail.setSrcTeamName(bills.getTeamName());
|
|
|
+ detail.setLocked(0);
|
|
|
+ detail.setOperatorId(bills.getOperatorId());
|
|
|
+ detail.setOperatorName(bills.getOperatorName());
|
|
|
+ baseMapper.updateById(detail);
|
|
|
+ } else {
|
|
|
+ billLocks.setCreateTime(new Date());
|
|
|
+ billLocks.setCreateUser(AuthUtil.getUserId());
|
|
|
+ billLocks.setCreateUserName(AuthUtil.getUserName());
|
|
|
+ billLocks.setBranchId(bills.getBranchId());
|
|
|
+ billLocks.setBillNo(bills.getBillNo());
|
|
|
+ billLocks.setBillDate(bills.getBillDate());
|
|
|
+ billLocks.setBusinessTypeName(billLocks.getBusinessType());
|
|
|
+ billLocks.setSrcBillNo(bills.getBillNo());
|
|
|
+ billLocks.setSrcVesselId(bills.getVesselId());
|
|
|
+ billLocks.setSrcVesselCnName(bills.getVesselCnName());
|
|
|
+ billLocks.setSrcVesselEnName(bills.getVesselEnName());
|
|
|
+ billLocks.setSrcVoyageNo(bills.getVoyageNo());
|
|
|
+ billLocks.setSrcMblno(bills.getMblno());
|
|
|
+ billLocks.setSrcRefno(bills.getRefno());
|
|
|
+ billLocks.setSrcTeamId(Long.parseLong(bills.getTeamId()));
|
|
|
+ billLocks.setSrcTeamName(bills.getTeamName());
|
|
|
+ billLocks.setLocked(0);
|
|
|
+ billLocks.setUnlockedCount(0);
|
|
|
+ billLocks.setOperatorId(bills.getOperatorId());
|
|
|
+ billLocks.setOperatorName(bills.getOperatorName());
|
|
|
+ baseMapper.insert(billLocks);
|
|
|
+ }
|
|
|
+ bills.setLocked(1);
|
|
|
+ billsService.updateById(bills);
|
|
|
+ } else if ("KYCK,KYJK".contains(billLocks.getBusinessType())) {
|
|
|
+
|
|
|
+ } else if ("BGSE,BGSI,BGAE,BGAI".contains(billLocks.getBusinessType())) {
|
|
|
+
|
|
|
+ } else {
|
|
|
+ throw new RuntimeException("业务类型错误,请联系管理员");
|
|
|
+ }
|
|
|
+ return R.data("操作成功");
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public R unlock(String ids) {
|
|
|
+ List<BillLocks> billLocksList = baseMapper.selectList(new LambdaQueryWrapper<BillLocks>()
|
|
|
+ .eq(BillLocks::getTenantId, AuthUtil.getTenantId())
|
|
|
+ .eq(BillLocks::getIsDeleted, 0)
|
|
|
+ .apply("find_in_set(id,'" + ids + "')"));
|
|
|
+ for (BillLocks item : billLocksList) {
|
|
|
+ item.setUnlockedCount(item.getUnlockedCount() + 1);
|
|
|
+ item.setLocked(1);
|
|
|
+ item.setLockedTime(new Date());
|
|
|
+ if ("HYCK,HYJK".contains(item.getBusinessType())) {
|
|
|
+ Bills bills = billsService.getById(item.getSrcId());
|
|
|
+ if (bills == null) {
|
|
|
+ throw new RuntimeException("未查到单据信息");
|
|
|
+ }
|
|
|
+ bills.setLockedDate(new Date());
|
|
|
+ billsService.updateById(bills);
|
|
|
+ } else if ("KYCK,KYJK".contains(item.getBusinessType())) {
|
|
|
+
|
|
|
+ } else if ("BGSE,BGSI,BGAE,BGAI".contains(item.getBusinessType())) {
|
|
|
+
|
|
|
+ } else {
|
|
|
+ throw new RuntimeException("业务类型错误,请联系管理员");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ this.updateBatchById(billLocksList);
|
|
|
+ return R.data("操作成功");
|
|
|
+ }
|
|
|
+
|
|
|
}
|