parent
6fb0040115
commit
6268d7f4cc
|
|
@ -65,12 +65,12 @@ public class InvoicingThdApi {
|
|||
*/
|
||||
@ApiOperation(value = "退货单-开始服务", notes = "退货单-开始服务")
|
||||
@AutoLog(value = "退货单-开始服务", clientType = "app")
|
||||
@PostMapping(value = "/startServ")
|
||||
public Result<?> startServ(@RequestBody InvoicingThdMainEntity dto) {
|
||||
@PostMapping(value = "/startServe")
|
||||
public Result<?> startServe(@RequestBody InvoicingThdMainEntity dto) {
|
||||
if (StringUtils.isBlank(dto.getId())) {
|
||||
return Result.error("缺少参数");
|
||||
}
|
||||
boolean result = tuiHuoApi.startServ(dto);
|
||||
boolean result = tuiHuoApi.startServe(dto);
|
||||
if (result) {
|
||||
return Result.OK("操作成功");
|
||||
} else {
|
||||
|
|
@ -176,4 +176,25 @@ public class InvoicingThdApi {
|
|||
return Result.error(result.get("message"));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 退货单-结束服务
|
||||
*
|
||||
* @param dto
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "退货单-结束服务", notes = "退货单-结束服务")
|
||||
@AutoLog(value = "退货单-结束服务", clientType = "app")
|
||||
@PostMapping(value = "/finishServe")
|
||||
public Result<?> finishServe(@RequestBody InvoicingThdMainEntity dto) {
|
||||
if (StringUtils.isBlank(dto.getId())) {
|
||||
return Result.error("缺少参数");
|
||||
}
|
||||
boolean result = tuiHuoApi.finishServe(dto);
|
||||
if (result) {
|
||||
return Result.OK("操作成功");
|
||||
} else {
|
||||
return Result.error("操作失败");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -47,6 +47,12 @@ public class InvoicingThdMainEntity implements Serializable {
|
|||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||
private Date ksTime;
|
||||
/**入库人*/
|
||||
private java.lang.String rkBy;
|
||||
/**入库时间*/
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||
private java.util.Date rkTime;
|
||||
/**结束人*/
|
||||
private String jsBy;
|
||||
/**结束时间*/
|
||||
|
|
@ -78,6 +84,10 @@ public class InvoicingThdMainEntity implements Serializable {
|
|||
* 开始人姓名
|
||||
*/
|
||||
private String ksrName;
|
||||
/**
|
||||
* 入库人姓名
|
||||
*/
|
||||
private String rkrName;
|
||||
/**
|
||||
* 结束人姓名
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ public interface ITuiHuoApi {
|
|||
|
||||
List<NuKcslEntity> thdNuMaterialList(InvoicingThdMainEntity dto);
|
||||
|
||||
boolean startServ(InvoicingThdMainEntity dto);
|
||||
boolean startServe(InvoicingThdMainEntity dto);
|
||||
|
||||
Map<String,Object> addThc(InvoicingThdGwcEntity dto);
|
||||
|
||||
|
|
@ -28,4 +28,6 @@ public interface ITuiHuoApi {
|
|||
|
||||
Map<String,String> submitThd(InvoicingThdMainEntity dto);
|
||||
|
||||
boolean finishServe(InvoicingThdMainEntity dto);
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -582,7 +582,7 @@ public class QingLingServiceImpl implements IQinglingApi {
|
|||
return false;
|
||||
}
|
||||
|
||||
String status = "5";
|
||||
String status = "5";//确认收货
|
||||
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
|
||||
|
||||
//主表改为已收货
|
||||
|
|
@ -690,6 +690,7 @@ public class QingLingServiceImpl implements IQinglingApi {
|
|||
qldInfoList.stream().forEach(item -> {
|
||||
NuWarehouseMaterialCrkInfo kfCrkLog = new NuWarehouseMaterialCrkInfo();
|
||||
BeanUtils.copyProperties(item, kfCrkLog);
|
||||
kfCrkLog.setId(null);
|
||||
kfCrkLog.setCreateBy(null);
|
||||
kfCrkLog.setCreateTime(null);
|
||||
kfCrkLog.setUpdateBy(null);
|
||||
|
|
|
|||
|
|
@ -82,6 +82,16 @@ public class NuInvoicingThdMain implements Serializable {
|
|||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||
@ApiModelProperty(value = "开始时间")
|
||||
private java.util.Date ksTime;
|
||||
/**入库人*/
|
||||
@Excel(name = "入库人", width = 15)
|
||||
@ApiModelProperty(value = "入库人")
|
||||
private java.lang.String rkBy;
|
||||
/**入库时间*/
|
||||
@Excel(name = "入库时间", width = 20, format = "yyyy-MM-dd HH:mm:ss")
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||
@ApiModelProperty(value = "入库时间")
|
||||
private java.util.Date rkTime;
|
||||
/**结束人*/
|
||||
@Excel(name = "结束人", width = 15)
|
||||
@ApiModelProperty(value = "结束人")
|
||||
|
|
|
|||
|
|
@ -8,12 +8,14 @@
|
|||
baseInfo.nu_name AS nuName,
|
||||
sqrtemp.realname AS fqrName,
|
||||
ksrtemp.realname AS ksrName,
|
||||
rkrtemp.realname AS rkrName,
|
||||
jsrtemp.realname AS jsrName,
|
||||
logStatus.item_text AS statusText
|
||||
from nu_invoicing_thd_main main
|
||||
left join nu_base_info baseInfo on main.nu_id = baseInfo.nu_id
|
||||
left join sys_user sqrtemp on sqrtemp.id = main.fq_by
|
||||
left join sys_user ksrtemp on ksrtemp.id = main.ks_by
|
||||
left join sys_user rkrtemp on rkrtemp.id = main.rk_by
|
||||
left join sys_user jsrtemp on jsrtemp.id = main.js_by
|
||||
LEFT JOIN sys_dict dict ON dict.dict_code = 'thd_status'
|
||||
LEFT JOIN sys_dict_item logStatus ON logStatus.dict_id = dict.id AND logStatus.item_value = main.status
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ package com.nu.modules.thd.service.impl;
|
|||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.google.common.collect.Maps;
|
||||
|
|
@ -10,9 +11,16 @@ import com.nu.entity.InvoicingThdGwcEntity;
|
|||
import com.nu.entity.InvoicingThdMainEntity;
|
||||
import com.nu.entity.NuKcslEntity;
|
||||
import com.nu.modules.care.api.IInvoicingOrdersApi;
|
||||
import com.nu.modules.cgd.entity.NuWarehouseMaterialCrkInfo;
|
||||
import com.nu.modules.cgd.service.INuWarehouseMaterialCrkInfoService;
|
||||
import com.nu.modules.invoicing.api.ITuiHuoApi;
|
||||
import com.nu.modules.nu.entity.NuInvoicingNuCrkLog;
|
||||
import com.nu.modules.nu.entity.NuInvoicingNuKcsl;
|
||||
import com.nu.modules.nu.mapper.NuInvoicingNuKcslMapper;
|
||||
import com.nu.modules.nu.service.INuInvoicingNuCrkLogService;
|
||||
import com.nu.modules.nu.service.INuInvoicingNuKcslService;
|
||||
import com.nu.modules.qld.entity.NuInvoicingQldInfo;
|
||||
import com.nu.modules.qld.entity.NuInvoicingQldLog;
|
||||
import com.nu.modules.qld.entity.NuInvoicingQldMain;
|
||||
import com.nu.modules.thd.entity.NuInvoicingThdGwc;
|
||||
import com.nu.modules.thd.entity.NuInvoicingThdInfo;
|
||||
|
|
@ -22,12 +30,16 @@ import com.nu.modules.thd.mapper.NuInvoicingThdGwcMapper;
|
|||
import com.nu.modules.thd.mapper.NuInvoicingThdLogMapper;
|
||||
import com.nu.modules.thd.mapper.NuInvoicingThdMainMapper;
|
||||
import com.nu.modules.thd.service.INuInvoicingThdInfoService;
|
||||
import com.nu.modules.warehouseMaterialInfo.entity.BlWarehouseMaterialInfo;
|
||||
import com.nu.modules.warehouseMaterialInfo.service.IBlWarehouseMaterialInfoService;
|
||||
import org.apache.commons.compress.utils.Lists;
|
||||
import org.apache.shiro.SecurityUtils;
|
||||
import org.jeecg.common.system.api.ISysBaseAPI;
|
||||
import org.jeecg.common.system.vo.LoginUser;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
import java.time.LocalDate;
|
||||
|
|
@ -59,7 +71,13 @@ public class ThdServiceImpl implements ITuiHuoApi {
|
|||
@Autowired
|
||||
private INuInvoicingThdInfoService thdInfoService;
|
||||
@Autowired
|
||||
private IInvoicingOrdersApi invoicingOrdersApi;
|
||||
private INuInvoicingNuCrkLogService invoicingNuCrkLogService;
|
||||
@Autowired
|
||||
private INuInvoicingNuKcslService invoicingNuKcslService;
|
||||
@Autowired
|
||||
private IBlWarehouseMaterialInfoService warehouseMaterialInfoService;
|
||||
@Autowired
|
||||
private INuWarehouseMaterialCrkInfoService warehouseMaterialCrkInfoService;
|
||||
|
||||
@Override
|
||||
public IPage<InvoicingThdMainEntity> thdList(Integer pageNo, Integer pageSize, InvoicingThdMainEntity dto) {
|
||||
|
|
@ -73,7 +91,7 @@ public class ThdServiceImpl implements ITuiHuoApi {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean startServ(InvoicingThdMainEntity dto) {
|
||||
public boolean startServe(InvoicingThdMainEntity dto) {
|
||||
//查询当前状态
|
||||
QueryWrapper<NuInvoicingThdMain> qw = new QueryWrapper<>();
|
||||
qw.eq("id", dto.getId());
|
||||
|
|
@ -97,8 +115,8 @@ public class ThdServiceImpl implements ITuiHuoApi {
|
|||
logData.setStatus(status);//操作状态
|
||||
logData.setOpeBy(sysUser.getId());//操作人
|
||||
logData.setOpeTime(new Date());//操作时间
|
||||
logData.setNuId(dto.getNuId());//护理单元id
|
||||
logData.setElderId(dto.getElderId());//长者id
|
||||
logData.setNuId(main.getNuId());//护理单元id
|
||||
logData.setElderId(main.getElderId());//长者id
|
||||
thdLogMapper.insert(logData);
|
||||
|
||||
return true;
|
||||
|
|
@ -175,6 +193,7 @@ public class ThdServiceImpl implements ITuiHuoApi {
|
|||
* @return
|
||||
*/
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Map<String, String> submitThd(InvoicingThdMainEntity dto) {
|
||||
Map<String, String> result = Maps.newHashMap();
|
||||
|
||||
|
|
@ -208,6 +227,7 @@ public class ThdServiceImpl implements ITuiHuoApi {
|
|||
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
|
||||
String status = "2";//当前节点 - 已入库
|
||||
String thdNo = null;//退货单号
|
||||
List<String> wlList = Lists.newArrayList();//本次涉及物料id
|
||||
|
||||
//生成退货单号
|
||||
{
|
||||
|
|
@ -253,38 +273,38 @@ public class ThdServiceImpl implements ITuiHuoApi {
|
|||
//修改主表状态
|
||||
main.setThdNo(thdNo);//退货单号
|
||||
main.setStatus(status);//已入库
|
||||
main.setJsBy(sysUser.getId());//入库人
|
||||
main.setJsTime(new Date());//入库时间
|
||||
main.setRkBy(sysUser.getId());//入库人
|
||||
main.setRkTime(new Date());//入库时间
|
||||
thdMainMapper.updateById(main);
|
||||
|
||||
//购物车数据 挪到info表里
|
||||
{
|
||||
//获取购物车物料数据
|
||||
QueryWrapper<NuInvoicingThdGwc> gwcQW = new QueryWrapper<>();
|
||||
gwcQW.eq("pk_id", dto.getId());
|
||||
List<NuInvoicingThdGwc> gwcList = thdGwcMapper.selectList(gwcQW);
|
||||
//========================================================================
|
||||
//获取购物车物料数据
|
||||
QueryWrapper<NuInvoicingThdGwc> gwcQW = new QueryWrapper<>();
|
||||
gwcQW.eq("pk_id", dto.getId());
|
||||
List<NuInvoicingThdGwc> gwcList = thdGwcMapper.selectList(gwcQW);
|
||||
wlList = gwcList.stream().map(NuInvoicingThdGwc::getWlId).collect(Collectors.toList());
|
||||
|
||||
//移除购物车数据
|
||||
InvoicingThdGwcEntity t_ = new InvoicingThdGwcEntity();
|
||||
t_.setPkId(dto.getId());
|
||||
thdGwcMapper.removeAll(t_);
|
||||
//移除购物车数据
|
||||
InvoicingThdGwcEntity t_ = new InvoicingThdGwcEntity();
|
||||
t_.setPkId(dto.getId());
|
||||
thdGwcMapper.removeAll(t_);
|
||||
|
||||
//info表插入物料数据
|
||||
List<NuInvoicingThdInfo> infoList = Lists.newArrayList();
|
||||
for (int i = 0; i < gwcList.size(); i++) {
|
||||
NuInvoicingThdGwc gwc = gwcList.get(i);//购物车取到的单条物料
|
||||
NuInvoicingThdInfo info = new NuInvoicingThdInfo();
|
||||
info.setThdNo(thdNo);//退货单号
|
||||
info.setKfId(gwc.getKfId());//库房id
|
||||
info.setWlId(gwc.getWlId());//物料id
|
||||
info.setThNum(gwc.getThNum());//退货数量
|
||||
info.setNuId(gwc.getNuId());//护理单元id
|
||||
info.setElderId(gwc.getElderId());//长者id
|
||||
infoList.add(info);
|
||||
}
|
||||
thdInfoService.saveBatch(infoList);
|
||||
//info表插入物料数据
|
||||
List<NuInvoicingThdInfo> infoList = Lists.newArrayList();
|
||||
for (int i = 0; i < gwcList.size(); i++) {
|
||||
NuInvoicingThdGwc gwc = gwcList.get(i);//购物车取到的单条物料
|
||||
NuInvoicingThdInfo info = new NuInvoicingThdInfo();
|
||||
info.setThdNo(thdNo);//退货单号
|
||||
info.setKfId(gwc.getKfId());//库房id
|
||||
info.setWlId(gwc.getWlId());//物料id
|
||||
info.setThNum(gwc.getThNum());//退货数量
|
||||
info.setNuId(gwc.getNuId());//护理单元id
|
||||
info.setElderId(gwc.getElderId());//长者id
|
||||
infoList.add(info);
|
||||
}
|
||||
|
||||
thdInfoService.saveBatch(infoList);
|
||||
//========================================================================
|
||||
//日志记录
|
||||
NuInvoicingThdLog logData = new NuInvoicingThdLog();
|
||||
logData.setThdId(dto.getId());//退货指令id
|
||||
|
|
@ -292,17 +312,149 @@ public class ThdServiceImpl implements ITuiHuoApi {
|
|||
logData.setStatus(status);//操作状态
|
||||
logData.setOpeBy(sysUser.getId());//操作人
|
||||
logData.setOpeTime(new Date());//操作时间
|
||||
logData.setNuId(dto.getNuId());//护理单元id
|
||||
logData.setElderId(dto.getElderId());//长者id
|
||||
logData.setNuId(main.getNuId());//护理单元id
|
||||
logData.setElderId(main.getElderId());//长者id
|
||||
thdLogMapper.insert(logData);
|
||||
|
||||
//TODO 库房出入库日志+库存
|
||||
//库房出入库日志+库存
|
||||
{
|
||||
//库房出入库日志
|
||||
QueryWrapper<BlWarehouseMaterialInfo> kcQW = new QueryWrapper<>();
|
||||
kcQW.in("wl_id", wlList);
|
||||
List<BlWarehouseMaterialInfo> kfnumList = warehouseMaterialInfoService.list(kcQW);
|
||||
Map<String, Map<String, String>> kfWlSlMap = kfnumList.stream()
|
||||
.collect(Collectors.groupingBy(
|
||||
BlWarehouseMaterialInfo::getNuId,
|
||||
Collectors.toMap(
|
||||
BlWarehouseMaterialInfo::getWlId,
|
||||
BlWarehouseMaterialInfo::getKcsl
|
||||
)
|
||||
));
|
||||
List<NuWarehouseMaterialCrkInfo> kfCrkLogList = Lists.newArrayList();
|
||||
for (int i = 0; i < infoList.size(); i++) {
|
||||
NuInvoicingThdInfo item = infoList.get(i);
|
||||
NuWarehouseMaterialCrkInfo kfCrkLog = new NuWarehouseMaterialCrkInfo();
|
||||
BeanUtils.copyProperties(item, kfCrkLog);
|
||||
kfCrkLog.setId(null);
|
||||
kfCrkLog.setCreateBy(null);
|
||||
kfCrkLog.setCreateTime(null);
|
||||
kfCrkLog.setUpdateBy(null);
|
||||
kfCrkLog.setUpdateTime(null);
|
||||
kfCrkLog.setCgdId(thdNo);//退货单号
|
||||
kfCrkLog.setNuId(item.getKfId());//库房id 不是nuid
|
||||
kfCrkLog.setWlId(item.getWlId());//物料id
|
||||
kfCrkLog.setCrkNum(item.getThNum());//出入库数量
|
||||
kfCrkLog.setCrkType("3");//出入库类型 3退货
|
||||
kfCrkLog.setCzqkcl(kfWlSlMap.get(item.getKfId()).get(item.getWlId()));//操作前库存量
|
||||
kfCrkLog.setDqkcl((Integer.parseInt(kfWlSlMap.get(item.getKfId()).get(item.getWlId())) + item.getThNum()) + "");//当前库存量
|
||||
kfCrkLog.setCrkStatus("1");//出入库状态 1入库
|
||||
kfCrkLogList.add(kfCrkLog);
|
||||
}
|
||||
warehouseMaterialCrkInfoService.saveBatch(kfCrkLogList);
|
||||
|
||||
//TODO 护理单元出入库日志+库存
|
||||
//库房库存调整
|
||||
Map<String, Integer> thdWlNumMap = infoList.stream()
|
||||
.collect(Collectors.toMap(NuInvoicingThdInfo::getWlId, NuInvoicingThdInfo::getThNum));
|
||||
List<BlWarehouseMaterialInfo> kfUpdateList = Lists.newArrayList();
|
||||
kfnumList.stream().forEach(item -> {
|
||||
if (thdWlNumMap.get(item.getWlId()) != null) {
|
||||
item.setKcsl((Integer.parseInt(item.getKcsl()) + thdWlNumMap.get(item.getWlId())) + "");
|
||||
kfUpdateList.add(item);
|
||||
}
|
||||
});
|
||||
warehouseMaterialInfoService.updateBatchById(kfUpdateList);
|
||||
}
|
||||
|
||||
//护理单元出入库日志+库存
|
||||
{
|
||||
//护理单元出入库日志
|
||||
List<NuInvoicingNuCrkLog> nuCrkLogList = Lists.newArrayList();
|
||||
infoList.stream().forEach(item -> {
|
||||
NuInvoicingNuCrkLog nuInvoicingNuCrkLog = new NuInvoicingNuCrkLog();
|
||||
BeanUtils.copyProperties(item, nuInvoicingNuCrkLog);
|
||||
nuInvoicingNuCrkLog.setCreateBy(null);
|
||||
nuInvoicingNuCrkLog.setCreateTime(null);
|
||||
nuInvoicingNuCrkLog.setWlNum(item.getThNum());//退货数量
|
||||
nuInvoicingNuCrkLog.setType("2");//类型 2退货
|
||||
nuInvoicingNuCrkLog.setOrderNumber(item.getThdNo());//单号
|
||||
nuInvoicingNuCrkLog.setOrderType("thd");//单子类型: thd退货单
|
||||
nuCrkLogList.add(nuInvoicingNuCrkLog);
|
||||
});
|
||||
invoicingNuCrkLogService.saveBatch(nuCrkLogList);
|
||||
|
||||
//护理单元货品修改对应现有数量
|
||||
QueryWrapper<NuInvoicingNuKcsl> nuKcslQW = new QueryWrapper<>();
|
||||
nuKcslQW.eq("nu_id", main.getNuId());
|
||||
nuKcslQW.eq("elder_id", main.getElderId());
|
||||
List<NuInvoicingNuKcsl> nuKcslList = invoicingNuKcslService.list(nuKcslQW);
|
||||
List<NuInvoicingNuKcsl> needUpdateList = Lists.newArrayList();
|
||||
if (!CollectionUtils.isEmpty(nuKcslList)) {
|
||||
Map<String, NuInvoicingNuKcsl> nuKcslMap = nuKcslList.stream()
|
||||
.collect(Collectors.toMap(NuInvoicingNuKcsl::getWlId, kcsl -> kcsl));
|
||||
infoList.stream().forEach(item -> {
|
||||
NuInvoicingNuKcsl nuInvoicingNuKcsl = new NuInvoicingNuKcsl();
|
||||
nuInvoicingNuKcsl.setNuId(item.getNuId());
|
||||
nuInvoicingNuKcsl.setElderId(item.getElderId());
|
||||
nuInvoicingNuKcsl.setWlId(item.getWlId());
|
||||
nuInvoicingNuKcsl.setKfId((item.getKfId()));
|
||||
|
||||
if (nuKcslMap.containsKey(item.getWlId())) {
|
||||
NuInvoicingNuKcsl existingKcsl = nuKcslMap.get(item.getWlId());
|
||||
nuInvoicingNuKcsl.setWlNum(existingKcsl.getWlNum() - item.getThNum() );
|
||||
needUpdateList.add(nuInvoicingNuKcsl);
|
||||
} else {
|
||||
//护理单元已有物料 不包含 本次退货物料(极其低概率 可以理解为不会发生) 上面已经做了退货物料检测
|
||||
throw new RuntimeException("入库失败");
|
||||
}
|
||||
});
|
||||
}
|
||||
if (!CollectionUtils.isEmpty(needUpdateList)) {
|
||||
needUpdateList.stream().forEach(item -> {
|
||||
UpdateWrapper<NuInvoicingNuKcsl> nuKcslUW = new UpdateWrapper<>();
|
||||
nuKcslUW.eq("nu_id", item.getNuId());
|
||||
nuKcslUW.eq("elder_id", item.getElderId());
|
||||
nuKcslUW.eq("wl_id", item.getWlId());
|
||||
invoicingNuKcslService.update(item, nuKcslUW);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
result.put("status", "success");
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean finishServe(InvoicingThdMainEntity dto) {
|
||||
//查询当前状态
|
||||
QueryWrapper<NuInvoicingThdMain> qw = new QueryWrapper<>();
|
||||
qw.eq("id", dto.getId());
|
||||
NuInvoicingThdMain main = thdMainMapper.selectOne(qw);
|
||||
|
||||
if (main == null || !"2".equals(main.getStatus())) {
|
||||
return false;
|
||||
} else {
|
||||
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
|
||||
String status = "3";//已结束服务
|
||||
|
||||
//更新退货单状态
|
||||
main.setStatus(status);//结束
|
||||
main.setJsBy(sysUser.getId());//结束人
|
||||
main.setJsTime(new Date());//结束服务时间
|
||||
thdMainMapper.updateById(main);
|
||||
|
||||
//插入日志
|
||||
NuInvoicingThdLog logData = new NuInvoicingThdLog();
|
||||
logData.setThdId(dto.getId());//退货指令id
|
||||
logData.setStatus(status);//操作状态
|
||||
logData.setOpeBy(sysUser.getId());//操作人
|
||||
logData.setOpeTime(new Date());//操作时间
|
||||
logData.setNuId(main.getNuId());//护理单元id
|
||||
logData.setElderId(main.getElderId());//长者id
|
||||
thdLogMapper.insert(logData);
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue