账套信息,代码优化!
This commit is contained in:
parent
1ac25ab2bd
commit
38a308bca9
|
|
@ -77,6 +77,7 @@
|
|||
<orderEntry type="library" name="Maven: org.unbescape:unbescape:1.1.6.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.thymeleaf.extras:thymeleaf-extras-java8time:3.0.4.RELEASE" level="project" />
|
||||
<orderEntry type="module" module-name="fileUpload" />
|
||||
<orderEntry type="library" name="Maven: com.cwhelp.modules:bss:2.0.1" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-web:2.1.4.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter:2.1.4.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-logging:2.1.4.RELEASE" level="project" />
|
||||
|
|
|
|||
|
|
@ -51,6 +51,11 @@
|
|||
<artifactId>fileUpload</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.cwhelp.modules</groupId>
|
||||
<artifactId>bss</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
|
|
|
|||
|
|
@ -0,0 +1,155 @@
|
|||
package com.cwhelp.admin.business.controller;
|
||||
|
||||
import com.cwhelp.admin.business.validator.BssEnterpriseValid;
|
||||
import com.cwhelp.common.constant.PlatformConst;
|
||||
import com.cwhelp.common.enums.ResultEnum;
|
||||
import com.cwhelp.common.enums.StatusEnum;
|
||||
import com.cwhelp.common.utils.EntityBeanUtil;
|
||||
import com.cwhelp.common.utils.ResultVoUtil;
|
||||
import com.cwhelp.common.utils.StatusUtil;
|
||||
import com.cwhelp.common.vo.ResultVo;
|
||||
import com.cwhelp.component.shiro.ShiroUtil;
|
||||
import com.cwhelp.modules.business.domain.BssEnterprise;
|
||||
import com.cwhelp.modules.business.domain.BssPlatform;
|
||||
import com.cwhelp.modules.business.service.BssEnterpriseService;
|
||||
import com.cwhelp.modules.system.domain.User;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.domain.Example;
|
||||
import org.springframework.data.domain.ExampleMatcher;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.Model;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author yan.y
|
||||
* @date 2019/08/06
|
||||
*/
|
||||
@Controller
|
||||
@RequestMapping("/bss/enterprise")
|
||||
public class BssEnterpriseController {
|
||||
|
||||
@Autowired
|
||||
private BssEnterpriseService bssEnterpriseService;
|
||||
|
||||
/**
|
||||
* 列表页面
|
||||
*/
|
||||
@GetMapping("/index")
|
||||
@RequiresPermissions("bss:enterprise:index")
|
||||
public String index(Model model, BssEnterprise bssEnterprise) {
|
||||
User user = ShiroUtil.getSubject();
|
||||
|
||||
// 创建匹配器,进行动态查询匹配
|
||||
ExampleMatcher matcher = ExampleMatcher.matching()
|
||||
.withMatcher("name", match -> match.contains())
|
||||
.withMatcher("platform.id",match -> match.contains());
|
||||
BssPlatform bssPlatform = new BssPlatform();
|
||||
bssPlatform.setId(user.getBssPlatform().getId());
|
||||
bssEnterprise.setPlatform(bssPlatform);
|
||||
|
||||
// 获取数据列表
|
||||
Example<BssEnterprise> example = Example.of(bssEnterprise, matcher);
|
||||
Page<BssEnterprise> list = bssEnterpriseService.getPageList(example);
|
||||
|
||||
// 封装数据
|
||||
model.addAttribute("list", list.getContent());
|
||||
model.addAttribute("page", list);
|
||||
return "/business/enterprise/index";
|
||||
}
|
||||
|
||||
/**
|
||||
* 跳转到添加页面
|
||||
*/
|
||||
@GetMapping("/add")
|
||||
@RequiresPermissions("bss:enterprise:add")
|
||||
public String toAdd(Model model) {
|
||||
User user = ShiroUtil.getSubject();
|
||||
BssPlatform bssPlatform = user.getBssPlatform();
|
||||
model.addAttribute("bssPlatform",bssPlatform);
|
||||
return "/business/enterprise/add";
|
||||
}
|
||||
|
||||
/**
|
||||
* 跳转到编辑页面
|
||||
*/
|
||||
@GetMapping("/edit/{id}")
|
||||
@RequiresPermissions("bss:enterprise:edit")
|
||||
public String toEdit(@PathVariable("id") BssEnterprise bssEnterprise, Model model) {
|
||||
User user = ShiroUtil.getSubject();
|
||||
BssPlatform bssPlatform = user.getBssPlatform();
|
||||
model.addAttribute("bssPlatform",bssPlatform);
|
||||
model.addAttribute("bssEnterprise", bssEnterprise);
|
||||
return "/business/enterprise/add";
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存添加/修改的数据
|
||||
* @param valid 验证对象
|
||||
*/
|
||||
@PostMapping({"/add","/edit"})
|
||||
@RequiresPermissions({"bss:enterprise:add","bss:enterprise:edit"})
|
||||
@ResponseBody
|
||||
public ResultVo save(@Validated BssEnterpriseValid valid, BssEnterprise bssEnterprise) {
|
||||
// 复制保留无需修改的数据
|
||||
if (bssEnterprise.getId() != null) {
|
||||
BssEnterprise beEnterprise = bssEnterpriseService.getById(bssEnterprise.getId());
|
||||
EntityBeanUtil.copyProperties(beEnterprise, bssEnterprise);
|
||||
}
|
||||
|
||||
User user = ShiroUtil.getSubject();
|
||||
BssPlatform bssPlatform = user.getBssPlatform();
|
||||
int platformType = bssPlatform.getType();
|
||||
|
||||
if (platformType == PlatformConst.COMPANY_TYPE) {
|
||||
List<BssEnterprise> listByPlatform = bssEnterpriseService.getListByPlatform(bssPlatform);
|
||||
if (listByPlatform.size() > 1) {
|
||||
return ResultVoUtil.error(ResultEnum.ENTERPRISE_NUMBER_EXCESSIVE.getCode(),ResultEnum.ENTERPRISE_NUMBER_EXCESSIVE.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
if (bssEnterpriseService.repeatByName(bssEnterprise)) {
|
||||
return ResultVoUtil.error(ResultEnum.ENTERPRISE_NAME_EXIST.getCode(),ResultEnum.ENTERPRISE_NAME_EXIST.getMessage());
|
||||
}
|
||||
|
||||
if (bssEnterpriseService.repeatByCreditCode(bssEnterprise)) {
|
||||
return ResultVoUtil.error(ResultEnum.ENTERPRISE_CREDITCODE_EXIST.getCode(),ResultEnum.ENTERPRISE_CREDITCODE_EXIST.getMessage());
|
||||
}
|
||||
|
||||
// 保存数据
|
||||
bssEnterpriseService.save(bssEnterprise);
|
||||
return ResultVoUtil.SAVE_SUCCESS;
|
||||
}
|
||||
|
||||
/**
|
||||
* 跳转到详细页面
|
||||
*/
|
||||
@GetMapping("/detail/{id}")
|
||||
@RequiresPermissions("bss:enterprise:detail")
|
||||
public String toDetail(@PathVariable("id") BssEnterprise bssEnterprise, Model model) {
|
||||
model.addAttribute("bssEnterprise",bssEnterprise);
|
||||
return "/business/enterprise/detail";
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置一条或者多条数据的状态
|
||||
*/
|
||||
@RequestMapping("/status/{param}")
|
||||
@RequiresPermissions("bss:enterprise:status")
|
||||
@ResponseBody
|
||||
public ResultVo status(
|
||||
@PathVariable("param") String param,
|
||||
@RequestParam(value = "ids", required = false) List<Long> ids) {
|
||||
// 更新状态
|
||||
StatusEnum statusEnum = StatusUtil.getStatusEnum(param);
|
||||
if (bssEnterpriseService.updateStatus(statusEnum, ids)) {
|
||||
return ResultVoUtil.success(statusEnum.getMessage() + "成功");
|
||||
} else {
|
||||
return ResultVoUtil.error(statusEnum.getMessage() + "失败,请重新操作");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,20 @@
|
|||
package com.cwhelp.admin.business.validator;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @author yan.y
|
||||
* @date 2019/08/06
|
||||
*/
|
||||
@Data
|
||||
public class BssEnterpriseValid implements Serializable {
|
||||
@NotEmpty(message = "名称不能为空")
|
||||
private String name;
|
||||
@NotEmpty(message = "增值税种类不能为空")
|
||||
private String vatType;
|
||||
@NotEmpty(message = "会计准则不能为空")
|
||||
private String accountingStandards;
|
||||
}
|
||||
|
|
@ -137,11 +137,11 @@ public class MainController{
|
|||
@PostMapping("/userInfo")
|
||||
@RequiresPermissions("index")
|
||||
@ResponseBody
|
||||
public ResultVo userInfo(@Validated UserValid valid, User user){
|
||||
public ResultVo userInfo(User user){
|
||||
|
||||
// 复制保留无需修改的数据
|
||||
User subUser = ShiroUtil.getSubject();
|
||||
String[] fields = {"id", "username", "password", "salt", "picture", "dept", "roles"};
|
||||
String[] fields = {"id", "username", "password", "salt","type" ,"picture","bssPlatform" ,"dept", "roles"};
|
||||
EntityBeanUtil.copyProperties(subUser, user, fields);
|
||||
|
||||
// 保存数据
|
||||
|
|
|
|||
Binary file not shown.
|
Before Width: | Height: | Size: 322 KiB After Width: | Height: | Size: 33 KiB |
|
|
@ -1,2 +1,2 @@
|
|||
/** layui-v2.3.0 MIT License By https://www.layui.com */
|
||||
;layui.define("jquery",function(e){"use strict";var i=layui.$,n=(layui.hint(),layui.device(),{config:{},set:function(e){var n=this;return n.config=i.extend({},n.config,e),n},on:function(e,i){return layui.onevent.call(this,t,e,i)}}),t="carousel",a="layui-this",l=">*[carousel-item]>*",o="layui-carousel-left",r="layui-carousel-right",d="layui-carousel-prev",s="layui-carousel-next",u="layui-carousel-arrow",c="layui-carousel-ind",m=function(e){var t=this;t.config=i.extend({},t.config,n.config,e),t.render()};m.prototype.config={width:"600px",height:"280px",full:!1,arrow:"hover",indicator:"inside",autoplay:!0,interval:3e3,anim:"",trigger:"click",index:0},m.prototype.render=function(){var e=this,n=e.config;n.elem=i(n.elem),n.elem[0]&&(e.elemItem=n.elem.find(l),n.index<0&&(n.index=0),n.index>=e.elemItem.length&&(n.index=e.elemItem.length-1),n.interval<800&&(n.interval=800),n.full?n.elem.css({position:"fixed",width:"100%",height:"100%",zIndex:9999}):n.elem.css({width:n.width,height:n.height}),n.elem.attr("lay-anim",n.anim),e.elemItem.eq(n.index).addClass(a),e.elemItem.length<=1||(e.indicator(),e.arrow(),e.autoplay(),e.events()))},m.prototype.reload=function(e){var n=this;clearInterval(n.timer),n.config=i.extend({},n.config,e),n.render()},m.prototype.prevIndex=function(){var e=this,i=e.config,n=i.index-1;return n<0&&(n=e.elemItem.length-1),n},m.prototype.nextIndex=function(){var e=this,i=e.config,n=i.index+1;return n>=e.elemItem.length&&(n=0),n},m.prototype.addIndex=function(e){var i=this,n=i.config;e=e||1,n.index=n.index+e,n.index>=i.elemItem.length&&(n.index=0)},m.prototype.subIndex=function(e){var i=this,n=i.config;e=e||1,n.index=n.index-e,n.index<0&&(n.index=i.elemItem.length-1)},m.prototype.autoplay=function(){var e=this,i=e.config;i.autoplay&&(e.timer=setInterval(function(){e.slide()},i.interval))},m.prototype.arrow=function(){var e=this,n=e.config,t=i(['<button class="layui-icon '+u+'" lay-type="sub">'+("updown"===n.anim?"":"")+"</button>",'<button class="layui-icon '+u+'" lay-type="add">'+("updown"===n.anim?"":"")+"</button>"].join(""));n.elem.attr("lay-arrow",n.arrow),n.elem.find("."+u)[0]&&n.elem.find("."+u).remove(),n.elem.append(t),t.on("click",function(){var n=i(this),t=n.attr("lay-type");e.slide(t)})},m.prototype.indicator=function(){var e=this,n=e.config,t=e.elemInd=i(['<div class="'+c+'"><ul>',function(){var i=[];return layui.each(e.elemItem,function(e){i.push("<li"+(n.index===e?' class="layui-this"':"")+"></li>")}),i.join("")}(),"</ul></div>"].join(""));n.elem.attr("lay-indicator",n.indicator),n.elem.find("."+c)[0]&&n.elem.find("."+c).remove(),n.elem.append(t),"updown"===n.anim&&t.css("margin-top",-(t.height()/2)),t.find("li").on("hover"===n.trigger?"mouseover":n.trigger,function(){var t=i(this),a=t.index();a>n.index?e.slide("templates.business.employee.add",a-n.index):a<n.index&&e.slide("sub",n.index-a)})},m.prototype.slide=function(e, i){var n=this,l=n.elemItem,u=n.config,c=u.index,m=u.elem.attr("lay-filter");n.haveSlide||("sub"===e?(n.subIndex(i),l.eq(u.index).addClass(d),setTimeout(function(){l.eq(c).addClass(r),l.eq(u.index).addClass(r)},50)):(n.addIndex(i),l.eq(u.index).addClass(s),setTimeout(function(){l.eq(c).addClass(o),l.eq(u.index).addClass(o)},50)),setTimeout(function(){l.removeClass(a+" "+d+" "+s+" "+o+" "+r),l.eq(u.index).addClass(a),n.haveSlide=!1},300),n.elemInd.find("li").eq(u.index).addClass(a).siblings().removeClass(a),n.haveSlide=!0,layui.event.call(this,t,"change("+m+")",{index:u.index,prevIndex:c,item:l.eq(u.index)}))},m.prototype.events=function(){var e=this,i=e.config;i.elem.data("haveEvents")||(i.elem.on("mouseenter",function(){clearInterval(e.timer)}).on("mouseleave",function(){e.autoplay()}),i.elem.data("haveEvents",!0))},n.render=function(e){var i=new m(e);return i},e(t,n)});
|
||||
;layui.define("jquery",function(e){"use strict";var i=layui.$,n=(layui.hint(),layui.device(),{config:{},set:function(e){var n=this;return n.config=i.extend({},n.config,e),n},on:function(e,i){return layui.onevent.call(this,t,e,i)}}),t="carousel",a="layui-this",l=">*[carousel-item]>*",o="layui-carousel-left",r="layui-carousel-right",d="layui-carousel-prev",s="layui-carousel-next",u="layui-carousel-arrow",c="layui-carousel-ind",m=function(e){var t=this;t.config=i.extend({},t.config,n.config,e),t.render()};m.prototype.config={width:"600px",height:"280px",full:!1,arrow:"hover",indicator:"inside",autoplay:!0,interval:3e3,anim:"",trigger:"click",index:0},m.prototype.render=function(){var e=this,n=e.config;n.elem=i(n.elem),n.elem[0]&&(e.elemItem=n.elem.find(l),n.index<0&&(n.index=0),n.index>=e.elemItem.length&&(n.index=e.elemItem.length-1),n.interval<800&&(n.interval=800),n.full?n.elem.css({position:"fixed",width:"100%",height:"100%",zIndex:9999}):n.elem.css({width:n.width,height:n.height}),n.elem.attr("lay-anim",n.anim),e.elemItem.eq(n.index).addClass(a),e.elemItem.length<=1||(e.indicator(),e.arrow(),e.autoplay(),e.events()))},m.prototype.reload=function(e){var n=this;clearInterval(n.timer),n.config=i.extend({},n.config,e),n.render()},m.prototype.prevIndex=function(){var e=this,i=e.config,n=i.index-1;return n<0&&(n=e.elemItem.length-1),n},m.prototype.nextIndex=function(){var e=this,i=e.config,n=i.index+1;return n>=e.elemItem.length&&(n=0),n},m.prototype.addIndex=function(e){var i=this,n=i.config;e=e||1,n.index=n.index+e,n.index>=i.elemItem.length&&(n.index=0)},m.prototype.subIndex=function(e){var i=this,n=i.config;e=e||1,n.index=n.index-e,n.index<0&&(n.index=i.elemItem.length-1)},m.prototype.autoplay=function(){var e=this,i=e.config;i.autoplay&&(e.timer=setInterval(function(){e.slide()},i.interval))},m.prototype.arrow=function(){var e=this,n=e.config,t=i(['<button class="layui-icon '+u+'" lay-type="sub">'+("updown"===n.anim?"":"")+"</button>",'<button class="layui-icon '+u+'" lay-type="add">'+("updown"===n.anim?"":"")+"</button>"].join(""));n.elem.attr("lay-arrow",n.arrow),n.elem.find("."+u)[0]&&n.elem.find("."+u).remove(),n.elem.append(t),t.on("click",function(){var n=i(this),t=n.attr("lay-type");e.slide(t)})},m.prototype.indicator=function(){var e=this,n=e.config,t=e.elemInd=i(['<div class="'+c+'"><ul>',function(){var i=[];return layui.each(e.elemItem,function(e){i.push("<li"+(n.index===e?' class="layui-this"':"")+"></li>")}),i.join("")}(),"</ul></div>"].join(""));n.elem.attr("lay-indicator",n.indicator),n.elem.find("."+c)[0]&&n.elem.find("."+c).remove(),n.elem.append(t),"updown"===n.anim&&t.css("margin-top",-(t.height()/2)),t.find("li").on("hover"===n.trigger?"mouseover":n.trigger,function(){var t=i(this),a=t.index();a>n.index?e.slide("templates.business.enterprise.add",a-n.index):a<n.index&&e.slide("sub",n.index-a)})},m.prototype.slide=function(e, i){var n=this,l=n.elemItem,u=n.config,c=u.index,m=u.elem.attr("lay-filter");n.haveSlide||("sub"===e?(n.subIndex(i),l.eq(u.index).addClass(d),setTimeout(function(){l.eq(c).addClass(r),l.eq(u.index).addClass(r)},50)):(n.addIndex(i),l.eq(u.index).addClass(s),setTimeout(function(){l.eq(c).addClass(o),l.eq(u.index).addClass(o)},50)),setTimeout(function(){l.removeClass(a+" "+d+" "+s+" "+o+" "+r),l.eq(u.index).addClass(a),n.haveSlide=!1},300),n.elemInd.find("li").eq(u.index).addClass(a).siblings().removeClass(a),n.haveSlide=!0,layui.event.call(this,t,"change("+m+")",{index:u.index,prevIndex:c,item:l.eq(u.index)}))},m.prototype.events=function(){var e=this,i=e.config;i.elem.data("haveEvents")||(i.elem.on("mouseenter",function(){clearInterval(e.timer)}).on("mouseleave",function(){e.autoplay()}),i.elem.data("haveEvents",!0))},n.render=function(e){var i=new m(e);return i},e(t,n)});
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
|
@ -63,8 +63,8 @@
|
|||
<th>职位</th>
|
||||
<th>手机号码</th>
|
||||
<th>身份证号码</th>
|
||||
<th>性别</th>
|
||||
<th>邮箱</th>
|
||||
<th>性别</th>
|
||||
<th>学历</th>
|
||||
<th>创建时间</th>
|
||||
<th>更新时间</th>
|
||||
|
|
@ -82,7 +82,7 @@
|
|||
<td th:text="${item.phoneNum}">手机号码</td>
|
||||
<td th:text="${item.card}">身份证号码</td>
|
||||
<td th:text="${item.email}">邮箱</td>
|
||||
<td th:text="${#dicts.keyValue('USER_SEX', item.sex)}">邮箱</td>
|
||||
<td th:text="${#dicts.keyValue('USER_SEX', item.sex)}">性别</td>
|
||||
<td th:text="${#dicts.keyValue('EDUCATION', item.education)}">学历</td>
|
||||
<td th:text="${#dates.format(item.createDate, 'yyyy-MM-dd HH:mm:ss')}">创建时间</td>
|
||||
<td th:text="${#dates.format(item.updateDate, 'yyyy-MM-dd HH:mm:ss')}">更新时间</td>
|
||||
|
|
|
|||
|
|
@ -0,0 +1,67 @@
|
|||
<!DOCTYPE html>
|
||||
<html xmlns:th="http://www.thymeleaf.org">
|
||||
<head th:replace="/common/template :: header(~{::title},~{::link},~{::style})">
|
||||
</head>
|
||||
<body>
|
||||
<div class="layui-form timo-compile">
|
||||
<form th:action="@{/bss/enterprise/add}">
|
||||
<input type="hidden" name="id" th:if="${bssEnterprise}" th:value="${bssEnterprise.id}">
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label required">名称</label>
|
||||
<div class="layui-input-inline">
|
||||
<input class="layui-input" type="text" name="name" placeholder="请输入名称" th:value="${bssEnterprise?.name}">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label required">统一社会信用代码</label>
|
||||
<div class="layui-input-inline">
|
||||
<input class="layui-input" type="text" name="creditCode" placeholder="请输入统一社会信用代码" th:value="${bssEnterprise?.creditCode}">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label required">所属平台</label>
|
||||
<div class="layui-input-inline">
|
||||
<select name="platform" mo-selected="${bssEnterprise?.platform?.id}" mo-empty="" lay-verify="platform">
|
||||
<option th:value="${bssPlatform.id}" th:text="${bssPlatform.name}" th:selected="${bssPlatform.id == bssEnterprise?.platform?.id}"></option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">所在地</label>
|
||||
<div class="layui-input-inline">
|
||||
<input class="layui-input" type="text" name="location" placeholder="请输入所在地" th:value="${bssEnterprise?.location}">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">行业</label>
|
||||
<div class="layui-input-inline">
|
||||
<input class="layui-input" type="text" name="industry" placeholder="请输入行业" th:value="${bssEnterprise?.industry}">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label required">增值税种类</label>
|
||||
<div class="layui-input-inline">
|
||||
<select name="vatType" mo:dict="VAT_TYPE" mo-selected="${bssEnterprise?.vatType}" mo-empty="" lay-verify="vatType"></select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label required">会计准则</label>
|
||||
<div class="layui-input-inline">
|
||||
<select name="accountingStandards" mo:dict="ACCOUNTING_STANDARDS" mo-selected="${bssEnterprise?.accountingStandards}" mo-empty="" lay-verify="accountingStandards"></select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item layui-form-text">
|
||||
<label class="layui-form-label">备注</label>
|
||||
<div class="layui-input-block">
|
||||
<textarea placeholder="请输入内容" class="layui-textarea" name="remark">[[${bssEnterprise?.remark}]]</textarea>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item timo-finally">
|
||||
<button class="layui-btn ajax-submit"><i class="fa fa-check-circle"></i> 保存</button>
|
||||
<button class="layui-btn btn-secondary close-popup"><i class="fa fa-times-circle"></i> 关闭</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<script th:replace="/common/template :: script"></script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -0,0 +1,59 @@
|
|||
<!DOCTYPE html>
|
||||
<html xmlns:th="http://www.thymeleaf.org">
|
||||
<head th:replace="/common/template :: header(~{::title},~{::link},~{::style})">
|
||||
</head>
|
||||
<body>
|
||||
<div class="timo-detail-page">
|
||||
<div class="timo-detail-title">基本信息</div>
|
||||
<table class="layui-table timo-detail-table">
|
||||
<colgroup>
|
||||
<col width="100px"><col>
|
||||
<col width="100px"><col>
|
||||
</colgroup>
|
||||
<tbody>
|
||||
<tr>
|
||||
<th>主键ID</th>
|
||||
<td th:text="${bssEnterprise.id}"></td>
|
||||
<th>名称</th>
|
||||
<td th:text="${bssEnterprise.name}"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>统一社会信用代码</th>
|
||||
<td th:text="${bssEnterprise.creditCode}"></td>
|
||||
<th>所属平台</th>
|
||||
<td th:text="${bssEnterprise.platform.name}"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>所在地</th>
|
||||
<td th:text="${bssEnterprise.location}"></td>
|
||||
<th>行业</th>
|
||||
<td th:text="${bssEnterprise.industry}"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>增值税种类</th>
|
||||
<td th:text="${bssEnterprise.vatType}"></td>
|
||||
<th>会计准则</th>
|
||||
<td th:text="${bssEnterprise.accountingStandards}"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>创建者</th>
|
||||
<td th:text="${bssEnterprise.createBy?.nickname}"></td>
|
||||
<th>更新者</th>
|
||||
<td th:text="${bssEnterprise.updateBy?.nickname}"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>创建时间</th>
|
||||
<td th:text="${#dates.format(bssEnterprise.createDate, 'yyyy-MM-dd HH:mm:ss')}"></td>
|
||||
<th>更新时间</th>
|
||||
<td th:text="${#dates.format(bssEnterprise.updateDate, 'yyyy-MM-dd HH:mm:ss')}"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>备注</th>
|
||||
<td th:text="${bssEnterprise.remark}" colspan="3"></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<script th:replace="/common/template :: script"></script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -0,0 +1,92 @@
|
|||
<!DOCTYPE html>
|
||||
<html xmlns:th="http://www.thymeleaf.org">
|
||||
<head th:replace="/common/template :: header(~{::title},~{::link},~{::style})">
|
||||
</head>
|
||||
<body class="timo-layout-page">
|
||||
<div class="layui-card">
|
||||
<div class="layui-card-header timo-card-header">
|
||||
<span><i class="fa fa-bars"></i> 账套信息管理</span>
|
||||
<i class="layui-icon layui-icon-refresh refresh-btn"></i>
|
||||
</div>
|
||||
<div class="layui-card-body">
|
||||
<div class="layui-row timo-card-screen">
|
||||
<div class="pull-left layui-form-pane timo-search-box">
|
||||
<div class="layui-inline">
|
||||
<label class="layui-form-label">状态</label>
|
||||
<div class="layui-input-block timo-search-status">
|
||||
<select class="timo-search-select" name="status" mo:dict="SEARCH_STATUS" mo-selected="${param.status}"></select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-inline">
|
||||
<label class="layui-form-label">名称</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" name="name" th:value="${param.name}" placeholder="请输入名称" autocomplete="off" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-inline">
|
||||
<button class="layui-btn timo-search-btn">
|
||||
<i class="fa fa-search"></i>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="pull-right screen-btn-group">
|
||||
<button class="layui-btn open-popup" data-title="添加账套信息" th:attr="data-url=@{/bss/enterprise/add}" data-size="auto">
|
||||
<i class="fa fa-plus"></i> 添加</button>
|
||||
<div class="btn-group">
|
||||
<button class="layui-btn">操作<span class="caret"></span></button>
|
||||
<dl class="layui-nav-child layui-anim layui-anim-upbit">
|
||||
<dd><a class="ajax-status" th:href="@{/bss/enterprise/status/ok}">启用</a></dd>
|
||||
<dd><a class="ajax-status" th:href="@{/bss/enterprise/status/freezed}">冻结</a></dd>
|
||||
<dd><a class="ajax-status" th:href="@{/bss/enterprise/status/delete}">删除</a></dd>
|
||||
</dl>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="timo-table-wrap">
|
||||
<table class="layui-table timo-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="timo-table-checkbox">
|
||||
<label class="timo-checkbox"><input type="checkbox">
|
||||
<i class="layui-icon layui-icon-ok"></i></label>
|
||||
</th>
|
||||
<th>名称</th>
|
||||
<th>所属</th>
|
||||
<th>统一社会信用代码</th>
|
||||
<th>所在地</th>
|
||||
<th>行业</th>
|
||||
<th>增值税种类</th>
|
||||
<th>会计准则</th>
|
||||
<th>创建时间</th>
|
||||
<th>数据状态</th>
|
||||
<th>操作</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr th:each="item:${list}">
|
||||
<td><label class="timo-checkbox"><input type="checkbox" th:value="${item.id}">
|
||||
<i class="layui-icon layui-icon-ok"></i></label></td>
|
||||
<td th:text="${item.name}">名称</td>
|
||||
<td th:text="${item.platform.name}">所属</td>
|
||||
<td th:text="${item.creditCode}">统一社会信用代码</td>
|
||||
<td th:text="${item.location}">所在地</td>
|
||||
<td th:text="${item.industry}">行业</td>
|
||||
<td th:text="${#dicts.keyValue('VAT_TYPE', item.vatType)}">增值税种类</td>
|
||||
<td th:text="${#dicts.keyValue('ACCOUNTING_STANDARDS', item.accountingStandards)}">会计准则</td>
|
||||
<td th:text="${#dates.format(item.createDate, 'yyyy-MM-dd HH:mm:ss')}">创建时间</td>
|
||||
<td th:text="${#dicts.dataStatus(item.status)}">数据状态</td>
|
||||
<td>
|
||||
<a class="open-popup" data-title="编辑账套信息" th:attr="data-url=@{'/bss/enterprise/edit/'+${item.id}}" data-size="auto" href="#">编辑</a>
|
||||
<a class="open-popup" data-title="详细信息" th:attr="data-url=@{'/bss/enterprise/detail/'+${item.id}}" data-size="800,600" href="#">详细</a>
|
||||
<a class="ajax-get" data-msg="您是否确认删除" th:href="@{/bss/enterprise/status/delete(ids=${item.id})}">删除</a>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div th:replace="/common/fragment :: page"></div>
|
||||
</div>
|
||||
</div>
|
||||
<script th:replace="/common/template :: script"></script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -4,7 +4,7 @@ package com.cwhelp.common.constant;
|
|||
* 超级管理员常量
|
||||
* @author yan.y
|
||||
*/
|
||||
public class AdminConst {
|
||||
public final class AdminConst {
|
||||
|
||||
/**
|
||||
* 超级管理员id
|
||||
|
|
|
|||
|
|
@ -0,0 +1,30 @@
|
|||
package com.cwhelp.common.constant;
|
||||
|
||||
/**
|
||||
* @author: yan.y
|
||||
* @Description:
|
||||
* @Date: Created in 23:08 2019/8/6
|
||||
*/
|
||||
public final class PlatformConst {
|
||||
|
||||
/**
|
||||
* 自营平台
|
||||
*/
|
||||
public static final int OWN_TYPE = 1;
|
||||
|
||||
/**
|
||||
* 代理平台
|
||||
*/
|
||||
public static final int PROXY_TYPE = 2;
|
||||
|
||||
/**
|
||||
* 个人平台
|
||||
*/
|
||||
public static final int PERSONAL_TYPE = 3;
|
||||
|
||||
/**
|
||||
* 公司平台
|
||||
*/
|
||||
public static final int COMPANY_TYPE = 4;
|
||||
|
||||
}
|
||||
|
|
@ -5,7 +5,7 @@ package com.cwhelp.common.constant;
|
|||
* @Description:
|
||||
* @Date: Created in 1:12 2019/8/5
|
||||
*/
|
||||
public class RoleConst {
|
||||
public final class RoleConst {
|
||||
|
||||
/**
|
||||
* 角色平台类型
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ package com.cwhelp.common.constant;
|
|||
* 数据状态常量
|
||||
* @author yan.y
|
||||
*/
|
||||
public class StatusConst {
|
||||
public final class StatusConst {
|
||||
|
||||
// 正常状态码
|
||||
public static final byte OK = 1;
|
||||
|
|
|
|||
|
|
@ -36,6 +36,14 @@ public enum ResultEnum implements ResultInterface {
|
|||
PLATFORM_EXIST_CONTACT_CARD(1002,"联系人证件号码已存在"),
|
||||
PLATFORM_EXIST_EMAIL(1003,"邮箱已存在"),
|
||||
|
||||
/**
|
||||
* 账套
|
||||
*/
|
||||
ENTERPRISE_NUMBER_EXCESSIVE(2001,"此企业下账套只能保存一个"),
|
||||
ENTERPRISE_NAME_EXIST(2002,"账套名称已存在"),
|
||||
ENTERPRISE_CREDITCODE_EXIST(2003,"账套统一社会信用代码已存在"),
|
||||
|
||||
|
||||
/**
|
||||
* 角色问题
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -61,6 +61,9 @@ public class ShiroUtil {
|
|||
*/
|
||||
public static User getSubject(){
|
||||
Long userId = (Long) SecurityUtils.getSubject().getPrincipal();
|
||||
if (userId == null) {
|
||||
return null;
|
||||
}
|
||||
return userService.getById(userId);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -24,8 +24,8 @@ public class DefaultValue {
|
|||
basic.setProjectPath(ToolUtil.getProjectPath() + "/");
|
||||
basic.setPackagePath("com.cwhelp");
|
||||
basic.setAuthor("yan.y");
|
||||
basic.setGenModule("order");
|
||||
basic.setTablePrefix("or_");
|
||||
basic.setGenModule("bss");
|
||||
basic.setTablePrefix("bss_");
|
||||
return basic;
|
||||
}
|
||||
|
||||
|
|
@ -35,13 +35,13 @@ public class DefaultValue {
|
|||
public static List<Field> fieldList(){
|
||||
List<Field> fields = new ArrayList<>();
|
||||
fields.add(new Field("id", "主键ID", FieldType.Long.getCode(), 0, true,null));
|
||||
fields.add(new Field("title", "标题", FieldType.String.getCode(), FieldQuery.Like.getCode(),true, Arrays.asList(new Integer[]{FieldVerify.NotNull.getCode()})));
|
||||
fields.add(new Field("remark", "备注", FieldType.String.getCode(), 0, false,null));
|
||||
fields.add(new Field("name", "名称", FieldType.String.getCode(), FieldQuery.Like.getCode(),true, Arrays.asList(new Integer[]{FieldVerify.NotNull.getCode()})));
|
||||
fields.add(new Field("createDate", "创建时间", FieldType.Date.getCode(), 0, true,null));
|
||||
fields.add(new Field("updateDate", "更新时间", FieldType.Date.getCode(), 0, true,null));
|
||||
fields.add(new Field("createBy", "创建者", FieldType.Object.getCode(), 0, false,null));
|
||||
fields.add(new Field("updateBy", "更新者", FieldType.Object.getCode(), 0, false,null));
|
||||
fields.add(new Field("status", "数据状态", FieldType.Byte.getCode(), 0, true,null));
|
||||
fields.add(new Field("remark", "备注", FieldType.String.getCode(), 0, false,null));
|
||||
return fields;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,79 @@
|
|||
package com.cwhelp.modules.business.domain;
|
||||
|
||||
import com.cwhelp.common.enums.StatusEnum;
|
||||
import com.cwhelp.common.utils.StatusUtil;
|
||||
import com.cwhelp.modules.system.domain.User;
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import lombok.Data;
|
||||
import org.hibernate.annotations.NotFound;
|
||||
import org.hibernate.annotations.NotFoundAction;
|
||||
import org.hibernate.annotations.Where;
|
||||
import org.springframework.data.annotation.CreatedBy;
|
||||
import org.springframework.data.annotation.CreatedDate;
|
||||
import org.springframework.data.annotation.LastModifiedBy;
|
||||
import org.springframework.data.annotation.LastModifiedDate;
|
||||
import org.springframework.data.jpa.domain.support.AuditingEntityListener;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
import javax.persistence.*;
|
||||
|
||||
/**
|
||||
* @author yan.y
|
||||
* @date 2019/08/06
|
||||
*/
|
||||
@Data
|
||||
@Entity
|
||||
@Table(name="bss_enterprise")
|
||||
@EntityListeners(AuditingEntityListener.class)
|
||||
@Where(clause = StatusUtil.notDelete)
|
||||
public class BssEnterprise implements Serializable {
|
||||
// 主键ID
|
||||
@Id
|
||||
@GeneratedValue(strategy=GenerationType.IDENTITY)
|
||||
private Long id;
|
||||
private String name;
|
||||
// 统一社会信用代码
|
||||
@Column(name = "credit_code")
|
||||
private String creditCode;
|
||||
// 所属平台
|
||||
@ManyToOne(fetch=FetchType.LAZY)
|
||||
@NotFound(action=NotFoundAction.IGNORE)
|
||||
@JoinColumn(name="platform_id")
|
||||
@JsonIgnore
|
||||
private BssPlatform platform;
|
||||
// 所在地
|
||||
private String location;
|
||||
// 行业
|
||||
private String industry;
|
||||
// 增值税种类
|
||||
@Column(name = "vat_type")
|
||||
private String vatType;
|
||||
// 会计准则
|
||||
@Column(name = "accounting_standards")
|
||||
private String accountingStandards;
|
||||
// 创建时间
|
||||
@CreatedDate
|
||||
private Date createDate;
|
||||
// 更新时间
|
||||
@LastModifiedDate
|
||||
private Date updateDate;
|
||||
// 创建者
|
||||
@CreatedBy
|
||||
@ManyToOne(fetch=FetchType.LAZY)
|
||||
@NotFound(action=NotFoundAction.IGNORE)
|
||||
@JoinColumn(name="create_by")
|
||||
@JsonIgnore
|
||||
private User createBy;
|
||||
// 更新者
|
||||
@LastModifiedBy
|
||||
@ManyToOne(fetch=FetchType.LAZY)
|
||||
@NotFound(action=NotFoundAction.IGNORE)
|
||||
@JoinColumn(name="update_by")
|
||||
@JsonIgnore
|
||||
private User updateBy;
|
||||
// 数据状态
|
||||
private Byte status = StatusEnum.OK.getCode();
|
||||
// 备注
|
||||
private String remark;
|
||||
}
|
||||
|
|
@ -0,0 +1,20 @@
|
|||
package com.cwhelp.modules.business.repository;
|
||||
|
||||
import com.cwhelp.modules.business.domain.BssEnterprise;
|
||||
import com.cwhelp.modules.business.domain.BssPlatform;
|
||||
import com.cwhelp.modules.system.repository.BaseRepository;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author yan.y
|
||||
* @date 2019/08/06
|
||||
*/
|
||||
public interface BssEnterpriseRepository extends BaseRepository<BssEnterprise, Long> {
|
||||
|
||||
List<BssEnterprise> findByPlatformEquals(BssPlatform bssPlatform);
|
||||
|
||||
BssEnterprise findByNameAndIdNot(String name, Long id);
|
||||
|
||||
BssEnterprise findByCreditCodeAndIdNot(String creditCode, Long id);
|
||||
}
|
||||
|
|
@ -0,0 +1,48 @@
|
|||
package com.cwhelp.modules.business.service;
|
||||
|
||||
import com.cwhelp.common.enums.StatusEnum;
|
||||
import com.cwhelp.modules.business.domain.BssEnterprise;
|
||||
import com.cwhelp.modules.business.domain.BssPlatform;
|
||||
import org.springframework.data.domain.Example;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author yan.y
|
||||
* @date 2019/08/06
|
||||
*/
|
||||
public interface BssEnterpriseService {
|
||||
|
||||
/**
|
||||
* 获取分页列表数据
|
||||
* @param example 查询实例
|
||||
* @return 返回分页数据
|
||||
*/
|
||||
Page<BssEnterprise> getPageList(Example<BssEnterprise> example);
|
||||
|
||||
/**
|
||||
* 根据ID查询数据
|
||||
* @param id 主键ID
|
||||
*/
|
||||
BssEnterprise getById(Long id);
|
||||
|
||||
/**
|
||||
* 保存数据
|
||||
* @param bssEnterprise 实体对象
|
||||
*/
|
||||
BssEnterprise save(BssEnterprise bssEnterprise);
|
||||
|
||||
List<BssEnterprise> getListByPlatform(BssPlatform bssPlatform);
|
||||
|
||||
/**
|
||||
* 状态(启用,冻结,删除)/批量状态处理
|
||||
*/
|
||||
@Transactional
|
||||
Boolean updateStatus(StatusEnum statusEnum, List<Long> idList);
|
||||
|
||||
Boolean repeatByName(BssEnterprise bssEnterprise);
|
||||
|
||||
Boolean repeatByCreditCode(BssEnterprise bssEnterprise);
|
||||
}
|
||||
|
|
@ -0,0 +1,84 @@
|
|||
package com.cwhelp.modules.business.service.impl;
|
||||
|
||||
import com.cwhelp.common.data.PageSort;
|
||||
import com.cwhelp.common.enums.StatusEnum;
|
||||
import com.cwhelp.modules.business.domain.BssEnterprise;
|
||||
import com.cwhelp.modules.business.domain.BssPlatform;
|
||||
import com.cwhelp.modules.business.repository.BssEnterpriseRepository;
|
||||
import com.cwhelp.modules.business.service.BssEnterpriseService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.domain.Example;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.PageRequest;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author yan.y
|
||||
* @date 2019/08/06
|
||||
*/
|
||||
@Service
|
||||
public class BssEnterpriseServiceImpl implements BssEnterpriseService {
|
||||
|
||||
@Autowired
|
||||
private BssEnterpriseRepository bssEnterpriseRepository;
|
||||
|
||||
/**
|
||||
* 根据ID查询数据
|
||||
* @param id 主键ID
|
||||
*/
|
||||
@Override
|
||||
@Transactional
|
||||
public BssEnterprise getById(Long id) {
|
||||
return bssEnterpriseRepository.findById(id).orElse(null);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取分页列表数据
|
||||
* @param example 查询实例
|
||||
* @return 返回分页数据
|
||||
*/
|
||||
@Override
|
||||
public Page<BssEnterprise> getPageList(Example<BssEnterprise> example) {
|
||||
// 创建分页对象
|
||||
PageRequest page = PageSort.pageRequest();
|
||||
return bssEnterpriseRepository.findAll(example, page);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<BssEnterprise> getListByPlatform(BssPlatform bssPlatform) {
|
||||
return bssEnterpriseRepository.findByPlatformEquals(bssPlatform);
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存数据
|
||||
* @param bssEnterprise 实体对象
|
||||
*/
|
||||
@Override
|
||||
public BssEnterprise save(BssEnterprise bssEnterprise) {
|
||||
return bssEnterpriseRepository.save(bssEnterprise);
|
||||
}
|
||||
|
||||
/**
|
||||
* 状态(启用,冻结,删除)/批量状态处理
|
||||
*/
|
||||
@Override
|
||||
@Transactional
|
||||
public Boolean updateStatus(StatusEnum statusEnum, List<Long> idList) {
|
||||
return bssEnterpriseRepository.updateStatus(statusEnum.getCode(), idList) > 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean repeatByName(BssEnterprise bssEnterprise) {
|
||||
Long id = bssEnterprise.getId() != null ? bssEnterprise.getId() : Long.MIN_VALUE;
|
||||
return bssEnterpriseRepository.findByNameAndIdNot(bssEnterprise.getName(), id) != null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean repeatByCreditCode(BssEnterprise bssEnterprise) {
|
||||
Long id = bssEnterprise.getId() != null ? bssEnterprise.getId() : Long.MIN_VALUE;
|
||||
return bssEnterpriseRepository.findByCreditCodeAndIdNot(bssEnterprise.getCreditCode(), id) != null;
|
||||
}
|
||||
}
|
||||
|
|
@ -75,6 +75,9 @@ public class UserServiceImpl implements UserService {
|
|||
*/
|
||||
@Override
|
||||
public User getById(Long id) {
|
||||
if (id == null) {
|
||||
return null;
|
||||
}
|
||||
return userRepository.findById(id).orElse(null);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue