Commit fc620dba by zhu.zewen

销毁审批关联数据状态更新为“已销毁”

parent c65eb32b
...@@ -4,6 +4,8 @@ import cn.hutool.core.bean.BeanUtil; ...@@ -4,6 +4,8 @@ import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.ObjectUtil;
import cn.hutool.json.JSONUtil; import cn.hutool.json.JSONUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.jmai.api.exception.ServiceException; import com.jmai.api.exception.ServiceException;
import com.jmai.physic.cloudsign.CloudsignService; import com.jmai.physic.cloudsign.CloudsignService;
...@@ -116,6 +118,7 @@ public class PhysicDestroyCheckServiceImpl extends BaseServiceImpl<PhysicDestroy ...@@ -116,6 +118,7 @@ public class PhysicDestroyCheckServiceImpl extends BaseServiceImpl<PhysicDestroy
@Override @Override
public PhysicDestroyCheck sign(PhysicDestroyCheckSignReq physicDestroyCheckSignReq) { public PhysicDestroyCheck sign(PhysicDestroyCheckSignReq physicDestroyCheckSignReq) {
// 1)审批流处理
boolean finished = false; boolean finished = false;
Long userId = SpringContextUtils.getUserId(); Long userId = SpringContextUtils.getUserId();
SysUser sysUser = sysUserMapper.selectById(userId); SysUser sysUser = sysUserMapper.selectById(userId);
...@@ -170,7 +173,8 @@ public class PhysicDestroyCheckServiceImpl extends BaseServiceImpl<PhysicDestroy ...@@ -170,7 +173,8 @@ public class PhysicDestroyCheckServiceImpl extends BaseServiceImpl<PhysicDestroy
} }
if(finished){ if(finished){
// 完成 => 转账生成 // 2.1)专账生成
// 完成 => 专账生成
BillDTO billDTO = new BillDTO(); BillDTO billDTO = new BillDTO();
BeanUtil.copyProperties(physicDestroyCheck,billDTO); BeanUtil.copyProperties(physicDestroyCheck,billDTO);
billDTO.setType(7); billDTO.setType(7);
...@@ -178,7 +182,7 @@ public class PhysicDestroyCheckServiceImpl extends BaseServiceImpl<PhysicDestroy ...@@ -178,7 +182,7 @@ public class PhysicDestroyCheckServiceImpl extends BaseServiceImpl<PhysicDestroy
billDTO.setRefId(physicDestroyCheck.getId()); billDTO.setRefId(physicDestroyCheck.getId());
physicBillService.createBill(billDTO); physicBillService.createBill(billDTO);
//创建销毁 // 2.2)创建销毁
List<PhysicDestroyCheckDetail> list = physicDestroyCheckDetailService.list(new LambdaQueryWrapper<PhysicDestroyCheckDetail>().eq(PhysicDestroyCheckDetail::getCheckId, physicDestroyCheck.getId())); List<PhysicDestroyCheckDetail> list = physicDestroyCheckDetailService.list(new LambdaQueryWrapper<PhysicDestroyCheckDetail>().eq(PhysicDestroyCheckDetail::getCheckId, physicDestroyCheck.getId()));
for (PhysicDestroyCheckDetail detail : list) { for (PhysicDestroyCheckDetail detail : list) {
PhysicStorageAmpoule ampoule = new PhysicStorageAmpoule(); PhysicStorageAmpoule ampoule = new PhysicStorageAmpoule();
...@@ -208,6 +212,20 @@ public class PhysicDestroyCheckServiceImpl extends BaseServiceImpl<PhysicDestroy ...@@ -208,6 +212,20 @@ public class PhysicDestroyCheckServiceImpl extends BaseServiceImpl<PhysicDestroy
ampoule.setPhysicBalance(physicSum - detail.getDestroyNum()); ampoule.setPhysicBalance(physicSum - detail.getDestroyNum());
physicStorageAmpouleMapper.insert(ampoule); physicStorageAmpouleMapper.insert(ampoule);
} }
// 2.3)更新关联数据状态为“已销毁”
LocalDateTime checkCreateTime = physicDestroyCheck.getCreateTime();
for (PhysicDestroyCheckDetail detail : list) {
LambdaUpdateWrapper<PhysicStorageAmpoule> updateWrapper = Wrappers.lambdaUpdate(PhysicStorageAmpoule.class)
.eq(PhysicStorageAmpoule::getPhysicName, detail.getPhysicName())
.eq(PhysicStorageAmpoule::getPhysicSpec, detail.getPhysicSpec())
.eq(PhysicStorageAmpoule::getFactoryName, detail.getFactoryName())
.eq(PhysicStorageAmpoule::getBatchNo, detail.getBatchNo())
// 按照提交销毁审批的创建时间,之前的全部标记已销毁
.lt(PhysicStorageAmpoule::getCreateTime, checkCreateTime)
.set(PhysicStorageAmpoule::getDestroyStatus, 1);
physicStorageAmpouleMapper.update(null, updateWrapper);
}
} }
physicDestroyCheckMapper.updateById(physicDestroyCheck); physicDestroyCheckMapper.updateById(physicDestroyCheck);
return getInfo(physicDestroyCheck.getId()); return getInfo(physicDestroyCheck.getId());
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment