Skip to content

Commit

Permalink
20190923
Browse files Browse the repository at this point in the history
  • Loading branch information
GspiriTer committed Sep 23, 2019
1 parent d2e35c7 commit dafa051
Show file tree
Hide file tree
Showing 392 changed files with 8,335 additions and 2,792 deletions.
6 changes: 0 additions & 6 deletions .gitignore

This file was deleted.

552 changes: 364 additions & 188 deletions docs/crm9.sql

Large diffs are not rendered by default.

164 changes: 164 additions & 0 deletions docs/update20190923.sql

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
<dependency>
<groupId>com.jfinal</groupId>
<artifactId>jfinal-undertow</artifactId>
<version>1.6</version>
<version>1.9</version>
</dependency>
<!--<dependency>-->
<!--<groupId>javax.servlet</groupId>-->
Expand Down
9 changes: 5 additions & 4 deletions src/main/java/com/kakarote/crm9/Application.java
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
package com.kakarote.crm9;

import com.jfinal.server.undertow.UndertowConfig;
import com.jfinal.server.undertow.UndertowServer;
import com.kakarote.crm9.common.config.JfinalConfig;
import com.kakarote.crm9.common.constant.BaseConstant;

public class Application {
public static void main(String[] args) {
UndertowServer
.create(JfinalConfig.class,"config/undertow.txt")
.setResourcePath("src/main/webapp,"+ BaseConstant.UPLOAD_PATH)
.start();
UndertowConfig config=new UndertowConfig(JfinalConfig.class,"config/undertow.txt");
config.setResourcePath("src/main/webapp,"+ BaseConstant.UPLOAD_PATH);
config.setServerName(BaseConstant.NAME);
UndertowServer.create(config).start();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@

import java.lang.annotation.*;

/**
* 非空校验注解
*/
@Retention(RetentionPolicy.RUNTIME)
@Target({ ElementType.METHOD,ElementType.TYPE})
@Inherited
@Documented
@Repeatable(NotNullValidates.class)
/**
* 非空校验注解,暂定
*/
public @interface NotNullValidate {
String value();
HttpEnum type() default HttpEnum.PARA;
Expand Down
11 changes: 0 additions & 11 deletions src/main/java/com/kakarote/crm9/common/config/JfinalConfig.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package com.kakarote.crm9.common.config;

import cn.hutool.core.util.ClassLoaderUtil;
import com.alibaba.druid.wall.WallFilter;
import com.jfinal.aop.Aop;
import com.kakarote.crm9.common.config.cache.CaffeineCache;
import com.kakarote.crm9.common.config.druid.DruidConfig;
Expand Down Expand Up @@ -143,16 +142,6 @@ public void configHandler(Handlers me) {

@Override
public void onStart() {
AdminFieldService adminFieldService=Aop.get(AdminFieldService.class);
adminFieldService.createView(1);
adminFieldService.createView(2);
adminFieldService.createView(3);
adminFieldService.createView(4);
adminFieldService.createView(5);
adminFieldService.createView(6);
adminFieldService.createView(7);
adminFieldService.createView(8);
adminFieldService.createView(10);
WorkService workService= Aop.get(WorkService.class);
workService.initialization();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public class CaffeineCache implements ICache {
private static final String DEFAULT_KEY="default";

private CaffeineCache() {
cacheConcurrentHashMap.put(DEFAULT_KEY,Caffeine.newBuilder().expireAfterWrite(15, TimeUnit.MINUTES).build());
cacheConcurrentHashMap.put(DEFAULT_KEY,Caffeine.newBuilder().expireAfterWrite(30, TimeUnit.MINUTES).build());
}

@Override
Expand All @@ -36,7 +36,7 @@ public <T> T get(Object key) {
public void put(String cacheName, Object key, Object value) {
Cache<Object, Object> cache = cacheConcurrentHashMap.get(cacheName);
if (cache == null) {
cache = Caffeine.newBuilder().expireAfterWrite(15, TimeUnit.MINUTES).build();
cache = Caffeine.newBuilder().expireAfterWrite(30, TimeUnit.MINUTES).build();
cacheConcurrentHashMap.put(cacheName, cache);
}
cache.put(key, value);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,19 +1,9 @@
package com.kakarote.crm9.common.config.druid;

import cn.hutool.core.util.StrUtil;
import com.alibaba.druid.filter.FilterChain;
import com.alibaba.druid.filter.FilterEventAdapter;
import com.alibaba.druid.proxy.jdbc.*;
import com.alibaba.druid.sql.SQLUtils;
import com.alibaba.druid.sql.ast.SQLExpr;
import com.alibaba.druid.sql.ast.expr.SQLQueryExpr;
import com.alibaba.druid.sql.dialect.mysql.ast.statement.MySqlSelectQueryBlock;
import com.kakarote.crm9.erp.admin.service.AdminUserService;
import com.kakarote.crm9.utils.BaseUtil;

import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;
import java.util.Properties;

@SuppressWarnings("all")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ public class BaseConstant implements Serializable {

public static final String NAME = "72CRM";

public static final String VERSION = "1.3.2";
public static final String VERSION = "1.3.3";

private static final long serialVersionUID = 1L;
/**
Expand All @@ -25,7 +25,7 @@ public class BaseConstant implements Serializable {
/**
* 角色类型列表
*/
public static final Integer[] ROLE_TYPES = {1, 2, 3, 4, 0};
public static final Integer[] ROLE_TYPES = {1, 2, 7, 8, 0};

/**
* 超级管理员的roleId
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import com.kakarote.crm9.utils.R;

import java.lang.reflect.Parameter;
import java.util.Date;

public class ErpInterceptor implements Interceptor {
@Override
Expand All @@ -35,8 +36,7 @@ public void intercept(Invocation invocation) {
}
//数据转换json的处理
this.modelToJson(invocation);

RedisManager.getRedis().expire(token, 3600);
BaseUtil.userExpire(token);
invocation.invoke();
} catch (Exception e) {
invocation.getController().renderJson(R.error("服务器响应异常"));
Expand Down Expand Up @@ -87,7 +87,7 @@ private void modelToJson(Invocation inv){
Class clazz = parameters[i].getType();
if (clazz.isAssignableFrom(Record.class)) {
inv.setArg(i, new Record().setColumns(jsonObject));
}else if(BasicType.unWrap(clazz).isPrimitive()||clazz.isAssignableFrom(String.class)){
}else if(BasicType.unWrap(clazz).isPrimitive()||clazz.isAssignableFrom(String.class)||clazz.isAssignableFrom(Date.class)){
String name=parameters[i].getName();
inv.setArg(i,jsonObject.getObject(name,clazz));
} else {
Expand Down
2 changes: 2 additions & 0 deletions src/main/java/com/kakarote/crm9/erp/_MappingKit.java
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ public static void mapping(ActiveRecordPlugin arp) {
arp.addMapping("72crm_crm_contract", "contract_id", CrmContract.class);
arp.addMapping("72crm_crm_contract_product", "r_id", CrmContractProduct.class);
arp.addMapping("72crm_crm_customer", "customer_id", CrmCustomer.class);
arp.addMapping("72crm_crm_customer_setting", "setting_id", CrmCustomerSetting.class);
arp.addMapping("72crm_crm_customer_settinguser", "id", CrmCustomerSettingUser.class);
arp.addMapping("72crm_crm_customer_stats", "id", CrmCustomerStats.class);
arp.addMapping("72crm_crm_leads", "leads_id", CrmLeads.class);
arp.addMapping("72crm_crm_owner_record", "record_id", CrmOwnerRecord.class);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public class AdminAchievementController extends Controller {
* 设置业绩目标
* @author hmb
*/
@Permissions("manage:crm")
@Permissions("manage:crm:achievement")
public void setAchievement(){
String data = getRawData();
List<CrmAchievement> crmAchievements = JSON.parseArray(data, CrmAchievement.class);
Expand All @@ -35,7 +35,7 @@ public void setAchievement(){
* @param achievement 业绩目标对象
* @author hmb
*/
@Permissions("manage:crm")
@Permissions("manage:crm:achievement")
public void queryAchievementList(@Para("")CrmAchievement achievement){
String userId = getPara("userId");
Integer deptId = getParaToInt("deptId");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,27 +29,24 @@ public class AdminBusinessTypeController extends Controller {
* @author hmb
* 设置商机组
*/
@Permissions("manage:crm")
@Permissions("manage:crm:setting")
public void setBusinessType() {
JSONObject jsonObject = JSON.parseObject(getRawData());

CrmBusinessType crmBusinessType = jsonObject.getObject("crmBusinessType", CrmBusinessType.class);
if(jsonObject.getJSONArray("deptIds") != null){
List<Integer> deptIds = jsonObject.getJSONArray("deptIds").toJavaList(Integer.class);
crmBusinessType.setDeptIds(TagUtil.fromSet(new HashSet<>(deptIds)));
}
JSONArray crmBusinessStatus = jsonObject.getJSONArray("crmBusinessStatus");
adminBusinessTypeService.addBusinessType(crmBusinessType,crmBusinessStatus);
renderJson(R.ok());
renderJson(adminBusinessTypeService.addBusinessType(crmBusinessType,crmBusinessStatus));
}

/**
* @author hmb
* @param basePageRequest 分页对象
* 查询商机组列表
*/

@Permissions("manage:crm")
@Permissions("manage:crm:setting")
public void queryBusinessTypeList(BasePageRequest<Void> basePageRequest) {
renderJson(R.ok().put("data", adminBusinessTypeService.queryBusinessTypeList(basePageRequest)));
}
Expand All @@ -58,7 +55,6 @@ public void queryBusinessTypeList(BasePageRequest<Void> basePageRequest) {
* @author hmb
* 获取详细信息
*/
@Permissions("manage:crm")
public void getBusinessType() {
String typeId = getPara("id");
renderJson(adminBusinessTypeService.getBusinessType(typeId));
Expand All @@ -68,7 +64,7 @@ public void getBusinessType() {
* @author hmb
* 删除商机状态组
*/
@Permissions("manage:crm")
@Permissions("manage:crm:setting")
public void deleteById() {
String typeId = getPara("id");
renderJson(adminBusinessTypeService.deleteById(typeId));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,13 @@ public class AdminDeptController extends Controller {
* 设置部门
* @param adminDept 部门对象
*/
@Permissions("manage:user")
public void setDept(@Para("") AdminDept adminDept){
@Permissions("manage:users:deptSave")
public void addDept(@Para("") AdminDept adminDept){
renderJson(adminDeptService.setDept(adminDept));
}

@Permissions("manage:users:deptUpdate")
public void updateDept(@Para("") AdminDept adminDept){
renderJson(adminDeptService.setDept(adminDept));
}

Expand All @@ -49,7 +54,7 @@ public void queryDeptByAuth(){
* @author hmb
* 删除部门
*/
@Permissions("manage:user")
@Permissions("manage:users:deptDelete")
public void deleteDept(){
String id = getPara("id");
renderJson(adminDeptService.deleteDept(id));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,23 +20,22 @@ public class AdminExamineController extends Controller {
/**
* 添加审批流程
*/
@Permissions("manage:examineFlow")
@Permissions("manage:examineFlow:update")
public void saveExamine(){
JSONObject jsonObject = JSON.parseObject(getRawData());
renderJson(examineService.saveExamine(jsonObject));
}
/**
* 查询所有未删除审批流程
*/
@Permissions("manage:examineFlow")
@Permissions("manage:examineFlow:update")
public void queryAllExamine(BasePageRequest<AdminExamine> basePageRequest){
renderJson(examineService.queryAllExamine(basePageRequest));
}
/**
* 根据id查询审批流程 examineId 审批流程id
* @author zxy
*/
@Permissions("manage:examineFlow")
public void queryExamineById(){
Integer examineId = getInt("examineId");
renderJson(examineService.queryExamineById(examineId));
Expand All @@ -46,17 +45,17 @@ public void queryExamineById(){
* examineId 审批流程id
* status 审批状态 1启用 0禁用 2 删除
*/
@Permissions("manage:examineFlow")
@Permissions("manage:examineFlow:update")
public void updateStatus(@Para("") AdminExamine adminExamine){
renderJson(examineService.updateStatus(adminExamine));
}
/**
* 查询当前启用审核流程步骤
* categoryType 1 合同 2 回款
*/
@Permissions("manage:examineFlow")
public void queryExaminStep(){
Integer categoryType = getInt("categoryType");
renderJson(examineService.queryExaminStep(categoryType));
Integer id = getInt("id");
renderJson(examineService.queryExaminStep(categoryType,id));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,10 @@ private boolean getExamineObjIdByRecordId(Integer recordId){
boolean auth;
Integer id = Db.queryInt("select contract_id from `72crm_crm_contract` where examine_record_id = ?",recordId);
if(id != null){
auth = AuthUtil.isCrmAuth(AuthUtil.getCrmTablePara(CrmEnum.CONTRACT_TYPE_KEY.getSign()),id);
auth = AuthUtil.isCrmAuth(AuthUtil.getCrmTablePara(CrmEnum.CRM_CONTRACT),id);
}else {
id = Db.queryInt("select receivables_id from `72crm_crm_receivables` where examine_record_id = ?",recordId);
auth = AuthUtil.isCrmAuth(AuthUtil.getCrmTablePara(CrmEnum.RECEIVABLES_TYPE_KEY.getSign()),id);
auth = AuthUtil.isCrmAuth(AuthUtil.getCrmTablePara(CrmEnum.CRM_RECEIVABLES),id);
}
return auth;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ public class AdminFieldController extends Controller {
* @author zhangzhiwei
* 保存自定义字段E
*/
@Permissions("manage:crm")
@Permissions("manage:crm:field")
public void save() {
String str=getRawData();
JSONObject jsonObject= JSON.parseObject(str);
Expand Down Expand Up @@ -135,7 +135,12 @@ public void queryField(@Para("label")String label,@Para("id")Integer id){
*/
public void information(@Para("types")Integer types,@Para("id")Integer id){
List<Record> recordList;
boolean auth = AuthUtil.isCrmAuth(AuthUtil.getCrmTablePara(CrmEnum.getSign(types)), id);
boolean auth;
if(types.equals(2)){
auth = AuthUtil.isPoolAuth(id);
}else {
auth = AuthUtil.isCrmAuth(AuthUtil.getCrmTablePara(CrmEnum.parse(types)), id);
}
if(auth){renderJson(R.noAuth()); return; }
if (1 == types){
recordList = crmLeadsService.information(id);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,11 +86,12 @@ public void login(@Para("username") String username, @Para("password") String pa
String token = IdUtil.simpleUUID();
user.setLastLoginIp(BaseUtil.getLoginAddress(getRequest()));
user.setLastLoginTime(new Date());

user.update();
user.setRoles(adminRoleService.queryRoleIdsByUserId(user.getUserId()));
redis.setex(token, 3600, user);
BaseUtil.setToken(user.getUserId(),token,1);
user.remove("password", "salt");
//setCookie("Admin-Token", token, 3600*24,true);
renderJson(R.ok().put("Admin-Token", token).put("user", user).put("auth", adminRoleService.auth(user.getUserId())));
}else{
Log.getLog(getClass()).warn("用户登录失败");
Expand Down
Loading

0 comments on commit dafa051

Please sign in to comment.