同步重庆代码

This commit is contained in:
sxu 2024-08-15 15:08:21 +08:00
parent b1c10ed046
commit 49b8fdf347
37 changed files with 589 additions and 227 deletions

View File

@ -2,6 +2,7 @@ package com.bonus.sgzb.base.api.domain;
import com.bonus.sgzb.common.core.web.domain.BaseEntity;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
@ -13,6 +14,7 @@ import java.math.BigDecimal;
* @author bonus
* @date 2023-12-15
*/
@Data
public class MaInputRecord extends BaseEntity
{
private static final long serialVersionUID = 1L;
@ -61,7 +63,11 @@ public class MaInputRecord extends BaseEntity
@ApiModelProperty(value = "机具编号")
private String maCode;
/**
* 机具类型1数量0编码
*/
@ApiModelProperty(value = "管理类型")
private String manageType;
public void setId(Long id)
{

View File

@ -2,8 +2,6 @@ package com.bonus.sgzb.base.api.domain;
import lombok.Data;
import java.util.List;
/**
* @author c liu
* @date 2024/2/21
@ -59,7 +57,8 @@ public class SltAgreementApply {
*结算总费用
*/
private String cost;
private String repairIds;
private List<SltAgreementRelation> relations;
private SltAgreementRelation relation;
}

View File

@ -44,6 +44,10 @@ public class SltAgreementInfo {
*机具id
*/
private String maId;
/**
*配件单价
*/
private String partPrice;
/**
*领料数量
*/
@ -67,6 +71,10 @@ public class SltAgreementInfo {
*领料id
*/
private String leaseId;
/**
*配件数量
*/
private String partNum;
/**
*退料id
*/
@ -153,7 +161,7 @@ public class SltAgreementInfo {
/**
* 费用承担方
*/
@Excel(name = "费用承担方")
@Excel(name = "费用承担方(01项目,03分包)")
private String costBearingParty;
/**
* 调整天数

View File

@ -45,6 +45,7 @@ public class SltAgreementRelation {
private String leaseCostOne;
private String leaseCostThree;
private String scrapCost;
private String preScrapCost;
private String repairCost;
private String isSltOne;
private String isSltThree;

View File

@ -0,0 +1,46 @@
package com.bonus.sgzb.common.core.constant;
public class RoleConstans {
private RoleConstans() {
throw new IllegalStateException("Utility class");
}
/**
* 管理员
*/
public static final String STRING_ADMIN = "admin";
/**
* 机具设备分公司--机具库管员
*/
public static final String STRING_JJFGS = "jjfgs";
/**
* 机具设备分公司--班长
*/
public static final String STRING_JJBZ = "jjbz";
/**
* 副班长
*/
public static final String STRING_FBZ = "fbz";
/**
*机具设备分公司--机具经理/书记
*/
public static final String STRING_EM01 = "em01";
/**
* 机具设备分公司--机具副经理
*/
public static final String STRING_EM02 = "em02";
/**
* 机具设备分公司--安全员
*/
public static final String STRING_EM03 = "em03";
/**
* 调试分公司--调试经理
*/
public static final String STRING_DM01 = "dm01";
/**
* 调试分公司--调试库管员
*/
public static final String STRING_DM05 = "dm05";
}

View File

@ -4,6 +4,7 @@ import org.apache.commons.lang3.time.DateUtils;
import java.text.*;
import java.time.LocalDate;
import java.time.YearMonth;
import java.time.format.DateTimeFormatter;
import java.time.temporal.ChronoUnit;
import java.time.temporal.TemporalAdjusters;
@ -795,6 +796,19 @@ public class DateTimeHelper {
return lastDayOfMonth;
}
// 获取上个月的年月
public static String getLastMonthYearMonth() {
// 获取当前时间的年月
YearMonth now = YearMonth.now();
// 减去一个月
YearMonth lastMonth = now.minusMonths(1);
// 将YearMonth对象格式化为字符串
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM");
return lastMonth.format(formatter);
}
public static void main(String[] args) {
System.err.println(getTimeAfterThirtyDay());
System.err.println(getNowTime());
@ -926,16 +940,46 @@ public class DateTimeHelper {
return list;
}
public static String getCalStartDay() {
public static String getPreMonthFirstDay() {
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
// 获取当前月第一天
Calendar c = Calendar.getInstance();
c.add(Calendar.MONTH, -1);
c.set(Calendar.DAY_OF_MONTH, 21);
c.set(Calendar.DAY_OF_MONTH, 1);// 设置为1号,当前日期既为本月第一天
String first = format.format(c.getTime());
return first;
}
public static String getCalDay(int day) {
public static String getCurrentMonthFirstDay() {
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
// 获取当前月第一天
Calendar c = Calendar.getInstance();
c.add(Calendar.MONTH, 0);
c.set(Calendar.DAY_OF_MONTH, 1);// 设置为1号,当前日期既为本月第一天
String first = format.format(c.getTime());
return first;
}
public static String getPreLastDay() {
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
// 获取当前月最后一天
Calendar c = Calendar.getInstance();
c.add(Calendar.MONTH, -1);
c.set(Calendar.DAY_OF_MONTH, c.getActualMaximum(Calendar.DAY_OF_MONTH));
String last = format.format(c.getTime());
return last;
}
public static String getPreMonthCalStartDay(int day) {
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
Calendar c = Calendar.getInstance();
c.add(Calendar.MONTH, -1);
c.set(Calendar.DAY_OF_MONTH, day);
String first = format.format(c.getTime());
return first;
}
public static String getCurrentMonthCalEndDay(int day) {
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
Calendar c = Calendar.getInstance();
c.add(Calendar.MONTH, 0);

View File

@ -55,7 +55,7 @@ public class LeaseApplyInfo implements Serializable {
/**
* 费用承担方
*/
@ApiModelProperty(value = "费用承担方")
@ApiModelProperty(value = "费用承担方(01项目,03分包)")
private String costBearingParty;
/**

View File

@ -69,7 +69,7 @@ public class TmTask implements Serializable {
/**
* 费用承担方
*/
@ApiModelProperty(value = "费用承担方")
@ApiModelProperty(value = "费用承担方(01项目,03分包)")
private String costBearingParty;
/**
* 编号

View File

@ -1090,15 +1090,15 @@ public class TmTaskServiceImpl implements TmTaskService {
remark = leaseApplyInfo1.getRemark();
phone = leaseApplyInfo1.getPhone();
}
List<LeaseApplyDetails> leaseApplyDetails = task.getLeaseApplyDetails();
List<LeaseApplyInfo> LeaseApplyInfoList = task.getLeaseApplyInfoList();
Long taskId = task.getTaskId();
if (CollUtil.isNotEmpty(leaseApplyDetails)) {
for (LeaseApplyDetails leaseApplyDetail : leaseApplyDetails) {
if (CollUtil.isNotEmpty(LeaseApplyInfoList)) {
for (LeaseApplyInfo leaseApply : LeaseApplyInfoList) {
LeaseApplyInfo leaseApplyInfos = new LeaseApplyInfo();
if (leaseApplyDetail.getCompanyId() == null) {
if (leaseApply.getCompanyId() == null) {
leaseApplyInfos = leaseApplyInfoMapper.selectByTaskIdAndCompIdCq(String.valueOf(taskId));
} else {
leaseApplyInfos = leaseApplyInfoMapper.selectByTaskIdAndCompId(String.valueOf(taskId), leaseApplyDetail.getCompanyId());
leaseApplyInfos = leaseApplyInfoMapper.selectByTaskIdAndCompId(String.valueOf(taskId), leaseApply.getCompanyId());
}
if (leaseApplyInfos == null) {
LeaseApplyInfo leaseApplyInfo = new LeaseApplyInfo();
@ -1115,9 +1115,10 @@ public class TmTaskServiceImpl implements TmTaskService {
}
leaseApplyInfo.setRemark(remark);
leaseApplyInfo.setType(task.getLeaseApplyInfoList().get(0).getType());
leaseApplyInfo.setCompanyId(leaseApplyDetail.getCompanyId());
leaseApplyInfo.setCompanyId(leaseApply.getCompanyId());
leaseApplyInfo.setEstimateLeaseTime(task.getEstimateLeaseTime());
leaseApplyInfo.setLeaseType(task.getLeaseType());
leaseApplyInfo.setCostBearingParty(leaseApply.getCostBearingParty());
res = leaseApplyInfoMapper.insert(leaseApplyInfo);
}
}

View File

@ -21,7 +21,7 @@ import java.util.List;
*/
@RestController
@RequestMapping("/base/receive")
@RequestMapping("/receive")
public class MaReceiveController extends BaseController {
@Resource

View File

@ -119,6 +119,7 @@ public class RepairApplyRecord implements Serializable {
private List<RepairPartDetails> partList;
private String partStrList;
private Long companyId;
private Integer partId;
/**
* 损坏照片id
*/

View File

@ -12,7 +12,7 @@ import java.util.List;
/**
* 工机具类型管理 数据层
*
*
* @author ruoyi
*/
@Mapper
@ -84,4 +84,6 @@ public interface MaTypeMapper {
int deletePropSetByTypeId(Long typeId);
int updateTypeNum(MaMachine maMachine);
List<MaTypeKeeper> selectMaTypeByUserId(Long userId);
}

View File

@ -161,4 +161,6 @@ public interface RepairMapper {
List<RepairTask> exportRepairTaskList(RepairTask bean);
int addRepairCost(@Param("bean") RepairApplyRecord bean, @Param("costs") BigDecimal costs,@Param("partType") String partType);
String selectPartPrice(Long partId);
}

View File

@ -161,74 +161,47 @@ public class ExcelServiceImpl implements ExcelService {
}
}
private void printLevel3Relation(Map<String, Map<String, List<MapType>>> level3Relation) {
for (Map.Entry<String, Map<String, List<MapType>>> firstLevel : level3Relation.entrySet()) {
boolean outExist = true;
System.out.println("level_1: " + firstLevel.getKey());
//TODO, sql查询是否有此名字 + parentId=0, select * from ma_part_type where name=? and parent_id=0;
MaPartType maPartType_level1 = excelMapper.selectMa(firstLevel.getKey(),0);
//TODO, 以上返回 maPartType_level1
if (Objects.nonNull(maPartType_level1)) {
loopInner(firstLevel, outExist,maPartType_level1.getPaId());
loopInner(firstLevel, maPartType_level1.getPaId());
} else {
//TODO, insert firstLevel, get id
MaPartType maPartType = new MaPartType();
maPartType.setPaName(firstLevel.getKey());
maPartType.setCreateBy(SecurityUtils.getLoginUser().getUserid().toString());
maPartType.setParentId(0L);
maPartType.setLevel("1");
excelMapper.insertPaName(maPartType);//如果第一层在数据库中查询不到则插入数据并且读取到parent_id
outExist = outExist && false;
loopInner(firstLevel, outExist, maPartType.getPaId());
loopInner(firstLevel, maPartType.getPaId());
}
}
}
private void loopInner(Map.Entry<String, Map<String, List<MapType>>> firstLevel, boolean outExist, long firstLevelId) {
private void loopInner(Map.Entry<String, Map<String, List<MapType>>> firstLevel, long firstLevelId) {
for (Map.Entry<String, List<MapType>> secondLevel : firstLevel.getValue().entrySet()) {
System.out.println("\tlevel_2: " + secondLevel.getKey());
//TODO, sql查询是否有此名字 + parentId=firstLevelId, select * from ma_part_type where name=? and parent_id = firstLevelId;
MaPartType maPartType_level2 = excelMapper.selectMa(secondLevel.getKey(),firstLevelId);
//TODO, 以上返回 maPartType_level2
if (Objects.nonNull(maPartType_level2)) {
looplevel3(secondLevel, outExist, maPartType_level2.getPaId());
looplevel3(secondLevel, maPartType_level2.getPaId());
} else {
//TODO, insert firstLevel, get id
if (!outExist) {
MaPartType maPartType = new MaPartType();
maPartType.setPaName(secondLevel.getKey());
maPartType.setCreateBy(SecurityUtils.getLoginUser().getUserid().toString());
maPartType.setParentId(firstLevelId);
maPartType.setLevel("2");
excelMapper.insertPaName(maPartType);//如果第一层在数据库中查询不到则插入数据并且读取到parent_id
outExist = outExist && false;
looplevel3(secondLevel, outExist, maPartType.getPaId());
}
MaPartType maPartType = new MaPartType();
maPartType.setPaName(secondLevel.getKey());
maPartType.setCreateBy(SecurityUtils.getLoginUser().getUserid().toString());
maPartType.setParentId(firstLevelId);
maPartType.setLevel("2");
excelMapper.insertPaName(maPartType);//如果第一层在数据库中查询不到则插入数据并且读取到parent_id
looplevel3(secondLevel, maPartType.getPaId());
}
}
}
private void looplevel3(Map.Entry<String, List<MapType>> secondLevel, boolean outExist, long secondLevelId) {
private void looplevel3(Map.Entry<String, List<MapType>> secondLevel, long secondLevelId) {
for (MapType thirdLevel : secondLevel.getValue()) {
System.out.println("\t\tlevel_3: " + thirdLevel);
//TODO, sql查询是否有此名字 + parentId=secondLevelId, select * from ma_part_type where name=? and parent_id = secondLevelId;
MaPartType maPartType_level3 = excelMapper.selectMa(thirdLevel.getPaName(),secondLevelId);
//TODO, 以上返回 maPartType_level3
if (Objects.nonNull(maPartType_level3)) {
if (!outExist) {
//TODO insert
MaPartType maPartType = new MaPartType();
maPartType.setPaName(thirdLevel.getPaName());
maPartType.setCreateBy(SecurityUtils.getLoginUser().getUserid().toString());
maPartType.setUnitId(thirdLevel.getUnitId());
maPartType.setBuyPrice(thirdLevel.getBuyPrice());
maPartType.setParentId(secondLevelId);
maPartType.setLevel("3");
excelMapper.insertPaName(maPartType);//如果第一层在数据库中查询不到则插入数据并且读取到parent_id
}
} else {
//TODO insert
if (Objects.isNull(maPartType_level3)) {
MaPartType maPartType = new MaPartType();
maPartType.setPaName(thirdLevel.getPaName());
maPartType.setCreateBy(SecurityUtils.getLoginUser().getUserid().toString());

View File

@ -8,11 +8,11 @@ import com.bonus.sgzb.base.domain.vo.DictVo;
import com.bonus.sgzb.base.mapper.RepairMapper;
import com.bonus.sgzb.base.service.RepairService;
import com.bonus.sgzb.common.core.exception.ServiceException;
import com.bonus.sgzb.common.core.utils.StringUtils;
import com.bonus.sgzb.common.core.web.domain.AjaxResult;
import com.bonus.sgzb.common.security.utils.SecurityUtils;
import com.bonus.sgzb.system.api.domain.SysUser;
import com.bonus.sgzb.system.api.model.LoginUser;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@ -58,8 +58,6 @@ public class RepairServiceImpl implements RepairService {
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";
@ -103,6 +101,7 @@ public class RepairServiceImpl implements RepairService {
if (nbType.equals(bean.getRepairType())) {
for (RepairPartDetails partDetails : partList) {
if (partDetails.getPartId() != null) {
// 有维修配件时
if (partDetails.getPartCost() == null || partDetails.getPartCost().isEmpty()) {
partDetails.setPartCost("0");
}
@ -111,11 +110,21 @@ public class RepairServiceImpl implements RepairService {
partDetails.setTypeId(bean.getTypeId());
partDetails.setCreateBy(loginUser.getUserid());
partDetails.setCompanyId(bean.getCompanyId());
// 根据partid 找到配件单价
String partPrice = mapper.selectPartPrice(partDetails.getPartId());
partDetails.setPartCost(partPrice);
mapper.addPart(partDetails);
partNum += partDetails.getPartNum();
bean.setPartPrice(partDetails.getPartCost());
bean.setPartId(partDetails.getPartId().intValue());
bean.setPartNum(partDetails.getPartNum());
bean.setRepairContent(partDetails.getRepairContent());
bean.setPartType(partDetails.getPartType());
mapper.addRecord(bean);
} else {
// 不选维修配件时
mapper.addRecord(bean);
}
}
bean.setPartNum(partNum);
}
if (fcType.equals(bean.getRepairType())) {
bean.setPartName(partList.get(0).getPartName());
@ -126,39 +135,26 @@ public class RepairServiceImpl implements RepairService {
} else {
bean.setSupplierId(partList.get(0).getSupplierId());
}
if (bean.getPartPrice() == null || bean.getPartPrice().isEmpty()) {
if (partList.get(0).getPartPrice() == null || partList.get(0).getPartPrice().isEmpty()) {
bean.setPartPrice("0");
} else {
bean.setPartPrice(partList.get(0).getPartPrice());
}
bean.setPartNum(partList.get(0).getPartNum());
mapper.addRecord(bean);
}
for (RepairPartDetails partDetails : partList) {
if (sfPart.equals(partDetails.getPartType())) {
if (StringUtils.isEmpty(partDetails.getPartCost())) {
partDetails.setPartCost("0");
}
if (StringUtils.isNotBlank(partDetails.getPartCost())) {
BigDecimal partCost = new BigDecimal(partDetails.getPartCost());
sfCosts = sfCosts.add(partCost);
} else if (bsfPart.equals(partDetails.getPartType())) {
if (StringUtils.isEmpty(partDetails.getPartCost())) {
partDetails.setPartCost("0");
}
BigDecimal partCost = new BigDecimal(partDetails.getPartCost());
bsfCosts = bsfCosts.add(partCost);
} else {
throw new ServiceException("请选择配件收费类型");
BigDecimal partNumber = new BigDecimal(partDetails.getPartNum());
sfCosts = sfCosts.add(partCost.multiply(partNumber));
}
}
if (!"0".equals(sfCosts.toString())) {
mapper.addRepairCost(bean, sfCosts, sfPart);
}
if (!"0".equals(bsfCosts.toString())) {
mapper.addRepairCost(bean, bsfCosts, bsfPart);
}
}
mapper.addRecord(bean);
return AjaxResult.success();
}

View File

@ -3,10 +3,7 @@ package com.bonus.sgzb.material.controller;
import com.bonus.sgzb.common.core.web.controller.BaseController;
import com.bonus.sgzb.common.core.web.domain.AjaxResult;
import com.bonus.sgzb.common.core.web.page.TableDataInfo;
import com.bonus.sgzb.material.domain.IotDto;
import com.bonus.sgzb.material.domain.IotLocationVo;
import com.bonus.sgzb.material.domain.IotRecordVo;
import com.bonus.sgzb.material.domain.IotVo;
import com.bonus.sgzb.material.domain.*;
import com.bonus.sgzb.material.service.IotMachineService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
@ -162,29 +159,50 @@ public class IotMachineController extends BaseController {
@ApiOperation("获取定位")
@PostMapping("/getLocation")
public AjaxResult getLocation(@Validated @RequestBody IotDto iotDto) {
log.info("获取定位接口:{}", iotDto);
return iotMachineService.getLocation(iotDto);
public AjaxResult getLocation(@Validated @RequestBody IotLocationVo iotLocationVo) {
log.info("获取定位接口:{}", iotLocationVo);
return AjaxResult.success(iotMachineService.getLocation(iotLocationVo));
}
@ApiOperation("查询行程")
@PostMapping("/searchItinerary")
public AjaxResult searchItinerary(@Validated @RequestBody IotLocationVo iotLocationVo) {
log.info("查询行程接口:{}", iotLocationVo);
return iotMachineService.searchItinerary(iotLocationVo);
return AjaxResult.success(iotMachineService.searchItinerary(iotLocationVo));
}
@ApiOperation("查询停留点")
@PostMapping("/reportParkDetailByTime")
public AjaxResult reportParkDetailByTime(@Validated @RequestBody IotLocationVo iotLocationVo) {
log.info("查询停留点接口:{}", iotLocationVo);
return iotMachineService.reportParkDetailByTime(iotLocationVo);
return AjaxResult.success(iotMachineService.reportParkDetailByTime(iotLocationVo));
}
@ApiOperation("报警记录")
@PostMapping("/reportAlarm")
public AjaxResult reportAlarm(@Validated @RequestBody IotLocationVo iotLocationVo) {
log.info("报警记录接口:{}", iotLocationVo);
return iotMachineService.reportAlarm(iotLocationVo);
return AjaxResult.success(iotMachineService.reportAlarm(iotLocationVo));
}
@ApiOperation("报警推送")
@GetMapping("/alarmPush")
public AjaxResult alarmPush() {
log.info("报警推送:=======");
return AjaxResult.success(iotMachineService.alarmPush());
}
@ApiOperation("报警列表")
@PostMapping("/alarmList")
public AjaxResult alarmList(@Validated @RequestBody IotLocationVo iotLocationVo) {
log.info("报警列表:=======");
return AjaxResult.success(iotMachineService.alarmList(iotLocationVo));
}
@ApiOperation("报警处置")
@PostMapping("/alarmManagement")
public AjaxResult alarmManagement(@Validated @RequestBody ReportAlarm reportAlarm) {
log.info("报警处置:=======");
return AjaxResult.success(iotMachineService.alarmManagement(reportAlarm));
}
}

View File

@ -83,6 +83,7 @@ public class PurchaseMacodeInfoController extends BaseController {
@GetMapping(value = "/putinDetails")
public TableDataInfo putinDetails(PurchaseMacodeInfo purchaseMacodeInfo) {
startPage();
return getDataTable(purchaseMacodeInfoService.selectPutinDetails(purchaseMacodeInfo));
}

View File

@ -136,7 +136,7 @@ public class AgreementInfo extends BaseEntity {
private String cost;
@ApiModelProperty(value = "结算状态")
private String sltStatus;
@ApiModelProperty(value = "费用承担方")
@ApiModelProperty(value = "费用承担方(01项目,03分包)")
private String costBearingParty;
private String codeNum;
/**

View File

@ -10,7 +10,7 @@ public class IotLocationVo {
/** iot设备ID */
@ApiModelProperty(value = "iot设备ID")
private Long iotId;
private String iotId;
/** 经度 */
@ApiModelProperty(value = "经度")
@ -40,4 +40,10 @@ public class IotLocationVo {
/** 报警内容 */
@ApiModelProperty(value = "报警内容")
private String startAlarm;
/**
* 记录的uuid 唯一确定这一条记录
*/
@ApiModelProperty(value = "记录的uuid 唯一确定这一条记录")
private String deviceAlarmId;
}

View File

@ -23,6 +23,10 @@ public class ProjectMonthCosts {
* 结算记录关联id
*/
private Integer sltMonthId;
/**
* 结算记录关联 task id
*/
private Integer taskId;
/**
* 单位id
*/
@ -36,7 +40,7 @@ public class ProjectMonthCosts {
*/
private String month;
/**
* 费用承担方
* 费用承担方(01项目,03分包)
*/
private String costBearingParty;
/**

View File

@ -63,7 +63,7 @@ public class ProjectMonthDetail {
*/
private String leasePrice;
/**
* 费用承担方
* 费用承担方(01项目,03分包)
*/
private String costBearingParty;
private String leaseDays;

View File

@ -0,0 +1,49 @@
package com.bonus.sgzb.material.domain;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.Date;
@Data
public class ReportAlarm {
/**
* 主键
*/
private int id;
/** iot设备编码 */
@ApiModelProperty(value = "iot设备编码")
private String iotCode;
/**
* 记录的uuid 唯一确定这一条记录
*/
private String deviceAlarmId;
/** 报警时间 */
@ApiModelProperty(value = "报警时间")
private Date startAlarmTime;
/** 报警内容 */
@ApiModelProperty(value = "报警内容")
private String startAlarm;
/** 是否推送 0:否1:是 */
@ApiModelProperty(value = "是否推送 0:否1:是")
private Integer whetherPush;
/** 是否核实 0:否1:是 */
@ApiModelProperty(value = "是否核实 0:否1:是")
private String whetherVerify;
/** 核实人 */
@ApiModelProperty(value = "核实人")
private Long StringBy;
/** 核实时间 */
@ApiModelProperty(value = "核实时间")
private Date verifyTime;
}

View File

@ -28,6 +28,8 @@ public interface CalMonthlyMapper {
int deleteCalcRecord(CalMonthlyBean bean);
int deleteMonthlyDetail(CalMonthlyBean bean);
int deleteMonthlyCosts(CalMonthlyBean bean);
int insertProMonCosts(ProjectMonthCosts projectMonthCosts);

View File

@ -117,4 +117,6 @@ public interface IotMachineMapper {
* @return
*/
List<IotRecordVo> getRecordList(IotDto iotDto);
List<IotVo> selectListByTypeId(Long typeId);
}

View File

@ -21,7 +21,7 @@ public interface PurchaseCheckDetailsMapper {
* @param taskId 新购验收任务详细purchase_check_details主键
* @return 新购验收任务详细purchase_check_details
*/
public PurchaseCheckDetails selectPurchaseCheckDetailsByTaskId(Long taskId);
public List<PurchaseCheckDetails> selectPurchaseCheckDetailsByTaskId(Long taskId);
/**
* 查询新购验收任务详细purchase_check_details列表

View File

@ -145,4 +145,8 @@ public interface RepairAuditDetailsMapper
List<RepairPart> getPartRecord(RepairAuditDetails bean);
int updateRepairCost(@Param("inputDetails")RepairAuditDetails inputDetails, @Param("status") String status);
List<String> getRepairApplyRecordId(Long repairId);
void updateRecodeStatus(String id);
}

View File

@ -0,0 +1,25 @@
package com.bonus.sgzb.material.mapper;
import com.bonus.sgzb.material.domain.IotLocationVo;
import com.bonus.sgzb.material.domain.ReportAlarm;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
@Mapper
public interface ReportAlarmMapper {
int add(ReportAlarm reportAlarm);
int deleteById(Long id);
int update(ReportAlarm reportAlarm);
ReportAlarm selectByDeviceAlarmId(@Param("DeviceAlarmId") String DeviceAlarmId);
List<ReportAlarm> selectByIotCode(IotLocationVo iotLocationVo);
}

View File

@ -70,4 +70,6 @@ public interface SltAgreementInfoMapper {
int updateOutSourceCosts(SltAgreementInfo sltAgreementInfo);
int updateBmAgreementInfo(@Param("agreementId") String agreementId);
int updateRecodeIsSlt(String id);
}

View File

@ -1,28 +1,35 @@
package com.bonus.sgzb.material.remind;
import com.bonus.sgzb.common.core.utils.StringUtils;
import com.bonus.sgzb.material.remind.service.CalcMonthlyService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.scheduling.annotation.Async;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
@Component
public class Inform {
@Autowired
private CalcMonthlyService calcfourCostService;
private CalcMonthlyService calcMonthlyService;
private final int CAL_DAY = 6;
@Value("${sgzb.job.settlementJobDay}")
private String settlementJobDay;
// @Scheduled(cron = "0 */1 * * * ? ") // 间隔5分钟执行
// @Scheduled(cron = "0 0 1 22 * ? ") // 每个月22日凌晨1点执行
//@Scheduled(cron = "0 */3 * * * ? ") // 间隔3分钟执行
@Scheduled(cron = "${sgzb.job.settlementJobCron}") // 结算日次日凌晨执行
@Async
public void taskCycle() {
System.out.println("===springMVC定时器启动====");
try {
// 生成每月数据 (上月21日---本月20日)
calcfourCostService.calcMonthInfo(CAL_DAY);
if (StringUtils.isEmpty(settlementJobDay)) {
calcMonthlyService.calcMonthInfo(1);
} else {
int calDay = Integer.parseInt(settlementJobDay);
calcMonthlyService.calcMonthInfo(calDay);
}
} catch (Exception e) {
e.printStackTrace();

View File

@ -34,22 +34,27 @@ public class CalcMonthlyServiceImp implements CalcMonthlyService {
@Override
public void calcMonthInfo(int day) {
String time = DateTimeHelper.getNowDate();
String calDay = DateTimeHelper.getCalDay(day);
if (time.equals(calDay)) {
CalMonthlyBean record = new CalMonthlyBean();
String month = DateTimeHelper.getCurrentMonth();
record.setMonth(month);
// cleanSameMonthOldRecords(record);
List<AgreementInfo> list = agreementInfoService.getAllAgreementId();
String startTime = DateTimeHelper.getCalStartDay();
String endTime = DateTimeHelper.getCalDay(day - 1);
list.forEach(t -> {
t.setStartTime(startTime);
t.setEndTime(endTime);
});
getLeaseListMonth(list, record);
String month;
String startTime;
String endTime;
if (day == 1) {
month = DateTimeHelper.getPrevMonth();
startTime = DateTimeHelper.getPreMonthFirstDay();
endTime = DateTimeHelper.getCurrentMonthFirstDay();
} else {
month = DateTimeHelper.getCurrentMonth();
startTime = DateTimeHelper.getPreMonthCalStartDay(day);
endTime = DateTimeHelper.getCurrentMonthCalEndDay(day);
}
CalMonthlyBean record = new CalMonthlyBean();
record.setMonth(month);
cleanSameMonthOldRecords(record);
List<AgreementInfo> list = agreementInfoService.getAllAgreementId();
list.forEach(t -> {
t.setStartTime(startTime);
t.setEndTime(endTime);
});
addProjectMonthCosts(list, record);
}
private void cleanSameMonthOldRecords(CalMonthlyBean record) {
@ -59,26 +64,27 @@ public class CalcMonthlyServiceImp implements CalcMonthlyService {
//清除上月之前计算过的记录 calc_project_month
calMonthlyMapper.deleteCalcRecord(bean);
//清除上月之前计算过的记录 project_month_costs(表名待定
//清除上月之前计算过的记录 project_month_detail, project_month_costs
calMonthlyMapper.deleteMonthlyDetail(bean);
calMonthlyMapper.deleteMonthlyCosts(bean);
}
}
}
private List<SltAgreementInfo> getLeaseListMonth(List<AgreementInfo> list, CalMonthlyBean record) {
private List<SltAgreementInfo> addProjectMonthCosts(List<AgreementInfo> list, CalMonthlyBean record) {
List<SltAgreementInfo> leaseList = new ArrayList<>();
calMonthlyMapper.insertCalcRecord(record);
String taskId = record.getId();
for (AgreementInfo bean : list) {
if (StringUtils.isNotBlank(bean.getStartTime()) && StringUtils.isNotBlank(bean.getEndTime())) {
List<SltAgreementInfo> monthList = sltAgreementInfoMapper.getLeaseListMonthNotNull(bean);
monthList.stream().filter(Objects::nonNull);
for (SltAgreementInfo sltAgreementInfo : monthList) {
calMonthlyMapper.insertCalcRecord(record);
// slt_project_month的主键id
String spmId = record.getId();
ProjectMonthCosts projectMonthCosts = new ProjectMonthCosts();
projectMonthCosts.setAgreementId(Integer.parseInt(sltAgreementInfo.getAgreementId()));
projectMonthCosts.setSltMonthId(Integer.parseInt(spmId));
projectMonthCosts.setSltMonthId(Integer.parseInt(taskId));
projectMonthCosts.setTaskId(Integer.parseInt(taskId));
projectMonthCosts.setUnitId(sltAgreementInfo.getUnitId());
projectMonthCosts.setProjectId(sltAgreementInfo.getLotId());
projectMonthCosts.setMonth(record.getMonth());
@ -94,7 +100,7 @@ public class CalcMonthlyServiceImp implements CalcMonthlyService {
agreementInfo.setIds(sltAgreementInfo.getIds());
sltAgreementInfo.setMonth(bean.getMonth());
agreementInfo.setEndTime(sltAgreementInfo.getOffTime());
List<SltAgreementInfo> leaseListOneMonth = getLeaseListOneMonth(agreementInfo, sltAgreementInfo, pmcId);
List<SltAgreementInfo> leaseListOneMonth = addProjectMonthDetail(agreementInfo, sltAgreementInfo, pmcId);
projectMonthCosts.setCosts(sltAgreementInfo.getCosts());
calMonthlyMapper.updateProMonCosts(projectMonthCosts);
sltAgreementInfo.setNode(leaseListOneMonth);
@ -106,25 +112,25 @@ public class CalcMonthlyServiceImp implements CalcMonthlyService {
}
private List<SltAgreementInfo> getLeaseListOneMonth(AgreementInfo list, SltAgreementInfo sltAgreementInfo, Integer pmcId) {
private List<SltAgreementInfo> addProjectMonthDetail(AgreementInfo agreementInfo, SltAgreementInfo sltAgreementInfo, Integer pmcId) {
ArrayList<String> idList = new ArrayList<>();
String[] ids = list.getIds().split(",");
String[] ids = agreementInfo.getIds().split(",");
for (String id : ids) {
idList.add(id);
}
List<SltAgreementInfo> leaseList = sltAgreementInfoMapper.getLeaseListOneMonth(list, idList);
List<SltAgreementInfo> leaseList = sltAgreementInfoMapper.getLeaseListOneMonth(agreementInfo, idList);
BigDecimal leaseCostOne = BigDecimal.ZERO;
for (SltAgreementInfo bean : leaseList) {
if (bean.getLeasePrice() == null) {
if (StringUtils.isEmpty(bean.getLeasePrice())) {
bean.setLeasePrice("0");
}
if (bean.getNum() == null) {
if (StringUtils.isEmpty(bean.getNum())) {
bean.setNum("0");
}
if (bean.getLeaseDays() == null) {
if (StringUtils.isEmpty(bean.getLeaseDays())) {
bean.setLeaseDays("0");
}
if (bean.getTrimDay() == null) {
if (Objects.isNull(bean.getTrimDay())) {
bean.setTrimDay(0);
}
BigDecimal leasePrice = new BigDecimal(bean.getLeasePrice());

View File

@ -18,7 +18,7 @@ public interface IPurchaseCheckDetailsService
* @param taskId 新购验收任务详细purchase_check_details主键
* @return 新购验收任务详细purchase_check_details
*/
public PurchaseCheckDetails selectPurchaseCheckDetailsByTaskId(Long taskId);
public List<PurchaseCheckDetails> selectPurchaseCheckDetailsByTaskId(Long taskId);
/**
* 查询新购验收任务详细purchase_check_details列表

View File

@ -1,10 +1,7 @@
package com.bonus.sgzb.material.service;
import com.bonus.sgzb.common.core.web.domain.AjaxResult;
import com.bonus.sgzb.material.domain.IotDto;
import com.bonus.sgzb.material.domain.IotLocationVo;
import com.bonus.sgzb.material.domain.IotRecordVo;
import com.bonus.sgzb.material.domain.IotVo;
import com.bonus.sgzb.material.domain.*;
import java.util.List;
@ -83,21 +80,21 @@ public interface IotMachineService {
* @param iotDto
* @return
*/
AjaxResult getLocation(IotDto iotDto);
IotLocationVo getLocation(IotLocationVo iotLocationVo);
/**
* 查询行程
* @param iotLocationVo
* @return
*/
AjaxResult searchItinerary(IotLocationVo iotLocationVo);
String searchItinerary(IotLocationVo iotLocationVo);
/**
* 查询停留点
* @param iotLocationVo
* @return
*/
AjaxResult reportParkDetailByTime(IotLocationVo iotLocationVo);
List<IotLocationVo> reportParkDetailByTime(IotLocationVo iotLocationVo);
/**
* App绑定设备
@ -111,5 +108,16 @@ public interface IotMachineService {
* @param iotLocationVo
* @return
*/
AjaxResult reportAlarm(IotLocationVo iotLocationVo);
List<IotLocationVo> reportAlarm(IotLocationVo iotLocationVo);
/**
* 报警推送
* @param
* @return
*/
int alarmPush();
List<ReportAlarm> alarmList(IotLocationVo iotLocationVo);
int alarmManagement(ReportAlarm reportAlarm);
}

View File

@ -3,9 +3,12 @@ package com.bonus.sgzb.material.service.impl;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson2.JSONObject;
import com.bonus.sgzb.base.domain.MaTypeKeeper;
import com.bonus.sgzb.base.mapper.MaTypeMapper;
import com.bonus.sgzb.common.core.constant.HttpStatus;
import com.bonus.sgzb.common.core.constant.TokenConstants;
import com.bonus.sgzb.common.core.exception.ServiceException;
import com.bonus.sgzb.common.core.utils.DateUtils;
import com.bonus.sgzb.common.core.utils.HttpHelper;
import com.bonus.sgzb.common.core.utils.StringHelper;
import com.bonus.sgzb.common.core.web.domain.AjaxResult;
@ -15,17 +18,20 @@ import com.bonus.sgzb.material.config.ExceptionEnum;
import com.bonus.sgzb.material.config.FieldGenerator;
import com.bonus.sgzb.material.domain.*;
import com.bonus.sgzb.material.mapper.IotMachineMapper;
import com.bonus.sgzb.material.mapper.ReportAlarmMapper;
import com.bonus.sgzb.material.service.IotMachineService;
import com.bonus.sgzb.system.api.domain.SysUser;
import lombok.Data;
import lombok.extern.slf4j.Slf4j;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.transaction.interceptor.TransactionAspectSupport;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.concurrent.TimeUnit;
/**
@ -42,6 +48,12 @@ public class IotMachineServiceImpl implements IotMachineService {
@Resource
private RedisService redisService;
@Resource
private MaTypeMapper maTypeMapper;
@Resource
private ReportAlarmMapper reportAlarmMapper;
/**
* 添加设备-保存
*
@ -108,14 +120,14 @@ public class IotMachineServiceImpl implements IotMachineService {
iotDto.setUpdateBy(SecurityUtils.getLoginUser().getUserid().toString());
try {
//设备修改
int res = iotMachineMapper.update(iotDto);
if (res == 0) {
// 如果修改失败返回修改到数据库异常的错误信息
throw new ServiceException(ExceptionEnum.UPDATE_TO_DATABASE.getMsg());
} else {
// 修改成功返回成功的消息和修改的记录数
return AjaxResult.success(ExceptionEnum.SUCCESS.getMsg(), res);
}
int res = iotMachineMapper.update(iotDto);
if (res == 0) {
// 如果修改失败返回修改到数据库异常的错误信息
throw new ServiceException(ExceptionEnum.UPDATE_TO_DATABASE.getMsg());
} else {
// 修改成功返回成功的消息和修改的记录数
return AjaxResult.success(ExceptionEnum.SUCCESS.getMsg(), res);
}
} catch (Exception e) {
log.error("Error updating to database: " + e.getMessage());
//捕获异常
@ -281,13 +293,13 @@ public class IotMachineServiceImpl implements IotMachineService {
/**
* 获取定位
* @param iotDto
* @param iotLocationVo
* @return
*/
@Override
public AjaxResult getLocation(IotDto iotDto) {
log.info("getLocation:{}", iotDto);
if (iotDto == null || iotDto.getIotId() == null) {
public IotLocationVo getLocation(IotLocationVo iotLocationVo) {
log.info("getLocation:{}", iotLocationVo);
if (iotLocationVo == null || iotLocationVo.getIotId() == null) {
throw new ServiceException(ExceptionEnum.PARAM_NULL.getMsg());
}
List<String> list=new ArrayList<>();
@ -300,14 +312,14 @@ public class IotMachineServiceImpl implements IotMachineService {
redisService.setCacheObject(TokenConstants.TOKEN_LOCATION,redisCode,23L, TimeUnit.HOURS);
}
map.clear();
list.add(iotDto.getIotId().toString());
list.add(iotLocationVo.getIotId());
map.put("deviceids",list);
String param = JSON.toJSONString(map);
String res = HttpHelper.doPost(HttpStatus.LAST_POSITION_URL+redisCode,param);
//对返回的结果进行解析
IotLocationVo iotLocationVo = resultDataHandler(res);
log.info("返回结果resultDataHandler:{}", iotLocationVo);
return AjaxResult.success(iotLocationVo);
IotLocationVo iotLocationVoRes = resultDataHandler(res);
log.info("返回结果resultDataHandler:{}", iotLocationVoRes);
return iotLocationVoRes;
}
/**
@ -316,7 +328,7 @@ public class IotMachineServiceImpl implements IotMachineService {
* @return
*/
@Override
public AjaxResult searchItinerary(IotLocationVo iotLocationVo) {
public String searchItinerary(IotLocationVo iotLocationVo) {
log.info("searchItinerary:{}", iotLocationVo);
if (iotLocationVo == null || iotLocationVo.getBeginTime() == null || iotLocationVo.getEndTime() == null) {
throw new ServiceException(ExceptionEnum.PARAM_NULL.getMsg());
@ -335,7 +347,7 @@ public class IotMachineServiceImpl implements IotMachineService {
map.put("endtime",iotLocationVo.getEndTime());
String param = JSON.toJSONString(map);
String res = HttpHelper.doPost(HttpStatus.QUERY_TRIPS_URL+redisCode,param);
return AjaxResult.success(res);
return res;
}
/**
@ -344,7 +356,7 @@ public class IotMachineServiceImpl implements IotMachineService {
* @return
*/
@Override
public AjaxResult reportParkDetailByTime(IotLocationVo iotLocationVo) {
public List<IotLocationVo> reportParkDetailByTime(IotLocationVo iotLocationVo) {
log.info("reportParkDetailByTime:{}", iotLocationVo);
if (iotLocationVo == null || iotLocationVo.getBeginTime() == null || iotLocationVo.getEndTime() == null) {
@ -366,8 +378,8 @@ public class IotMachineServiceImpl implements IotMachineService {
String res = HttpHelper.doPost(HttpStatus.REPORT_PARK_DETAIL_BY_TIME_URL+redisCode,param);
//对返回的结果进行解析
List<IotLocationVo> iotLocationVoList = resultReportParkDetailByTime(res);
log.info("resultDataHandler:{}", iotLocationVo);
return AjaxResult.success(iotLocationVoList);
log.info("resultReportParkDetailByTime:{}", iotLocationVoList);
return iotLocationVoList;
}
/**
@ -447,7 +459,7 @@ public class IotMachineServiceImpl implements IotMachineService {
* @return
*/
@Override
public AjaxResult reportAlarm(IotLocationVo iotLocationVo) {
public List<IotLocationVo> reportAlarm(IotLocationVo iotLocationVo) {
log.info("reportAlarm:{}", iotLocationVo);
if (iotLocationVo == null || iotLocationVo.getIotId() == null || iotLocationVo.getBeginTime() == null || iotLocationVo.getEndTime() == null) {
throw new ServiceException(ExceptionEnum.PARAM_NULL.getMsg());
@ -463,7 +475,7 @@ public class IotMachineServiceImpl implements IotMachineService {
redisService.setCacheObject(TokenConstants.TOKEN_LOCATION,redisCode,23L, TimeUnit.HOURS);
}
map.clear();
list.add(iotLocationVo.getIotId().toString());
list.add(iotLocationVo.getIotId());
map.put("devices",list);
map.put("startday",iotLocationVo.getBeginTime());
map.put("endday",iotLocationVo.getEndTime());
@ -474,9 +486,87 @@ public class IotMachineServiceImpl implements IotMachineService {
//对返回的结果进行解析
List<IotLocationVo> iotLocationVoList = resultReportAlarm(res);
log.info("resultDataHandler:{}", iotLocationVo);
return AjaxResult.success(iotLocationVoList);
return iotLocationVoList;
}
/**
* 报警推送
* @param
* @return
* 每三个小时执行一次3 * 60 * 60 * 1000 毫秒 = 10800000 毫秒
*/
@Override
@Transactional(rollbackFor = Exception.class)
@Scheduled(fixedRate = 10800000)
public int alarmPush() {
log.info("开始获取报警信息====");
//获取当前登录用户的所有信息
Long userId = SecurityUtils.getLoginUser().getUserid();
//查看当前用户名下有哪些类型的设备
List<MaTypeKeeper> maTypeKeeperList = maTypeMapper.selectMaTypeByUserId(userId);
List<IotLocationVo> iotLocationVoAll = new ArrayList<>();
for (int i = 0; i < maTypeKeeperList.size(); i++) {
//查询该类机具有哪些设备绑定的iot设备
List<IotVo> iotVoList = iotMachineMapper.selectListByTypeId(maTypeKeeperList.get(i).getTypeId());
for (IotVo iotVo:iotVoList) {
IotLocationVo iotLocationVo = new IotLocationVo();
iotLocationVo.setIotId(iotVo.getIotCode());
iotLocationVo.setBeginTime(DateUtils.getDate());
iotLocationVo.setEndTime(DateUtils.getDate());
//获取当前设备的报警信息
List<IotLocationVo> iotLocationVoList = reportAlarm(iotLocationVo);
//保存所有的报警信息
iotLocationVoAll.addAll(iotLocationVoList);
}
}
int count = handlingAlarmInformation(iotLocationVoAll);
return count;
}
@Override
public List<ReportAlarm> alarmList(IotLocationVo iotLocationVo) {
log.info("alarmList:{}", iotLocationVo);
return reportAlarmMapper.selectByIotCode(iotLocationVo);
}
@Override
public int alarmManagement(ReportAlarm reportAlarm) {
log.info("alarmManagement:{}", reportAlarm);
return reportAlarmMapper.update(reportAlarm);
}
/**
* 处理报警信息
* @param iotLocationVoAll
* @return
*/
private int handlingAlarmInformation(List<IotLocationVo> iotLocationVoAll) {
log.info("处理报警信息====");
int fly = 0;
if (iotLocationVoAll != null && iotLocationVoAll.size() > 0) {
for (IotLocationVo iotLocationVo : iotLocationVoAll) {
//根据当前的报警uuid查看是否有这条记录
ReportAlarm reportAlarm = reportAlarmMapper.selectByDeviceAlarmId(iotLocationVo.getDeviceAlarmId());
if (reportAlarm == null) {
reportAlarm.setIotCode(iotLocationVo.getIotId());
reportAlarm.setDeviceAlarmId(iotLocationVo.getDeviceAlarmId());
reportAlarm.setStartAlarm(iotLocationVo.getStartAlarm());
SimpleDateFormat sdf = new SimpleDateFormat(DateUtils.YYYY_MM_DD_HH_MM_SS);
try {
reportAlarm.setStartAlarmTime(sdf.parse(iotLocationVo.getStartAlarmTime()));
} catch (ParseException e) {
log.error("日期转换异常!!!");
}
//异常信息保存到数据库
reportAlarmMapper.add(reportAlarm);
fly=1;
}
}
}
return fly;
}
/**
* 解析报警返回报文
* @param res
@ -500,6 +590,8 @@ public class IotMachineServiceImpl implements IotMachineService {
IotLocationVo iotLocationVo = new IotLocationVo();
iotLocationVo.setStartAlarmTime(jsonObject.getString("startalarmtime"));
iotLocationVo.setStartAlarm(jsonObject.getString("stralarm"));
iotLocationVo.setDeviceAlarmId(jsonObject.getString("devicealarmid"));
iotLocationVo.setIotId(jsonObject.getString("deviceid"));
iotLocationVoList.add(iotLocationVo);
}
}
@ -528,7 +620,7 @@ public class IotMachineServiceImpl implements IotMachineService {
JSONArray jsonArray = JSON.parseArray(records);
for (int i = 0; i < jsonArray.size(); i++) {
JSONObject jsonObject = JSONObject.from(jsonArray.getJSONObject(i));
iotLocationVo.setIotId(StringHelper.conversionLong(jsonObject.getString("deviceid")));
iotLocationVo.setIotId(jsonObject.getString("deviceid"));
iotLocationVo.setCallat(StringHelper.conversionBigDecimal(jsonObject.getString("callat")));
iotLocationVo.setCallon(StringHelper.conversionBigDecimal(jsonObject.getString("callon")));
}

View File

@ -38,7 +38,7 @@ public class PurchaseCheckDetailsServiceImpl implements IPurchaseCheckDetailsSer
* @return 新购验收任务详细purchase_check_details
*/
@Override
public PurchaseCheckDetails selectPurchaseCheckDetailsByTaskId(Long taskId) {
public List<PurchaseCheckDetails> selectPurchaseCheckDetailsByTaskId(Long taskId) {
return purchaseCheckDetailsMapper.selectPurchaseCheckDetailsByTaskId(taskId);
}

View File

@ -302,6 +302,7 @@ public class PurchaseMacodeInfoServiceImpl implements IPurchaseMacodeInfoService
* 通过/不通过
*/
@Override
@Transactional(rollbackFor = Exception.class)
public int modifyManageStatus(MaInputVO maInputVO) {
Long taskId = maInputVO.getTaskId();
String checkResult = maInputVO.getCheckResult();
@ -378,20 +379,35 @@ public class PurchaseMacodeInfoServiceImpl implements IPurchaseMacodeInfoService
purchaseMacodeInfoMapper.deleteMaLabelBindByMaId(maInputRecord.getMaId());
//修改purchase_macode_info表
purchaseMacodeInfoMapper.updatetePurchaseMaCodeInfoByMaCodeAndTaskIdAndTypeId(taskId, typeId, maInputRecord.getMaCode());
//修改purchase_check_details表
checkDetailsMapper.updatePurchaseCheckDetailsByTaskId(taskId, typeId);
if ("1".equals(maInputRecord.getManageType())){
//修改purchase_check_details表
checkDetailsMapper.updatePurchaseCheckDetailsByTaskId(taskId, typeId);
}
}
}
//判断是否全部已操作通过或不通过
int count=purchaseMacodeInfoMapper.isOperateAll(taskId);
if (count<=0){
//全部审核任务状态改为已审核
TmTask task = new TmTask();
task.setTaskId(taskId);
task.setTaskStatus(28);
task.setUpdateBy(String.valueOf(SecurityUtils.getLoginUser().getUserid()));
task.setUpdateTime(DateUtils.getNowDate());
taskMapper.updateTmTask(task);
//获取该订单下所有的装备信息
List<PurchaseCheckDetails> purchaseCheckDetailsList=checkDetailsMapper.selectPurchaseCheckDetailsByTaskId(taskId);
//判断每种设备的验收数量和绑定数量一致
for (PurchaseCheckDetails purchaseCheckDetails : purchaseCheckDetailsList) {
if (StringUtils.isNotNull(purchaseCheckDetails.getBindNum())){
if (purchaseCheckDetails.getCheckNum().compareTo(BigDecimal.valueOf(purchaseCheckDetails.getBindNum()))!=0){
//全部操作以后如果还有未绑定的则不改变状态
count=1;
}
}
}
if (count==0){
//全部审核任务状态改为已审核
TmTask task = new TmTask();
task.setTaskId(taskId);
task.setTaskStatus(28);
task.setUpdateBy(String.valueOf(SecurityUtils.getLoginUser().getUserid()));
task.setUpdateTime(DateUtils.getNowDate());
taskMapper.updateTmTask(task);
}
}
return 1;
}

View File

@ -241,6 +241,12 @@ public class RepairAuditDetailsServiceImpl implements IRepairAuditDetailsService
repairTestInputMapper.insertRepairInputDetails(repairInputDetails);
}
repairAuditDetailsMapper.updateRepairCost(inputDetails,status);
// 根据repairId找到taskId和 typeId maid
List<String> repairApplyRecordId = repairAuditDetailsMapper.getRepairApplyRecordId(inputDetails.getRepairId());
// 再去repair_apply_record 中查并给一个标识表示审核完成
for (String id : repairApplyRecordId) {
repairAuditDetailsMapper.updateRecodeStatus(id);
}
}
}
if (scrapNumList != null && scrapNumList.size() > 0) {

View File

@ -30,6 +30,7 @@ import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Objects;
/**
* @author c liu
@ -58,6 +59,7 @@ public class SltAgreementInfoServiceImpl implements SltAgreementInfoService {
//维修费用列表
List<SltAgreementInfo> repairList = getRepairList(list);
//报废费用列表
List<SltAgreementInfo> scrapList = getScrapList(list);
//预报废费用列表
List<SltAgreementInfo> preScrapList = getPreScrapList(list);
@ -69,11 +71,12 @@ public class SltAgreementInfoServiceImpl implements SltAgreementInfoService {
sltInfoVo.setScrapList(scrapList);
sltInfoVo.setPreScrapList(preScrapList);
sltInfoVo.setLoseList(loseList);
List<SltAgreementRelation> relations = getRelations(leaseListOne, leaseListThree, repairList, scrapList, loseList, list);
List<SltAgreementRelation> relations = getRelations(leaseListOne, leaseListThree, repairList, scrapList, preScrapList, loseList, list);
sltInfoVo.setRelations(relations);
return sltInfoVo;
}
@Override
public List<SltAgreementInfo> getPreScrapList(List<AgreementInfo> list) {
List<SltAgreementInfo> scrapList = new ArrayList<>();
String taskType = "57";
@ -87,10 +90,10 @@ public class SltAgreementInfoServiceImpl implements SltAgreementInfoService {
if (scrapList != null && scrapList.size() > 0) {
for (SltAgreementInfo bean : scrapList) {
if (bean.getBuyPrice() == null) {
if (StringUtils.isEmpty(bean.getBuyPrice())) {
bean.setBuyPrice("0");
}
if (bean.getNum() == null) {
if (StringUtils.isEmpty(bean.getNum())) {
bean.setNum("0");
}
BigDecimal buyPrice = new BigDecimal(bean.getBuyPrice());
@ -166,15 +169,18 @@ public class SltAgreementInfoServiceImpl implements SltAgreementInfoService {
leaseList.addAll(oneOfList);
}
for (SltAgreementInfo bean : leaseList) {
if (bean.getLeasePrice() == null) {
if (StringUtils.isEmpty(bean.getLeasePrice())) {
bean.setLeasePrice("0");
}
if (bean.getNum() == null) {
if (StringUtils.isEmpty(bean.getNum())) {
bean.setNum("0");
}
if (bean.getLeaseDays() == null) {
if (StringUtils.isEmpty(bean.getLeaseDays())) {
bean.setLeaseDays("0");
}
if (Objects.isNull(bean.getTrimDay())) {
bean.setTrimDay(0);
}
BigDecimal leasePrice = new BigDecimal(bean.getLeasePrice());
BigDecimal num = new BigDecimal(bean.getNum());
BigDecimal leaseDays = new BigDecimal(bean.getLeaseDays());
@ -201,16 +207,16 @@ public class SltAgreementInfoServiceImpl implements SltAgreementInfoService {
leaseList.addAll(oneOfList);
}
for (SltAgreementInfo bean : leaseList) {
if (bean.getLeasePrice() == null) {
if (StringUtils.isEmpty(bean.getLeasePrice())) {
bean.setLeasePrice("0");
}
if (bean.getNum() == null) {
if (StringUtils.isEmpty(bean.getNum())) {
bean.setNum("0");
}
if (bean.getLeaseDays() == null) {
if (StringUtils.isEmpty(bean.getLeaseDays())) {
bean.setLeaseDays("0");
}
if (bean.getTrimDay() == null) {
if (Objects.isNull(bean.getTrimDay())) {
bean.setTrimDay(0);
}
BigDecimal leasePrice = new BigDecimal(bean.getLeasePrice());
@ -223,13 +229,15 @@ public class SltAgreementInfoServiceImpl implements SltAgreementInfoService {
// 应结算金额
BigDecimal costs = leasePrice.multiply(num).multiply(leaseDays);
bean.setCosts(String.valueOf(costs));
//实际结算天数
bean.setRealDays(realDays);
// 实际结算金额
bean.setRealCosts(String.valueOf(realCosts));
}
return leaseList;
}
private List<SltAgreementRelation> getRelations(List<SltAgreementInfo> leaseListOne, List<SltAgreementInfo> leaseListThree, List<SltAgreementInfo> repairList, List<SltAgreementInfo> scrapList, List<SltAgreementInfo> loseList, List<AgreementInfo> list) {
private List<SltAgreementRelation> getRelations(List<SltAgreementInfo> leaseListOne, List<SltAgreementInfo> leaseListThree, List<SltAgreementInfo> repairList, List<SltAgreementInfo> scrapList, List<SltAgreementInfo> preScrapList, List<SltAgreementInfo> loseList, List<AgreementInfo> list) {
List<SltAgreementRelation> relations = new ArrayList<>();
for (AgreementInfo info : list) {
SltAgreementRelation relation = new SltAgreementRelation();
@ -237,6 +245,7 @@ public class SltAgreementInfoServiceImpl implements SltAgreementInfoService {
BigDecimal leaseCostOne = BigDecimal.ZERO;
BigDecimal leaseCostThree = BigDecimal.ZERO;
BigDecimal scrapCost = BigDecimal.ZERO;
BigDecimal preScrapCost = BigDecimal.ZERO;
BigDecimal repairCost = BigDecimal.ZERO;
for (SltAgreementInfo lease : leaseListOne) {
if (lease.getAgreementId().equals(info.getAgreementId().toString())) {
@ -260,7 +269,8 @@ public class SltAgreementInfoServiceImpl implements SltAgreementInfoService {
}
for (SltAgreementInfo repair : repairList) {
if (repair.getAgreementId().equals(info.getAgreementId().toString())) {
BigDecimal allCost = new BigDecimal(repair.getAllCosts());
// 暂时先计算配件总价后期需要加上委外维修费用
BigDecimal allCost = new BigDecimal(repair.getPartAllCosts());
repairCost = repairCost.add(allCost);
}
}
@ -270,6 +280,12 @@ public class SltAgreementInfoServiceImpl implements SltAgreementInfoService {
scrapCost = scrapCost.add(cost);
}
}
for (SltAgreementInfo scrap : preScrapList) {
if (scrap.getAgreementId().equals(info.getAgreementId().toString())) {
BigDecimal cost = new BigDecimal(scrap.getCosts());
preScrapCost = preScrapCost.add(cost);
}
}
for (SltAgreementInfo lose : loseList) {
if (lose.getAgreementId().equals(info.getAgreementId().toString())) {
//TODO 上面已经set过值这里为什么还要set值
@ -299,6 +315,7 @@ public class SltAgreementInfoServiceImpl implements SltAgreementInfoService {
relation.setLeaseCostThree(leaseCostThree.toString());
relation.setRepairCost(repairCost.toString());
relation.setScrapCost(scrapCost.toString());
relation.setPreScrapCost(preScrapCost.toString());
relation.setLoseCost(loseCost.toString());
relations.add(relation);
}
@ -308,8 +325,16 @@ public class SltAgreementInfoServiceImpl implements SltAgreementInfoService {
@Override
@Transactional
public AjaxResult submitFee(SltAgreementApply apply) {
SltAgreementRelation relation = apply.getRelation();
if (StringUtils.isNotBlank(apply.getRepairIds())) {
for (String id : apply.getRepairIds().split(",")) {
sltAgreementInfoMapper.updateRecodeIsSlt(id);
}
}
sltAgreementInfoMapper.updateInfoStatus(apply.getAgreementId());
int i = sltAgreementInfoMapper.updateBmAgreementInfo(apply.getAgreementId());
sltAgreementInfoMapper.updateBmAgreementInfo(apply.getAgreementId());
relation.setAgreementId(apply.getAgreementId());
int i = sltAgreementInfoMapper.insRelation(relation);
if (i > 0) {
return AjaxResult.success("结算成功");
} else {
@ -333,6 +358,7 @@ public class SltAgreementInfoServiceImpl implements SltAgreementInfoService {
}
@Override
public List<SltAgreementInfo> getLoseList(List<AgreementInfo> list) {
List<SltAgreementInfo> loseList = new ArrayList<>();
for (AgreementInfo bean : list) {
@ -340,10 +366,10 @@ public class SltAgreementInfoServiceImpl implements SltAgreementInfoService {
loseList.addAll(oneOfList);
}
for (SltAgreementInfo bean : loseList) {
if (bean.getBuyPrice() == null) {
if (StringUtils.isEmpty(bean.getBuyPrice())) {
bean.setBuyPrice("0");
}
if (bean.getNum() == null) {
if (StringUtils.isEmpty(bean.getNum())) {
bean.setNum("0");
}
BigDecimal buyPrice = new BigDecimal(bean.getBuyPrice());
@ -361,6 +387,7 @@ public class SltAgreementInfoServiceImpl implements SltAgreementInfoService {
return loseList;
}
@Override
public List<SltAgreementInfo> getScrapList(List<AgreementInfo> list) {
List<SltAgreementInfo> scrapList = new ArrayList<>();
String taskType = "57";
@ -375,10 +402,10 @@ public class SltAgreementInfoServiceImpl implements SltAgreementInfoService {
if (scrapList != null && scrapList.size() > 0) {
for (SltAgreementInfo bean : scrapList) {
if (bean.getBuyPrice() == null) {
if (StringUtils.isEmpty(bean.getBuyPrice())) {
bean.setBuyPrice("0");
}
if (bean.getNum() == null) {
if (StringUtils.isEmpty(bean.getNum())) {
bean.setNum("0");
}
BigDecimal buyPrice = new BigDecimal(bean.getBuyPrice());
@ -410,12 +437,12 @@ public class SltAgreementInfoServiceImpl implements SltAgreementInfoService {
Integer num = 0;
//租赁费用列表
for (AgreementInfo agreementInfo : list) {
// 如果不选择具体日期或者选择了最新月份则需要查数据
if (agreementInfo.getStartTime() == null || DateTimeHelper.getNowMonth().equals(DateTimeHelper.getNowMonth(DateTimeHelper.parse(agreementInfo.getEndTime(), "yyyy-MM")))) {
// 如果选择了最新月份则需要查数据
if (StringUtils.isNotBlank(agreementInfo.getStartTime()) && StringUtils.isNotBlank(agreementInfo.getEndTime()) && DateTimeHelper.getNowMonth().equals(DateTimeHelper.getNowMonth(DateTimeHelper.parse(agreementInfo.getEndTime(), "yyyy-MM")))) {
List<SltAgreementInfo> listMonth = getLeaseListMonth(agreementInfo, num);
leaseListMonth.addAll(listMonth);
} else {
// 查定时任务记录的数据
// 如果不传日期或传以往日期 查定时任务记录的数据
List<SltAgreementInfo> listMonth = getLeaseJobListMonth(agreementInfo);
leaseListMonth.addAll(listMonth);
}
@ -424,6 +451,10 @@ public class SltAgreementInfoServiceImpl implements SltAgreementInfoService {
}
private List<SltAgreementInfo> getLeaseJobListMonth(AgreementInfo agreementInfo) {
if (StringUtils.isBlank(agreementInfo.getEndTime())) {
String lastMonthYearMonth = DateTimeHelper.getLastMonthYearMonth();
agreementInfo.setEndTime(lastMonthYearMonth);
}
List<SltAgreementInfo> monthCosts = calMonthlyMapper.getMonthCosts(agreementInfo);
int num = 0;
for (SltAgreementInfo monthCost : monthCosts) {
@ -442,22 +473,22 @@ public class SltAgreementInfoServiceImpl implements SltAgreementInfoService {
private List<SltAgreementInfo> getLeaseListMonth(AgreementInfo bean, Integer num) {
List<SltAgreementInfo> leaseList = new ArrayList<>();
// for (AgreementInfo bean : list) {
if (StringUtils.isNotBlank(bean.getStartTime()) && StringUtils.isNotBlank(bean.getEndTime())) {
List<SltAgreementInfo> monthList = sltAgreementInfoMapper.getLeaseListMonthNotNull(bean);
for (SltAgreementInfo sltAgreementInfo : monthList) {
AgreementInfo agreementInfo = new AgreementInfo();
agreementInfo.setAgreementId(bean.getAgreementId());
agreementInfo.setCostBearingParty(sltAgreementInfo.getCostBearingParty());
agreementInfo.setStartTime(sltAgreementInfo.getBeginTime());
agreementInfo.setIds(sltAgreementInfo.getIds());
sltAgreementInfo.setMonth(bean.getMonth());
sltAgreementInfo.setCodeNum(num++);
agreementInfo.setEndTime(sltAgreementInfo.getOffTime());
List<SltAgreementInfo> leaseListOneMonth = getLeaseListOneMonth(agreementInfo, sltAgreementInfo);
sltAgreementInfo.setNode(leaseListOneMonth);
}
leaseList.addAll(monthList);
} else {
// if (StringUtils.isNotBlank(bean.getStartTime()) && StringUtils.isNotBlank(bean.getEndTime())) {
List<SltAgreementInfo> monthList = sltAgreementInfoMapper.getLeaseListMonthNotNull(bean);
for (SltAgreementInfo sltAgreementInfo : monthList) {
AgreementInfo agreementInfo = new AgreementInfo();
agreementInfo.setAgreementId(bean.getAgreementId());
agreementInfo.setCostBearingParty(sltAgreementInfo.getCostBearingParty());
agreementInfo.setStartTime(sltAgreementInfo.getBeginTime());
agreementInfo.setIds(sltAgreementInfo.getIds());
sltAgreementInfo.setMonth(bean.getMonth());
sltAgreementInfo.setCodeNum(num++);
agreementInfo.setEndTime(sltAgreementInfo.getOffTime());
List<SltAgreementInfo> leaseListOneMonth = getLeaseListOneMonth(agreementInfo, sltAgreementInfo);
sltAgreementInfo.setNode(leaseListOneMonth);
}
leaseList.addAll(monthList);
/* } else {
List<SltAgreementInfo> oneOfList = sltAgreementInfoMapper.getLeaseListMonth(bean);
for (SltAgreementInfo sltAgreementInfo : oneOfList) {
AgreementInfo agreementInfo = new AgreementInfo();
@ -471,7 +502,7 @@ public class SltAgreementInfoServiceImpl implements SltAgreementInfoService {
sltAgreementInfo.setNode(leaseListOneMonth);
}
leaseList.addAll(oneOfList);
}
}*/
// }
return leaseList;
}
@ -485,16 +516,16 @@ public class SltAgreementInfoServiceImpl implements SltAgreementInfoService {
List<SltAgreementInfo> leaseList = sltAgreementInfoMapper.getLeaseListOneMonth(list, idList);
BigDecimal leaseCostOne = BigDecimal.ZERO;
for (SltAgreementInfo bean : leaseList) {
if (bean.getLeasePrice() == null) {
if (StringUtils.isEmpty(bean.getLeasePrice())) {
bean.setLeasePrice("0");
}
if (bean.getNum() == null) {
if (StringUtils.isEmpty(bean.getNum())) {
bean.setNum("0");
}
if (bean.getLeaseDays() == null) {
if (StringUtils.isEmpty(bean.getLeaseDays())) {
bean.setLeaseDays("0");
}
if (bean.getTrimDay() == null) {
if (Objects.isNull(bean.getTrimDay())) {
bean.setTrimDay(0);
}
BigDecimal leasePrice = new BigDecimal(bean.getLeasePrice());
@ -516,6 +547,7 @@ public class SltAgreementInfoServiceImpl implements SltAgreementInfoService {
return leaseList;
}
@Override
public List<SltAgreementInfo> getRepairList(List<AgreementInfo> list) {
List<SltAgreementInfo> repairList = new ArrayList<>();
String taskType = "41";
@ -530,6 +562,7 @@ public class SltAgreementInfoServiceImpl implements SltAgreementInfoService {
return repairList;
}
@Override
public List<SltAgreementInfo> getLeaseListOne(List<AgreementInfo> list) {
List<SltAgreementInfo> leaseList = new ArrayList<>();
for (AgreementInfo bean : list) {
@ -537,16 +570,16 @@ public class SltAgreementInfoServiceImpl implements SltAgreementInfoService {
leaseList.addAll(oneOfList);
}
for (SltAgreementInfo bean : leaseList) {
if (bean.getLeasePrice() == null) {
if (StringUtils.isEmpty(bean.getLeasePrice())) {
bean.setLeasePrice("0");
}
if (bean.getNum() == null) {
if (StringUtils.isEmpty(bean.getNum())) {
bean.setNum("0");
}
if (bean.getLeaseDays() == null) {
if (StringUtils.isEmpty(bean.getLeaseDays())) {
bean.setLeaseDays("0");
}
if (bean.getTrimDay() == null) {
if (Objects.isNull(bean.getTrimDay())) {
bean.setTrimDay(0);
}
BigDecimal leasePrice = new BigDecimal(bean.getLeasePrice());
@ -559,7 +592,9 @@ public class SltAgreementInfoServiceImpl implements SltAgreementInfoService {
// 应结算金额
BigDecimal costs = leasePrice.multiply(num).multiply(leaseDays);
bean.setCosts(String.valueOf(costs));
//实际结算天数
bean.setRealDays(realDays);
// 实际结算金额
bean.setRealCosts(String.valueOf(realCosts));
}
return leaseList;