当前位置:   article > 正文

基于ssm家庭记账本系统的微信小程序源码和论文_共享记账源码

共享记账源码

摘  要

随着我国经济迅速发展,人们对手机的需求越来越大,各种手机软件也都在被广泛应用,但是对于手机进行数据信息管理,对于手机的各种软件也是备受用户的喜爱,家庭记账本小程序用户普遍使用,为方便用户能够可以随时进行家庭记账本小程序的数据信息管理,特开发了基于家庭记账本小程序的管理系统。

家庭记账本小程序的设计主要是对系统所要实现的功能进行详细考虑,确定所要实现的功能后进行界面的设计,在这中间还要考虑如何可以更好的将功能及页面进行很好的结合,方便用户可以很容易明了的找到自己所需要的信息,还有系统平台后期的可操作性,通过对信息内容的详细了解进行技术的开发。

家庭记账本小程序的开发利用现有的成熟技术参考,以源代码为模板,分析功能调整与家庭记账本小程序管理的实际需求相结合,讨论了基于家庭记账本小程序管理的使用。 

关键词:家庭记账本小程序;JAVA

基于ssm家庭记账本系统的微信小程序源码和论文002

演示视频:

基于ssm家庭记账本系统的微信小程序源码和论文

Abstract

With the rapid development of China's economy, people have more and more demands for mobile phones, and various mobile phone software are also widely used. However, for mobile phones, data information management is also popular with users. The small program of home bookkeeping is widely used by users, so that users can manage the data information of the small program at any time In this paper, the management system based on the small program of household bookkeeping is developed.

The design of the home bookkeeping small program is mainly to consider the functions to be realized in detail, and then design the interface after determining the functions to be realized. In this process, we should consider how to better combine the functions and pages, so that users can easily find the information they need, and the operability of the system platform later, and make it easy for users to find the information they need Through the detailed understanding of information content for technical development.

The development of the family bookkeeping small program uses the existing mature technical reference, takes the source code as the template, analyzes the function adjustment and the actual needs of the family bookkeeping small program management, discusses the use of the family bookkeeping small program management.  

Key words: household bookkeeping widget; Java

 

  1. package com.controller;
  2. import java.io.File;
  3. import java.math.BigDecimal;
  4. import java.net.URL;
  5. import java.text.SimpleDateFormat;
  6. import com.alibaba.fastjson.JSONObject;
  7. import java.util.*;
  8. import org.springframework.beans.BeanUtils;
  9. import javax.servlet.http.HttpServletRequest;
  10. import org.springframework.web.context.ContextLoader;
  11. import javax.servlet.ServletContext;
  12. import com.service.TokenService;
  13. import com.utils.*;
  14. import java.lang.reflect.InvocationTargetException;
  15. import com.service.DictionaryService;
  16. import org.apache.commons.lang3.StringUtils;
  17. import com.annotation.IgnoreAuth;
  18. import org.slf4j.Logger;
  19. import org.slf4j.LoggerFactory;
  20. import org.springframework.beans.factory.annotation.Autowired;
  21. import org.springframework.stereotype.Controller;
  22. import org.springframework.web.bind.annotation.*;
  23. import com.baomidou.mybatisplus.mapper.EntityWrapper;
  24. import com.baomidou.mybatisplus.mapper.Wrapper;
  25. import com.entity.*;
  26. import com.entity.view.*;
  27. import com.service.*;
  28. import com.utils.PageUtils;
  29. import com.utils.R;
  30. import com.alibaba.fastjson.*;
  31. /**
  32. * 收入详情
  33. * 后端接口
  34. * @author
  35. * @email
  36. */
  37. @RestController
  38. @Controller
  39. @RequestMapping("/shouruxiangqing")
  40. public class ShouruxiangqingController {
  41. private static final Logger logger = LoggerFactory.getLogger(ShouruxiangqingController.class);
  42. @Autowired
  43. private ShouruxiangqingService shouruxiangqingService;
  44. @Autowired
  45. private TokenService tokenService;
  46. @Autowired
  47. private DictionaryService dictionaryService;
  48. //级联表service
  49. @Autowired
  50. private YonghuService yonghuService;
  51. /**
  52. * 后端列表
  53. */
  54. @RequestMapping("/page")
  55. public R page(@RequestParam Map<String, Object> params, HttpServletRequest request){
  56. logger.debug("page方法:,,Controller:{},,params:{}",this.getClass().getName(),JSONObject.toJSONString(params));
  57. String role = String.valueOf(request.getSession().getAttribute("role"));
  58. if(false)
  59. return R.error(511,"永不会进入");
  60. else if("用户".equals(role))
  61. params.put("yonghuId",request.getSession().getAttribute("userId"));
  62. if(params.get("orderBy")==null || params.get("orderBy")==""){
  63. params.put("orderBy","id");
  64. }
  65. PageUtils page = shouruxiangqingService.queryPage(params);
  66. //字典表数据转换
  67. List<ShouruxiangqingView> list =(List<ShouruxiangqingView>)page.getList();
  68. for(ShouruxiangqingView c:list){
  69. //修改对应字典表字段
  70. dictionaryService.dictionaryConvert(c, request);
  71. }
  72. return R.ok().put("data", page);
  73. }
  74. /**
  75. * 后端详情
  76. */
  77. @RequestMapping("/info/{id}")
  78. public R info(@PathVariable("id") Long id, HttpServletRequest request){
  79. logger.debug("info方法:,,Controller:{},,id:{}",this.getClass().getName(),id);
  80. ShouruxiangqingEntity shouruxiangqing = shouruxiangqingService.selectById(id);
  81. if(shouruxiangqing !=null){
  82. //entity转view
  83. ShouruxiangqingView view = new ShouruxiangqingView();
  84. BeanUtils.copyProperties( shouruxiangqing , view );//把实体数据重构到view中
  85. //级联表
  86. YonghuEntity yonghu = yonghuService.selectById(shouruxiangqing.getYonghuId());
  87. if(yonghu != null){
  88. BeanUtils.copyProperties( yonghu , view ,new String[]{ "id", "createTime", "insertTime", "updateTime"});//把级联的数据添加到view中,并排除id和创建时间字段
  89. view.setYonghuId(yonghu.getId());
  90. }
  91. //修改对应字典表字段
  92. dictionaryService.dictionaryConvert(view, request);
  93. return R.ok().put("data", view);
  94. }else {
  95. return R.error(511,"查不到数据");
  96. }
  97. }
  98. /**
  99. * 后端保存
  100. */
  101. @RequestMapping("/save")
  102. public R save(@RequestBody ShouruxiangqingEntity shouruxiangqing, HttpServletRequest request){
  103. logger.debug("save方法:,,Controller:{},,shouruxiangqing:{}",this.getClass().getName(),shouruxiangqing.toString());
  104. String role = String.valueOf(request.getSession().getAttribute("role"));
  105. if(false)
  106. return R.error(511,"永远不会进入");
  107. else if("用户".equals(role))
  108. shouruxiangqing.setYonghuId(Integer.valueOf(String.valueOf(request.getSession().getAttribute("userId"))));
  109. Wrapper<ShouruxiangqingEntity> queryWrapper = new EntityWrapper<ShouruxiangqingEntity>()
  110. .eq("shouruxiangqing_name", shouruxiangqing.getShouruxiangqingName())
  111. .eq("shouruxiangqing_money", shouruxiangqing.getShouruxiangqingMoney())
  112. .eq("shouruxiangqing_types", shouruxiangqing.getShouruxiangqingTypes())
  113. .eq("yonghu_id", shouruxiangqing.getYonghuId())
  114. .eq("insert_time", new SimpleDateFormat("yyyy-MM-dd").format(new Date()))
  115. ;
  116. logger.info("sql语句:"+queryWrapper.getSqlSegment());
  117. ShouruxiangqingEntity shouruxiangqingEntity = shouruxiangqingService.selectOne(queryWrapper);
  118. if(shouruxiangqingEntity==null){
  119. shouruxiangqing.setInsertTime(new Date());
  120. shouruxiangqing.setCreateTime(new Date());
  121. shouruxiangqingService.insert(shouruxiangqing);
  122. return R.ok();
  123. }else {
  124. return R.error(511,"表中有相同数据");
  125. }
  126. }
  127. /**
  128. * 后端修改
  129. */
  130. @RequestMapping("/update")
  131. public R update(@RequestBody ShouruxiangqingEntity shouruxiangqing, HttpServletRequest request){
  132. logger.debug("update方法:,,Controller:{},,shouruxiangqing:{}",this.getClass().getName(),shouruxiangqing.toString());
  133. String role = String.valueOf(request.getSession().getAttribute("role"));
  134. // if(false)
  135. // return R.error(511,"永远不会进入");
  136. // else if("用户".equals(role))
  137. // shouruxiangqing.setYonghuId(Integer.valueOf(String.valueOf(request.getSession().getAttribute("userId"))));
  138. //根据字段查询是否有相同数据
  139. Wrapper<ShouruxiangqingEntity> queryWrapper = new EntityWrapper<ShouruxiangqingEntity>()
  140. .notIn("id",shouruxiangqing.getId())
  141. .andNew()
  142. .eq("shouruxiangqing_name", shouruxiangqing.getShouruxiangqingName())
  143. .eq("shouruxiangqing_money", shouruxiangqing.getShouruxiangqingMoney())
  144. .eq("shouruxiangqing_types", shouruxiangqing.getShouruxiangqingTypes())
  145. .eq("yonghu_id", shouruxiangqing.getYonghuId())
  146. .eq("insert_time", new SimpleDateFormat("yyyy-MM-dd").format(shouruxiangqing.getInsertTime()))
  147. ;
  148. logger.info("sql语句:"+queryWrapper.getSqlSegment());
  149. ShouruxiangqingEntity shouruxiangqingEntity = shouruxiangqingService.selectOne(queryWrapper);
  150. if("".equals(shouruxiangqing.getShouruxiangqingPhoto()) || "null".equals(shouruxiangqing.getShouruxiangqingPhoto())){
  151. shouruxiangqing.setShouruxiangqingPhoto(null);
  152. }
  153. if(shouruxiangqingEntity==null){
  154. shouruxiangqingService.updateById(shouruxiangqing);//根据id更新
  155. return R.ok();
  156. }else {
  157. return R.error(511,"表中有相同数据");
  158. }
  159. }
  160. /**
  161. * 删除
  162. */
  163. @RequestMapping("/delete")
  164. public R delete(@RequestBody Integer[] ids){
  165. logger.debug("delete:,,Controller:{},,ids:{}",this.getClass().getName(),ids.toString());
  166. shouruxiangqingService.deleteBatchIds(Arrays.asList(ids));
  167. return R.ok();
  168. }
  169. /**
  170. * 批量上传
  171. */
  172. @RequestMapping("/batchInsert")
  173. public R save( String fileName, HttpServletRequest request){
  174. logger.debug("batchInsert方法:,,Controller:{},,fileName:{}",this.getClass().getName(),fileName);
  175. Integer yonghuId = Integer.valueOf(String.valueOf(request.getSession().getAttribute("userId")));
  176. SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
  177. try {
  178. List<ShouruxiangqingEntity> shouruxiangqingList = new ArrayList<>();//上传的东西
  179. Map<String, List<String>> seachFields= new HashMap<>();//要查询的字段
  180. Date date = new Date();
  181. int lastIndexOf = fileName.lastIndexOf(".");
  182. if(lastIndexOf == -1){
  183. return R.error(511,"该文件没有后缀");
  184. }else{
  185. String suffix = fileName.substring(lastIndexOf);
  186. if(!".xls".equals(suffix)){
  187. return R.error(511,"只支持后缀为xls的excel文件");
  188. }else{
  189. URL resource = this.getClass().getClassLoader().getResource("../../upload/" + fileName);//获取文件路径
  190. File file = new File(resource.getFile());
  191. if(!file.exists()){
  192. return R.error(511,"找不到上传文件,请联系管理员");
  193. }else{
  194. List<List<String>> dataList = PoiUtil.poiImport(file.getPath());//读取xls文件
  195. dataList.remove(0);//删除第一行,因为第一行是提示
  196. for(List<String> data:dataList){
  197. //循环
  198. ShouruxiangqingEntity shouruxiangqingEntity = new ShouruxiangqingEntity();
  199. // shouruxiangqingEntity.setShouruxiangqingName(data.get(0)); //标题 要改的
  200. // shouruxiangqingEntity.setShouruxiangqingPhoto("");//详情和图片
  201. // shouruxiangqingEntity.setShouruxiangqingMoney(Integer.valueOf(data.get(0))); //收入金额 要改的
  202. // shouruxiangqingEntity.setShouruxiangqingTypes(Integer.valueOf(data.get(0))); //收入类型 要改的
  203. // shouruxiangqingEntity.setYonghuId(Integer.valueOf(data.get(0))); //用户 要改的
  204. // shouruxiangqingEntity.setShouruxiangqingContent("");//详情和图片
  205. // shouruxiangqingEntity.setInsertTime(date);//时间
  206. // shouruxiangqingEntity.setCreateTime(date);//时间
  207. shouruxiangqingList.add(shouruxiangqingEntity);
  208. //把要查询是否重复的字段放入map中
  209. }
  210. //查询是否重复
  211. shouruxiangqingService.insertBatch(shouruxiangqingList);
  212. return R.ok();
  213. }
  214. }
  215. }
  216. }catch (Exception e){
  217. e.printStackTrace();
  218. return R.error(511,"批量插入数据异常,请联系管理员");
  219. }
  220. }
  221. /**
  222. * 前端列表
  223. */
  224. @IgnoreAuth
  225. @RequestMapping("/list")
  226. public R list(@RequestParam Map<String, Object> params, HttpServletRequest request){
  227. logger.debug("list方法:,,Controller:{},,params:{}",this.getClass().getName(),JSONObject.toJSONString(params));
  228. // 没有指定排序字段就默认id倒序
  229. if(StringUtil.isEmpty(String.valueOf(params.get("orderBy")))){
  230. params.put("orderBy","id");
  231. }
  232. PageUtils page = shouruxiangqingService.queryPage(params);
  233. //字典表数据转换
  234. List<ShouruxiangqingView> list =(List<ShouruxiangqingView>)page.getList();
  235. for(ShouruxiangqingView c:list)
  236. dictionaryService.dictionaryConvert(c, request); //修改对应字典表字段
  237. return R.ok().put("data", page);
  238. }
  239. /**
  240. * 前端详情
  241. */
  242. @RequestMapping("/detail/{id}")
  243. public R detail(@PathVariable("id") Long id, HttpServletRequest request){
  244. logger.debug("detail方法:,,Controller:{},,id:{}",this.getClass().getName(),id);
  245. ShouruxiangqingEntity shouruxiangqing = shouruxiangqingService.selectById(id);
  246. if(shouruxiangqing !=null){
  247. //entity转view
  248. ShouruxiangqingView view = new ShouruxiangqingView();
  249. BeanUtils.copyProperties( shouruxiangqing , view );//把实体数据重构到view中
  250. //级联表
  251. YonghuEntity yonghu = yonghuService.selectById(shouruxiangqing.getYonghuId());
  252. if(yonghu != null){
  253. BeanUtils.copyProperties( yonghu , view ,new String[]{ "id", "createDate"});//把级联的数据添加到view中,并排除id和创建时间字段
  254. view.setYonghuId(yonghu.getId());
  255. }
  256. //修改对应字典表字段
  257. dictionaryService.dictionaryConvert(view, request);
  258. return R.ok().put("data", view);
  259. }else {
  260. return R.error(511,"查不到数据");
  261. }
  262. }
  263. /**
  264. * 前端保存
  265. */
  266. @RequestMapping("/add")
  267. public R add(@RequestBody ShouruxiangqingEntity shouruxiangqing, HttpServletRequest request){
  268. logger.debug("add方法:,,Controller:{},,shouruxiangqing:{}",this.getClass().getName(),shouruxiangqing.toString());
  269. Wrapper<ShouruxiangqingEntity> queryWrapper = new EntityWrapper<ShouruxiangqingEntity>()
  270. .eq("shouruxiangqing_name", shouruxiangqing.getShouruxiangqingName())
  271. .eq("shouruxiangqing_money", shouruxiangqing.getShouruxiangqingMoney())
  272. .eq("shouruxiangqing_types", shouruxiangqing.getShouruxiangqingTypes())
  273. .eq("yonghu_id", shouruxiangqing.getYonghuId())
  274. ;
  275. logger.info("sql语句:"+queryWrapper.getSqlSegment());
  276. ShouruxiangqingEntity shouruxiangqingEntity = shouruxiangqingService.selectOne(queryWrapper);
  277. if(shouruxiangqingEntity==null){
  278. shouruxiangqing.setInsertTime(new Date());
  279. shouruxiangqing.setCreateTime(new Date());
  280. shouruxiangqingService.insert(shouruxiangqing);
  281. return R.ok();
  282. }else {
  283. return R.error(511,"表中有相同数据");
  284. }
  285. }
  286. }

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/知新_RL/article/detail/311157
推荐阅读
相关标签
  

闽ICP备14008679号