package com.steerinfo.dil.service.impl; import com.steerinfo.dil.mapper.DilNoticeMapper; import com.steerinfo.dil.model.DilNotice; import com.steerinfo.dil.service.IDilNoticeService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import java.util.ArrayList; import java.util.Date; import java.math.BigDecimal; import java.util.List; import java.util.Map; /** * DilNotice服务实现: * @author generator * @version 1.0-SNAPSHORT 2021-12-08 02:21 * 类描述 * 修订历史: * 日期:2021-12-08 * 作者:generator * 参考: * 描述:DilNotice服务实现 * @see null * @Copyright 湖南视拓信息技术股份有限公司. All rights reserved. */ @Service(value = "dilNoticeService") public class DilNoticeServiceImpl implements IDilNoticeService { @Autowired private DilNoticeMapper dilNoticeMapper; /** * 获取通知信息 * */ @Override public List> getNoticeList(Map mapVal) { return dilNoticeMapper.getNoticeList(mapVal); } /** * 承运商获取通知信息 * */ @Override public List> getCarrierNoticeList(Map mapVal) { return dilNoticeMapper.getCarrierNoticeList(mapVal); } /** * 销售公司获取通知信息 * */ @Override public List> getMarketingNoticeList(Map mapVal) { return dilNoticeMapper.getMarketingNoticeList(mapVal); } /** * 收货用户获取通知信息 * */ @Override public List> getClientNoticeList(Map mapVal) { return dilNoticeMapper.getClientNoticeList(mapVal); } @Override public List> getNewNoticeByPermission(BigDecimal permission) { return dilNoticeMapper.getNewNoticeByPermission(permission); } /** * 增加通知信息 * */ @Override /*这里是解决前端毛病所妥协的结果,前端拿不到value值,只能拿到name也就是key值,这里在后端强行将key转为value值QAQ*/ public int insertNotice(DilNotice dilNotice) { dilNotice.setDeleted(new BigDecimal(0)); dilNotice.setInsertTime(new Date()); if(dilNotice.getPermissions()!=null){ if(dilNotice.getPermissions().equals("承运商")){ dilNotice.setPermission(BigDecimal.valueOf(1)); } else if(dilNotice.getPermissions().equals("销售商")){ dilNotice.setPermission(BigDecimal.valueOf(2)); } else if(dilNotice.getPermissions().equals("收货客户")){ dilNotice.setPermission(BigDecimal.valueOf(3)); } } { } //需要手动设置发布人 /*dilNotice.setInsertUsername("admin");*/ dilNotice.setNoticeId(dilNoticeMapper.selectNoticeId()); return dilNoticeMapper.insertSelective(dilNotice); } /** * 修改通知信息 * */ @Override public int updateNotice(DilNotice dilNotice) { /*dilNotice.setUpdateTime(new Date());*/ /*dilNotice.setUpdateUsername("admin");*/ return dilNoticeMapper.updateByPrimaryKeySelective(dilNotice); } /** * 删除通知信息 * */ @Override public int deleteNotice(BigDecimal id) { DilNotice dilNotice = dilNoticeMapper.selectByPrimaryKey(id); dilNotice.setDeleted(new BigDecimal(1)); return dilNoticeMapper.updateByPrimaryKeySelective(dilNotice); } /** * 根据id获取运力信息 * @param id * @return */ @Override public List> getNoticeById(BigDecimal id) { return dilNoticeMapper.getNoticeById(id); } /** * @author:zyf * @version:1.0 * @Date: * @Description: 获取通知信息数据 */ public List> getNoticeData(String orgcode){ List> noticeData=new ArrayList<>(); if ("chengyunshang".equals(orgcode)){ BigDecimal permission=BigDecimal.valueOf(1); noticeData = dilNoticeMapper.getNoticeData(permission); }else if ("xiaoshougongsi".equals(orgcode)){ BigDecimal permission=BigDecimal.valueOf(2); noticeData = dilNoticeMapper.getNoticeData(permission); }else if ("shouhuokehu".equals(orgcode)){ BigDecimal permission=BigDecimal.valueOf(3); noticeData = dilNoticeMapper.getNoticeData(permission); }else { noticeData = dilNoticeMapper.getNoticeData1(); } return noticeData; } /* * 获取下拉框 * */ /* @Override public List> getCapacityTypeId() { return rmsCapacityMapper.getCapacityTypeId(); } @Override public List> getCarrierId() { return rmsCapacityMapper.getCarrierId(); } */ }