Get the source code: Download it from "Resources" on the homepage of the blog!
Features
The pharmaceutical invoicing system is mainly divided into two roles: employees and customers. This system has the versatility of the invoicing system, and can be modified to other invoicing systems, such as household appliances invoicing, mobile phone invoicing, etc.;
The main functional modules after employee login are:
My panel: personal information, modify information, modify password;
employee management: employee addition, employee query;
drug management: drug category addition, drug category query, drug addition, drug query;
customer management: Customer inquiry;
supplier management: supplier addition, supplier inquiry;
bill management: purchase addition, purchase inquiry, return bill, sales bill inquiry;
after the customer logs in, the main functional modules are:
My panel: personal information, modification information, change password;
Purchase of medicines: medicine display, purchased medicines;
environmental needs
1. Operating environment: preferably java jdk 1.8, we are running on this platform. Other versions are also theoretically possible.
2. IDE environment: IDEA, Eclipse, Myeclipse can be used. IDEA is recommended;
3. Tomcat environment: Tomcat 7.x, 8.x, 9.x versions are available
4. Hardware environment: Windows 7/8/10 with more than 1G memory; or Mac OS;
5. Maven project: Yes; Check whether pom.xml is included in the source code directory; if so, it is a maven project, otherwise it is a non-maven project
6. Database: MySql version 5.7;
system framework
1. Backend: SpringBoot
2. Front end: HTML+Echarts+JQuery
Instructions for use
1. Use IDEA/Eclipse/MyEclipse to import the source code of the back-end project. When importing from Eclipse/MyEclipse, if it is a maven project, please select maven; if it is a maven project, after the import is successful, please execute the maven clean;maven install command, configure tomcat, and then run ;
2. Use Navicat or other tools to create a database with the corresponding name in mysql, and import the sql file of the project;
3. Before running the project, you need to configure the MqSQL database, and modify the configuration file corresponding to the database in application.properties;
4. Configure Tomcat and run the backend project in Tomcat;
5. After the operation is successful, visit in the browser: http://localhost:8888
6. Customers and employees correspond to the database tables t_customers and t_employees, and the username is the mobile phone number and the password It is also the corresponding mobile phone number
Customer account: 15133480838 Password: 15133480838
Staff account: 15133330551 Password: 15133330551
User related controller:
/**
* 用户相关的controller
*/
@Controller
public class UserController {
/**
* 转向登录页面
*/
@RequestMapping(value = "/login")
public String login(){
return "/login";
}
/**
* 判断用户登录是否成功
*/
@RequestMapping(value = "/toLogin")
@ResponseBody
public Object toLogin(String username,String password){
if(username==null||password==null){
return ResultMapUtil.getHashMapLogin("用户名密码不能为空","2");
}
Subject subject = SecurityUtils.getSubject();
UsernamePasswordToken token = new UsernamePasswordToken(username,password);
try{
subject.login(token);
}catch (UnknownAccountException e){
return ResultMapUtil.getHashMapLogin("用户名不存在","2");
}catch (IncorrectCredentialsException e){
return ResultMapUtil.getHashMapLogin("密码错误","2");
}
return ResultMapUtil.getHashMapLogin("验证成功","1");
}
/**
* 转向后台管理首页
*/
@RequestMapping(value = "/index")
public String index(){
return "/index";
}
/**
* 退出登录
*/
@RequestMapping(value = "/logout")
public String logout(){
Subject subject = SecurityUtils.getSubject();
subject.logout();
return "redirect:/login";
}
}
Controllers related to sales records:
/**
* 销售记录相关的controller
*/
@Controller
@RequestMapping(value = "/saleinfo")
public class SaleinfoController {
@Autowired
private ISaleinfoService saleinfoService;
/**
* 转向销售记录页面
*/
@RequestMapping
public String saleinfo(){
return "/saleinfo";
}
/**
* 分页查询销售记录列表
*/
@RequestMapping(value = "/saleinfoQueryPage")
@ResponseBody
public Object saleinfoQueryPage(String param, @RequestParam(defaultValue = "1")int pageNum,@RequestParam(defaultValue = "10")int pageSize){
try{
IPage<Saleinfo> iPage = saleinfoService.selectSaleinfoPage(pageNum,pageSize,param);
return ResultMapUtil.getHashMapMysqlPage(iPage);
} catch (Exception e){
return ResultMapUtil.getHashMapException(e);
}
}
/**
* 转向销售记录新增页面
*/
@RequestMapping(value = "/saleinfoPage")
public String saleinfoPage(){
return "/saleinfoPage";
}
/**
* 添加一个销售记录
*/
@RequestMapping(value = "/saleinfoAdd")
@ResponseBody
public Object saleinfoAdd(Saleinfo saleinfo){
try{
int i = saleinfoService.addSaleinfo(saleinfo);
return ResultMapUtil.getHashMapSave(i);
} catch (Exception e){
return ResultMapUtil.getHashMapException(e);
}
}
/**
* 转向销售记录编辑页面
*/
@RequestMapping(value = "/saleinfoQueryById")
public String saleinfoQueryById(@RequestParam(name = "id",required = true)Integer id, Model model){
Saleinfo saleinfo = saleinfoService.querySaleinfoById(id);
model.addAttribute("obj",saleinfo);
return "/saleinfoPage";
}
/**
* 修改一个销售记录
*/
@RequestMapping(value = "/saleinfoEdit")
@ResponseBody
public Object saleinfoEdit(Saleinfo saleinfo){
try{
int i = saleinfoService.editSaleinfo(saleinfo);
return ResultMapUtil.getHashMapSave(i);
} catch (Exception e){
return ResultMapUtil.getHashMapException(e);
}
}
/**
* 删除一个销售记录
*/
@RequestMapping(value = "/saleinfoDelById")
@ResponseBody
public Object saleinfoDelById(Integer id){
try{
int i = saleinfoService.delSaleinfoById(id);
return ResultMapUtil.getHashMapDel(i);
} catch (Exception e){
return ResultMapUtil.getHashMapException(e);
}
}
}
Drug-related controllers:
/**
* 药品相关的controller
*/
@Controller
@RequestMapping(value = "/druginfo")
public class DruginfoController {
@Autowired
private IDruginfoService druginfoService;
/**
* 转向药品页面
*/
@RequestMapping
public String druginfo(){
return "/druginfo";
}
/**
* 分页查询药品列表
*/
@RequestMapping(value = "/druginfoQueryPage")
@ResponseBody
public Object druginfoQueryPage(String param, @RequestParam(defaultValue = "1")int pageNum,@RequestParam(defaultValue = "10")int pageSize){
try{
IPage<Druginfo> iPage = druginfoService.selectDruginfoPage(pageNum,pageSize,param);
return ResultMapUtil.getHashMapMysqlPage(iPage);
} catch (Exception e){
return ResultMapUtil.getHashMapException(e);
}
}
/**
* 转向药品新增页面
*/
@RequestMapping(value = "/druginfoPage")
public String druginfoPage(){
return "/druginfoPage";
}
/**
* 添加一个药品
*/
@RequestMapping(value = "/druginfoAdd")
@ResponseBody
public Object druginfoAdd(Druginfo druginfo){
try{
int i = druginfoService.addDruginfo(druginfo);
return ResultMapUtil.getHashMapSave(i);
} catch (Exception e){
return ResultMapUtil.getHashMapException(e);
}
}
/**
* 转向药品编辑页面
*/
@RequestMapping(value = "/druginfoQueryById")
public String druginfoQueryById(@RequestParam(name = "id",required = true)Integer id, Model model){
Druginfo druginfo = druginfoService.queryDruginfoById(id);
model.addAttribute("obj",druginfo);
return "/druginfoPage";
}
/**
* 修改一个药品
*/
@RequestMapping(value = "/druginfoEdit")
@ResponseBody
public Object druginfoEdit(Druginfo druginfo){
try{
int i = druginfoService.editDruginfo(druginfo);
return ResultMapUtil.getHashMapSave(i);
} catch (Exception e){
return ResultMapUtil.getHashMapException(e);
}
}
/**
* 删除一个药品
*/
@RequestMapping(value = "/druginfoDelById")
@ResponseBody
public Object druginfoDelById(Integer id){
try{
int i = druginfoService.delDruginfoById(id);
return ResultMapUtil.getHashMapDel(i);
} catch (Exception e){
return ResultMapUtil.getHashMapException(e);
}
}
/**
* 获取所有药品
*/
@RequestMapping(value = "/druginfoList")
@ResponseBody
public Object druginfoList(){
List<Druginfo> druginfoList = druginfoService.queryDruginfoList();
return ResultMapUtil.getHashMapList(druginfoList);
}
/**
* 转向药品保质期检查页面
*/
@RequestMapping(value = "/warranty")
public String warranty(){
return "/warranty";
}
}
Permission authentication configuration:
/**
* 权限认证
*/
public class UserRealm extends AuthorizingRealm {
@Autowired
private IUserService userService;
@Override
protected AuthorizationInfo doGetAuthorizationInfo(PrincipalCollection principalCollection) {
return null;
}
/**
* 登录认证
* @param authenticationToken
* @return
* @throws AuthenticationException
*/
@Override
protected AuthenticationInfo doGetAuthenticationInfo(AuthenticationToken authenticationToken) throws AuthenticationException {
UsernamePasswordToken token = (UsernamePasswordToken) authenticationToken;
String username = token.getUsername();
User queryUser = new User();
queryUser.setUsername(username);
//根据用户名查询用户是否存在
User user = userService.queryUserByUsername(queryUser);
if(user==null){
return null;
}
return new SimpleAuthenticationInfo(user,user.getPassword(),getName());
}
}
Get the source code: Download it from "Resources" on the homepage of the blog!