牧场系统设计与实现计算机毕业设计源码LW文档
关键代码
packagecom。example。controller;
importcn。hutool。core。collection。CollUtil;
importcn。hutool。core。collection。CollectionUtil;
importcn。hutool。core。io。IoUtil;
importcn。hutool。core。util。ObjectUtil;
importcn。hutool。core。util。StrUtil;
importcn。hutool。crypto。SecureUtil;
importcn。hutool。json。JSONObject;
importcn。hutool。poi。excel。ExcelUtil;
importcn。hutool。poi。excel。ExcelWriter;
importcom。example。common。Result;
importcom。example。common。ResultCode;
importcom。example。entity。YaopinrukuInfo;
importcom。example。dao。YaopinrukuInfoDao;
importcom。example。service。YaopinrukuInfoService;
importcom。example。exception。CustomException;
importcom。example。common。ResultCode;
importcom。example。vo。EchartsData;
importcom。example。vo。YaopinrukuInfoVo;
importcom。github。pagehelper。PageHelper;
importcom。github。pagehelper。PageInfo;
importcom。example。service。;
importorg。springframework。web。bind。annotation。;
importorg。springframework。beans。factory。annotation。Value;
importcn。hutool。core。util。StrUtil;
importorg。springframework。web。multipart。MultipartFile;
importjavax。annotation。Resource;
importjavax。servlet。ServletOutputStream;
importjavax。servlet。http。HttpServletRequest;
importjavax。servlet。http。HttpServletResponse;
importjava。io。IOException;
importjava。util。;
importjava。util。stream。Collectors;
RestController
RequestMapping(valueyaopinrukuInfo)
publicclassYaopinrukuInfoController{
Resource
privateYaopinrukuInfoServiceyaopinrukuInfoService;
Resource
privateYaopinrukuInfoDaoyaopinrukuInfoDao;
PostMapping
publicResultadd(RequestBodyYaopinrukuInfoVoyaopinrukuInfo){
mixmajixami
yaopinrukuInfoService。add(yaopinrukuInfo);
returnResult。success(yaopinrukuInfo);
}
youtixing1
youtixing2
DeleteMapping({id})
publicResultdelete(PathVariableLongid){
yaopinrukuInfoService。delete(id);
returnResult。success();
}
PutMapping
publicResultupdate(RequestBodyYaopinrukuInfoVoyaopinrukuInfo){
yaopinrukuInfoService。update(yaopinrukuInfo);
returnResult。success();
}
PutMapping(update2)
publicResultupdate2(RequestBodyYaopinrukuInfoVoyaopinrukuInfo){
yaopinrukuInfoService。update2(yaopinrukuInfo);
returnResult。success();
}
GetMapping({id})
publicResultdetail(PathVariableLongid){
YaopinrukuInfoyaopinrukuInfoyaopinrukuInfoService。findById(id);
returnResult。success(yaopinrukuInfo);
}
GetMapping(changeStatus{id})
publicResultchangeStatus(PathVariableLongid){
yaopinrukuInfoService。changeStatus(id);
returnResult。success();
}
GetMapping
publicResultListYaopinrukuInfoVoall(){
returnResult。success(yaopinrukuInfoService。findAll());
}
GetMapping(page{name})
publicResultPageInfoYaopinrukuInfoVopage(PathVariableStringname,
RequestParam(defaultValue1)IntegerpageNum,
RequestParam(defaultValue5)IntegerpageSize,
HttpServletRequestrequest){
returnResult。success(yaopinrukuInfoService。findPage(name,pageNum,pageSize,request));
}
GetMapping(pageqt{name})
publicResultPageInfoYaopinrukuInfoVopageqt(PathVariableStringname,
RequestParam(defaultValue1)IntegerpageNum,
RequestParam(defaultValue8)IntegerpageSize,
HttpServletRequestrequest){
returnResult。success(yaopinrukuInfoService。findPageqt(name,pageNum,pageSize,request));
}
PostMapping(register)
publicResultregister(RequestBodyYaopinrukuInfoyaopinrukuInfo){
if(StrUtil。isBlank(yaopinrukuInfo。getName())StrUtil。isBlank(yaopinrukuInfo。getPassword())){
thrownewCustomException(ResultCode。PARAMERROR);
}
returnResult。success(yaopinrukuInfoService。add(yaopinrukuInfo));
}
批量通过excel添加信息
paramfileexcel文件
throwsIOException
PostMapping(upload)
publicResultupload(MultipartFilefile)throwsIOException{
ListinfoListExcelUtil。getReader(file。getInputStream())。readAll(YaopinrukuInfo。class);
if(!CollectionUtil。isEmpty(infoList)){
处理一下空数据
ListresultListinfoList。stream()。filter(xObjectUtil。isNotEmpty(x。getYaopinmingcheng()))。collect(Collectors。toList());
for(YaopinrukuInfoinfo:resultList){
yaopinrukuInfoService。add(info);
}
}
returnResult。success();
}
yoxutonxgjitu
GetMapping(getExcelModel)
publicvoidgetExcelModel(HttpServletResponseresponse)throwsIOException{
1。生成excel
MapString,ObjectrownewLinkedHashMap();
row。put(yaopinbianhao,A药品编号);
row。put(yaopinmingcheng,A药品名称);
row。put(kucun,A库存);
row。put(rukushuliang,A入库数量);
row。put(rukushijian,A入库时间);
row。put(beizhu,A备注);
row。put(caozuoren,A操作人);row。put(status,是);
row。put(level,yaopinruku);
ListMapString,ObjectlistCollUtil。newArrayList(row);
2。写excel
ExcelWriterwriterExcelUtil。getWriter(true);
writer。write(list,true);
response。setContentType(applicationvnd。openxmlformatsofficedocument。spreadsheetml。sheet;charsetutf8);
response。setHeader(ContentDisposition,attachment;filenameyaopinrukuInfoModel。xlsx);
ServletOutputStreamoutresponse。getOutputStream();
writer。flush(out,true);
writer。close();
IoUtil。close(System。out);
}
GetMapping(getExcel)
publicvoidgetExcel(HttpServletResponseresponse)throwsIOException{
1。生成excel
MapString,ObjectrownewLinkedHashMap();
row。put(yaopinbianhao,A药品编号);
row。put(yaopinmingcheng,A药品名称);
row。put(kucun,A库存);
row。put(rukushuliang,A入库数量);
row。put(rukushijian,A入库时间);
row。put(beizhu,A备注);
row。put(caozuoren,A操作人);
row。put(status,是);
row。put(level,权限);
ListMapString,ObjectlistCollUtil。newArrayList(row);
ListMapString,ObjectdaochuexcellistyaopinrukuInfoDao。daochuexcel();
MapString,DoubletypeMapnewHashMap();
for(MapString,Objectmap:daochuexcellist){
list。add(map);
}
2。写excel
ExcelWriterwriterExcelUtil。getWriter(true);
writer。write(list,true);
response。setContentType(applicationvnd。openxmlformatsofficedocument。spreadsheetml。sheet;charsetutf8);
response。setHeader(ContentDisposition,attachment;filenameyaopinrukuInfo。xlsx);
ServletOutputStreamoutresponse。getOutputStream();
writer。flush(out,true);
writer。close();
IoUtil。close(System。out);
}
privatevoidgetPieData(Stringname,ListpieList,MapString,DoubledataMap){
EchartsDatapieDatanewEchartsData();
EchartsData。SeriesseriesnewEchartsData。Series();
MapString,StringtitleMapnewHashMap(2);
titleMap。put(text,name);
pieData。setTitle(titleMap);
series。setName(name比例);
series。setType(pie);
series。setRadius(55);
ListobjectsnewArrayList();
ListlegendListnewArrayList();
for(Stringkey:dataMap。keySet()){
DoublevaluedataMap。get(key);
objects。add(newJSONObject()。putOpt(name,key)。putOpt(value,value));
legendList。add(key);
}
series。setData(objects);
pieData。setSeries(Collections。singletonList(series));
MapString,BooleanmapnewHashMap();
map。put(show,true);
pieData。setTooltip(map);
MapString,ObjectlegendMapnewHashMap(4);
legendMap。put(orient,vertical);
legendMap。put(x,left);
legendMap。put(y,center);
legendMap。put(data,legendList);
pieData。setLegend(legendMap);
pieList。add(pieData);
}
privatevoidgetBarData(Stringname,ListbarList,MapString,DoubledataMap){
EchartsDatabarDatanewEchartsData();
EchartsData。SeriesseriesnewEchartsData。Series();
ListseriesObjsnewArrayList();
ListxAxisObjsnewArrayList();
for(Stringkey:dataMap。keySet()){
DoublevaluedataMap。get(key);
xAxisObjs。add(key);
seriesObjs。add(value);
}
series。setType(bar);
series。setName(name);
series。setData(seriesObjs);
barData。setSeries(Collections。singletonList(series));
MapString,ObjectxAxisMapnewHashMap(1);
xAxisMap。put(data,xAxisObjs);
barData。setxAxis(xAxisMap);
barData。setyAxis(newHashMap());
MapString,ObjectlegendMapnewHashMap(1);
legendMap。put(data,Collections。singletonList(name));
barData。setLegend(legendMap);
MapString,BooleanmapnewHashMap(1);
map。put(show,true);
barData。setTooltip(map);
MapString,StringtitleMapnewHashMap(1);
titleMap。put(text,name);
barData。setTitle(titleMap);
barList。add(barData);
}
}
墨西哥为何向美国军火商讨说法?近期,墨西哥打定主意,要向美国军火商讨说法。上月底,美国马萨诸塞州一名联邦法官驳回了墨西哥去年针对美国军火商提起的诉讼。在该起诉讼中,墨西哥方面控告11家美国军火商因渎职和非法商业
全志T3开发板(4核ARMCortex从开发板到PLC本次测试板卡是创龙科技旗下,一款基于全志科技T3处理器设计的4核ARMCortexA7高性能低功耗国产评估板,每核主频高达1。2GHz。评估板接口资源丰富,引出双路网口双路CAN双
超发货币去了哪里?该去哪里?头条创作挑战赛货币超发,一般人理解成就是开启核动力印刷机印制天量的钞票,比如民国的金圆券一战后德国的马克,印得越多,贬值越大,物价越高。再比如老朋友津巴布韦的超级超发,最大面值的货
不用熬夜剁手!今年双十一有这些新变化一年一度的双十一又要来了!今年双十一迎来一些新变化,预售时间缩短购物车扩容一键退差价晚八人来了,还增加这些新功能今年双十一,无论是预售付定金阶段还是售卖阶段,都告别了零点,电商平台
A股走势已明了,历史或会重演?炒股,是靠认知的变现,任何与投资有关的行为,都不是单纯的靠努力,而是靠思维能力。现实里面没有做过生意,没有创业的人,投资股票,往往更容易亏损,因为他们没有投资思维,只有博弈思维,把
因冬装陷入质疑的李宁道歉了,但诚意不多事实反复证明不恰当的消费者教育,只会让品牌被消费者狠狠教育。这次卷入风波的品牌是李宁。新品疑似日本军服,李宁回应来源于中国古代文化10月17日前后,李宁新款服饰的图片开始在互联网发
打脸真快!快船为何如此拉胯?拦路虎变成虐菜小能手了?在今日的常规赛中,雷霆主场10894胜快船,取得赛季首胜。雷霆后卫谢伊吉尔杰斯亚历山大表现出色,本场比赛他上场37分钟,22投11中,得到33分5篮板8助攻3抢断3盖帽。耳光打得啪
遭遇拦路虎,拼多多商标又又又被驳回了!拼多多有点想法但不多太惨了,拼多多的商标又双叒叕被驳回了,上诉到法院都没有用的那种。据最新消息,因商标注册申请被驳回,拼多多关联公司上海寻梦信息技术有限公司将国家知识产权局诉至法院,北京市高级人民法院
今晚的篮筐是大海!七人上双,广厦33分痛扁山西,是苦难也是财富开赛以来,广厦队可谓是最惨的球队,他们接连遭遇主力球员伤病,目前也是2胜3负排名中游,而山西队则是开赛状态火热,除了揭幕战输给四川外,他们接连击败广州吉林辽宁,豪取四连胜,排在联赛
既然没有大任降,就不要再苦我心志了圣人说天将降大任于斯人也,必先苦其心志,劳其筋骨,饿其体肤,空乏其身,行拂乱其所为,所以动心忍性,增益其所不能。我以为老天爷一定是有什么大任务交给我,例如拯救地球,解放全人类,才苦
抢注阿里巴巴却不使用?阿里筑商标护城河遇拦路虎现在想要成功注册一枚商标有点难,想要获得一枚好听易记,甚至和大企业知名商标近似的商标,那更是难上加难!看下这件商标阿里巴巴,多少人梦寐以求的名称,可以说是自带超高流量的一件商标。这