留样柜
This commit is contained in:
parent
db8467f0ab
commit
a53211446e
|
|
@ -161,20 +161,20 @@ public class RabbitListenerConfiguration implements RabbitListenerConfigurer {
|
|||
|
||||
public void configureRabbitListeners(RabbitListenerEndpointRegistrar registrar) {
|
||||
this.nowQueues.add(this.rabbitPropertiesExt.getRetryQueue());
|
||||
try {
|
||||
this.existQueues().forEach((queue, queueStatus) -> {
|
||||
if (!this.nowQueues.contains(queue) || !this.mqProperties.getNamespace().equals(queueStatus.getNamespace())) {
|
||||
if (queueStatus.messagesReady > 0L) {
|
||||
throw new IllegalStateException("Queue be deleted while unconsumed messages exist. \"" + queue + "\"");
|
||||
}
|
||||
|
||||
this.amqpAdmin.deleteQueue(queue);
|
||||
}
|
||||
|
||||
});
|
||||
} catch (JsonProcessingException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
// try {
|
||||
// this.existQueues().forEach((queue, queueStatus) -> {
|
||||
// if (!this.nowQueues.contains(queue) || !this.mqProperties.getNamespace().equals(queueStatus.getNamespace())) {
|
||||
// if (queueStatus.messagesReady > 0L) {
|
||||
// throw new IllegalStateException("Queue be deleted while unconsumed messages exist. \"" + queue + "\"");
|
||||
// }
|
||||
//
|
||||
// this.amqpAdmin.deleteQueue(queue);
|
||||
// }
|
||||
//
|
||||
// });
|
||||
// } catch (JsonProcessingException e) {
|
||||
// throw new RuntimeException(e);
|
||||
// }
|
||||
Iterator var2 = this.rabbitListenerEndpoints.iterator();
|
||||
|
||||
while(var2.hasNext()) {
|
||||
|
|
|
|||
|
|
@ -25,22 +25,26 @@ public class KitchenSampleCabinetRecord extends BaseEntity {
|
|||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 主键id */
|
||||
private Long recordId;
|
||||
private String recordId;
|
||||
|
||||
/** 设备id */
|
||||
@Excel(name = "设备id")
|
||||
@ApiModelProperty(value = "设备id")
|
||||
private Long deviceId;
|
||||
|
||||
@Excel(name = "留样id")
|
||||
@ApiModelProperty(value = "留样id")
|
||||
private String sampleId;
|
||||
|
||||
/** 开柜温度 */
|
||||
@Excel(name = "开柜温度")
|
||||
@ApiModelProperty(value = "开柜温度")
|
||||
private Long openCabinetTemp;
|
||||
private String openCabinetTemp;
|
||||
|
||||
/** 关柜温度 */
|
||||
@Excel(name = "关柜温度")
|
||||
@ApiModelProperty(value = "关柜温度")
|
||||
private Long closeCabinetTemp;
|
||||
private String closeCabinetTemp;
|
||||
|
||||
/** 操作员工id */
|
||||
@Excel(name = "操作员工id")
|
||||
|
|
|
|||
|
|
@ -57,4 +57,6 @@ public interface KitchenSampleCabinetRecordMapper {
|
|||
* @return 结果
|
||||
*/
|
||||
public int deleteKitchenSampleCabinetRecordByRecordIds(Long[] recordIds);
|
||||
|
||||
int updateKitchenSampleRecord(KitchenSampleCabinetRecord kitchenSampleCabinetRecord);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,15 +6,19 @@ import cn.hutool.core.collection.CollUtil;
|
|||
import com.bonus.canteen.core.kitchen.domain.constants.SampleCabinetActionTypeEnum;
|
||||
import com.bonus.common.core.exception.ServiceException;
|
||||
import com.bonus.common.core.utils.DateUtils;
|
||||
import com.bonus.common.security.utils.SecurityUtils;
|
||||
import org.hibernate.validator.internal.util.StringHelper;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.bonus.canteen.core.kitchen.mapper.KitchenSampleCabinetRecordMapper;
|
||||
import com.bonus.canteen.core.kitchen.domain.KitchenSampleCabinetRecord;
|
||||
import com.bonus.canteen.core.kitchen.service.IKitchenSampleCabinetRecordService;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.transaction.interceptor.TransactionAspectSupport;
|
||||
|
||||
/**
|
||||
* 留样柜操作记录Service业务层处理
|
||||
*
|
||||
*
|
||||
* @author xsheng
|
||||
* @date 2025-06-16
|
||||
*/
|
||||
|
|
@ -25,7 +29,7 @@ public class KitchenSampleCabinetRecordServiceImpl implements IKitchenSampleCabi
|
|||
|
||||
/**
|
||||
* 查询留样柜操作记录
|
||||
*
|
||||
*
|
||||
* @param recordId 留样柜操作记录主键
|
||||
* @return 留样柜操作记录
|
||||
*/
|
||||
|
|
@ -36,7 +40,7 @@ public class KitchenSampleCabinetRecordServiceImpl implements IKitchenSampleCabi
|
|||
|
||||
/**
|
||||
* 查询留样柜操作记录列表
|
||||
*
|
||||
*
|
||||
* @param kitchenSampleCabinetRecord 留样柜操作记录
|
||||
* @return 留样柜操作记录
|
||||
*/
|
||||
|
|
@ -44,7 +48,7 @@ public class KitchenSampleCabinetRecordServiceImpl implements IKitchenSampleCabi
|
|||
public List<KitchenSampleCabinetRecord> selectKitchenSampleCabinetRecordList(KitchenSampleCabinetRecord kitchenSampleCabinetRecord) {
|
||||
List<KitchenSampleCabinetRecord> kitchenSampleCabinetRecordList = kitchenSampleCabinetRecordMapper
|
||||
.selectKitchenSampleCabinetRecordList(kitchenSampleCabinetRecord);
|
||||
if(CollUtil.isNotEmpty(kitchenSampleCabinetRecordList)) {
|
||||
if (CollUtil.isNotEmpty(kitchenSampleCabinetRecordList)) {
|
||||
for (KitchenSampleCabinetRecord record : kitchenSampleCabinetRecordList) {
|
||||
record.setActionTypeName(SampleCabinetActionTypeEnum.getDescByKey(record.getActionType()));
|
||||
}
|
||||
|
|
@ -54,24 +58,56 @@ public class KitchenSampleCabinetRecordServiceImpl implements IKitchenSampleCabi
|
|||
|
||||
/**
|
||||
* 新增留样柜操作记录
|
||||
*
|
||||
*
|
||||
* @param kitchenSampleCabinetRecord 留样柜操作记录
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public int insertKitchenSampleCabinetRecord(KitchenSampleCabinetRecord kitchenSampleCabinetRecord) {
|
||||
kitchenSampleCabinetRecord.setCreateTime(DateUtils.getNowDate());
|
||||
kitchenSampleCabinetRecord.setCreateBy(SecurityUtils.getUsername());
|
||||
kitchenSampleCabinetRecord.setRecordId(null);
|
||||
try {
|
||||
return kitchenSampleCabinetRecordMapper.insertKitchenSampleCabinetRecord(kitchenSampleCabinetRecord);
|
||||
if (StringHelper.isNullOrEmptyString(kitchenSampleCabinetRecord.getSampleId())){
|
||||
kitchenSampleCabinetRecord.setSampleId("-1");
|
||||
int code = kitchenSampleCabinetRecordMapper.insertKitchenSampleCabinetRecord(kitchenSampleCabinetRecord);
|
||||
if (code <= 0) {
|
||||
throw new ServiceException("新增留样柜操作记录失败");
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
String[] arr = kitchenSampleCabinetRecord.getSampleId().split(",");
|
||||
for (String id : arr) {
|
||||
kitchenSampleCabinetRecord.setSampleId(id);
|
||||
int code = kitchenSampleCabinetRecordMapper.insertKitchenSampleCabinetRecord(kitchenSampleCabinetRecord);
|
||||
if (code <= 0) {
|
||||
throw new ServiceException("新增留样柜操作记录失败");
|
||||
}
|
||||
if (2 == kitchenSampleCabinetRecord.getOperateType()){
|
||||
return 1;
|
||||
}
|
||||
if( 1 == kitchenSampleCabinetRecord.getActionType() || 2 == kitchenSampleCabinetRecord.getActionType()) {
|
||||
// 记录新增成功后,更新留样柜状态
|
||||
int updateCode = kitchenSampleCabinetRecordMapper.updateKitchenSampleRecord(kitchenSampleCabinetRecord);
|
||||
if (updateCode <= 0) {
|
||||
throw new ServiceException("更新留样柜状态失败");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
return 1;
|
||||
} catch (Exception e) {
|
||||
throw new ServiceException(e.getMessage());
|
||||
// 回滚事务
|
||||
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
||||
// 抛出自定义异常
|
||||
throw new ServiceException("新增留样柜操作记录失败");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改留样柜操作记录
|
||||
*
|
||||
*
|
||||
* @param kitchenSampleCabinetRecord 留样柜操作记录
|
||||
* @return 结果
|
||||
*/
|
||||
|
|
@ -87,7 +123,7 @@ public class KitchenSampleCabinetRecordServiceImpl implements IKitchenSampleCabi
|
|||
|
||||
/**
|
||||
* 批量删除留样柜操作记录
|
||||
*
|
||||
*
|
||||
* @param recordIds 需要删除的留样柜操作记录主键
|
||||
* @return 结果
|
||||
*/
|
||||
|
|
@ -98,7 +134,7 @@ public class KitchenSampleCabinetRecordServiceImpl implements IKitchenSampleCabi
|
|||
|
||||
/**
|
||||
* 删除留样柜操作记录信息
|
||||
*
|
||||
*
|
||||
* @param recordId 留样柜操作记录主键
|
||||
* @return 结果
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -22,6 +22,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<result property="deviceName" column="device_name" />
|
||||
<result property="canteenName" column="canteen_name" />
|
||||
<result property="staffName" column="staff_name" />
|
||||
<result property="sampleId" column="sampleId" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectKitchenSampleCabinetRecordVo">
|
||||
|
|
@ -39,6 +40,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<include refid="selectKitchenSampleCabinetRecordVo"/>
|
||||
<where>
|
||||
<if test="deviceId != null "> and kscr.device_id = #{deviceId}</if>
|
||||
<if test="sampleId != null "> and kscr.sampleId = #{sampleId}</if>
|
||||
<if test="openCabinetTemp != null "> and open_cabinet_temp = #{openCabinetTemp}</if>
|
||||
<if test="closeCabinetTemp != null "> and close_cabinet_temp = #{closeCabinetTemp}</if>
|
||||
<if test="staffId != null "> and kscr.staff_id = #{staffId}</if>
|
||||
|
|
@ -76,6 +78,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
insert into kitchen_sample_cabinet_record
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="deviceId != null">device_id,</if>
|
||||
<if test="sampleId != null">sampleId,</if>
|
||||
<if test="openCabinetTemp != null">open_cabinet_temp,</if>
|
||||
<if test="closeCabinetTemp != null">close_cabinet_temp,</if>
|
||||
<if test="staffId != null">staff_id,</if>
|
||||
|
|
@ -92,6 +95,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="deviceId != null">#{deviceId},</if>
|
||||
<if test="sampleId != null">#{sampleId},</if>
|
||||
<if test="openCabinetTemp != null">#{openCabinetTemp},</if>
|
||||
<if test="closeCabinetTemp != null">#{closeCabinetTemp},</if>
|
||||
<if test="staffId != null">#{staffId},</if>
|
||||
|
|
@ -112,6 +116,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
update kitchen_sample_cabinet_record
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="deviceId != null">device_id = #{deviceId},</if>
|
||||
<if test="sampleId != null">device_id = #{sampleId},</if>
|
||||
<if test="openCabinetTemp != null">open_cabinet_temp = #{openCabinetTemp},</if>
|
||||
<if test="closeCabinetTemp != null">close_cabinet_temp = #{closeCabinetTemp},</if>
|
||||
<if test="staffId != null">staff_id = #{staffId},</if>
|
||||
|
|
@ -123,7 +128,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<if test="operateDate != null">operate_date = #{operateDate},</if>
|
||||
<if test="createBy != null">create_by = #{createBy},</if>
|
||||
<if test="createTime != null">create_time = #{createTime},</if>
|
||||
<if test="updateBy != null">update_by = #{updateBy},</if>
|
||||
0 <if test="updateBy != null">update_by = #{updateBy},</if>
|
||||
<if test="updateTime != null">update_time = #{updateTime},</if>
|
||||
</trim>
|
||||
where record_id = #{recordId}
|
||||
|
|
@ -139,4 +144,24 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
#{recordId}
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
<update id="updateKitchenSampleRecord">
|
||||
<if test="actionType == 1">
|
||||
update kitchen_sample_dishes_record set
|
||||
enter_cabinet_time= now(),
|
||||
cabinet_no = #{deviceId},
|
||||
save_status = '2'
|
||||
where record_id = #{sampleId};
|
||||
|
||||
</if>
|
||||
<if test="actionType == 2">
|
||||
update kitchen_sample_dishes_record set
|
||||
leave_cabinet_time= now(),
|
||||
cabinet_no = #{deviceId},
|
||||
save_status = '3',
|
||||
valid_duration = TIMESTAMPDIFF(HOUR , enter_cabinet_time, now()),
|
||||
duration_standard = if(TIMESTAMPDIFF(HOUR, enter_cabinet_time, now()), 1, 2)
|
||||
where record_id = #{sampleId};
|
||||
</if>
|
||||
</update>
|
||||
</mapper>
|
||||
Loading…
Reference in New Issue