|
|
@@ -25,10 +25,7 @@ import lombok.AllArgsConstructor;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.springblade.client.entity.FeesDesc;
|
|
|
import org.springblade.client.entity.Message;
|
|
|
-import org.springblade.client.feign.ICorpsArchivesClient;
|
|
|
-import org.springblade.client.feign.IFeesDescClient;
|
|
|
-import org.springblade.client.feign.IMessageClient;
|
|
|
-import org.springblade.client.feign.ISerialClient;
|
|
|
+import org.springblade.client.feign.*;
|
|
|
import org.springblade.core.secure.utils.AuthUtil;
|
|
|
import org.springblade.core.tool.api.R;
|
|
|
import org.springblade.finance.dto.ApplyDTO;
|
|
|
@@ -56,6 +53,7 @@ import org.springframework.transaction.annotation.Transactional;
|
|
|
import org.springframework.transaction.interceptor.TransactionAspectSupport;
|
|
|
|
|
|
import java.math.BigDecimal;
|
|
|
+import java.text.SimpleDateFormat;
|
|
|
import java.util.Date;
|
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
|
@@ -105,6 +103,8 @@ public class MaintenanceServiceImpl extends ServiceImpl<MaintenanceMapper, Maint
|
|
|
//财务
|
|
|
private final IFinanceClient financeClient;
|
|
|
|
|
|
+ private final IWechatClient wechatClient;
|
|
|
+
|
|
|
@Override
|
|
|
public IPage<MaintenanceVO> selectMaintenancePage(IPage<MaintenanceVO> page, MaintenanceVO maintenance) {
|
|
|
return page.setRecords(baseMapper.selectMaintenancePage(page, maintenance));
|
|
|
@@ -195,6 +195,13 @@ public class MaintenanceServiceImpl extends ServiceImpl<MaintenanceMapper, Maint
|
|
|
maintenanceLog.setCreateUserName(AuthUtil.getUserName());
|
|
|
maintenanceLog.setType("设备报修");
|
|
|
maintenanceLogService.save(maintenanceLog);
|
|
|
+ SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
|
|
|
+ String date = "";
|
|
|
+ if (ObjectUtils.isNotNull(maintenance.getRepairReportDate())) {
|
|
|
+ date = format.format(maintenance.getRepairReportDate());
|
|
|
+ }
|
|
|
+// wechatClient.sendMessage("o9USS6462dtxKR9dCrqxZTrAsm5o", "报修通知", "设备报修", date, maintenance.getCorpName(), maintenance.getDeviceName(),
|
|
|
+// maintenance.getCorpTel(), maintenance.getMaintenanceWorkerTel(), maintenance.getDeviceDescribe(), maintenance.getMaintenanceAmount(), "1");
|
|
|
return R.data(maintenance);
|
|
|
}
|
|
|
|
|
|
@@ -242,6 +249,8 @@ public class MaintenanceServiceImpl extends ServiceImpl<MaintenanceMapper, Maint
|
|
|
maintenanceLog.setCreateUserName(AuthUtil.getUserName());
|
|
|
maintenanceLog.setType("已派工");
|
|
|
maintenanceLogService.save(maintenanceLog);
|
|
|
+ // wechatClient.sendMessage("o9USS6462dtxKR9dCrqxZTrAsm5o", "派工通知", "设备报修", date, maintenance.getCorpName(), maintenance.getDeviceName(),
|
|
|
+// maintenance.getCorpTel(), maintenance.getMaintenanceWorkerTel(), maintenance.getDeviceDescribe(), maintenance.getMaintenanceAmount(), "1");
|
|
|
return R.data(maintenance);
|
|
|
}
|
|
|
|
|
|
@@ -292,6 +301,9 @@ public class MaintenanceServiceImpl extends ServiceImpl<MaintenanceMapper, Maint
|
|
|
maintenanceLog.setCreateUserName(AuthUtil.getUserName());
|
|
|
maintenanceLog.setType("已撤销");
|
|
|
maintenanceLogService.save(maintenanceLog);
|
|
|
+ // wechatClient.sendMessage("o9USS6462dtxKR9dCrqxZTrAsm5o", "撤销派工通知", "设备报修", date, maintenance.getCorpName(), maintenance.getDeviceName(),
|
|
|
+// maintenance.getCorpTel(), maintenance.getMaintenanceWorkerTel(), maintenance.getDeviceDescribe(), maintenance.getMaintenanceAmount(), "1");
|
|
|
+
|
|
|
return R.data(maintenance);
|
|
|
}
|
|
|
|
|
|
@@ -335,6 +347,9 @@ public class MaintenanceServiceImpl extends ServiceImpl<MaintenanceMapper, Maint
|
|
|
maintenanceLog.setCreateUserName(AuthUtil.getUserName());
|
|
|
maintenanceLog.setType("确认接单");
|
|
|
maintenanceLogService.save(maintenanceLog);
|
|
|
+ // wechatClient.sendMessage("o9USS6462dtxKR9dCrqxZTrAsm5o", "接单通知", "设备报修", date, maintenance.getCorpName(), maintenance.getDeviceName(),
|
|
|
+// maintenance.getCorpTel(), maintenance.getMaintenanceWorkerTel(), maintenance.getDeviceDescribe(), maintenance.getMaintenanceAmount(), "1");
|
|
|
+
|
|
|
return R.data(maintenance);
|
|
|
}
|
|
|
|
|
|
@@ -360,6 +375,8 @@ public class MaintenanceServiceImpl extends ServiceImpl<MaintenanceMapper, Maint
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
+ @GlobalTransactional(rollbackFor = Exception.class, timeoutMills = 12000000)
|
|
|
public R submitWX(Maintenance maintenance) {
|
|
|
maintenance.setCreateTime(new Date());
|
|
|
maintenance.setCreateUserName(AuthUtil.getUserName());
|
|
|
@@ -394,6 +411,8 @@ public class MaintenanceServiceImpl extends ServiceImpl<MaintenanceMapper, Maint
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
+ @GlobalTransactional(rollbackFor = Exception.class, timeoutMills = 12000000)
|
|
|
public R payPrepay(Maintenance maintenance, int type) {
|
|
|
if (null == maintenance) {
|
|
|
throw new RuntimeException("未找到订单信息,订单已取消");
|
|
|
@@ -483,6 +502,8 @@ public class MaintenanceServiceImpl extends ServiceImpl<MaintenanceMapper, Maint
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
+ @GlobalTransactional(rollbackFor = Exception.class, timeoutMills = 12000000)
|
|
|
public R confirmFees(Maintenance maintenance) {
|
|
|
if (maintenance.getId() == null) {
|
|
|
throw new RuntimeException("缺少必要参数");
|
|
|
@@ -523,7 +544,12 @@ public class MaintenanceServiceImpl extends ServiceImpl<MaintenanceMapper, Maint
|
|
|
maintenance.setUpdateUser(AuthUtil.getUserId());
|
|
|
maintenance.setUpdateUserName(AuthUtil.getUserName());
|
|
|
baseMapper.updateById(maintenance);
|
|
|
- corpsArchivesClient.updateArchives(maintenance.getArchivesId() + "", maintenance.getRepairReportDate(), maintenance.getDeviceId() + "");
|
|
|
+ SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
|
|
|
+ String date = "";
|
|
|
+ if (ObjectUtils.isNotNull(maintenance.getRepairReportDate())) {
|
|
|
+ date = format.format(maintenance.getRepairReportDate());
|
|
|
+ }
|
|
|
+ corpsArchivesClient.updateArchives(maintenance.getArchivesId() + "", date, maintenance.getDeviceId() + "");
|
|
|
MaintenanceLog maintenanceLog = new MaintenanceLog();
|
|
|
maintenanceLog.setSysNo(maintenance.getSysNo());
|
|
|
maintenanceLog.setSrcId(maintenance.getId());
|
|
|
@@ -532,6 +558,9 @@ public class MaintenanceServiceImpl extends ServiceImpl<MaintenanceMapper, Maint
|
|
|
maintenanceLog.setCreateUserName(AuthUtil.getUserName());
|
|
|
maintenanceLog.setType("费用确认");
|
|
|
maintenanceLogService.save(maintenanceLog);
|
|
|
+ // wechatClient.sendMessage("o9USS6462dtxKR9dCrqxZTrAsm5o", "待支付通知", "设备报修", date, maintenance.getCorpName(), maintenance.getDeviceName(),
|
|
|
+// maintenance.getCorpTel(), maintenance.getMaintenanceWorkerTel(), maintenance.getDeviceDescribe(), maintenance.getMaintenanceAmount(), "1");
|
|
|
+
|
|
|
return R.data(maintenance);
|
|
|
}
|
|
|
|
|
|
@@ -597,6 +626,8 @@ public class MaintenanceServiceImpl extends ServiceImpl<MaintenanceMapper, Maint
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
+ @GlobalTransactional(rollbackFor = Exception.class, timeoutMills = 12000000)
|
|
|
public R scanPay(Maintenance maintenance) {
|
|
|
if (maintenance.getId() == null) {
|
|
|
throw new RuntimeException("缺少必要参数");
|
|
|
@@ -616,16 +647,26 @@ public class MaintenanceServiceImpl extends ServiceImpl<MaintenanceMapper, Maint
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
+ @GlobalTransactional(rollbackFor = Exception.class, timeoutMills = 12000000)
|
|
|
public R revokeConfirmFees(Maintenance maintenance) {
|
|
|
if (maintenance.getId() == null) {
|
|
|
throw new RuntimeException("缺少必要参数");
|
|
|
}
|
|
|
Acc acc = financeClient.selectBySrcId(maintenance.getId());
|
|
|
- if (ObjectUtils.isNotNull(acc) && (new BigDecimal("0.00").compareTo(acc.getSettlementAmount()) == 0 || ObjectUtils.isNull(acc.getSettlementAmount()))){
|
|
|
- financeClient.deleteBySrcId(maintenance.getId());
|
|
|
- }else {
|
|
|
- throw new RuntimeException("账单已结算,撤销失败");
|
|
|
+ if (ObjectUtils.isNotNull(acc)) {
|
|
|
+ if (ObjectUtils.isNotNull(acc) && (new BigDecimal("0.00").compareTo(acc.getSettlementAmount()) == 0 || ObjectUtils.isNull(acc.getSettlementAmount()))) {
|
|
|
+ financeClient.deleteBySrcId(maintenance.getId());
|
|
|
+ } else {
|
|
|
+ throw new RuntimeException("账单已结算,撤销失败");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
|
|
|
+ String date = "";
|
|
|
+ if (ObjectUtils.isNotNull(maintenance.getRepairReportDate())) {
|
|
|
+ date = format.format(maintenance.getRepairReportDate());
|
|
|
}
|
|
|
+ corpsArchivesClient.updateArchivesRevoke(maintenance.getArchivesId() + "", date, maintenance.getDeviceId() + "");
|
|
|
maintenance.setStatus(3);
|
|
|
maintenance.setUpdateTime(new Date());
|
|
|
maintenance.setUpdateUser(AuthUtil.getUserId());
|