This commit is contained in:
Shaun Chyxion 2017-07-25 23:52:35 +08:00
parent 10d54372c9
commit 68ec6baa07
12 changed files with 43 additions and 99 deletions

2
server/.gitignore vendored
View File

@ -6,3 +6,5 @@
target/
bin/
crm/src/main/resources/static/
crm/src/main/resources/application.properties
crm/src/main/resources/log4j2.xml

View File

@ -24,6 +24,7 @@ import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import com.pudonghot.ambition.crm.model.CustomerYearToDateSale;
import com.pudonghot.ambition.crm.service.CustomerPropertyService;
import com.pudonghot.ambition.crm.form.create.CustomerFormForCreate;
import com.pudonghot.ambition.crm.form.update.CustomerFormForUpdate;
@ -55,6 +56,7 @@ public class CustomerController
private static final Map<String, String> SORT_COLS = new HashMap<>();
static {
SORT_COLS.put(Customer.ID, "customer.id");
SORT_COLS.put("dateAdded", "customer.date_added");
SORT_COLS.put("countryCode", "customer.country_code");
SORT_COLS.put(Customer.MS, "customer.ms");
SORT_COLS.put(Customer.REGION, "customer.region");
@ -68,8 +70,10 @@ public class CustomerController
CRITERION_COLS.put(Customer.NAME, "customer.name");
CRITERION_COLS.put(Customer.STATE, "customer.state");
CRITERION_COLS.put(Customer.CITY, "customer.city");
CRITERION_COLS.put("status", "prop.id");
CRITERION_COLS.put(CustomerYearToDateSale.YEAR,
CustomerYearToDateSale.YEAR);
CRITERION_COLS.put("ytdSale", CustomerYearToDateSale.YTD_SALE);
}
@Autowired
@ -174,6 +178,11 @@ public class CustomerController
if (StringUtils.isNotBlank(col)) {
final String criterionCol = criterionCol(col);
if (StringUtils.isNotBlank(criterionCol)) {
// for search year
if (CustomerYearToDateSale.YEAR.equals(criterionCol) ||
CustomerYearToDateSale.YTD_SALE.equals(criterionCol)) {
search.setAttr("YTD_SALE", true);
}
final String op = criterion[1];
final String val = criterion[2];
if (StringUtils.isNotBlank(op) && StringUtils.isNotBlank(val)) {

View File

@ -24,7 +24,7 @@ public class DbExceptionResolver extends DefaultExceptionResolver {
private static final long serialVersionUID = 1L;
{
put(DuplicateKeyException.class,
pair(5039, "重复主键,请检查输入"));
pair(5039, "Duplicate Key"));
}
/**

View File

@ -15,14 +15,14 @@ public class ExceptionMessageSupport implements ExceptionMessage {
private static final Map<Object, Object> map = new HashMap<Object, Object>() {
private static final long serialVersionUID = 1L;
{
put(4010, "登录验证失败,请联系管理员");
put(4011, "登录失效,请重新登录");
put(4012, "账户不存在或者账户密码不匹配");
put(4013, "密码不正确");
put(4014, "密码已过期,请联系管理员");
put(4015, "账户锁定,请联系管理员");
put(4016, "无权限访问");
put(5000, "系统繁忙,请稍后再试");
put(4010, "Authentication exception caused, please contact system admin");
put(4011, "Please sign in");
put(4012, "Unknown account");
put(4013, "Incorrect credentials");
put(4014, "Expired credentials");
put(4015, "Account locked");
put(4016, "No right to access");
put(5000, "Unknown error, please contact system admin");
}
};

View File

@ -1,16 +0,0 @@
# Server
server.port=80
# MySQL
datasource.host=127.0.0.1
datasource.port=3306
datasource.database-name=ambition_crm
datasource.username=root
datasource.password=696@2^~)oZ@^#*Q
# Shiro
shiro.session.validation.scheduler.enabled=true
spring.http.multipart.max-file-size=1024MB
spring.http.multipart.max-request-size=1024MB

View File

@ -1,37 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<Configuration status="WARN">
<Properties>
<Property name="log.level">INFO</Property>
<Property name="log.dir">/data/program/logs/${project.artifactId}</Property>
<Property name="pattern">%-d{yyyy-MM-dd HH:mm:ss,SSS} %-5p [%t][%c{1}] %m%n</Property>
</Properties>
<Appenders>
<Console name="Console" target="SYSTEM_OUT">
<PatternLayout pattern="${pattern}" />
</Console>
<RollingFile name="File"
fileName="${log.dir}/${project.artifactId}.log"
filePattern="${log.dir}/$${date:yyyy-MM}/${project.artifactId}-%d{yyyy-MM-dd}-%i.log">
<PatternLayout pattern="${pattern}" />
<Policies>
<TimeBasedTriggeringPolicy />
<SizeBasedTriggeringPolicy size="16 MB" />
</Policies>
<DefaultRolloverStrategy max="32" />
</RollingFile>
</Appenders>
<Loggers>
<Logger name="org.springframework" level="INFO" additivity="false">
<AppenderRef ref="File" />
</Logger>
<Logger name="org.apache" level="WARN" additivity="false">
<AppenderRef ref="File" />
</Logger>
<Logger name="org.hibernate.validator" level="WARN" additivity="false">
<AppenderRef ref="File" />
</Logger>
<Root level="${log.level}" additivity="false">
<AppenderRef ref="File" level="${log.level}" />
</Root>
</Loggers>
</Configuration>

View File

@ -28,10 +28,15 @@
</select>
<select id="countForShow" resultType="int">
select count(1)
select count(distinct customer.id)
from <include refid="table" /> customer
<if test="s.getAttr('YTD_SALE') != null">
join crm_customer_year_to_date_sale
on customer.id = customer_id
</if>
left join crm_customer_property prop
on customer.status = prop.id
@ -46,7 +51,7 @@
</select>
<sql id="selectionCommon">
select
select distinct
<foreach collection="new com.pudonghot.ambition.crm.model.Customer().cols('customer')"
item="col" separator=", ">
${col}
@ -68,6 +73,12 @@
and enabled = 1) sum_ytd_sales
from <include refid="table" /> customer
<if test="s.getAttr('YTD_SALE') != null">
join crm_customer_year_to_date_sale
on customer.id = customer_id
</if>
left join crm_customer_property prop
on customer.status = prop.id
</sql>

View File

@ -9,17 +9,10 @@ export default BaseComponent.extend({
let me = this;
let user = me.get('user');
if (!user) {
user = Ember.$.sessionStorage.get('user');
if (user) {
me.set('user', user);
}
else {
Ember.Logger.info('No User Found In Session Storage, Try To Load From Cloud');
me.ajax.doGet(false, 'auth/info', (u) => {
me.set('user', u);
Ember.$.sessionStorage.set('user', u);
});
}
Ember.Logger.info('No User Found In Session Storage, Try To Load From Cloud');
me.ajax.doGet(false, 'auth/info', (u) => {
me.set('user', u);
});
}
},
actions: {
@ -27,7 +20,6 @@ export default BaseComponent.extend({
let me = this;
me.ajax.doPost(false, 'auth/logout', () => {
me.set('user', null);
Ember.$.sessionStorage.set('user', null);
me.get('message').alert('Sign out successfully');
me.get('router').transitionTo('login');
});

View File

@ -30,7 +30,8 @@ export default Ember.Route.extend({
cols: [{col: 'name', name: 'Name'},
{col: 'dateAdded', name: 'Date Added'},
{col: 'year', name: 'Year'},
{col: 'ytdSale', name: 'YTD Sales'},
{col: 'ytdSale', name: 'YTD Sale'},
{col: 'sumYtdSales', name: 'Sum YTD Sales'},
{col: 'countryCode', name: 'Country'},
{col: 'state', name: 'State'},
{col: 'city', name: 'City'},

View File

@ -16,18 +16,9 @@ export default Ember.Route.extend({
Ember.$.sessionStorage.set('user', user);
me.set('ajax.user', user);
me.message.alert('Sign in successfully');
// Log the user in, then reattempt previous transition if it exists.
let prevTransition = me.get('prevTransition');
if (prevTransition) {
me.set('prevTransition', null);
prevTransition.retry();
}
else {
// Default back to app list
me.transitionTo('index');
}
me.transitionTo('index');
}, function(msg) {
me.get('message').warn('Login Fail [' + msg + ']');
me.get('message').warn(msg);
});
}
}

View File

@ -36,7 +36,7 @@
<th>Name</th>
{{/if}}
{{#if tableOptions.showDateAdded}}
<th>Added</th>
{{sortable-th name='dateAdded' text='Added'}}
{{/if}}
{{#if tableOptions.showYears}}
<th>Years</th>

View File

@ -87,15 +87,6 @@ module.exports = function(defaults) {
destDir: '/assets/img'
});
// JQuery HotKeys
// importVendor(app, 'bower_components/jquery.hotkeys/jquery.hotkeys.js');
// Bootstrap WYSIWYG
importVendor(app, 'bower_components/bootstrap-wysiwyg/bootstrap-wysiwyg.js');
// Bootstrap TreeView
importVendor(app, 'bower_components/bootstrap-treeview/src/css/bootstrap-treeview.css');
importVendor(app, 'bower_components/bootstrap-treeview/src/js/bootstrap-treeview.js');
// ACE CSS
importVendor(app, 'vendor/ace/css/ace.css');
importVendor(app, 'vendor/ace/css/ace-fonts.css');