Merge remote-tracking branch 'origin/master'
commit
8c30d5a50b
|
@ -220,20 +220,14 @@ public class AccountController extends BaseController {
|
||||||
model.put("keywords", keywords);
|
model.put("keywords", keywords);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 导出
|
|
||||||
* @param keywords
|
|
||||||
* @param model
|
|
||||||
* @param response
|
|
||||||
* @throws IOException
|
|
||||||
*/
|
|
||||||
@RequestMapping("/export")
|
@RequestMapping("/export")
|
||||||
public void export(@RequestParam(value = "keywords",required = false) String keywords,Map<String, Object> model,
|
public void export(@RequestParam(value = "keywords",required = false) String keywords, HttpServletResponse httpServletResponse) throws IOException {
|
||||||
HttpServletResponse response) throws IOException {
|
Map<String, String> searchInfo = getSearchInfo(keywords);
|
||||||
// 初始化参数
|
downloadHeader(httpServletResponse , Utils.generateExcelName("人员信息"), "application/octet-stream");
|
||||||
ConcurrentHashMap<String, String> searchInfo = getSearchInfo(keywords,model);
|
String[] headers = {"工号", "手机号码", "姓名", "常驻地", "一级部门", "直接主管", "职位", "所属角色", "公司邮件地址"};
|
||||||
downloadHeader(response , Utils.generateExcelName("人员信息"));
|
String[] exportColumns = {"empCode", "telephone", "workLocation", "deptName", "directManager", "positionName", "roleName", "companyEmail"};
|
||||||
accountService.exportExcel(response,searchInfo);
|
ExportUtils.exportToExcel(headers, exportColumns, 1, 10000,
|
||||||
|
httpServletResponse.getOutputStream(), (pN, pS) -> accountService.getAdminList(searchInfo, pN, pS).getList());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -0,0 +1,44 @@
|
||||||
|
package cn.palmte.work.controller.backend;
|
||||||
|
|
||||||
|
import cn.palmte.work.model.ProfitMarginConfig;
|
||||||
|
import cn.palmte.work.model.ProfitMarginConfigRepository;
|
||||||
|
import cn.palmte.work.service.ProfitMarginConfigService;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Controller;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
@Controller
|
||||||
|
@RequestMapping("/profitMarginConfig")
|
||||||
|
public class ProfitMarginConfigController extends BaseController{
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ProfitMarginConfigService profitMarginConfigService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ProfitMarginConfigRepository profitMarginConfigRepository;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 跳转到编辑页面
|
||||||
|
*/
|
||||||
|
@RequestMapping("/edit")
|
||||||
|
public String edit(Map<String, Object> model) {
|
||||||
|
ProfitMarginConfig profitMarginConfig = profitMarginConfigRepository.findOne(1);
|
||||||
|
model.put("profitMarginConfig", profitMarginConfig);
|
||||||
|
return "/admin/profit_marfin_config_input";
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping(value = "/save")
|
||||||
|
public String save(ProfitMarginConfig profitMarginConfig,Map<String, Object> model){
|
||||||
|
try {
|
||||||
|
profitMarginConfigService.saveOrUpdate(profitMarginConfig);
|
||||||
|
} catch (Exception e) {
|
||||||
|
model.put("errorMessage", e.getMessage());
|
||||||
|
return "/common/error";
|
||||||
|
}
|
||||||
|
return "redirect:/profitMarginConfig/edit";
|
||||||
|
}
|
||||||
|
}
|
|
@ -4,6 +4,7 @@ import cn.palmte.work.model.SysRole;
|
||||||
import top.jfunc.common.db.bean.Page;
|
import top.jfunc.common.db.bean.Page;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
|
|
||||||
public interface AdminRepositoryCustom {
|
public interface AdminRepositoryCustom {
|
||||||
|
@ -30,7 +31,7 @@ public interface AdminRepositoryCustom {
|
||||||
* @param pageNum
|
* @param pageNum
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
Page getAdminList(ConcurrentHashMap<String, String> searchInfo, int pageSize, int pageNum);
|
Page getAdminList(Map<String, String> searchInfo, int pageSize, int pageNum);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据用户ID查询用户信息
|
* 根据用户ID查询用户信息
|
||||||
|
|
|
@ -116,7 +116,7 @@ public class AdminRepositoryImpl implements AdminRepositoryCustom {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Page<Admin> getAdminList(ConcurrentHashMap<String, String> searchInfo, int pageSize, int pageNum) {
|
public Page<Admin> getAdminList(Map<String, String> searchInfo, int pageSize, int pageNum) {
|
||||||
Page<Admin> page = new Page(pageNum, pageSize);
|
Page<Admin> page = new Page(pageNum, pageSize);
|
||||||
int thisPage = (pageNum - 1) * pageSize;
|
int thisPage = (pageNum - 1) * pageSize;
|
||||||
String sql = getSelect() + getSqlExceptSelect(searchInfo) + " limit " + thisPage + "," + pageSize;
|
String sql = getSelect() + getSqlExceptSelect(searchInfo) + " limit " + thisPage + "," + pageSize;
|
||||||
|
@ -158,7 +158,7 @@ public class AdminRepositoryImpl implements AdminRepositoryCustom {
|
||||||
return select;
|
return select;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getSqlExceptSelect(ConcurrentHashMap<String, String> searchInfo) {
|
public String getSqlExceptSelect(Map<String, String> searchInfo) {
|
||||||
StringBuffer sqlExceptSelect = new StringBuffer(" from sys_user u LEFT JOIN sys_user_role ur on u.id = ur.user_id LEFT JOIN sys_role r on r.id = ur.role_id ");
|
StringBuffer sqlExceptSelect = new StringBuffer(" from sys_user u LEFT JOIN sys_user_role ur on u.id = ur.user_id LEFT JOIN sys_role r on r.id = ur.role_id ");
|
||||||
|
|
||||||
Admin admin = InterfaceUtil.getAdmin();
|
Admin admin = InterfaceUtil.getAdmin();
|
||||||
|
|
|
@ -0,0 +1,51 @@
|
||||||
|
package cn.palmte.work.model;
|
||||||
|
|
||||||
|
import org.hibernate.annotations.GenericGenerator;
|
||||||
|
|
||||||
|
import javax.persistence.*;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 利润率配置
|
||||||
|
*/
|
||||||
|
@Entity
|
||||||
|
@Table(name = "profit_margin_config")
|
||||||
|
public class ProfitMarginConfig {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* id
|
||||||
|
*/
|
||||||
|
@Id
|
||||||
|
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||||
|
@GenericGenerator(name = "persistenceGenerator", strategy = "increment")
|
||||||
|
private Integer id;
|
||||||
|
|
||||||
|
@Column(name = "year_profit_margin")
|
||||||
|
private String yearProfitMargin;
|
||||||
|
|
||||||
|
@Column(name = "threshold_value")
|
||||||
|
private String thresholdValue;
|
||||||
|
|
||||||
|
public Integer getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setId(Integer id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getYearProfitMargin() {
|
||||||
|
return yearProfitMargin;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setYearProfitMargin(String yearProfitMargin) {
|
||||||
|
this.yearProfitMargin = yearProfitMargin;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getThresholdValue() {
|
||||||
|
return thresholdValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setThresholdValue(String thresholdValue) {
|
||||||
|
this.thresholdValue = thresholdValue;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,7 @@
|
||||||
|
package cn.palmte.work.model;
|
||||||
|
|
||||||
|
import org.springframework.data.jpa.repository.JpaRepository;
|
||||||
|
|
||||||
|
public interface ProfitMarginConfigRepository extends JpaRepository<ProfitMarginConfig,Integer> {
|
||||||
|
|
||||||
|
}
|
|
@ -55,7 +55,7 @@ public class AccountService {
|
||||||
@Autowired
|
@Autowired
|
||||||
private UserPositionRepository userPositionRepository;
|
private UserPositionRepository userPositionRepository;
|
||||||
|
|
||||||
public Page<Admin> getAdminList(ConcurrentHashMap<String, String> searchInfo, int pageSize, int pageNum) {
|
public Page<Admin> getAdminList(Map<String, String> searchInfo, int pageSize, int pageNum) {
|
||||||
Page<Admin> adminList = adminRepositoryImpl.getAdminList(searchInfo, pageSize, pageNum);
|
Page<Admin> adminList = adminRepositoryImpl.getAdminList(searchInfo, pageSize, pageNum);
|
||||||
return adminList;
|
return adminList;
|
||||||
}
|
}
|
||||||
|
@ -255,13 +255,6 @@ public class AccountService {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void exportExcel(HttpServletResponse response, ConcurrentHashMap<String, String> searchInfo) throws IOException {
|
|
||||||
String[] headers = {"工号", "手机号码", "姓名", "常驻地", "一级部门", "直接主管", "职位", "所属角色", "公司邮件地址"};
|
|
||||||
String[] exportColumns = {"empCode", "telephone", "workLocation", "deptName", "directManager", "positionName", "roleName", "companyEmail"};
|
|
||||||
ExportUtils.exportToExcel(headers, exportColumns, 1, 5000,
|
|
||||||
response.getOutputStream(), (pN, pS) -> getAdminList(searchInfo, pN, pS).getList());
|
|
||||||
}
|
|
||||||
|
|
||||||
public ResponseMsg check(Collection<Map> maps) {
|
public ResponseMsg check(Collection<Map> maps) {
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,21 @@
|
||||||
|
package cn.palmte.work.service;
|
||||||
|
|
||||||
|
import cn.palmte.work.model.ProfitMarginConfig;
|
||||||
|
import cn.palmte.work.model.ProfitMarginConfigRepository;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
public class ProfitMarginConfigService {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ProfitMarginConfigRepository profitMarginConfigRepository;
|
||||||
|
|
||||||
|
|
||||||
|
public void saveOrUpdate(ProfitMarginConfig profitMarginConfig) {
|
||||||
|
ProfitMarginConfig obj = profitMarginConfigRepository.findOne(1);
|
||||||
|
obj.setThresholdValue(profitMarginConfig.getThresholdValue());
|
||||||
|
obj.setYearProfitMargin(profitMarginConfig.getYearProfitMargin());
|
||||||
|
profitMarginConfigRepository.saveAndFlush(obj);
|
||||||
|
}
|
||||||
|
}
|
Binary file not shown.
Before Width: | Height: | Size: 54 KiB After Width: | Height: | Size: 34 KiB |
|
@ -0,0 +1,155 @@
|
||||||
|
<#assign base=request.contextPath />
|
||||||
|
<#import "../common/defaultLayout.ftl" as defaultLayout>
|
||||||
|
<@defaultLayout.layout>
|
||||||
|
<link rel="stylesheet" href="../assets/css/amazeui.min.css"/>
|
||||||
|
<link rel="stylesheet" href="../assets/css/amazeui.switch.css"/>
|
||||||
|
|
||||||
|
<div class="admin-content">
|
||||||
|
<div class="admin-content-body">
|
||||||
|
<div class="am-cf am-padding">
|
||||||
|
<div class="am-fl am-cf"><strong class="am-text-primary am-text-lg">配置管理</strong> /项目利润率配置</div>
|
||||||
|
</div>
|
||||||
|
<form method="post" class="am-form" id="tmpForm" action="${base}/profitMarginConfig/save">
|
||||||
|
<!--选项卡(tabs)begin-->
|
||||||
|
<div class="am-tabs am-margin" data-am-tabs>
|
||||||
|
<ul class="am-tabs-nav am-nav am-nav-tabs">
|
||||||
|
<li class="am-active">
|
||||||
|
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
<div class="am-tabs-bd">
|
||||||
|
<div class="am-tab-panel am-fade am-in am-active" id="tab1">
|
||||||
|
<input name="tId" id="tId" type="hidden" value="${tId!}"/>
|
||||||
|
<!--验证表单元素(validate) begin-->
|
||||||
|
<!--input begin-->
|
||||||
|
<div class="am-g am-form-group am-margin-top" id="threshold">
|
||||||
|
<div class="am-u-sm-4 am-u-md-2 am-text-right">
|
||||||
|
<span style="color: red;">*</span>
|
||||||
|
项目贡献利润率阀值:
|
||||||
|
</div>
|
||||||
|
<div class="am-u-sm-6 am-u-md-6">
|
||||||
|
<input name="thresholdValue" class="js-ajax-validate"
|
||||||
|
data-validate-async data-validation-message="请输入项目贡献利润率阀值"
|
||||||
|
type="number" step="0.01" id="thresholdValue"
|
||||||
|
value="${profitMarginConfig.thresholdValue!}" minlength="1"
|
||||||
|
maxlength="4" oninput="if(value.length>4)value=value.slice(0,4)"
|
||||||
|
placeholder="请输入项目贡献利润率阀值" required/>
|
||||||
|
<p>注:请注意保留小数点后两位</p>
|
||||||
|
</div>
|
||||||
|
<div class="am-u-sm-2 am-u-md-4 input-msg"></div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="am-g am-form-group am-margin-top" id="threshold">
|
||||||
|
<div class="am-u-sm-4 am-u-md-2 am-text-right">
|
||||||
|
<span style="color: red;">*</span>
|
||||||
|
项目年利润率:
|
||||||
|
</div>
|
||||||
|
<div class="am-u-sm-6 am-u-md-6">
|
||||||
|
<input name="yearProfitMargin" class="js-ajax-validate"
|
||||||
|
data-validate-async data-validation-message="请输入项目年利润率"
|
||||||
|
type="number" step="0.01" id="yearProfitMargin"
|
||||||
|
value="${profitMarginConfig.yearProfitMargin!}" minlength="1"
|
||||||
|
maxlength="4" oninput="if(value.length>4)value=value.slice(0,4)"
|
||||||
|
placeholder="请输入项目年利润率" required/>
|
||||||
|
<p>注:请注意保留小数点后两位</p>
|
||||||
|
</div>
|
||||||
|
<div class="am-u-sm-2 am-u-md-4 input-msg"></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!--选项卡(tabs)end-->
|
||||||
|
<div class="am-margin">
|
||||||
|
<button type="submit" class="am-btn am-btn-primary am-btn-xs">提交保存</button>
|
||||||
|
<#--<button type="button" class="am-btn am-btn-warning am-btn-xs"
|
||||||
|
onclick="javascript:history.go(-1);">返回上一级
|
||||||
|
</button>-->
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</@defaultLayout.layout>
|
||||||
|
<script src="../assets/js/amazeui.switch.js"></script>
|
||||||
|
<script type="text/javascript">
|
||||||
|
var urlBase = "${base}";
|
||||||
|
var url;
|
||||||
|
|
||||||
|
$(function () {
|
||||||
|
/*表单验证:begin*/
|
||||||
|
//自定义规则,用法:验证元素上加class="js-pattern-sort"
|
||||||
|
if ($.AMUI && $.AMUI.validator) {
|
||||||
|
$.AMUI.validator.patterns.sort = /^([0-9]+)$/;
|
||||||
|
}
|
||||||
|
$("#tmpForm").validator({
|
||||||
|
// 域通过验证时回调
|
||||||
|
onValid: function (validity) {
|
||||||
|
$(validity.field).closest('.am-form-group').find('.am-alert').hide();
|
||||||
|
},
|
||||||
|
// 域验证通过时添加的操作,通过该接口可定义各种验证提示
|
||||||
|
markValid: function (validity) {
|
||||||
|
// this is Validator instance
|
||||||
|
var $field = $(validity.field);
|
||||||
|
//add by zxl,只对有required属性的字段进行验证
|
||||||
|
if (typeof ($field.attr("required")) != "undefined") {
|
||||||
|
var options = this.options;
|
||||||
|
var $parent = $field.closest('.am-form-group');
|
||||||
|
$field.addClass(options.validClass).removeClass(options.inValidClass);
|
||||||
|
|
||||||
|
$parent.addClass('am-form-success').removeClass('am-form-error');
|
||||||
|
|
||||||
|
options.onValid.call(this, validity);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
// 验证出错时的回调, validity 对象包含相关信息,格式通 H5 表单元素的 validity 属性
|
||||||
|
onInValid: function (validity) {
|
||||||
|
var $field = $(validity.field);
|
||||||
|
var $group = $field.closest('.am-form-group');
|
||||||
|
var $alert = $group.find('.am-alert');
|
||||||
|
// 使用自定义的提示信息 或 插件内置的提示信息
|
||||||
|
var msg = $field.data('validationMessage') || this.getValidationMessage(validity);
|
||||||
|
|
||||||
|
if (!$alert.length) {
|
||||||
|
$alert = $("<div class='am-alert am-alert-danger'></div>").hide().appendTo($group.find(".input-msg"));
|
||||||
|
}
|
||||||
|
console.log("onInValid : " + $field.val());
|
||||||
|
$alert.html(msg).show();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
/*表单验证:end*/
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
</script>
|
||||||
|
<style type="text/css">
|
||||||
|
/*验证:提示信息样式 begin*/
|
||||||
|
.am-alert-danger {
|
||||||
|
background-color: transparent;
|
||||||
|
border-color: transparent;
|
||||||
|
color: red;
|
||||||
|
}
|
||||||
|
|
||||||
|
.am-alert {
|
||||||
|
margin-bottom: 1em;
|
||||||
|
padding: .625em;
|
||||||
|
background: transparent;
|
||||||
|
border: none;
|
||||||
|
border-radius: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*验证:提示信息样式 end*/
|
||||||
|
</style>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue