Merge branch 'dev-cq' of http://192.168.0.56:3000/bonus/devicesmgt into dev-cq

This commit is contained in:
BianLzhaoMin 2024-06-19 14:43:01 +08:00
commit 771e755198
2 changed files with 41 additions and 36 deletions

View File

@ -52,29 +52,30 @@ public class RepairServiceImpl implements RepairService {
@Override
@Transactional(rollbackFor = Exception.class)
public AjaxResult submitRepairApply( RepairApplyRecord bean) {
public AjaxResult submitRepairApply(RepairApplyRecord bean) {
RepairTaskDetails details = mapper.getById(bean.getId());
LoginUser loginUser = SecurityUtils.getLoginUser();
bean.setCreateBy(loginUser.getUserid());
List<RepairPartDetails> partList = bean.getPartList();
BigDecimal sfCosts = new BigDecimal("0");
BigDecimal bsfCosts = new BigDecimal("0");
Integer partNum = 0;
String nbType = "1";
String fcType = "2";
String sfPart = "1";
String bsfPart = "0";
if (partList != null && partList.size()>0){
if (partList != null && partList.size() > 0) {
bean.setRepairNum(partList.get(0).getRepairNum());
bean.setRepairer(partList.get(0).getRepairer());
}
switch (bean.getRepairType()) {
case "1":{
case "1": {
int repairNum = details.getRepairedNum() + bean.getRepairNum();
int num = repairNum + details.getScrapNum();
if (num > details.getRepairNum()) {
throw new ServiceException("维修数量大于维修总量");
}
mapper.updateRepairedNum(bean.getId(), repairNum,bean.getRepairer(),loginUser.getUserid());
mapper.updateRepairedNum(bean.getId(), repairNum, bean.getRepairer(), loginUser.getUserid());
break;
}
case "2": {
@ -83,7 +84,7 @@ public class RepairServiceImpl implements RepairService {
if (num > details.getRepairNum()) {
throw new ServiceException("维修数量大于维修总量");
}
mapper.updateRepairedNumTwo(bean.getId(), repairNum,loginUser.getUserid());
mapper.updateRepairedNumTwo(bean.getId(), repairNum, loginUser.getUserid());
break;
}
case "3": {
@ -92,17 +93,17 @@ public class RepairServiceImpl implements RepairService {
if (num > details.getRepairNum()) {
throw new ServiceException("维修数量大于维修总量");
}
mapper.updateScrapNum(bean.getId(), scrapNum,loginUser.getUserid());
mapper.updateScrapNum(bean.getId(), scrapNum, loginUser.getUserid());
break;
}
default:
break;
}
if (partList != null && partList.size()>0){
if (nbType.equals(bean.getRepairType())){
for (RepairPartDetails partDetails : partList){
if(partDetails.getPartId() != null){
if (partDetails.getPartCost() == null || partDetails.getPartCost().isEmpty()){
if (partList != null && partList.size() > 0) {
if (nbType.equals(bean.getRepairType())) {
for (RepairPartDetails partDetails : partList) {
if (partDetails.getPartId() != null) {
if (partDetails.getPartCost() == null || partDetails.getPartCost().isEmpty()) {
partDetails.setPartCost("0");
}
partDetails.setTaskId(bean.getTaskId());
@ -111,47 +112,50 @@ public class RepairServiceImpl implements RepairService {
partDetails.setCreateBy(loginUser.getUserid());
partDetails.setCompanyId(bean.getCompanyId());
mapper.addPart(partDetails);
partNum += partDetails.getPartNum();
}
}
bean.setPartNum(partNum);
}
if (fcType.equals(bean.getRepairType())){
if (fcType.equals(bean.getRepairType())) {
bean.setPartName(partList.get(0).getPartName());
bean.setPartType(partList.get(0).getPartType());
bean.setRepairContent(partList.get(0).getRepairContent());
if (partList.get(0).getSupplierId() == null){
if (partList.get(0).getSupplierId() == null) {
throw new ServiceException("请选择返厂厂家");
}else {
} else {
bean.setSupplierId(partList.get(0).getSupplierId());
}
if (bean.getPartPrice() == null || bean.getPartPrice().isEmpty()){
if (bean.getPartPrice() == null || bean.getPartPrice().isEmpty()) {
bean.setPartPrice("0");
}else {
} else {
bean.setPartPrice(partList.get(0).getPartPrice());
}
bean.setPartNum(partList.get(0).getPartNum());
}
for (RepairPartDetails partDetails : partList){
if (sfPart.equals(partDetails.getPartType())){
if (StringUtils.isEmpty(partDetails.getPartCost())){
for (RepairPartDetails partDetails : partList) {
if (sfPart.equals(partDetails.getPartType())) {
if (StringUtils.isEmpty(partDetails.getPartCost())) {
partDetails.setPartCost("0");
}
BigDecimal partCost = new BigDecimal(partDetails.getPartCost());
sfCosts = sfCosts.add(partCost);
} else if (bsfPart.equals(partDetails.getPartType())) {
if (StringUtils.isEmpty(partDetails.getPartCost())){
if (StringUtils.isEmpty(partDetails.getPartCost())) {
partDetails.setPartCost("0");
}
BigDecimal partCost = new BigDecimal(partDetails.getPartCost());
bsfCosts = bsfCosts.add(partCost);
} else{
} else {
throw new ServiceException("请选择配件收费类型");
}
}
if (!"0".equals(sfCosts.toString())){
mapper.addRepairCost(bean,sfCosts,sfPart);
if (!"0".equals(sfCosts.toString())) {
mapper.addRepairCost(bean, sfCosts, sfPart);
}
if (!"0".equals(bsfCosts.toString())){
mapper.addRepairCost(bean,bsfCosts,bsfPart);
if (!"0".equals(bsfCosts.toString())) {
mapper.addRepairCost(bean, bsfCosts, bsfPart);
}
}
mapper.addRecord(bean);
@ -162,13 +166,13 @@ public class RepairServiceImpl implements RepairService {
@Transactional(rollbackFor = Exception.class)
public AjaxResult fastRepairApply(List<RepairTaskDetails> list) {
LoginUser loginUser = SecurityUtils.getLoginUser();
for (RepairTaskDetails bean : list){
for (RepairTaskDetails bean : list) {
int repairedNum = bean.getRepairNum() - bean.getRepairedNum() - bean.getScrapNum();
if (repairedNum <= 0){
if (repairedNum <= 0) {
throw new ServiceException("选中的数据中包含待维修数量为0的机具请重新选择");
}
}
for (RepairTaskDetails bean : list){
for (RepairTaskDetails bean : list) {
int repairedNum = bean.getRepairNum() - bean.getRepairedNum() - bean.getScrapNum();
RepairApplyRecord partDetails = new RepairApplyRecord();
partDetails.setTaskId(bean.getTaskId());
@ -180,7 +184,7 @@ public class RepairServiceImpl implements RepairService {
partDetails.setCompanyId(bean.getCompanyId());
mapper.addRecord(partDetails);
int i = repairedNum + bean.getRepairedNum();
mapper.updateRepairedNumTwo(bean.getId(),i,loginUser.getUserid());
mapper.updateRepairedNumTwo(bean.getId(), i, loginUser.getUserid());
}
return AjaxResult.success();
}
@ -189,19 +193,19 @@ public class RepairServiceImpl implements RepairService {
@Transactional(rollbackFor = Exception.class)
public AjaxResult endRepairTask(List<RepairTask> taskList) {
LoginUser loginUser = SecurityUtils.getLoginUser();
for (RepairTask task : taskList){
for (RepairTask task : taskList) {
int i = mapper.getUnFinish(task);
if (i > 0){
if (i > 0) {
throw new ServiceException("选中的数据中包含维修未完成的,请完成维修再进行提交审核");
}
}
int i = mapper.updateTaskStatus(taskList,loginUser.getUserid());
for (RepairTask task : taskList){
int i = mapper.updateTaskStatus(taskList, loginUser.getUserid());
for (RepairTask task : taskList) {
task.setCreateBy(loginUser.getUserid());
Long agreementId = mapper.getAgreementId(task);
List<RepairTaskDetails> detailsList = mapper.getDetailsListByTaskId(task);
mapper.addTask(task);
for (RepairTaskDetails details : detailsList){
for (RepairTaskDetails details : detailsList) {
details.setCreateBy(loginUser.getUserid());
details.setTaskId(task.getTaskId());
mapper.addAuditDetails(details);
@ -221,7 +225,7 @@ public class RepairServiceImpl implements RepairService {
@Override
public int completeRepair(ArrayList<Long> ids) {
LoginUser loginUser = SecurityUtils.getLoginUser();
return mapper.completeRepair(ids,loginUser.getUserid());
return mapper.completeRepair(ids, loginUser.getUserid());
}
@Override

View File

@ -787,11 +787,12 @@
sd.id as sdId
FROM
ma_machine mm
LEFT JOIN slt_agreement_info sai on mm.type_id = sai.type_id and mm.ma_id = sai.ma_id
LEFT JOIN ma_type mt on mt.type_id=mm.type_id
LEFT JOIN ma_type mt2 on mt2.type_id=mt.parent_id
LEFT JOIN sys_dic sd on mm.ma_status=sd.id
WHERE
qr_code =#{qrCode}
mm.qr_code =#{qrCode} and sai.agreement_id = #{agreementId}
</select>
<select id="backReceiveRecord" resultType="com.bonus.sgzb.app.domain.BackApplyInfo">
SELECT