anderx лет назад: 3
Родитель
Сommit
822e28240b
67 измененных файлов с 3121 добавлено и 1489 удалено
  1. 82 24
      src/main/java/com/goafanti/admin/bo/AdminListBo.java
  2. 7 5
      src/main/java/com/goafanti/admin/service/NewAdminService.java
  3. 5 1
      src/main/java/com/goafanti/admin/service/impl/AdminServiceImpl.java
  4. 140 9
      src/main/java/com/goafanti/admin/service/impl/NewAdminServiceImpl.java
  5. 51 0
      src/main/java/com/goafanti/ambSystem/bo/AmbAll.java
  6. 241 0
      src/main/java/com/goafanti/ambSystem/bo/InputAmb.java
  7. 81 0
      src/main/java/com/goafanti/ambSystem/bo/OutAmb.java
  8. 73 0
      src/main/java/com/goafanti/ambSystem/bo/OutAmbDtails.java
  9. 92 0
      src/main/java/com/goafanti/ambSystem/controller/AmbApiController.java
  10. 28 0
      src/main/java/com/goafanti/ambSystem/service/AmbService.java
  11. 204 0
      src/main/java/com/goafanti/ambSystem/service/Impl/AmbServiceImpl.java
  12. 2 0
      src/main/java/com/goafanti/common/constant/AFTConstants.java
  13. 4 0
      src/main/java/com/goafanti/common/controller/BaseController.java
  14. 18 1
      src/main/java/com/goafanti/common/controller/WebpageController.java
  15. 14 3
      src/main/java/com/goafanti/common/dao/AdminMapper.java
  16. 35 0
      src/main/java/com/goafanti/common/dao/AmbSystemMapper.java
  17. 12 0
      src/main/java/com/goafanti/common/dao/NewOrderChangeMapper.java
  18. 1 0
      src/main/java/com/goafanti/common/dao/OrderExamineMapper.java
  19. 8 8
      src/main/java/com/goafanti/common/dao/RoleMapper.java
  20. 39 77
      src/main/java/com/goafanti/common/dao/TOrderInvoiceMapper.java
  21. 10 0
      src/main/java/com/goafanti/common/dao/TOrderNewMapper.java
  22. 0 2
      src/main/java/com/goafanti/common/dao/UserMapper.java
  23. 147 88
      src/main/java/com/goafanti/common/mapper/AdminMapper.xml
  24. 335 0
      src/main/java/com/goafanti/common/mapper/AmbSystemMapper.xml
  25. 3 3
      src/main/java/com/goafanti/common/mapper/DepartmentMapper.xml
  26. 61 10
      src/main/java/com/goafanti/common/mapper/NewOrderChangeMapper.xml
  27. 6 0
      src/main/java/com/goafanti/common/mapper/OrderExamineMapper.xml
  28. 25 17
      src/main/java/com/goafanti/common/mapper/RoleMapper.xml
  29. 109 321
      src/main/java/com/goafanti/common/mapper/TOrderInvoiceMapper.xml
  30. 43 8
      src/main/java/com/goafanti/common/mapper/TOrderNewMapper.xml
  31. 26 26
      src/main/java/com/goafanti/common/mapper/TOrderPaymentMapper.xml
  32. 16 13
      src/main/java/com/goafanti/common/mapper/TOrderTaskMapper.xml
  33. 4 4
      src/main/java/com/goafanti/common/mapper/UserMapperExt.xml
  34. 2 2
      src/main/java/com/goafanti/common/mapper/UserMidMapper.xml
  35. 50 8
      src/main/java/com/goafanti/common/model/Admin.java
  36. 247 0
      src/main/java/com/goafanti/common/model/AmbSystem.java
  37. 13 0
      src/main/java/com/goafanti/common/model/NewOrderChange.java
  38. 14 4
      src/main/java/com/goafanti/common/model/Role.java
  39. 376 639
      src/main/java/com/goafanti/common/model/TOrderInvoice.java
  40. 18 4
      src/main/java/com/goafanti/common/model/TOrderNew.java
  41. 61 6
      src/main/java/com/goafanti/common/utils/AsyncUtils.java
  42. 5 0
      src/main/java/com/goafanti/common/utils/StringUtils.java
  43. 1 1
      src/main/java/com/goafanti/core/mybatis/page/Pagination.java
  44. 1 0
      src/main/java/com/goafanti/customer/controller/AdminCustomerApiController.java
  45. 2 1
      src/main/java/com/goafanti/customer/service/impl/CustomerServiceImpl.java
  46. 13 3
      src/main/java/com/goafanti/order/bo/NewOderCahngeListBo.java
  47. 9 0
      src/main/java/com/goafanti/order/bo/OrderListBo.java
  48. 13 3
      src/main/java/com/goafanti/order/bo/TOrderInvoiceBo.java
  49. 59 58
      src/main/java/com/goafanti/order/enums/OrderStage.java
  50. 2 0
      src/main/java/com/goafanti/order/service/OrderNewService.java
  51. 3 7
      src/main/java/com/goafanti/order/service/impl/FundManagerOrderServiceImpl.java
  52. 90 52
      src/main/java/com/goafanti/order/service/impl/OrderChangeServiceImpl.java
  53. 52 5
      src/main/java/com/goafanti/order/service/impl/OrderInvoiceServiceImpl.java
  54. 38 2
      src/main/java/com/goafanti/order/service/impl/OrderNewServiceImpl.java
  55. 32 2
      src/main/java/com/goafanti/order/service/impl/OrderProjectServiceImpl.java
  56. 9 5
      src/main/java/com/goafanti/order/service/impl/OrderServiceImpl.java
  57. 2 1
      src/main/java/com/goafanti/order/service/impl/OutsourceOrgServiceImpl.java
  58. 2 0
      src/main/java/com/goafanti/order/service/impl/PushOrderService.java
  59. 2 0
      src/main/java/com/goafanti/organization/bo/outOrderPayment.java
  60. 14 0
      src/main/java/com/goafanti/organization/service/impl/OrganizationServiceImpl.java
  61. 4 0
      src/main/java/com/goafanti/permission/service/impl/NewRoleServiceImpl.java
  62. 4 4
      src/main/java/com/goafanti/user/controller/UserLoginController.java
  63. 3 1
      src/main/resources/props/config_local.properties
  64. 3 1
      src/main/resources/props/config_test.properties
  65. 1 1
      src/main/resources/shiro_base_auth.ini
  66. 18 0
      src/main/webapp/WEB-INF/views/admin/amiba.html
  67. 36 59
      src/main/webapp/WEB-INF/views/portal/websocket.html

+ 82 - 24
src/main/java/com/goafanti/admin/bo/AdminListBo.java

@@ -3,6 +3,7 @@ package com.goafanti.admin.bo;
 import java.util.Date;
 import java.util.List;
 
+import com.goafanti.common.model.Role;
 import org.apache.commons.lang3.time.DateFormatUtils;
 
 import com.goafanti.common.constant.AFTConstants;
@@ -20,7 +21,7 @@ public class AdminListBo {
 	 * 用户名
 	 */
 	private String	name;
-	
+
 	/**
 	 * 密码
 	 */
@@ -45,12 +46,12 @@ public class AdminListBo {
 	 * 所在省份
 	 */
 	private String	province;
-	
+
 	/**
-	 * 所在市 
+	 * 所在市
 	 */
 	private String city;
-	
+
 	/**
 	 * 岗位
 	 */
@@ -65,38 +66,38 @@ public class AdminListBo {
 	 * 上级管理用户ID
 	 */
 	private String	superiorId;
-	
+
 	/** 部门ID **/
 	private String departmentId;
-	
+
 	/** 部门名称 **/
 	private String departmentName;
-	
+
 	/** 用户状态 **/
 	private String status;
-	
+
 	/** 用户编号 **/
 	@SuppressWarnings("unused")
 	private String userNo;
-	
+
 	/** 职务 **/
 	private String duty;
-	
+
 	/**
 	 * 最后登录时间
 	 */
 	private String lastLoginTime;
 	/** 角色 **/
-	private List<String> roles;
-	
+	private List<Role> roles;
+
 	/** 角色 id**/
-	private List<String> rolesId;
-	
-	
+	private List<String> rolesName;
+
+
 	private String contactMobile;
-	
+
 	private String contactId;
-	
+
 	private String openId;
 
 	/**
@@ -109,6 +110,55 @@ public class AdminListBo {
 	 */
 	private String depManager;
 
+
+	private String ambId;
+	private String ancestors;
+	private Integer ambManage;
+	private String ambName;
+	private String ancestorsNames;
+	private String ambRole;
+
+
+	public String getAmbId() {
+		return ambId;
+	}
+
+	public void setAmbId(String ambId) {
+		this.ambId = ambId;
+	}
+
+	public String getAncestors() {
+		return ancestors;
+	}
+
+	public void setAncestors(String ancestors) {
+		this.ancestors = ancestors;
+	}
+
+	public Integer getAmbManage() {
+		return ambManage;
+	}
+
+	public void setAmbManage(Integer ambManage) {
+		this.ambManage = ambManage;
+	}
+
+	public String getAmbRole() {
+		return ambRole;
+	}
+
+	public void setAmbRole(String ambRole) {
+		this.ambRole = ambRole;
+	}
+
+	public String getAmbName() {
+		return ambName;
+	}
+
+	public void setAmbName(String ambName) {
+		this.ambName = ambName;
+	}
+
 	public String getDepManager() {
 		return depManager;
 	}
@@ -125,19 +175,27 @@ public class AdminListBo {
 		this.reviewer = reviewer;
 	}
 
-	public List<String> getRolesId() {
-		return rolesId;
+	public List<String> getRolesName() {
+		return rolesName;
 	}
 
-	public void setRolesId(List<String> rolesId) {
-		this.rolesId = rolesId;
+	public void setRolesName(List<String> rolesName) {
+		this.rolesName = rolesName;
 	}
 
-	public List<String> getRoles() {
+	public String getAncestorsNames() {
+		return ancestorsNames;
+	}
+
+	public void setAncestorsNames(String ancestorsNames) {
+		this.ancestorsNames = ancestorsNames;
+	}
+
+	public List<Role> getRoles() {
 		return roles;
 	}
 
-	public void setRoles(List<String> roles) {
+	public void setRoles(List<Role> roles) {
 		this.roles = roles;
 	}
 
@@ -252,7 +310,7 @@ public class AdminListBo {
 	public void setSuperior(String superior) {
 		this.superior = superior;
 	}
-	
+
 	public String getDepartmentId() {
 		return departmentId;
 	}

+ 7 - 5
src/main/java/com/goafanti/admin/service/NewAdminService.java

@@ -10,7 +10,7 @@ import com.goafanti.core.mybatis.page.Pagination;
 
 public interface NewAdminService {
 	Pagination<AdminListBo> listAdmin(AdminListBo alb,String rid,String roleName, Integer pageNo, Integer pageSize);
-	
+
 	List<Admin> selectAllAdmin();
 
 	Admin selectByMobile(String username);
@@ -60,13 +60,15 @@ public interface NewAdminService {
 	Map<String, String> listAdminSelect();
 
 	List<Admin> listAdminByName(String name);
-	
-	Admin selectAllByid(String id);	
-	
+
+	Admin selectAllByid(String id);
+
 	int deleteById(String id);
 
 	List<AdminListBo> selectAdminByOrg();
 
 	boolean checkAdminRole(List<String> roles, Admin admin);
-	
+
+	void pushRolesName(AdminListBo i);
+
 }

+ 5 - 1
src/main/java/com/goafanti/admin/service/impl/AdminServiceImpl.java

@@ -8,6 +8,7 @@ import com.goafanti.admin.service.DepartmentService;
 import com.goafanti.common.dao.*;
 import com.goafanti.common.error.BusinessException;
 import com.goafanti.common.model.Department;
+import com.goafanti.common.model.Role;
 import com.goafanti.common.utils.RedisUtil;
 import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -51,6 +52,8 @@ public class AdminServiceImpl extends BaseMybatisDao<AdminMapper> implements Adm
 	private DepartmentService departmentService;
 	@Resource(name = "passwordUtil")
 	private PasswordUtil					passwordUtil;
+	@Autowired
+	private NewAdminServiceImpl newAdminService;
 
 	@Autowired
 	private RedisUtil	redisUtil;
@@ -343,7 +346,8 @@ public class AdminServiceImpl extends BaseMybatisDao<AdminMapper> implements Adm
 		Pagination<AdminListBo> p = (Pagination<AdminListBo>)findPage("frequentContactsList", "frequentContactsCount", params, pageNo, pageSize);
 		List<AdminListBo> list=(List<AdminListBo>)p.getList();
 		for(AdminListBo i:list){
-			i.setRoles(adminMapper.selectRolesByUid(i.getContactId()));
+			newAdminService.pushRolesName(i);
+
 		}
 		return p;
 	}

+ 140 - 9
src/main/java/com/goafanti/admin/service/impl/NewAdminServiceImpl.java

@@ -2,7 +2,10 @@ package com.goafanti.admin.service.impl;
 
 import java.util.*;
 
+import com.goafanti.common.dao.*;
+import com.goafanti.common.model.AmbSystem;
 import com.goafanti.common.model.Role;
+import com.goafanti.common.utils.AsyncUtils;
 import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
@@ -11,9 +14,6 @@ import com.goafanti.admin.bo.AdminDetail;
 import com.goafanti.admin.bo.AdminListBo;
 import com.goafanti.admin.service.NewAdminService;
 import com.goafanti.common.constant.AFTConstants;
-import com.goafanti.common.dao.AdminLocationMapper;
-import com.goafanti.common.dao.AdminMapper;
-import com.goafanti.common.dao.UserRoleMapper;
 import com.goafanti.common.model.Admin;
 import com.goafanti.common.model.UserRole;
 import com.goafanti.common.utils.StringUtils;
@@ -29,6 +29,12 @@ public class NewAdminServiceImpl extends BaseMybatisDao<AdminMapper> implements
 	private UserRoleMapper		userRoleMapper;
 	@Autowired
 	private AdminLocationMapper	adminLocationMapper;
+	@Autowired
+	private AmbSystemMapper	ambSystemMapper;
+	@Autowired
+	private RoleMapper	roleMapper;
+	@Autowired
+	private AsyncUtils asyncUtils;
 
 	@Override
 	public Pagination<AdminListBo> listAdmin(AdminListBo alb, String rid,String roleName,Integer pageNo, Integer pageSize) {
@@ -42,16 +48,29 @@ public class NewAdminServiceImpl extends BaseMybatisDao<AdminMapper> implements
 		if(StringUtils.isNotBlank(alb.getStatus())) params.put("status", alb.getStatus());
 		if(StringUtils.isNotBlank(alb.getMobile())) params.put("mobile", alb.getMobile());
 		if(StringUtils.isNotBlank(alb.getSuperiorId())) params.put("superiorId", alb.getSuperiorId());
+		if(StringUtils.isNotBlank(alb.getAmbId())) params.put("ambId", alb.getAmbId());
+		if(StringUtils.isNotBlank(alb.getAncestors())) params.put("ancestors", alb.getAncestors());
+		if(alb.getAmbManage()!=null) params.put("ambManage", alb.getAmbManage());
 		Pagination<AdminListBo> p=(Pagination<AdminListBo>)findPage("selectAdminListByPage","selectAdminCount",params,pageNo,pageSize);
-		List<AdminListBo> list=(List<AdminListBo>)p.getList();
+		List<AdminListBo> list= (List<AdminListBo>) p.getList();
 		for(AdminListBo i:list){
-			i.setRoles(adminMapper.selectRolesByUid(i.getId()));
-			i.setRolesId(adminMapper.selectRolesIdByUid(i.getId()));
+			pushRolesName(i);
 		}
 		return p;
 	}
 
 	@Override
+	public void pushRolesName(AdminListBo i) {
+		List<Role> roles = adminMapper.selectRolesByUid(i.getId());
+		i.setRoles(roles);
+		List<String> ls=new ArrayList<>();
+		for (Role role : roles) {
+			ls.add(role.getRoleName());
+		}
+		i.setRolesName(ls);
+	}
+
+	@Override
 	public List<Admin> selectAllAdmin() {
 		return adminMapper.selectAllAdmin(null);
 	}
@@ -77,6 +96,7 @@ public class NewAdminServiceImpl extends BaseMybatisDao<AdminMapper> implements
 		Map<String, Object> params = new HashMap<>();
 		params.put("uid", ad.getId());
 		params.put("roles", roleIds);
+		Set<String> useRole = roleMapper.findRoleByUserId(ad.getId());
 		if (ad.getId() != "1") {
 			userRoleMapper.deleteByUserId(ad.getId());
 			if (!roleIds.isEmpty()) {
@@ -84,13 +104,98 @@ public class NewAdminServiceImpl extends BaseMybatisDao<AdminMapper> implements
 			}
 			TokenManager.clearUserAuthByUserId(ad.getId());
 		}
+
 		ad.setType(sumType(roleIds));
 		int count=adminMapper.updateByPrimaryKeySelective(ad);
-		List<Admin> Nos =adminMapper.selectIDNBySuperiorId(ad.getId());
+		pushAmbRole(ad);
+		pushAdminRole(ad.getId(),roleIds,useRole);
+		if (count>0&&ad.getAmbId()!=null){
+			//进行巴人数计算
+//			AmbSystem ambSystem = ambSystemMapper.selectByPrimaryKey(Long.valueOf(ad.getAmbId()));
+//			if (ambSystem.getAncestors()!=null){
+//				List<String> list = Arrays.asList(ambSystem.getAncestors().split(","));
+//
+//			}
+
+
+		}
 		return count;
 	}
 
 
+
+	private void pushAdminRole(String id,List<String>roleIds, Set<String> useRole) {
+		Integer flag=0;
+		String roleType="";
+		//加入以前有也要重新计算
+		if (useRole!=null){
+			for (String s : useRole) {
+				if (AFTConstants.SALESMAN_ADMIN.equals(s)){
+					flag=1;
+					roleType=AFTConstants.SALESMAN_ADMIN;
+					break;
+				}else if (AFTConstants.COMPANY_MANAGER.equals(s)){
+					flag=2;
+					roleType=AFTConstants.COMPANY_MANAGER;
+					break;
+				}else if (AFTConstants.FINANCE_ADMIN.equals(s)){
+					flag=3;
+					roleType=AFTConstants.FINANCE_ADMIN;
+					break;
+				}else if (AFTConstants.TECH_ADMIN.equals(s)){
+					flag=4;
+					roleType=AFTConstants.TECH_ADMIN;
+					break;
+				}else if (AFTConstants.TECH.equals(s)){
+					flag=5;
+					roleType=AFTConstants.TECH;
+					break;
+				}else if (AFTConstants.TECH_MANAGER.equals(s)){
+					flag=6;
+					roleType=AFTConstants.TECH_MANAGER;
+					break;
+				}
+			}
+		}
+		List<Role> roleList = roleMapper.selectByIdList(roleIds);
+		if (roleList!=null){
+			for (Role role : roleList) {
+				if (AFTConstants.SALESMAN_ADMIN.equals(role.getRoleType().toString())){
+					flag=1;
+					roleType=AFTConstants.SALESMAN_ADMIN;
+					break;
+				}else if (AFTConstants.COMPANY_MANAGER.equals(role.getRoleType().toString())){
+					flag=2;
+					roleType=AFTConstants.COMPANY_MANAGER;
+					break;
+				}else if (AFTConstants.FINANCE_ADMIN.equals(role.getRoleType().toString())){
+					flag=3;
+					roleType=AFTConstants.FINANCE_ADMIN;
+					break;
+				}else if (AFTConstants.TECH_ADMIN.equals(role.getRoleType().toString())){
+					flag=4;
+					roleType=AFTConstants.TECH_ADMIN;
+					break;
+				}else if (AFTConstants.TECH.equals(role.getRoleType().toString())){
+					flag=5;
+					roleType=AFTConstants.TECH;
+					break;
+				}else if (AFTConstants.TECH_MANAGER.equals(role.getRoleType().toString())){
+					flag=6;
+					roleType=AFTConstants.TECH_MANAGER;
+					break;
+				}
+			}
+		}
+		if (flag!=0){
+
+			asyncUtils.updateListExamineName(flag,id,roleType);
+		}
+
+
+	}
+
+
 	private int sumType(List<String > roleIds) {
 		int type=0;
 		for (String roleId : roleIds) {
@@ -205,7 +310,7 @@ public class NewAdminServiceImpl extends BaseMybatisDao<AdminMapper> implements
 
 	@Override
 	public int insertNewAdmin(Admin ad ,List<String> roleIds) {
-		ad.setStatus("正常");
+		ad.setStatus("0");
 		ad.setId(UUID.randomUUID().toString());
 		ad.setType(sumType(roleIds));
 
@@ -220,7 +325,33 @@ public class NewAdminServiceImpl extends BaseMybatisDao<AdminMapper> implements
 			}
 			TokenManager.clearUserAuthByUserId(ad.getId());
 		}
-		return adminMapper.insert(ad);
+		if(ad.getAmbId()!=null)pushAmbRole(ad);
+		adminMapper.insertSelective(ad);
+		pushAdminRole(ad.getId(),roleIds,null);
+		return 1;
+	}
+
+	/**
+	 * 计算巴权限
+	 * @param ad
+	 */
+	private void pushAmbRole(Admin ad) {
+		if (ad.getId()!=null){
+			ad.setAmbRole("7");
+		}else {
+			Admin use = adminMapper.selectByPrimaryKey(ad.getId());
+			AmbSystem ambSystem = ambSystemMapper.selectByPrimaryKey(Long.valueOf(ad.getAmbId()));
+			if (ambSystem.getLvl() == 5 || ambSystem.getLvl() == 6) {
+				if (use.getAmbRole() == null) {
+					ad.setAmbRole("7");
+				} else {
+					if (!use.getAmbRole().contains("7")) {
+						ad.setAmbRole(use.getAmbRole() + ",7");
+					}
+				}
+			}
+		}
+
 	}
 
 	@Override

+ 51 - 0
src/main/java/com/goafanti/ambSystem/bo/AmbAll.java

@@ -0,0 +1,51 @@
+package com.goafanti.ambSystem.bo;
+
+import java.util.List;
+
+public class AmbAll {
+    private Long id;
+    private String name;
+    private Integer lvl;
+    private Long parentId;
+    private List<AmbAll> list;
+
+    public Long getId() {
+        return id;
+    }
+
+    public void setId(Long id) {
+        this.id = id;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    public Integer getLvl() {
+        return lvl;
+    }
+
+    public void setLvl(Integer lvl) {
+        this.lvl = lvl;
+    }
+
+    public Long getParentId() {
+        return parentId;
+    }
+
+    public void setParentId(Long parentId) {
+        this.parentId = parentId;
+    }
+
+    public List<AmbAll> getList() {
+        return list;
+    }
+
+    public void setList(List<AmbAll> list) {
+        this.list = list;
+    }
+}

+ 241 - 0
src/main/java/com/goafanti/ambSystem/bo/InputAmb.java

@@ -0,0 +1,241 @@
+package com.goafanti.ambSystem.bo;
+
+import com.goafanti.common.constant.ErrorConstants;
+import com.goafanti.common.model.AmbSystem;
+import com.goafanti.common.utils.Param;
+
+import javax.validation.constraints.NotNull;
+import java.util.Date;
+
+public class InputAmb extends AmbSystem {
+    /**
+     * 部门id
+     */
+
+    private Long id;
+
+    /**
+     * 父部门id
+     */
+    @Param(name="上级部门")
+    @NotNull(message = "{"+ ErrorConstants.PARAM_EMPTY_ERROR+"}")
+    private Long parentId;
+
+    /**
+     * 祖级列表
+     */
+    private String ancestors;
+
+    /**
+     * 部门名称
+     */
+    @Param(name="吧名称")
+    @NotNull(message = "{"+ ErrorConstants.PARAM_EMPTY_ERROR+"}")
+    private String name;
+
+    /**
+     * 显示顺序
+     */
+    private Integer orderNum;
+
+    /**
+     * 负责人
+     */
+    @Param(name="巴负责人")
+    @NotNull(message = "{"+ ErrorConstants.PARAM_EMPTY_ERROR+"}")
+    private String leader;
+
+    /**
+     * 部门状态(0正常 1停用)
+     */
+    private String status;
+
+    /**
+     * 创建者
+     */
+    private String createBy;
+
+    /**
+     * 创建时间
+     */
+    private Date createTime;
+
+    /**
+     * 更新者
+     */
+    private String updateBy;
+
+    /**
+     * 更新时间
+     */
+    private Date updateTime;
+
+    /**
+     * 层级 0=集团,1=管综经开总,2=大区总,3=区总,4=事业部总,5=战区总,6=巴总
+     */
+    private Integer lvl;
+
+    /**
+     * 财务id
+     */
+    @Param(name="财务负责人")
+    @NotNull(message = "{"+ ErrorConstants.PARAM_EMPTY_ERROR+"}")
+    private String financeId;
+
+
+    /**
+     * 会计id
+     */
+    @Param(name="会计负责人")
+    @NotNull(message = "{"+ ErrorConstants.PARAM_EMPTY_ERROR+"}")
+    private String accountant;
+
+    /**
+     * 祖级名称
+     */
+    private String ancestorsNames;
+
+    private Integer pageNo;
+    private Integer pageSize;
+
+
+    @Override
+    public String getAccountant() {
+        return accountant;
+    }
+
+    @Override
+    public void setAccountant(String accountant) {
+        this.accountant = accountant;
+    }
+
+    public Integer getPageNo() {
+        return pageNo;
+    }
+
+    public void setPageNo(Integer pageNo) {
+        this.pageNo = pageNo;
+    }
+
+    public Integer getPageSize() {
+        return pageSize;
+    }
+
+    public void setPageSize(Integer pageSize) {
+        this.pageSize = pageSize;
+    }
+
+    private static final long serialVersionUID = 1L;
+
+    public Long getId() {
+        return id;
+    }
+
+    public void setId(Long id) {
+        this.id = id;
+    }
+
+    public Long getParentId() {
+        return parentId;
+    }
+
+    public void setParentId(Long parentId) {
+        this.parentId = parentId;
+    }
+
+    public String getAncestors() {
+        return ancestors;
+    }
+
+    public void setAncestors(String ancestors) {
+        this.ancestors = ancestors;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    public Integer getOrderNum() {
+        return orderNum;
+    }
+
+    public void setOrderNum(Integer orderNum) {
+        this.orderNum = orderNum;
+    }
+
+    public String getLeader() {
+        return leader;
+    }
+
+    public void setLeader(String leader) {
+        this.leader = leader;
+    }
+
+    public String getStatus() {
+        return status;
+    }
+
+    public void setStatus(String status) {
+        this.status = status;
+    }
+
+    public String getCreateBy() {
+        return createBy;
+    }
+
+    public void setCreateBy(String createBy) {
+        this.createBy = createBy;
+    }
+
+    public Date getCreateTime() {
+        return createTime;
+    }
+
+    public void setCreateTime(Date createTime) {
+        this.createTime = createTime;
+    }
+
+    public String getUpdateBy() {
+        return updateBy;
+    }
+
+    public void setUpdateBy(String updateBy) {
+        this.updateBy = updateBy;
+    }
+
+    public Date getUpdateTime() {
+        return updateTime;
+    }
+
+    public void setUpdateTime(Date updateTime) {
+        this.updateTime = updateTime;
+    }
+
+    public Integer getLvl() {
+        return lvl;
+    }
+
+    public void setLvl(Integer lvl) {
+        this.lvl = lvl;
+    }
+
+    public String getFinanceId() {
+        return financeId;
+    }
+
+    public void setFinanceId(String financeId) {
+        this.financeId = financeId;
+    }
+
+    public String getAncestorsNames() {
+        return ancestorsNames;
+    }
+
+    public void setAncestorsNames(String ancestorsNames) {
+        this.ancestorsNames = ancestorsNames;
+    }
+}

+ 81 - 0
src/main/java/com/goafanti/ambSystem/bo/OutAmb.java

@@ -0,0 +1,81 @@
+package com.goafanti.ambSystem.bo;
+
+
+
+public class OutAmb {
+    /**
+     * 部门id
+     */
+    private Long id;
+    private String name;
+    private String ancestorsNames;
+    private String leaderName;
+    private String  financeName;
+    private String  accountantName;
+    private String createTimes;
+    private Integer status;
+
+    public String getCreateTimes() {
+        return createTimes;
+    }
+
+    public void setCreateTimes(String createTimes) {
+        this.createTimes = createTimes;
+    }
+
+    public Integer getStatus() {
+        return status;
+    }
+
+    public void setStatus(Integer status) {
+        this.status = status;
+    }
+
+    public String getAccountantName() {
+        return accountantName;
+    }
+
+    public void setAccountantName(String accountantName) {
+        this.accountantName = accountantName;
+    }
+
+    public Long getId() {
+        return id;
+    }
+
+    public void setId(Long id) {
+        this.id = id;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    public String getAncestorsNames() {
+        return ancestorsNames;
+    }
+
+    public void setAncestorsNames(String ancestorsNames) {
+        this.ancestorsNames = ancestorsNames;
+    }
+
+    public String getLeaderName() {
+        return leaderName;
+    }
+
+    public void setLeaderName(String leaderName) {
+        this.leaderName = leaderName;
+    }
+
+    public String getFinanceName() {
+        return financeName;
+    }
+
+    public void setFinanceName(String financeName) {
+        this.financeName = financeName;
+    }
+}

+ 73 - 0
src/main/java/com/goafanti/ambSystem/bo/OutAmbDtails.java

@@ -0,0 +1,73 @@
+package com.goafanti.ambSystem.bo;
+
+
+import com.goafanti.common.model.AmbSystem;
+
+public class OutAmbDtails extends AmbSystem {
+    /**
+     * 部门id
+     */
+    private Long id;
+    private String name;
+    private String ancestorsNames;
+    private String leaderName;
+    private String  financeName;
+    private String  accountantName;
+    private String  createTimes;
+
+    public String getCreateTimes() {
+        return createTimes;
+    }
+
+    public void setCreateTimes(String createTimes) {
+        this.createTimes = createTimes;
+    }
+
+    public String getAccountantName() {
+        return accountantName;
+    }
+
+    public void setAccountantName(String accountantName) {
+        this.accountantName = accountantName;
+    }
+
+    public Long getId() {
+        return id;
+    }
+
+    public void setId(Long id) {
+        this.id = id;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    public String getAncestorsNames() {
+        return ancestorsNames;
+    }
+
+    public void setAncestorsNames(String ancestorsNames) {
+        this.ancestorsNames = ancestorsNames;
+    }
+
+    public String getLeaderName() {
+        return leaderName;
+    }
+
+    public void setLeaderName(String leaderName) {
+        this.leaderName = leaderName;
+    }
+
+    public String getFinanceName() {
+        return financeName;
+    }
+
+    public void setFinanceName(String financeName) {
+        this.financeName = financeName;
+    }
+}

+ 92 - 0
src/main/java/com/goafanti/ambSystem/controller/AmbApiController.java

@@ -0,0 +1,92 @@
+package com.goafanti.ambSystem.controller;
+
+import com.goafanti.ambSystem.bo.InputAmb;
+import com.goafanti.ambSystem.service.AmbService;
+import com.goafanti.common.bo.Result;
+import com.goafanti.common.constant.ErrorConstants;
+import com.goafanti.common.controller.CertifyApiController;
+import com.goafanti.common.utils.*;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.validation.BindingResult;
+import org.springframework.validation.annotation.Validated;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.bind.annotation.RestController;
+
+
+@RestController
+@RequestMapping(value = "/api/admin/amb")
+public class AmbApiController extends CertifyApiController {
+	@Autowired
+	private AmbService ambService;
+
+	@RequestMapping(value="/add",method = RequestMethod.POST)
+	public Result addAmb(@Validated InputAmb in,BindingResult bindingResult){
+		Result res =new Result();
+		if (bindingResult.hasErrors()) {
+			res.getError().add(buildErrorByMsg(bindingResult.getFieldError().getDefaultMessage(),
+					ParamUtils.getParamName(in,bindingResult.getFieldError().getField())));
+			return res;
+		}
+		int i=ambService.checkAmb(in,0);
+		if (i==-1){
+			res.getError().add(buildError(String.format("[%s]已存在,请确认后再新增",in.getName())));
+			return res;
+		}
+		res.data(ambService.addAmb(in));
+		return res;
+	}
+
+	@RequestMapping(value="/update",method = RequestMethod.POST)
+	public Result updateAmb( InputAmb in){
+		Result res =new Result();
+		if (in.getId()==null){
+			res.getError().add(buildErrorMessageParams(ErrorConstants.PARAM_EMPTY_ERROR,"巴编号"));
+			return res;
+		}
+		res.data(ambService.updateAmb(in));
+		return res;
+	}
+
+	@RequestMapping(value="/delete",method = RequestMethod.POST)
+	public Result deleteAmb( InputAmb in){
+		Result res =new Result();
+		if (in.getId()==null){
+			res.getError().add(buildErrorMessageParams(ErrorConstants.PARAM_EMPTY_ERROR,"巴编号"));
+			return res;
+		}
+		int i=ambService.checkAmb(in,2);
+		if (i==-1){
+			res.getError().add(buildError("巴存在子项目,请先删除所有子项"));
+			return res;
+		}
+		res.data(ambService.deleteAmb(in));
+		return res;
+	}
+
+	@RequestMapping(value="/details",method = RequestMethod.GET)
+	public Result detailsAmb( InputAmb in){
+		Result res =new Result();
+		if (in.getId()==null){
+			res.getError().add(buildErrorMessageParams(ErrorConstants.PARAM_EMPTY_ERROR,"巴编号"));
+			return res;
+		}
+		res.data(ambService.detailsAmb(in));
+		return res;
+	}
+
+	@RequestMapping(value="/select",method = RequestMethod.GET)
+	public Result selectAmb( InputAmb in){
+		Result res =new Result();
+		res.data(ambService.selectAmb(in));
+		return res;
+	}
+
+	@RequestMapping(value="/selectAll",method = RequestMethod.GET)
+	public Result selectAll( ){
+		Result res =new Result();
+		res.data(ambService.selectAll());
+		return res;
+	}
+
+}

+ 28 - 0
src/main/java/com/goafanti/ambSystem/service/AmbService.java

@@ -0,0 +1,28 @@
+package com.goafanti.ambSystem.service;
+
+import com.goafanti.ambSystem.bo.InputAmb;
+import com.goafanti.core.mybatis.page.Pagination;
+
+import java.util.List;
+
+public interface AmbService {
+    int addAmb(InputAmb in);
+
+    int updateAmb(InputAmb in);
+
+    Pagination<?> selectAmb(InputAmb in);
+
+    List<?> selectAll();
+
+    int deleteAmb(InputAmb in);
+
+    /**
+     *
+     * @param in
+     * @param type 0新增 1修改 2删除
+     * @return
+     */
+    int checkAmb(InputAmb in,Integer type);
+
+    Object detailsAmb(InputAmb in);
+}

+ 204 - 0
src/main/java/com/goafanti/ambSystem/service/Impl/AmbServiceImpl.java

@@ -0,0 +1,204 @@
+package com.goafanti.ambSystem.service.Impl;
+
+import com.goafanti.ambSystem.bo.AmbAll;
+import com.goafanti.ambSystem.bo.InputAmb;
+import com.goafanti.ambSystem.bo.OutAmb;
+import com.goafanti.ambSystem.service.AmbService;
+import com.goafanti.common.dao.AdminMapper;
+import com.goafanti.common.dao.AmbSystemMapper;
+import com.goafanti.common.error.BusinessException;
+import com.goafanti.common.model.Admin;
+import com.goafanti.common.model.AmbSystem;
+import com.goafanti.common.utils.StringUtils;
+import com.goafanti.core.mybatis.BaseMybatisDao;
+import com.goafanti.core.mybatis.page.Pagination;
+import com.goafanti.core.shiro.token.TokenManager;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.stereotype.Service;
+
+import java.util.*;
+
+@Service
+public class AmbServiceImpl extends BaseMybatisDao<AmbSystemMapper> implements AmbService {
+    @Value(value = "${amb.maxLvl}")
+    private Integer maxLvl=null;
+    @Autowired
+    private AmbSystemMapper ambSystemMapper;
+    @Autowired
+    private AdminMapper adminMapper;
+
+    @Override
+    public int addAmb(InputAmb in) {
+        getParentParam(in);
+        in.setStatus("0");
+        in.setCreateBy(TokenManager.getAdminId());
+        in.setCreateTime(new Date());
+        ambSystemMapper.insertSelective(in);
+        pushAdminAmbRole(in,null);
+        return  1;
+    }
+
+    public  void getParentParam(InputAmb in){
+        AmbSystem parentAmb = ambSystemMapper.selectByPrimaryKey(in.getParentId());
+        in.setLvl(parentAmb.getLvl()+1);
+        if (in.getLvl()>maxLvl)throw new BusinessException(String.format("层级最多添加%s层,如需添加更多请联系管理员。",maxLvl));
+        in.setAncestors(parentAmb.getAncestors()+","+parentAmb.getId());
+        in.setAncestorsNames(getAncestorsNames(in.getAncestors()));
+    }
+
+    @Override
+    public int updateAmb(InputAmb in) {
+        AmbSystem use = ambSystemMapper.selectByPrimaryKey(in.getId());
+        int i=0;
+        //0为执行计算巴名称,1为已执行,无需再执行
+        if (in.getParentId()!=null&&in.getParentId()!=use.getParentId()){
+            getParentParam(in);
+            i=updateAncestorsNames(in,use.getName(),i);
+        }
+        if (in.getName()!=null&&!in.getName().equals(use.getName())){
+            i=updateAncestorsNames(in,use.getName(),i);
+        }
+        in.setUpdateBy(TokenManager.getAdminId());
+        in.setUpdateTime(new Date());
+        ambSystemMapper.updateByPrimaryKeySelective(in);
+        if (!in.getLeader().equals(use.getLeader()))pushAdminAmbRole(in,use);
+        return 1;
+    }
+
+    /**
+     * 设置巴主巴角色
+     * @param in
+     */
+    private void pushAdminAmbRole(InputAmb in,AmbSystem use) {
+        //如果是修改,处理原负责人
+        if (in.getId()!=null){
+            if (in.getLeader()!=null){
+                updateAmbRole(use.getLeader());
+            }
+        }
+        updateAmbRole(in.getLeader());
+    }
+
+    /**
+     *
+     * @param leader
+     */
+    private void updateAmbRole(String  leader) {
+        StringBuffer str=new StringBuffer();
+        List<AmbSystem> list=selectByLeader(leader);
+        Admin a =new Admin();
+        for (AmbSystem ambSystem : list) {
+            if (ambSystem.getLvl()==5||ambSystem.getLvl()==6){
+                a.setAmbManage(1);
+            }
+            str.append(ambSystem.getLvl()).append(",");
+
+        }
+        a.setId(leader);
+        if (StringUtils.isNotBlank(str)) a.setAmbRole(str.substring(0,str.length()-1));
+        adminMapper.updateByPrimaryKeySelective(a);
+
+    }
+    private List<AmbSystem> selectByLeader(String leader) {
+        AmbSystem a =new AmbSystem();
+        a.setLeader(leader);
+        return ambSystemMapper.selectByParameter(a);
+    }
+
+    private List<AmbSystem> selectByParentId(Long parentId) {
+        AmbSystem a =new AmbSystem();
+        a.setParentId(parentId);
+        return ambSystemMapper.selectByParameter(a);
+    }
+
+    private int updateAncestorsNames(InputAmb in,String useName,Integer i) {
+        if (i>0)return i;
+        return ambSystemMapper.updateAncestorsNames(in.getId(),in.getName(),useName);
+    }
+
+    @Override
+    public Pagination<OutAmb> selectAmb(InputAmb in) {
+        HashMap<String, Object> param = new HashMap<>();
+        param.put("name",in.getName());
+        param.put("lvl",in.getLvl());
+        param.put("leader",in.getLeader());
+        param.put("ancestors",in.getAncestors());
+        return (Pagination<OutAmb>) findPage("selectAmbSystemList","selectAmbSystemCount",param,in.getPageNo(),in.getPageSize());
+    }
+
+    @Override
+    public List<?> selectAll() {
+        List<AmbAll> list = ambSystemMapper.getAncestorsList(null);
+        List<AmbAll> all=new ArrayList<>();
+        for (AmbAll a : list) {
+            if (a.getLvl()==0){
+                pushLvl(a,list);
+                all.add(a);
+            }
+        }
+
+        return all;
+    }
+
+    @Override
+    public int deleteAmb(InputAmb in) {
+        return ambSystemMapper.deleteByPrimaryKey(in.getId());
+    }
+
+    @Override
+    public int checkAmb(InputAmb in,Integer type) {
+
+        if (type==0){
+            int i = ambSystemMapper.selectByName(in.getName());
+            if (i>0)return -1;
+        }else if (type==2){
+            List<AmbSystem> ambSystems = selectByParentId(in.getId());
+            if (!ambSystems.isEmpty())return -1;
+        }
+
+        return 0;
+    }
+
+
+
+    @Override
+    public Object detailsAmb(InputAmb in) {
+        return ambSystemMapper.selectDtailsAmb(in.getId());
+    }
+
+    private void pushLvl(AmbAll a , List<AmbAll> list) {
+        if (a.getLvl()<7){
+            List<AmbAll> all=new ArrayList<>();
+            for (AmbAll as : list) {
+                if (as.getParentId().equals(a.getId())){
+                    pushLvl(as,list);
+                    all.add(as);
+                }
+            }
+            a.setList(all);
+        }
+
+    }
+
+    private String getAncestorsNames(String ancestors) {
+        String[] split = ancestors.split(",");
+        List<String> list = Arrays.asList(split);
+        List<AmbAll> ancestorsList = ambSystemMapper.getAncestorsList(list);
+        StringBuffer sb=new StringBuffer();
+        for (AmbAll ambSystem : ancestorsList) {
+            for (String s : list) {
+                //第一层无需装配
+                if (!ambSystem.getId().toString().equals("1")){
+                    if (ambSystem.getId().toString().equals(s)){
+                        sb=sb.append(ambSystem.getName()).append(",");
+                        break;
+                    }
+                }
+            }
+        }
+        String str="";
+        if (sb.length()>1)str=sb.substring(0,sb.length()-1);
+        return str;
+    }
+}

+ 2 - 0
src/main/java/com/goafanti/common/constant/AFTConstants.java

@@ -35,6 +35,8 @@ public class AFTConstants {
 	public static final String  TECH		                        = "98";
 	/**	财务管理员*/
 	public static final String  FINANCE_ADMIN                       = "9997";
+	/**	湖南特批开票*/
+	public static final String  HN_APPROVED							= "9987";
 	/**	财务经理*/
 	public static final String  FINANCE_MANAGER						= "997";
 	/**	财务专员*/

+ 4 - 0
src/main/java/com/goafanti/common/controller/BaseController.java

@@ -103,6 +103,10 @@ public class BaseController {
 		}
 		return (String) msg;
 	}
+	protected Error buildErrorMessageParams(String key,Object... params) {
+		String msg = (String) errorResource.getProperty(key);
+		return  new Error(MessageFormat.format( msg, params));
+	}
 
 	protected String getErrorMessage(String key, Object... obj) {
 		return MessageFormat.format(getErrorMessage(key), obj);

+ 18 - 1
src/main/java/com/goafanti/common/controller/WebpageController.java

@@ -46,7 +46,7 @@ public class WebpageController extends BaseController {
 
 
 	@RequestMapping(value = "/user/account/index", method = RequestMethod.GET)
-	public ModelAndView index(HttpServletRequest request, ModelAndView modelview) {
+	public ModelAndView UserIndex(HttpServletRequest request, ModelAndView modelview) {
 		modelview.setViewName("/user/account/index");
 		return modelview;
 	}
@@ -198,6 +198,11 @@ public class WebpageController extends BaseController {
 		modelview.setViewName("/admin/index");
 		return modelview;
 	}
+	@RequestMapping(value = "/admin/amiba", method = RequestMethod.GET)
+	public ModelAndView adminAmiba(HttpServletRequest request, ModelAndView modelview) {
+		modelview.setViewName("/admin/amiba");
+		return modelview;
+	}
 
 	@RequestMapping(value = "/admin/idea", method = RequestMethod.GET)
 	public ModelAndView adminIdea(HttpServletRequest request, ModelAndView modelview) {
@@ -475,4 +480,16 @@ public class WebpageController extends BaseController {
 		return modelview;
 	}
 
+	@RequestMapping(value = "/portal/webSocket", method = RequestMethod.GET)
+	public ModelAndView webSocket(HttpServletRequest request, ModelAndView modelview) {
+		modelview.setViewName("/portal/webSocket");
+		return modelview;
+	}
+
+	@RequestMapping(value = "/open/index", method = RequestMethod.GET)
+	public ModelAndView index(HttpServletRequest request, ModelAndView modelview) {
+		modelview.setViewName("/portal/index");
+		return modelview;
+	}
+
 }

+ 14 - 3
src/main/java/com/goafanti/common/dao/AdminMapper.java

@@ -71,9 +71,9 @@ public interface AdminMapper {
 
     String selectNameByid(String id);
 
-    List<String>selectRolesByUid(String id);
+    List<Role> selectRolesByUid(String id);
+
 
-    List<String>selectRolesIdByUid(String id);
 
     String selectStatusByMobile(@Param("mobile")String mobile);
 
@@ -128,7 +128,15 @@ public interface AdminMapper {
 
     List<String> getaidFrequentContacts(String id);
 
-    List<String> listNameByDepAndName(@Param("depId")String depId,@Param("roleName")String roleName);
+    /**
+     * 获取属于某部门的角色
+     * @param depId
+     * @param roleType
+     * @return
+     */
+        List<String> listNameByDepAndName(@Param("depId")String depId,@Param("roleType")String roleType);
+
+    List<Admin> listAdminBydepIdAndRoleType(@Param("depId")String depId,@Param("roleType")String roleType);
 
     List<String> selectBySuperId(String aid);
 
@@ -150,4 +158,7 @@ public interface AdminMapper {
     List<String> getLowerFinanceDep(String aid);
 
 
+    int selectByAmbIdCount(String id);
+
+    List<Admin> selectAdminByRoleType(@Param("roleType") String roleType);
 }

+ 35 - 0
src/main/java/com/goafanti/common/dao/AmbSystemMapper.java

@@ -0,0 +1,35 @@
+package com.goafanti.common.dao;
+
+import com.goafanti.ambSystem.bo.AmbAll;
+import com.goafanti.ambSystem.bo.OutAmbDtails;
+import com.goafanti.common.model.AmbSystem;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+public interface AmbSystemMapper {
+    int deleteByPrimaryKey(Long id);
+
+    int insert(AmbSystem record);
+
+    int insertSelective(AmbSystem record);
+
+    AmbSystem selectByPrimaryKey(Long id);
+
+    int updateByPrimaryKeySelective(AmbSystem record);
+
+    int updateByPrimaryKey(AmbSystem record);
+
+    List<AmbAll> getAncestorsList(List<String> list);
+
+    List<AmbSystem> selectByParameter(AmbSystem a);
+
+    int selectByName(String name);
+
+    OutAmbDtails selectDtailsAmb(Long id);
+
+
+    int updateAncestorsNames(@Param(value = "id") Long id, @Param(value = "name")String name, @Param(value = "useName")String useName);
+
+    
+}

+ 12 - 0
src/main/java/com/goafanti/common/dao/NewOrderChangeMapper.java

@@ -40,4 +40,16 @@ public interface NewOrderChangeMapper {
     NewOrderChangeBo selectByChangeId(String changeId);
 
     NewOrderChangeBo selectByorderNoAndStatus(String orderNo);
+
+    /**
+     * 切换审核人员
+     * @param type 3财务
+     * @param depId 部门编号
+     * @param aid 切换后审核人
+     * @return
+     */
+    int updateExamineName(@Param("type")Integer type, @Param("depId")String depId, @Param("aid")String aid,
+                          @Param("names")String names);
+
+    int updateTaskExamineName(@Param("aid") String aid, @Param("taskReceiverId") String taskReceiverId,@Param("type") Integer type);
 }

+ 1 - 0
src/main/java/com/goafanti/common/dao/OrderExamineMapper.java

@@ -116,4 +116,5 @@ public interface OrderExamineMapper {
     void deleteByAidAndStatus(@Param("aid")String aid,  @Param("type")Integer type);
 
 
+    void updateBack(@Param("aid")String aid, @Param("taskReceiverId")String taskReceiverId);
 }

+ 8 - 8
src/main/java/com/goafanti/common/dao/RoleMapper.java

@@ -28,16 +28,16 @@ public interface RoleMapper {
 	int deleteByPrimaryKeys(List<String> records);
 
 	List<RolePermissionBo> findRolePermissionsExceptAreaManager();
-	
-	List<Role> findRoles();
-	
+
+	List<Role> selectByIdList(List<String> list);
+
 	List<RolePermissionBo> selectRolePList(String id);
-	
+
 	int selectCountByRoleId(List<String> records);
-	
+
 	String selectIdByName(String roleName);
-	
+
 	String selectNameById(String id);
-	
+
 	String selectIdByNamei(Role role);
-}
+}

+ 39 - 77
src/main/java/com/goafanti/common/dao/TOrderInvoiceMapper.java

@@ -11,82 +11,44 @@ import java.util.List;
 import org.apache.ibatis.annotations.Param;
 
 public interface TOrderInvoiceMapper {
+    int deleteByPrimaryKey(Integer id);
 
-	/**
-	 * This method was generated by MyBatis Generator. This method corresponds to the database table t_order_invoice
-	 * @mbg.generated  Fri May 17 09:46:50 CST 2019
-	 */
-	long countByExample(TOrderInvoiceExample example);
-
-	/**
-	 * This method was generated by MyBatis Generator. This method corresponds to the database table t_order_invoice
-	 * @mbg.generated  Fri May 17 09:46:50 CST 2019
-	 */
-	int deleteByExample(TOrderInvoiceExample example);
-
-	/**
-	 * This method was generated by MyBatis Generator. This method corresponds to the database table t_order_invoice
-	 * @mbg.generated  Fri May 17 09:46:50 CST 2019
-	 */
-	int deleteByPrimaryKey(Integer id);
-
-	/**
-	 * This method was generated by MyBatis Generator. This method corresponds to the database table t_order_invoice
-	 * @mbg.generated  Fri May 17 09:46:50 CST 2019
-	 */
-	int insert(TOrderInvoice record);
-
-	/**
-	 * This method was generated by MyBatis Generator. This method corresponds to the database table t_order_invoice
-	 * @mbg.generated  Fri May 17 09:46:50 CST 2019
-	 */
-	int insertSelective(TOrderInvoice record);
-
-	/**
-	 * This method was generated by MyBatis Generator. This method corresponds to the database table t_order_invoice
-	 * @mbg.generated  Fri May 17 09:46:50 CST 2019
-	 */
-	List<TOrderInvoice> selectByExample(TOrderInvoiceExample example);
-
-	/**
-	 * This method was generated by MyBatis Generator. This method corresponds to the database table t_order_invoice
-	 * @mbg.generated  Fri May 17 09:46:50 CST 2019
-	 */
-	TOrderInvoice selectByPrimaryKey(Integer id);
-
-	/**
-	 * This method was generated by MyBatis Generator. This method corresponds to the database table t_order_invoice
-	 * @mbg.generated  Fri May 17 09:46:50 CST 2019
-	 */
-	int updateByExampleSelective(@Param("record") TOrderInvoice record, @Param("example") TOrderInvoiceExample example);
-
-	/**
-	 * This method was generated by MyBatis Generator. This method corresponds to the database table t_order_invoice
-	 * @mbg.generated  Fri May 17 09:46:50 CST 2019
-	 */
-	int updateByExample(@Param("record") TOrderInvoice record, @Param("example") TOrderInvoiceExample example);
-
-	/**
-	 * This method was generated by MyBatis Generator. This method corresponds to the database table t_order_invoice
-	 * @mbg.generated  Fri May 17 09:46:50 CST 2019
-	 */
-	int updateByPrimaryKeySelective(TOrderInvoice record);
-
-	/**
-	 * This method was generated by MyBatis Generator. This method corresponds to the database table t_order_invoice
-	 * @mbg.generated  Fri May 17 09:46:50 CST 2019
-	 */
-	int updateByPrimaryKey(TOrderInvoice record);
-
-	String checkApplyAmount(@Param("orderNo")String orderNo,@Param("id")Integer id);
-
-	TOrderInvoiceDetails selectByInvoiceDitails(Integer id);
-
-	 BigDecimal conutAmountByOrderNo(String orderNo);
-
-	List<InvoiceBo> selectByOrderNo(String orderNo);
-
-	TOrderInvoiceDetails getInvoiceDetails(String orderNo);
-
-	List<OutInvoiceLog>  selectInvoiceLog(Integer id);
+    int insert(TOrderInvoice record);
+
+    int insertSelective(TOrderInvoice record);
+
+    TOrderInvoice selectByPrimaryKey(Integer id);
+
+    int updateByPrimaryKeySelective(TOrderInvoice record);
+
+    int updateByPrimaryKey(TOrderInvoice record);
+
+    String checkApplyAmount(@Param("orderNo")String orderNo,@Param("id")Integer id);
+
+    TOrderInvoiceDetails selectByInvoiceDitails(Integer id);
+
+    BigDecimal conutAmountByOrderNo(String orderNo);
+
+    List<InvoiceBo> selectByOrderNo(String orderNo);
+
+    TOrderInvoiceDetails getInvoiceDetails(String orderNo);
+
+    List<OutInvoiceLog>  selectInvoiceLog(Integer id);
+
+    /**
+     * 切换审核人员
+     * @param type 0财务  1营销管理员 3公司管理
+     * @param depId 部门编号
+     * @param aid 切换后审核人
+     * @return
+     */
+    int updateExamineName(@Param("type")Integer type, @Param("depId")String depId, @Param("aid")String aid
+        ,@Param("names")String names);
+
+    /**
+     * @param roleType
+     * @param depId
+     * @return
+     */
+    int updateListExamineName(@Param("type")Integer type, @Param("depId")String depId,@Param("roleType")String roleType);
 }

+ 10 - 0
src/main/java/com/goafanti/common/dao/TOrderNewMapper.java

@@ -57,4 +57,14 @@ public interface TOrderNewMapper {
     List<OutOrderSalesSource> orderSalesSource(InputOrderSalesSource in);
 
     TOrderNew  checkOrderProcessStatus(Integer tid);
+
+    /**
+     * 切换审核人员
+     * @param type 3财务
+     * @param depId 部门编号
+     * @param aid 切换后审核人
+     * @return
+     */
+    int updateExamineName(@Param("type")Integer type, @Param("depId")String depId, @Param("aid")String aid,
+                          @Param("names")String names);
 }

+ 0 - 2
src/main/java/com/goafanti/common/dao/UserMapper.java

@@ -59,14 +59,12 @@ public interface UserMapper {
 
     /**
      * 根据客户模糊搜索
-     * @param name
      * @return
      */
     List<CustomerSimpleBo> findCustomerByName(@Param("identifyName")String identifyName);
 
     /**
      * 判断客户是否存在
-     * @param name
      * @return
      */
     int judgeCustomerByName(@Param("identifyName")String identifyName);

+ 147 - 88
src/main/java/com/goafanti/common/mapper/AdminMapper.xml

@@ -24,11 +24,14 @@
     <result column="open_id" jdbcType="VARCHAR" property="openId" />
     <result column="type" jdbcType="INTEGER" property="type" />
     <result column="reviewer" jdbcType="VARCHAR" property="reviewer" />
+    <result column="amb_id" jdbcType="VARCHAR" property="ambId" />
+    <result column="amb_role" jdbcType="VARCHAR" property="ambRole" />
+    <result column="amb_manage" jdbcType="INTEGER" property="ambManage" />
   </resultMap>
   <sql id="Base_Column_List">
     id, mobile, `name`, `password`, email, create_time, `number`, province, `position`,
     superior_id, city, department_id, `status`, user_no, duty, district, head_portrait_url,
-    contact_mobile, last_login_time, open_id, `type`, reviewer
+    contact_mobile, last_login_time, open_id, `type`, reviewer, amb_id, amb_role, amb_manage
   </sql>
   <select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="BaseResultMap">
     select
@@ -40,30 +43,29 @@
     delete from admin
     where id = #{id,jdbcType=VARCHAR}
   </delete>
-  <insert id="insert" parameterType="com.goafanti.common.model.Admin">
-    insert into admin (id, mobile, `name`,
-      `password`, email, create_time,
-      `number`, province, `position`,
-      superior_id, city, department_id,
-      `status`, user_no, duty,
-      district, head_portrait_url, contact_mobile,
-      last_login_time, open_id, `type`,
-      reviewer)
-    values (#{id,jdbcType=VARCHAR}, #{mobile,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR},
-      #{password,jdbcType=VARCHAR}, #{email,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP},
-      #{number,jdbcType=INTEGER}, #{province,jdbcType=VARCHAR}, #{position,jdbcType=VARCHAR},
-      #{superiorId,jdbcType=VARCHAR}, #{city,jdbcType=VARCHAR}, #{departmentId,jdbcType=VARCHAR},
-      #{status,jdbcType=VARCHAR}, #{userNo,jdbcType=VARCHAR}, #{duty,jdbcType=VARCHAR},
-      #{district,jdbcType=VARCHAR}, #{headPortraitUrl,jdbcType=VARCHAR}, #{contactMobile,jdbcType=VARCHAR},
-      #{lastLoginTime,jdbcType=TIMESTAMP}, #{openId,jdbcType=VARCHAR}, #{type,jdbcType=INTEGER},
-      #{reviewer,jdbcType=VARCHAR})
+  <insert id="insert" keyColumn="id" keyProperty="id" parameterType="com.goafanti.common.model.Admin" useGeneratedKeys="true">
+    insert into admin (mobile, `name`, `password`,
+      email, create_time, `number`,
+      province, `position`, superior_id,
+      city, department_id, `status`,
+      user_no, duty, district,
+      head_portrait_url, contact_mobile, last_login_time,
+      open_id, `type`, reviewer,
+      amb_id, amb_role, amb_manage
+      )
+    values (#{mobile,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR}, #{password,jdbcType=VARCHAR},
+      #{email,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP}, #{number,jdbcType=INTEGER},
+      #{province,jdbcType=VARCHAR}, #{position,jdbcType=VARCHAR}, #{superiorId,jdbcType=VARCHAR},
+      #{city,jdbcType=VARCHAR}, #{departmentId,jdbcType=VARCHAR}, #{status,jdbcType=VARCHAR},
+      #{userNo,jdbcType=VARCHAR}, #{duty,jdbcType=VARCHAR}, #{district,jdbcType=VARCHAR},
+      #{headPortraitUrl,jdbcType=VARCHAR}, #{contactMobile,jdbcType=VARCHAR}, #{lastLoginTime,jdbcType=TIMESTAMP},
+      #{openId,jdbcType=VARCHAR}, #{type,jdbcType=INTEGER}, #{reviewer,jdbcType=VARCHAR},
+      #{ambId,jdbcType=VARCHAR}, #{ambRole,jdbcType=VARCHAR}, #{ambManage,jdbcType=INTEGER}
+      )
   </insert>
-  <insert id="insertSelective" parameterType="com.goafanti.common.model.Admin">
+  <insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="com.goafanti.common.model.Admin" useGeneratedKeys="true">
     insert into admin
     <trim prefix="(" suffix=")" suffixOverrides=",">
-      <if test="id != null">
-        id,
-      </if>
       <if test="mobile != null">
         mobile,
       </if>
@@ -127,11 +129,17 @@
       <if test="reviewer != null">
         reviewer,
       </if>
+      <if test="ambId != null">
+        amb_id,
+      </if>
+      <if test="ambRole != null">
+        amb_role,
+      </if>
+      <if test="ambManage != null">
+        amb_manage,
+      </if>
     </trim>
     <trim prefix="values (" suffix=")" suffixOverrides=",">
-      <if test="id != null">
-        #{id,jdbcType=VARCHAR},
-      </if>
       <if test="mobile != null">
         #{mobile,jdbcType=VARCHAR},
       </if>
@@ -195,6 +203,15 @@
       <if test="reviewer != null">
         #{reviewer,jdbcType=VARCHAR},
       </if>
+      <if test="ambId != null">
+        #{ambId,jdbcType=VARCHAR},
+      </if>
+      <if test="ambRole != null">
+        #{ambRole,jdbcType=VARCHAR},
+      </if>
+      <if test="ambManage != null">
+        #{ambManage,jdbcType=INTEGER},
+      </if>
     </trim>
   </insert>
   <update id="updateByPrimaryKeySelective" parameterType="com.goafanti.common.model.Admin">
@@ -263,6 +280,15 @@
       <if test="reviewer != null">
         reviewer = #{reviewer,jdbcType=VARCHAR},
       </if>
+      <if test="ambId != null">
+        amb_id = #{ambId,jdbcType=VARCHAR},
+      </if>
+      <if test="ambRole != null">
+        amb_role = #{ambRole,jdbcType=VARCHAR},
+      </if>
+      <if test="ambManage != null">
+        amb_manage = #{ambManage,jdbcType=INTEGER},
+      </if>
     </set>
     where id = #{id,jdbcType=VARCHAR}
   </update>
@@ -288,15 +314,17 @@
       last_login_time = #{lastLoginTime,jdbcType=TIMESTAMP},
       open_id = #{openId,jdbcType=VARCHAR},
       `type` = #{type,jdbcType=INTEGER},
-      reviewer = #{reviewer,jdbcType=VARCHAR}
+      reviewer = #{reviewer,jdbcType=VARCHAR},
+      amb_id = #{ambId,jdbcType=VARCHAR},
+      amb_role = #{ambRole,jdbcType=VARCHAR},
+      amb_manage = #{ambManage,jdbcType=INTEGER}
     where id = #{id,jdbcType=VARCHAR}
   </update>
-
   <select id="selectAllAdmin" resultMap="BaseResultMap">
     select
     <include refid="Base_Column_List" />
     from admin
-    where status !='锁定'
+    where status ='0'
     <if test="depId != null">
       and department_id = #{depId,jdbcType=VARCHAR}
     </if>
@@ -508,47 +536,38 @@
   <select id="listAdminByName" parameterType="java.lang.String" resultMap="BaseResultMap">
     select id,name from admin where   name like concat('%',#{name},'%')
     <if test="status==0">
-      and status= '正常'
+      and status= '0'
     </if>
     <if test="status==1">
-      and status= '锁定'
+      and status= '1'
     </if>
   </select>
 
   <!--*************************************************************************-->
   <select id="selectAdminListByPage" parameterType="java.lang.String" resultType="com.goafanti.admin.bo.AdminListBo">
-    select x.*,y.name as departmentName from(select
-    <!-- a.user_no as userNo, -->
-    a.mobile, a.name,
-    a.position, a.email, a.id,
-    a.province,
-    a.city,
-    a.create_time as createTime,
-    aa.name as superior,
-    a.superior_id as superiorId,
-    a.department_id as departmentId,
-    a.last_login_time as lastLoginTime,
-    a.contact_mobile as contactMobile,
-    a.duty,a.status,
-    a.type
+    select a.id, a.mobile, a.name, a.position, a.email, a.province, a.city, a.create_time as createTime, aa.name as superior,dep.name departmentName,
+    a.superior_id as superiorId, a.department_id as departmentId, a.last_login_time as lastLoginTime, a.contact_mobile as contactMobile,
+    a.duty,a.status, a.type, ambs.id ambId,ambs.name ambName,ambs.ancestors_names ancestorsNames ,a.amb_role ambRole
     from admin a
     left join admin_location al on a.id = al.admin_id
     left join admin aa on aa.id = a.superior_id
-    left join user_role ur on a.id=ur.uid
-    left join `role` y on ur.rid=y.id
-    where a.id <![CDATA[ <> ]]> '1'
+    left join amb_system ambs on a.amb_id=ambs.id
+    left join department dep on a.department_id = dep.id
+    <if test="rid != null">
+      RIGHT join (select uid from user_role where rid=#{rid,jdbcType=VARCHAR}) ur on a.id=ur.uid
+    </if>
     <if test="roleName != null">
-      and y.role_name= #{roleName,jdbcType=VARCHAR}
+      left  join  user_role  ur on a.id=ur.uid
+      RIGHT join (select id from role where role_name =#{roleName,jdbcType=VARCHAR}) y on ur.rid=y.id
     </if>
+    where a.status in (0,1)
     <if test="name != null">
       and a.name like concat('%',#{name,jdbcType=VARCHAR},'%')
     </if>
     <if test="departmentId != null">
       and a.department_id = #{departmentId,jdbcType=VARCHAR}
     </if>
-    <if test="rid != null">
-      and ur.rid = #{rid,jdbcType=VARCHAR}
-    </if>
+
     <if test="duty != null">
       and a.duty = #{duty,jdbcType=VARCHAR}
     </if>
@@ -564,30 +583,41 @@
     <if test="superiorId != null">
       and a.superior_id = #{superiorId,jdbcType=VARCHAR}
     </if>
-    group by a.id
-    order by a.last_login_time,a.number )x left join department y on x.departmentId = y.id
+    <if test="ambId != null">
+      and a.amb_id = #{ambId}
+    </if>
+    <if test="ancestors != null">
+      and (ambs.id=#{ancestors} or find_in_set( #{ancestors} ,ambs.ancestors))
+    </if>
+    <if test="ambManage !=null">
+      and a.amb_manage= #{ambManage}
+    </if>
+    order by a.last_login_time desc
     <if test="page_sql!=null">
       ${page_sql}
     </if>
   </select>
   <select id="selectAdminCount" parameterType="java.lang.String" resultType="java.lang.Integer">
-    select count(t.counts)
-    from(select a.id counts from (select a.id  from admin a
-    left join user_role ur on a.id=ur.uid
-    left join `role` y on ur.rid=y.id
-    where a.id <![CDATA[ <> ]]> '1'
+    select count(*)
+    from admin a
+    left join admin_location al on a.id = al.admin_id
+    left join admin aa on aa.id = a.superior_id
+    left join amb_system ambs on a.amb_id=ambs.id
+    left join department dep on a.department_id = dep.id
+    <if test="rid != null">
+      RIGHT join (select * from user_role where rid=#{rid,jdbcType=VARCHAR}) ur on a.id=ur.uid
+    </if>
     <if test="roleName != null">
-      and y.role_name= #{roleName,jdbcType=VARCHAR}
+      left  join  user_role  ur on a.id=ur.uid
+      RIGHT join (select * from role where role_name =#{roleName,jdbcType=VARCHAR}) y on ur.rid=y.id
     </if>
+    where a.status in (0,1)
     <if test="name != null">
       and a.name like concat('%',#{name,jdbcType=VARCHAR},'%')
     </if>
     <if test="departmentId != null">
       and a.department_id = #{departmentId,jdbcType=VARCHAR}
     </if>
-    <if test="rid != null">
-      and ur.rid = #{rid,jdbcType=VARCHAR}
-    </if>
     <if test="duty != null">
       and a.duty = #{duty,jdbcType=VARCHAR}
     </if>
@@ -603,8 +633,15 @@
     <if test="superiorId != null">
       and a.superior_id = #{superiorId,jdbcType=VARCHAR}
     </if>
-    )a
-    group by a.id)t
+    <if test="ambId != null">
+      and a.amb_id = #{ambId}
+    </if>
+    <if test="ancestors != null">
+      and (ambs.id=#{ancestors} or find_in_set( #{ancestors} ,ambs.ancestors))
+    </if>
+    <if test="ambManage !=null">
+      and a.amb_manage= #{ambManage}
+    </if>
   </select>
   <insert id="insertn" parameterType="com.goafanti.common.model.Admin">
     insert into admin (id, mobile, name,
@@ -643,7 +680,7 @@
            a.province, a.`position`,a.reviewer , a.superior_id as superiorId,
            a.department_id as departmentId, a.status,a.user_no as userNo,a.duty,a.district,
            a.head_portrait_url as headPortraitUrl, a.contact_mobile as contactMobile,
-           b.name superior,c.name reviewerName,a.type
+           b.name superior,c.name reviewerName,a.type,a.amb_id ambId
     from admin a left join admin b on a.superior_id =b.id left join admin c on a.reviewer =c.id
     where a.id= #{id,jdbcType=VARCHAR}
   </select>
@@ -654,21 +691,15 @@
     where
       id=#{id,jdbcType=VARCHAR}
   </select>
-  <select id="selectRolesByUid" parameterType="java.lang.String" resultType="java.lang.String">
+  <select id="selectRolesByUid" parameterType="com.goafanti.common.model.Role" resultType="com.goafanti.common.model.Role">
     select
-      r.role_name as roles
+      r.id,r.role_name as roleName
     from user_role ur
            left join role r on r.id = ur.rid
     where
       uid=#{id,jdbcType=VARCHAR}
   </select>
-  <select id="selectRolesIdByUid" parameterType="java.lang.String" resultType="java.lang.String">
-    select
-      rid as rolesId
-    from user_role
-    where
-      uid=#{id,jdbcType=VARCHAR}
-  </select>
+
   <select id="selectStatusByMobile" parameterType="java.lang.String" resultType="java.lang.String">
     select
       status
@@ -758,7 +789,7 @@
     where c.role_name  = #{name,jdbcType=VARCHAR}
   </select>
   <update id="updateLockIds" parameterType="java.lang.String">
-    update admin set status = '锁定' where id in (${lockIds})
+    update admin set status = '1' where id in (${lockIds})
   </update>
 
   <!--  用户是为正常的 -->
@@ -770,14 +801,14 @@
   <select id="getAdminRoleNameList" parameterType="java.lang.String" resultMap="BaseResultMap">
     select a.id, a.name from admin a left join user_role b on a.id=b.uid
                                      left join `role` c on b.rid=c.id
-    where c.role_name  = #{name,jdbcType=VARCHAR} and a.status='正常'
+    where c.role_name  = #{name,jdbcType=VARCHAR} and a.status= 0
   </select>
 
   <select id="getAdminRoleNamesList" parameterType="java.lang.String" resultMap="BaseResultMap">
     select a.id, a.name from admin a left join user_role b on a.id=b.uid
-                                     left join `role` c on b.rid=c.id
-    where a.status='正常'
-      and  c.role_name  in
+    left join `role` c on b.rid=c.id
+    where a.status= 0
+    and  c.role_name  in
     <foreach close=")" collection="list" item="name" open="(" separator=",">
       #{name}
     </foreach>
@@ -786,13 +817,13 @@
   <select id="getAdminRoleTypeList" parameterType="java.lang.String" resultMap="BaseResultMap">
     select a.id, a.name from admin a left join user_role b on a.id=b.uid
                                      left join `role` c on b.rid=c.id
-    where c.role_type  = #{roleType} and a.status='正常'
+    where c.role_type  = #{roleType} and a.status= 0
   </select>
 
   <select id="getAdminRoleTypesList" parameterType="java.lang.String" resultMap="BaseResultMap">
     select a.id, a.name from admin a left join user_role b on a.id=b.uid
-                                     left join `role` c on b.rid=c.id
-    where a.status='正常'
+    left join `role` c on b.rid=c.id
+    where a.status= 0
     and  c.role_type  in
     <foreach close=")" collection="list" item="type" open="(" separator=",">
       #{type}
@@ -818,7 +849,7 @@
     on a.contacts_id=b.id left join department c
     on c.id=b.department_id left join user_role x on x.uid=b.id
     left join `role` y on x.rid=y.id
-    where b.status ='正常'
+    where b.status ='0'
     <if test="roleName != null">
       and y.role_name= #{roleName,jdbcType=VARCHAR}
     </if>
@@ -845,7 +876,7 @@
     on a.contacts_id=b.id
     left join user_role x on x.uid=b.id
     left join `role` y on x.rid=y.id
-    where b.status ='正常'
+    where b.status ='0'
     <if test="roleName != null">
       and y.role_name= #{roleName,jdbcType=VARCHAR}
     </if>
@@ -869,7 +900,7 @@
   </delete>
   <select id="getaidFrequentContacts" resultType="java.lang.String">
     select b.id from admin_contacts a left join admin b on a.contacts_id = b.id
-    where b.status = '正常' and a.aid= #{id,jdbcType=VARCHAR}
+    where b.status = '0' and a.aid= #{id,jdbcType=VARCHAR}
   </select>
 
 
@@ -901,7 +932,7 @@
     left join user_role e on a.id=e.uid
     left join `role` f on e.rid=f.id
     where f.role_name in ('营销员','营销经理')
-    and	 a.status='正常'
+    and	 a.status= 0
     <if test="depId != null">
       and a.department_id =  #{depId,jdbcType=VARCHAR}
     </if>
@@ -916,7 +947,7 @@
     left join user_role e on a.id=e.uid
     left join `role` f on e.rid=f.id
     where f.role_name in ('营销员','营销经理')
-    and	 a.status='正常'
+    and	 a.status= 0
     <if test="depId != null">
       and a.department_id =  #{depId,jdbcType=VARCHAR}
     </if>
@@ -1029,8 +1060,18 @@
     select a.id  from admin a left join user_role b on a.id =b.uid
                               left join `role` c on b.rid=c.id
     where department_id= #{depId}
-      and c.role_name= #{roleName}
+      and c.role_type= #{roleType}
+  </select>
+
+
+  <select id="listAdminBydepIdAndRoleType" resultType="com.goafanti.common.model.Admin">
+    select a.id,a.name  from admin a left join user_role b on a.id =b.uid
+                                     left join `role` c on b.rid=c.id
+    where department_id= #{depId}
+      and c.role_type= #{roleType}
   </select>
+
+
   <select id="selectBySuperId" resultType="java.lang.String">
     select id from admin where superior_id= #{aid}
   </select>
@@ -1072,4 +1113,22 @@
     select b.id from admin a left join department b on a.id=b.finance_id
     where a.superior_id = #{aid}
   </select>
+  <select id="selectByAmbIdCount" resultType="java.lang.Integer">
+    SELECT count(*) from admin where amb_id= #{ambId}
+  </select>
+  <select id="selectAdminByRoleType" parameterType="java.lang.String" resultType="com.goafanti.common.model.Admin">
+    SELECT a.id,a.name ,a.mobile ,a.email,a.department_id departmentId
+    FROM admin a left join user_role b on a.id=b.uid
+    left join `role` c on b.rid =c.id
+    where a.status='0'
+    <if test="roleType =='99998'">
+      and c.role_type  in ('99998','99988')
+    </if>
+    <if test="roleType =='99999'">
+      and c.role_type  in ('99999','99989')
+    </if>
+    <if test="roleType !='99999' and roleType !='99998'">
+      and c.role_type  in (#{roleType})
+    </if>
+  </select>
 </mapper>

+ 335 - 0
src/main/java/com/goafanti/common/mapper/AmbSystemMapper.xml

@@ -0,0 +1,335 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.goafanti.common.dao.AmbSystemMapper">
+  <resultMap id="BaseResultMap" type="com.goafanti.common.model.AmbSystem">
+    <id column="id" jdbcType="BIGINT" property="id" />
+    <result column="parent_id" jdbcType="BIGINT" property="parentId" />
+    <result column="ancestors" jdbcType="VARCHAR" property="ancestors" />
+    <result column="name" jdbcType="VARCHAR" property="name" />
+    <result column="order_num" jdbcType="INTEGER" property="orderNum" />
+    <result column="leader" jdbcType="VARCHAR" property="leader" />
+    <result column="status" jdbcType="CHAR" property="status" />
+    <result column="create_by" jdbcType="VARCHAR" property="createBy" />
+    <result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
+    <result column="update_by" jdbcType="VARCHAR" property="updateBy" />
+    <result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
+    <result column="lvl" jdbcType="INTEGER" property="lvl" />
+    <result column="finance_id" jdbcType="VARCHAR" property="financeId" />
+    <result column="ancestors_names" jdbcType="VARCHAR" property="ancestorsNames" />
+    <result column="accountant" jdbcType="VARCHAR" property="accountant" />
+    <result column="remarks" jdbcType="VARCHAR" property="remarks" />
+    <result column="total_amount" jdbcType="DECIMAL" property="totalAmount" />
+    <result column="members_count" jdbcType="INTEGER" property="membersCount" />
+  </resultMap>
+  <sql id="Base_Column_List">
+    id, parent_id, ancestors, `name`, order_num, leader, `status`, create_by, create_time,
+    update_by, update_time, lvl, finance_id, ancestors_names, accountant, remarks, total_amount,
+    members_count
+  </sql>
+  <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
+    select
+    <include refid="Base_Column_List" />
+    from amb_system
+    where id = #{id,jdbcType=BIGINT}
+  </select>
+  <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
+    delete from amb_system
+    where id = #{id,jdbcType=BIGINT}
+  </delete>
+  <insert id="insert" keyColumn="id" keyProperty="id" parameterType="com.goafanti.common.model.AmbSystem" useGeneratedKeys="true">
+    insert into amb_system (parent_id, ancestors, `name`,
+      order_num, leader, `status`,
+      create_by, create_time, update_by,
+      update_time, lvl, finance_id,
+      ancestors_names, accountant, remarks,
+      total_amount, members_count)
+    values (#{parentId,jdbcType=BIGINT}, #{ancestors,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR},
+      #{orderNum,jdbcType=INTEGER}, #{leader,jdbcType=VARCHAR}, #{status,jdbcType=CHAR},
+      #{createBy,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP}, #{updateBy,jdbcType=VARCHAR},
+      #{updateTime,jdbcType=TIMESTAMP}, #{lvl,jdbcType=INTEGER}, #{financeId,jdbcType=VARCHAR},
+      #{ancestorsNames,jdbcType=VARCHAR}, #{accountant,jdbcType=VARCHAR}, #{remarks,jdbcType=VARCHAR},
+      #{totalAmount,jdbcType=DECIMAL}, #{membersCount,jdbcType=INTEGER})
+  </insert>
+  <insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="com.goafanti.common.model.AmbSystem" useGeneratedKeys="true">
+    insert into amb_system
+    <trim prefix="(" suffix=")" suffixOverrides=",">
+      <if test="parentId != null">
+        parent_id,
+      </if>
+      <if test="ancestors != null">
+        ancestors,
+      </if>
+      <if test="name != null">
+        `name`,
+      </if>
+      <if test="orderNum != null">
+        order_num,
+      </if>
+      <if test="leader != null">
+        leader,
+      </if>
+      <if test="status != null">
+        `status`,
+      </if>
+      <if test="createBy != null">
+        create_by,
+      </if>
+      <if test="createTime != null">
+        create_time,
+      </if>
+      <if test="updateBy != null">
+        update_by,
+      </if>
+      <if test="updateTime != null">
+        update_time,
+      </if>
+      <if test="lvl != null">
+        lvl,
+      </if>
+      <if test="financeId != null">
+        finance_id,
+      </if>
+      <if test="ancestorsNames != null">
+        ancestors_names,
+      </if>
+      <if test="accountant != null">
+        accountant,
+      </if>
+      <if test="remarks != null">
+        remarks,
+      </if>
+      <if test="totalAmount != null">
+        total_amount,
+      </if>
+      <if test="membersCount != null">
+        members_count,
+      </if>
+    </trim>
+    <trim prefix="values (" suffix=")" suffixOverrides=",">
+      <if test="parentId != null">
+        #{parentId,jdbcType=BIGINT},
+      </if>
+      <if test="ancestors != null">
+        #{ancestors,jdbcType=VARCHAR},
+      </if>
+      <if test="name != null">
+        #{name,jdbcType=VARCHAR},
+      </if>
+      <if test="orderNum != null">
+        #{orderNum,jdbcType=INTEGER},
+      </if>
+      <if test="leader != null">
+        #{leader,jdbcType=VARCHAR},
+      </if>
+      <if test="status != null">
+        #{status,jdbcType=CHAR},
+      </if>
+      <if test="createBy != null">
+        #{createBy,jdbcType=VARCHAR},
+      </if>
+      <if test="createTime != null">
+        #{createTime,jdbcType=TIMESTAMP},
+      </if>
+      <if test="updateBy != null">
+        #{updateBy,jdbcType=VARCHAR},
+      </if>
+      <if test="updateTime != null">
+        #{updateTime,jdbcType=TIMESTAMP},
+      </if>
+      <if test="lvl != null">
+        #{lvl,jdbcType=INTEGER},
+      </if>
+      <if test="financeId != null">
+        #{financeId,jdbcType=VARCHAR},
+      </if>
+      <if test="ancestorsNames != null">
+        #{ancestorsNames,jdbcType=VARCHAR},
+      </if>
+      <if test="accountant != null">
+        #{accountant,jdbcType=VARCHAR},
+      </if>
+      <if test="remarks != null">
+        #{remarks,jdbcType=VARCHAR},
+      </if>
+      <if test="totalAmount != null">
+        #{totalAmount,jdbcType=DECIMAL},
+      </if>
+      <if test="membersCount != null">
+        #{membersCount,jdbcType=INTEGER},
+      </if>
+    </trim>
+  </insert>
+  <update id="updateByPrimaryKeySelective" parameterType="com.goafanti.common.model.AmbSystem">
+    update amb_system
+    <set>
+      <if test="parentId != null">
+        parent_id = #{parentId,jdbcType=BIGINT},
+      </if>
+      <if test="ancestors != null">
+        ancestors = #{ancestors,jdbcType=VARCHAR},
+      </if>
+      <if test="name != null">
+        `name` = #{name,jdbcType=VARCHAR},
+      </if>
+      <if test="orderNum != null">
+        order_num = #{orderNum,jdbcType=INTEGER},
+      </if>
+      <if test="leader != null">
+        leader = #{leader,jdbcType=VARCHAR},
+      </if>
+      <if test="status != null">
+        `status` = #{status,jdbcType=CHAR},
+      </if>
+      <if test="createBy != null">
+        create_by = #{createBy,jdbcType=VARCHAR},
+      </if>
+      <if test="createTime != null">
+        create_time = #{createTime,jdbcType=TIMESTAMP},
+      </if>
+      <if test="updateBy != null">
+        update_by = #{updateBy,jdbcType=VARCHAR},
+      </if>
+      <if test="updateTime != null">
+        update_time = #{updateTime,jdbcType=TIMESTAMP},
+      </if>
+      <if test="lvl != null">
+        lvl = #{lvl,jdbcType=INTEGER},
+      </if>
+      <if test="financeId != null">
+        finance_id = #{financeId,jdbcType=VARCHAR},
+      </if>
+      <if test="ancestorsNames != null">
+        ancestors_names = #{ancestorsNames,jdbcType=VARCHAR},
+      </if>
+      <if test="accountant != null">
+        accountant = #{accountant,jdbcType=VARCHAR},
+      </if>
+      <if test="remarks != null">
+        remarks = #{remarks,jdbcType=VARCHAR},
+      </if>
+      <if test="totalAmount != null">
+        total_amount = #{totalAmount,jdbcType=DECIMAL},
+      </if>
+      <if test="membersCount != null">
+        members_count = #{membersCount,jdbcType=INTEGER},
+      </if>
+    </set>
+    where id = #{id,jdbcType=BIGINT}
+  </update>
+  <update id="updateByPrimaryKey" parameterType="com.goafanti.common.model.AmbSystem">
+    update amb_system
+    set parent_id = #{parentId,jdbcType=BIGINT},
+      ancestors = #{ancestors,jdbcType=VARCHAR},
+      `name` = #{name,jdbcType=VARCHAR},
+      order_num = #{orderNum,jdbcType=INTEGER},
+      leader = #{leader,jdbcType=VARCHAR},
+      `status` = #{status,jdbcType=CHAR},
+      create_by = #{createBy,jdbcType=VARCHAR},
+      create_time = #{createTime,jdbcType=TIMESTAMP},
+      update_by = #{updateBy,jdbcType=VARCHAR},
+      update_time = #{updateTime,jdbcType=TIMESTAMP},
+      lvl = #{lvl,jdbcType=INTEGER},
+      finance_id = #{financeId,jdbcType=VARCHAR},
+      ancestors_names = #{ancestorsNames,jdbcType=VARCHAR},
+      accountant = #{accountant,jdbcType=VARCHAR},
+      remarks = #{remarks,jdbcType=VARCHAR},
+      total_amount = #{totalAmount,jdbcType=DECIMAL},
+      members_count = #{membersCount,jdbcType=INTEGER}
+    where id = #{id,jdbcType=BIGINT}
+  </update>
+  <update id="updateAncestorsNames">
+    update amb_system
+    set  ancestors_names=replace(ancestors_names,#{useName},#{name})
+    where FIND_IN_SET( #{id},ancestors)
+  </update>
+
+  <select id="getAncestorsList" resultType="com.goafanti.ambSystem.bo.AmbAll">
+    select id,name,lvl,parent_id parentId
+    from amb_system where status=0
+    <if test="list !=null and list.size>0 ">
+    and  id in
+    <foreach close=")" collection="list" item="id" open="(" separator=",">
+      #{id}
+    </foreach>
+  </if>
+  </select>
+
+  <select id="selectAmbSystemList" resultType="com.goafanti.ambSystem.bo.OutAmb">
+    select a.id,a.name ,a.ancestors_names ancestorsNames ,a.status,
+    b.name leaderName,c.name financeName,d.name accountantName,
+    date_format(a.create_time,'%Y-%m-%d %H:%i:%s')createTimes
+    from amb_system a
+    left join admin b on a.leader =b.id
+    left join admin c on a.finance_id =c.id
+    left join admin d on a.accountant =d.id
+    where 1=1
+    <if test="lvl &lt; 5">
+      and a.lvl= #{lvl}
+    </if>
+    <if test="lvl &gt; 4">
+      and a.lvl in(5,6)
+    </if>
+    <if test="leader !=null">
+      and a.leader= #{leader}
+    </if>
+    <if test="name !=null">
+      and a.name  like concat('%',#{name},'%')
+    </if>
+    <if test="ancestors !=null">
+      and (a.id=#{ancestors} or find_in_set( #{ancestors} ,a.ancestors))
+    </if>
+    order by id
+    <if test="page_sql !=null">
+      ${page_sql}
+    </if>
+  </select>
+
+  <select id="selectAmbSystemCount" resultType="java.lang.Integer">
+    select count(*)
+    from amb_system a
+    left join admin b on a.leader =b.id
+    left join admin c on a.finance_id =c.id
+    where 1=1
+    <if test="lvl &lt; 5">
+      and a.lvl= #{lvl}
+    </if>
+    <if test="lvl &gt; 4">
+      and a.lvl in(5,6)
+    </if>
+    <if test="leader !=null">
+      and a.leader= #{leader}
+    </if>
+    <if test="name !=null">
+      and a.name  like concat('%',#{name},'%')
+    </if>
+    <if test="ancestors !=null">
+      and (a.id=#{ancestors} or find_in_set( #{ancestors} ,a.ancestors))
+    </if>
+  </select>
+    <select id="selectByParameter"  parameterType="com.goafanti.common.model.AmbSystem" resultMap="BaseResultMap">
+        select
+        <include refid="Base_Column_List" />
+        from amb_system
+        where 1=1
+          <if test="parentId !=null">
+            and  parent_id = #{parentId}
+          </if>
+      <if test="leader !=null">
+        and  leader = #{leader}
+      </if>
+    </select>
+    <select id="selectByName" resultType="java.lang.Integer">
+      select
+       count(*)
+      from amb_system
+      where name= #{name}
+    </select>
+  <select id="selectDtailsAmb" resultType="com.goafanti.ambSystem.bo.OutAmbDtails">
+    select a.id,a.name,a.parent_id parentId,a.accountant,a.lvl,a.status,a.ancestors, a.ancestors_names ancestorsNames,
+        a.order_num orderNum,a.remarks, date_format(a.create_time,'%Y-%m-%d %H:%i:%s')createTimes, a.leader,
+        a.finance_id financeId, b.name leaderName,c.name financeName,d.name accountantName
+    from amb_system a left join admin b on a.leader =b.id left join admin c on a.finance_id =c.id
+    left join admin d on a.accountant =d.id
+    where a.id= #{id}
+  </select>
+</mapper>

+ 3 - 3
src/main/java/com/goafanti/common/mapper/DepartmentMapper.xml

@@ -355,7 +355,7 @@
     select
       name,id
     from admin
-    where status='正常'
+    where status= 0
       and name  like concat('%',#{name,jdbcType=VARCHAR},'%')
   </select>
   <select id="selectAllById" resultType="com.goafanti.organization.bo.OrganizationListOut">
@@ -502,7 +502,7 @@
     </if>
     group by a.aid ) y on x.aid=y.aid)b on a.id=b.aid
     left join department d on a.department_id=d.id
-    where  a.status='正常'  and a.type=1
+    where  a.status= 0  and a.type=1
     <if test="adminName !=null">
       and a.name  like concat('%',#{adminName},'%')
     </if>
@@ -534,7 +534,7 @@
     </if>
     group by a.aid ) y on a.id=y.aid
     left join department c on a.department_id =c.id
-    where  a.status='正常'  and a.type=1
+    where  a.status= 0  and a.type=1
     <if test="depIds!= null">
       and a.department_id in
       <foreach close=")" collection="depIds" item="deps" open="(" separator=",">

+ 61 - 10
src/main/java/com/goafanti/common/mapper/NewOrderChangeMapper.xml

@@ -36,6 +36,7 @@
     <result column="attachment_url" jdbcType="VARCHAR" property="attachmentUrl" />
     <result column="contract_picture_url" jdbcType="VARCHAR" property="contractPictureUrl" />
     <result column="first_amount" jdbcType="DECIMAL" property="firstAmount" />
+    <result column="examine_name" jdbcType="VARCHAR" property="examineName" />
   </resultMap>
   <sql id="Base_Column_List">
     id, order_no, process_state, `status`, `type`, create_time, remarks, voucher_url,
@@ -43,7 +44,7 @@
     zxs_cost, zxs_remarks, payment_time, payment_amount, invoice_time, invoice_amount,
     invoice_type, cw_cost, refundable_amount, cw_remarks, estimate_cost, estimate_refundable,
     refund_Invoice, used_order, refund_status, refund_url, back_status, attachment_url,
-    contract_picture_url, first_amount
+    contract_picture_url, first_amount, examine_name
   </sql>
   <select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
     select
@@ -66,8 +67,8 @@
       refundable_amount, cw_remarks, estimate_cost,
       estimate_refundable, refund_Invoice, used_order,
       refund_status, refund_url, back_status,
-      attachment_url, contract_picture_url, first_amount
-      )
+      attachment_url, contract_picture_url, first_amount,
+      examine_name)
     values (#{orderNo,jdbcType=VARCHAR}, #{processState,jdbcType=INTEGER}, #{status,jdbcType=INTEGER},
       #{type,jdbcType=INTEGER}, #{createTime,jdbcType=TIMESTAMP}, #{remarks,jdbcType=VARCHAR},
       #{voucherUrl,jdbcType=VARCHAR}, #{totalAmount,jdbcType=DECIMAL}, #{settlementAmount,jdbcType=DECIMAL},
@@ -78,8 +79,8 @@
       #{refundableAmount,jdbcType=DECIMAL}, #{cwRemarks,jdbcType=VARCHAR}, #{estimateCost,jdbcType=DECIMAL},
       #{estimateRefundable,jdbcType=DECIMAL}, #{refundInvoice,jdbcType=DECIMAL}, #{usedOrder,jdbcType=VARCHAR},
       #{refundStatus,jdbcType=INTEGER}, #{refundUrl,jdbcType=VARCHAR}, #{backStatus,jdbcType=INTEGER},
-      #{attachmentUrl,jdbcType=VARCHAR}, #{contractPictureUrl,jdbcType=VARCHAR}, #{firstAmount,jdbcType=DECIMAL}
-      )
+      #{attachmentUrl,jdbcType=VARCHAR}, #{contractPictureUrl,jdbcType=VARCHAR}, #{firstAmount,jdbcType=DECIMAL},
+      #{examineName,jdbcType=VARCHAR})
   </insert>
   <insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="com.goafanti.common.model.NewOrderChange" useGeneratedKeys="true">
     insert into new_order_change
@@ -183,6 +184,9 @@
       <if test="firstAmount != null">
         first_amount,
       </if>
+      <if test="examineName != null">
+        examine_name,
+      </if>
     </trim>
     <trim prefix="values (" suffix=")" suffixOverrides=",">
       <if test="orderNo != null">
@@ -284,6 +288,9 @@
       <if test="firstAmount != null">
         #{firstAmount,jdbcType=DECIMAL},
       </if>
+      <if test="examineName != null">
+        #{examineName,jdbcType=VARCHAR},
+      </if>
     </trim>
   </insert>
   <update id="updateByPrimaryKeySelective" parameterType="com.goafanti.common.model.NewOrderChange">
@@ -388,6 +395,9 @@
       <if test="firstAmount != null">
         first_amount = #{firstAmount,jdbcType=DECIMAL},
       </if>
+      <if test="examineName != null">
+        examine_name = #{examineName,jdbcType=VARCHAR},
+      </if>
     </set>
     where id = #{id,jdbcType=INTEGER}
   </update>
@@ -425,7 +435,8 @@
       back_status = #{backStatus,jdbcType=INTEGER},
       attachment_url = #{attachmentUrl,jdbcType=VARCHAR},
       contract_picture_url = #{contractPictureUrl,jdbcType=VARCHAR},
-      first_amount = #{firstAmount,jdbcType=DECIMAL}
+      first_amount = #{firstAmount,jdbcType=DECIMAL},
+      examine_name = #{examineName,jdbcType=VARCHAR}
     where id = #{id,jdbcType=INTEGER}
   </update>
   <select id="selectByorderNo" resultType="com.goafanti.order.bo.NewOrderChangeBo">
@@ -436,7 +447,7 @@ select
 	a.change_amount changeAmount, a.applicant, a.dep_name depName, a.project_state projectState, a.zxs_cost zxsCost,
 	a.zxs_remarks zxsRemarks, date_format(a.payment_time, '%Y-%m-%d')paymentTimes, a.payment_amount paymentAmount,
 	date_format(a. invoice_time, '%Y-%m-%d') invoiceTimes, a.invoice_amount invoiceAmount,a.invoice_type invoiceType,
-	a.cw_remarks cwRemarks,a.contract_picture_url contractPictureUrl,a.first_amount firstAmount
+	a.cw_remarks cwRemarks,a.contract_picture_url contractPictureUrl,a.first_amount firstAmount,a.examine_name examineName
     from new_order_change a where 1 = 1
 	and a.order_no= #{orderNo}
 	order by a.create_time desc limit 1
@@ -474,7 +485,7 @@ select
 	date_format(a.create_time, '%Y-%m-%d %H:%i:%S')createTimes, a.remarks, a.voucher_url voucherUrl,a.cw_cost cwCost,a.refund_status refundStatus,
 	a.total_amount totalAmount, a.settlement_amount settlementAmount, (a.total_amount-a.settlement_amount) arrears,a.attachment_url attachmentUrl,
 	a.change_amount changeAmount, a.applicant, a.dep_name depName, a.project_state projectState, a.zxs_cost zxsCost,a.first_amount firstAmount,
-	a.zxs_remarks zxsRemarks, date_format(a.payment_time, '%Y-%m-%d')paymentTimes, a.payment_amount paymentAmount,
+	a.zxs_remarks zxsRemarks, date_format(a.payment_time, '%Y-%m-%d')paymentTimes, a.payment_amount paymentAmount,a.examine_name examineName,
 	date_format(a. invoice_time, '%Y-%m-%d') invoiceTimes, a.invoice_amount invoiceAmount,a.invoice_type invoiceType,
 	a.cw_remarks cwRemarks,a.estimate_cost estimateCost,estimate_refundable estimateRefundable,refund_Invoice refundInvoice,a.contract_picture_url contractPictureUrl
 	from new_order_change a where 1 = 1 and a.id= #{id}
@@ -485,7 +496,7 @@ select
   </select>
   <select id="selectOrderChangeList" resultType="com.goafanti.order.bo.NewOderCahngeListBo">
 	select a.id,a.order_no orderNo,b.contract_no contractNo, date_format(a.create_time,'%Y-%m-%d %H:%i:%S')createTimes,c.nickname,b.order_type orderType,
-  date_format(b.create_time,'%Y-%m-%d %H:%i:%S')establishTimes, b.order_status orderStatus,b.total_amount totalAmount,a.status ,
+  date_format(b.create_time,'%Y-%m-%d %H:%i:%S')establishTimes, b.order_status orderStatus,b.total_amount totalAmount,a.status ,a.examine_name examineName,
   b.settlement_amount settlementAmount,(b.total_amount-b.settlement_amount) arrears,d.name salesmanName,e.name depName,a.`type`,
   a.process_state processState,a.back_status backStatus from new_order_change  noc left join  new_order_change a on noc.id=a.id
   left join t_order_new b on a.order_no=b.order_no left join user c on b.buyer_id=c.id left join admin d on b.salesman_id=d.id
@@ -711,7 +722,47 @@ select
 	set `refund_Invoice`=ifnull(`refund_Invoice`,0)- #{amount}
 	where order_no= #{orderNo}
 	</update>
-	<select id="getOrderChange" resultType="java.util.Map">
+
+    <select id="getOrderChange" resultType="java.util.Map">
 	select id,used_order usedOrder from new_order_change where  order_no= #{orderNo} order by id
 	</select>
+
+  <update id="updateExamineName">
+    update  new_order_change a
+    <if test="names ==null">
+      ,t_order_new b,admin c
+      set a.examine_name=c.name
+      where a.process_state = #{type} and a.order_no =b.order_no
+      <if test="type==1">
+        and b.order_dep = #{depId}
+      </if>
+      and c.id= #{aid}
+    </if>
+      <if test="names !=null">
+        ,t_order_new b
+        set a.examine_name=#{names}
+        where a.process_state = #{type} and a.order_no =b.order_no
+        <if test="type==1">
+          and b.order_dep = #{depId}
+        </if>
+      </if>
+  </update>
+    <update id="updateTaskExamineName">
+      update new_order_change n left join (select c.id
+             from t_order_new a left join t_order_task b on a.order_no =b.order_no
+                                left join new_order_change c on a.order_no =c.order_no
+             where (b.consultant_id in (#{aid},#{taskReceiverId}) or b.manager_id in (#{aid},#{taskReceiverId}))
+               and c.process_state in (#{type}) group by c.id)x on n.id =x.id
+      left join (select a.order_no ,group_concat(DISTINCT b.name)name from order_examine a left join admin b on a.aid=b.id
+                   where 1=1
+                   <if test="type==2">
+                   and  a.type=0
+                   </if>
+                  <if test="type==3">
+                  and   a.type=1
+                  </if>
+      group by a.order_no ) a on n.order_no =a.order_no
+      set n.examine_name =a.name
+      where n.process_state =#{type}
+    </update>
 </mapper>

+ 6 - 0
src/main/java/com/goafanti/common/mapper/OrderExamineMapper.xml

@@ -337,8 +337,14 @@
       and type= #{type}
     </if>
   </update>
+
   <delete id="deleteByAidAndStatus">
     delete  from order_examine
     where status=0 and  aid=#{aid} and type=#{type}
   </delete>
+  <update id="updateBack">
+    update order_examine
+    set aid= #{taskReceiverId} ,`type` =1
+    where aid= #{aid} and and status =0
+  </update>
 </mapper>

+ 25 - 17
src/main/java/com/goafanti/common/mapper/RoleMapper.xml

@@ -10,7 +10,7 @@
     id, role_name, role_type ,creater,create_time as createTime
   </sql>
   <select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="BaseResultMap">
-    select 
+    select
     <include refid="Base_Column_List" />
     from role
     where id = #{id,jdbcType=VARCHAR}
@@ -82,7 +82,7 @@
   </update>
   <insert id="insertBatch" parameterType="com.goafanti.common.model.Role">
     insert into role (id, name)
-    values 
+    values
     <foreach item="item" index="index" collection="list" separator=",">
       (#{item.id,jdbcType=VARCHAR}, #{item.name,jdbcType=VARCHAR})
     </foreach>
@@ -110,15 +110,15 @@
   </select>
   <delete id="deleteByPrimaryKeys" parameterType="java.lang.String">
     delete from role
-    where id in 
-    <foreach item="item" index="index" collection="list" open="(" separator="," close=")">  
-	  #{item,jdbcType=VARCHAR}  
+    where id in
+    <foreach item="item" index="index" collection="list" open="(" separator="," close=")">
+	  #{item,jdbcType=VARCHAR}
     </foreach>
   </delete>
- <!-- ******************************************************************** --> 
+ <!-- ******************************************************************** -->
   <select id="selectRoleList" resultType="com.goafanti.permission.bo.RoleBo">
     select id,role_name as roleName,role_type as roleType,creater,create_time as createTime
-    from role 
+    from role
     where role_type <![CDATA[ < ]]> 999999
     <if test="roleName !=null">
 		AND role_name like CONCAT('%',#{roleName,jdbcType=VARCHAR},'%')
@@ -137,7 +137,7 @@
 		AND role_name like CONCAT('%',#{roleName,jdbcType=VARCHAR},'%')
 		</if>
   </select>
-  
+
   <select id="selectRolePList" resultType="com.goafanti.permission.bo.RolePermissionBo">
   	select tr.id as rid, tr.role_name as rname, tr.role_type,tp.id as pid,tp.name as pname,tp.url
     from role tr
@@ -147,14 +147,14 @@
     tr.id=#{id,jdbcType=VARCHAR}
   </select>
   <select id="selectCountByRoleId" parameterType="java.lang.String" resultType="java.lang.Integer">
-  	select 
-  	count(0) 
-  	from user_role 
-   	where 
-   	rid in 
-    <foreach item="item" index="index" collection="list" open="(" separator="," close=")">  
-	  #{item,jdbcType=VARCHAR}  
-    </foreach>  
+  	select
+  	count(0)
+  	from user_role
+   	where
+   	rid in
+    <foreach item="item" index="index" collection="list" open="(" separator="," close=")">
+	  #{item,jdbcType=VARCHAR}
+    </foreach>
   </select>
   <select id="selectIdByName" parameterType="java.lang.String" resultType="java.lang.String">
   	select
@@ -179,4 +179,12 @@
   	and
   	id!=#{id,jdbcType=VARCHAR}
   </select>
-</mapper>
+    <select id="selectByIdList" resultMap="BaseResultMap">
+        select
+        <include refid="Base_Column_List" />
+        from role where id in
+        <foreach item="item" index="index" collection="list" open="(" separator="," close=")">
+            #{item,jdbcType=VARCHAR}
+        </foreach>
+    </select>
+</mapper>

+ 109 - 321
src/main/java/com/goafanti/common/mapper/TOrderInvoiceMapper.xml

@@ -2,11 +2,6 @@
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="com.goafanti.common.dao.TOrderInvoiceMapper">
   <resultMap id="BaseResultMap" type="com.goafanti.common.model.TOrderInvoice">
-    <!--
-      WARNING - @mbg.generated
-      This element is automatically generated by MyBatis Generator, do not modify.
-      This element was generated on Fri May 17 09:46:50 CST 2019.
-    -->
     <id column="id" jdbcType="INTEGER" property="id" />
     <result column="order_no" jdbcType="VARCHAR" property="orderNo" />
     <result column="type" jdbcType="INTEGER" property="type" />
@@ -34,182 +29,57 @@
     <result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
     <result column="approval" jdbcType="INTEGER" property="approval" />
     <result column="already_amount" jdbcType="DECIMAL" property="alreadyAmount" />
+    <result column="examine_name" jdbcType="VARCHAR" property="examineName" />
   </resultMap>
-  <sql id="Example_Where_Clause">
-    <!--
-      WARNING - @mbg.generated
-      This element is automatically generated by MyBatis Generator, do not modify.
-      This element was generated on Fri May 17 09:46:50 CST 2019.
-    -->
-    <where>
-      <foreach collection="oredCriteria" item="criteria" separator="or">
-        <if test="criteria.valid">
-          <trim prefix="(" prefixOverrides="and" suffix=")">
-            <foreach collection="criteria.criteria" item="criterion">
-              <choose>
-                <when test="criterion.noValue">
-                  and ${criterion.condition}
-                </when>
-                <when test="criterion.singleValue">
-                  and ${criterion.condition} #{criterion.value}
-                </when>
-                <when test="criterion.betweenValue">
-                  and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
-                </when>
-                <when test="criterion.listValue">
-                  and ${criterion.condition}
-                  <foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
-                    #{listItem}
-                  </foreach>
-                </when>
-              </choose>
-            </foreach>
-          </trim>
-        </if>
-      </foreach>
-    </where>
-  </sql>
-  <sql id="Update_By_Example_Where_Clause">
-    <!--
-      WARNING - @mbg.generated
-      This element is automatically generated by MyBatis Generator, do not modify.
-      This element was generated on Fri May 17 09:46:50 CST 2019.
-    -->
-    <where>
-      <foreach collection="example.oredCriteria" item="criteria" separator="or">
-        <if test="criteria.valid">
-          <trim prefix="(" prefixOverrides="and" suffix=")">
-            <foreach collection="criteria.criteria" item="criterion">
-              <choose>
-                <when test="criterion.noValue">
-                  and ${criterion.condition}
-                </when>
-                <when test="criterion.singleValue">
-                  and ${criterion.condition} #{criterion.value}
-                </when>
-                <when test="criterion.betweenValue">
-                  and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
-                </when>
-                <when test="criterion.listValue">
-                  and ${criterion.condition}
-                  <foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
-                    #{listItem}
-                  </foreach>
-                </when>
-              </choose>
-            </foreach>
-          </trim>
-        </if>
-      </foreach>
-    </where>
-  </sql>
   <sql id="Base_Column_List">
-    <!--
-      WARNING - @mbg.generated
-      This element is automatically generated by MyBatis Generator, do not modify.
-      This element was generated on Fri May 17 09:46:50 CST 2019.
-    -->
-    id, order_no, type, status, reject_reason, remarks, invoice_type, unit_name, tax_number,
-    amount, banks, content, unit_address, invoice_remarks, unit_mobile, voucher_url,
+    id, order_no, `type`, `status`, reject_reason, remarks, invoice_type, unit_name,
+    tax_number, amount, banks, content, unit_address, invoice_remarks, unit_mobile, voucher_url,
     post, addressee, addressee_mobile, addressee_province, addressee_city, addressee_area,
-    recipient_address, create_time, update_time, approval, already_amount
+    recipient_address, create_time, update_time, approval, already_amount, examine_name
   </sql>
-  <select id="selectByExample" parameterType="com.goafanti.common.model.TOrderInvoiceExample" resultMap="BaseResultMap">
-    <!--
-      WARNING - @mbg.generated
-      This element is automatically generated by MyBatis Generator, do not modify.
-      This element was generated on Fri May 17 09:46:50 CST 2019.
-    -->
-    select
-    <if test="distinct">
-      distinct
-    </if>
-    <include refid="Base_Column_List" />
-    from t_order_invoice
-    <if test="_parameter != null">
-      <include refid="Example_Where_Clause" />
-    </if>
-    <if test="orderByClause != null">
-      order by ${orderByClause}
-    </if>
-  </select>
   <select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
-    <!--
-      WARNING - @mbg.generated
-      This element is automatically generated by MyBatis Generator, do not modify.
-      This element was generated on Fri May 17 09:46:50 CST 2019.
-    -->
     select
     <include refid="Base_Column_List" />
     from t_order_invoice
     where id = #{id,jdbcType=INTEGER}
   </select>
   <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
-    <!--
-      WARNING - @mbg.generated
-      This element is automatically generated by MyBatis Generator, do not modify.
-      This element was generated on Fri May 17 09:46:50 CST 2019.
-    -->
     delete from t_order_invoice
     where id = #{id,jdbcType=INTEGER}
   </delete>
-  <delete id="deleteByExample" parameterType="com.goafanti.common.model.TOrderInvoiceExample">
-    <!--
-      WARNING - @mbg.generated
-      This element is automatically generated by MyBatis Generator, do not modify.
-      This element was generated on Fri May 17 09:46:50 CST 2019.
-    -->
-    delete from t_order_invoice
-    <if test="_parameter != null">
-      <include refid="Example_Where_Clause" />
-    </if>
-  </delete>
-  <insert id="insert" parameterType="com.goafanti.common.model.TOrderInvoice">
-    <!--
-      WARNING - @mbg.generated
-      This element is automatically generated by MyBatis Generator, do not modify.
-      This element was generated on Fri May 17 09:46:50 CST 2019.
-    -->
-    insert into t_order_invoice (id, order_no, type,
-      status, reject_reason, remarks,
-      invoice_type, unit_name, tax_number,
-      amount, banks, content,
-      unit_address, invoice_remarks, unit_mobile,
-      voucher_url, post, addressee,
-      addressee_mobile, addressee_province, addressee_city,
-      addressee_area, recipient_address, create_time,
-      update_time, approval, already_amount
+  <insert id="insert" keyColumn="id" keyProperty="id" parameterType="com.goafanti.common.model.TOrderInvoice" useGeneratedKeys="true">
+    insert into t_order_invoice (order_no, `type`, `status`,
+      reject_reason, remarks, invoice_type,
+      unit_name, tax_number, amount,
+      banks, content, unit_address,
+      invoice_remarks, unit_mobile, voucher_url,
+      post, addressee, addressee_mobile,
+      addressee_province, addressee_city, addressee_area,
+      recipient_address, create_time, update_time,
+      approval, already_amount, examine_name
       )
-    values (#{id,jdbcType=INTEGER}, #{orderNo,jdbcType=VARCHAR}, #{type,jdbcType=INTEGER},
-      #{status,jdbcType=INTEGER}, #{rejectReason,jdbcType=VARCHAR}, #{remarks,jdbcType=VARCHAR},
-      #{invoiceType,jdbcType=INTEGER}, #{unitName,jdbcType=VARCHAR}, #{taxNumber,jdbcType=VARCHAR},
-      #{amount,jdbcType=DECIMAL}, #{banks,jdbcType=VARCHAR}, #{content,jdbcType=VARCHAR},
-      #{unitAddress,jdbcType=VARCHAR}, #{invoiceRemarks,jdbcType=VARCHAR}, #{unitMobile,jdbcType=VARCHAR},
-      #{voucherUrl,jdbcType=VARCHAR}, #{post,jdbcType=INTEGER}, #{addressee,jdbcType=VARCHAR},
-      #{addresseeMobile,jdbcType=VARCHAR}, #{addresseeProvince,jdbcType=INTEGER}, #{addresseeCity,jdbcType=INTEGER},
-      #{addresseeArea,jdbcType=INTEGER}, #{recipientAddress,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP},
-      #{updateTime,jdbcType=TIMESTAMP}, #{approval,jdbcType=INTEGER}, #{alreadyAmount,jdbcType=DECIMAL}
+    values (#{orderNo,jdbcType=VARCHAR}, #{type,jdbcType=INTEGER}, #{status,jdbcType=INTEGER},
+      #{rejectReason,jdbcType=VARCHAR}, #{remarks,jdbcType=VARCHAR}, #{invoiceType,jdbcType=INTEGER},
+      #{unitName,jdbcType=VARCHAR}, #{taxNumber,jdbcType=VARCHAR}, #{amount,jdbcType=DECIMAL},
+      #{banks,jdbcType=VARCHAR}, #{content,jdbcType=VARCHAR}, #{unitAddress,jdbcType=VARCHAR},
+      #{invoiceRemarks,jdbcType=VARCHAR}, #{unitMobile,jdbcType=VARCHAR}, #{voucherUrl,jdbcType=VARCHAR},
+      #{post,jdbcType=INTEGER}, #{addressee,jdbcType=VARCHAR}, #{addresseeMobile,jdbcType=VARCHAR},
+      #{addresseeProvince,jdbcType=INTEGER}, #{addresseeCity,jdbcType=INTEGER}, #{addresseeArea,jdbcType=INTEGER},
+      #{recipientAddress,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP},
+      #{approval,jdbcType=INTEGER}, #{alreadyAmount,jdbcType=DECIMAL}, #{examineName,jdbcType=VARCHAR}
       )
   </insert>
-  <insert id="insertSelective" parameterType="com.goafanti.common.model.TOrderInvoice" keyColumn="id" keyProperty="id"  useGeneratedKeys="true">
-    <!--
-      WARNING - @mbg.generated
-      This element is automatically generated by MyBatis Generator, do not modify.
-      This element was generated on Fri May 17 09:46:50 CST 2019.
-    -->
+  <insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="com.goafanti.common.model.TOrderInvoice" useGeneratedKeys="true">
     insert into t_order_invoice
     <trim prefix="(" suffix=")" suffixOverrides=",">
-      <if test="id != null">
-        id,
-      </if>
       <if test="orderNo != null">
         order_no,
       </if>
       <if test="type != null">
-        type,
+        `type`,
       </if>
       <if test="status != null">
-        status,
+        `status`,
       </if>
       <if test="rejectReason != null">
         reject_reason,
@@ -280,11 +150,11 @@
       <if test="alreadyAmount != null">
         already_amount,
       </if>
+      <if test="examineName != null">
+        examine_name,
+      </if>
     </trim>
     <trim prefix="values (" suffix=")" suffixOverrides=",">
-      <if test="id != null">
-        #{id,jdbcType=INTEGER},
-      </if>
       <if test="orderNo != null">
         #{orderNo,jdbcType=VARCHAR},
       </if>
@@ -363,167 +233,22 @@
       <if test="alreadyAmount != null">
         #{alreadyAmount,jdbcType=DECIMAL},
       </if>
+      <if test="examineName != null">
+        #{examineName,jdbcType=VARCHAR},
+      </if>
     </trim>
   </insert>
-  <select id="countByExample" parameterType="com.goafanti.common.model.TOrderInvoiceExample" resultType="java.lang.Long">
-    <!--
-      WARNING - @mbg.generated
-      This element is automatically generated by MyBatis Generator, do not modify.
-      This element was generated on Fri May 17 09:46:50 CST 2019.
-    -->
-    select count(*) from t_order_invoice
-    <if test="_parameter != null">
-      <include refid="Example_Where_Clause" />
-    </if>
-  </select>
-  <update id="updateByExampleSelective" parameterType="map">
-    <!--
-      WARNING - @mbg.generated
-      This element is automatically generated by MyBatis Generator, do not modify.
-      This element was generated on Fri May 17 09:46:50 CST 2019.
-    -->
-    update t_order_invoice
-    <set>
-      <if test="record.id != null">
-        id = #{record.id,jdbcType=INTEGER},
-      </if>
-      <if test="record.orderNo != null">
-        order_no = #{record.orderNo,jdbcType=VARCHAR},
-      </if>
-      <if test="record.type != null">
-        type = #{record.type,jdbcType=INTEGER},
-      </if>
-      <if test="record.status != null">
-        status = #{record.status,jdbcType=INTEGER},
-      </if>
-      <if test="record.rejectReason != null">
-        reject_reason = #{record.rejectReason,jdbcType=VARCHAR},
-      </if>
-      <if test="record.remarks != null">
-        remarks = #{record.remarks,jdbcType=VARCHAR},
-      </if>
-      <if test="record.invoiceType != null">
-        invoice_type = #{record.invoiceType,jdbcType=INTEGER},
-      </if>
-      <if test="record.unitName != null">
-        unit_name = #{record.unitName,jdbcType=VARCHAR},
-      </if>
-      <if test="record.taxNumber != null">
-        tax_number = #{record.taxNumber,jdbcType=VARCHAR},
-      </if>
-      <if test="record.amount != null">
-        amount = #{record.amount,jdbcType=DECIMAL},
-      </if>
-      <if test="record.banks != null">
-        banks = #{record.banks,jdbcType=VARCHAR},
-      </if>
-      <if test="record.content != null">
-        content = #{record.content,jdbcType=VARCHAR},
-      </if>
-      <if test="record.unitAddress != null">
-        unit_address = #{record.unitAddress,jdbcType=VARCHAR},
-      </if>
-      <if test="record.invoiceRemarks != null">
-        invoice_remarks = #{record.invoiceRemarks,jdbcType=VARCHAR},
-      </if>
-      <if test="record.unitMobile != null">
-        unit_mobile = #{record.unitMobile,jdbcType=VARCHAR},
-      </if>
-      <if test="record.voucherUrl != null">
-        voucher_url = #{record.voucherUrl,jdbcType=VARCHAR},
-      </if>
-      <if test="record.post != null">
-        post = #{record.post,jdbcType=INTEGER},
-      </if>
-      <if test="record.addressee != null">
-        addressee = #{record.addressee,jdbcType=VARCHAR},
-      </if>
-      <if test="record.addresseeMobile != null">
-        addressee_mobile = #{record.addresseeMobile,jdbcType=VARCHAR},
-      </if>
-      <if test="record.addresseeProvince != null">
-        addressee_province = #{record.addresseeProvince,jdbcType=INTEGER},
-      </if>
-      <if test="record.addresseeCity != null">
-        addressee_city = #{record.addresseeCity,jdbcType=INTEGER},
-      </if>
-      <if test="record.addresseeArea != null">
-        addressee_area = #{record.addresseeArea,jdbcType=INTEGER},
-      </if>
-      <if test="record.recipientAddress != null">
-        recipient_address = #{record.recipientAddress,jdbcType=VARCHAR},
-      </if>
-      <if test="record.createTime != null">
-        create_time = #{record.createTime,jdbcType=TIMESTAMP},
-      </if>
-      <if test="record.updateTime != null">
-        update_time = #{record.updateTime,jdbcType=TIMESTAMP},
-      </if>
-      <if test="record.approval != null">
-        approval = #{record.approval,jdbcType=INTEGER},
-      </if>
-      <if test="record.alreadyAmount != null">
-        already_amount = #{record.alreadyAmount,jdbcType=DECIMAL},
-      </if>
-    </set>
-    <if test="_parameter != null">
-      <include refid="Update_By_Example_Where_Clause" />
-    </if>
-  </update>
-  <update id="updateByExample" parameterType="map">
-    <!--
-      WARNING - @mbg.generated
-      This element is automatically generated by MyBatis Generator, do not modify.
-      This element was generated on Fri May 17 09:46:50 CST 2019.
-    -->
-    update t_order_invoice
-    set id = #{record.id,jdbcType=INTEGER},
-      order_no = #{record.orderNo,jdbcType=VARCHAR},
-      type = #{record.type,jdbcType=INTEGER},
-      status = #{record.status,jdbcType=INTEGER},
-      reject_reason = #{record.rejectReason,jdbcType=VARCHAR},
-      remarks = #{record.remarks,jdbcType=VARCHAR},
-      invoice_type = #{record.invoiceType,jdbcType=INTEGER},
-      unit_name = #{record.unitName,jdbcType=VARCHAR},
-      tax_number = #{record.taxNumber,jdbcType=VARCHAR},
-      amount = #{record.amount,jdbcType=DECIMAL},
-      banks = #{record.banks,jdbcType=VARCHAR},
-      content = #{record.content,jdbcType=VARCHAR},
-      unit_address = #{record.unitAddress,jdbcType=VARCHAR},
-      invoice_remarks = #{record.invoiceRemarks,jdbcType=VARCHAR},
-      unit_mobile = #{record.unitMobile,jdbcType=VARCHAR},
-      voucher_url = #{record.voucherUrl,jdbcType=VARCHAR},
-      post = #{record.post,jdbcType=INTEGER},
-      addressee = #{record.addressee,jdbcType=VARCHAR},
-      addressee_mobile = #{record.addresseeMobile,jdbcType=VARCHAR},
-      addressee_province = #{record.addresseeProvince,jdbcType=INTEGER},
-      addressee_city = #{record.addresseeCity,jdbcType=INTEGER},
-      addressee_area = #{record.addresseeArea,jdbcType=INTEGER},
-      recipient_address = #{record.recipientAddress,jdbcType=VARCHAR},
-      create_time = #{record.createTime,jdbcType=TIMESTAMP},
-      update_time = #{record.updateTime,jdbcType=TIMESTAMP},
-      approval = #{record.approval,jdbcType=INTEGER},
-      already_amount = #{record.alreadyAmount,jdbcType=DECIMAL}
-    <if test="_parameter != null">
-      <include refid="Update_By_Example_Where_Clause" />
-    </if>
-  </update>
   <update id="updateByPrimaryKeySelective" parameterType="com.goafanti.common.model.TOrderInvoice">
-    <!--
-      WARNING - @mbg.generated
-      This element is automatically generated by MyBatis Generator, do not modify.
-      This element was generated on Fri May 17 09:46:50 CST 2019.
-    -->
     update t_order_invoice
     <set>
       <if test="orderNo != null">
         order_no = #{orderNo,jdbcType=VARCHAR},
       </if>
       <if test="type != null">
-        type = #{type,jdbcType=INTEGER},
+        `type` = #{type,jdbcType=INTEGER},
       </if>
       <if test="status != null">
-        status = #{status,jdbcType=INTEGER},
+        `status` = #{status,jdbcType=INTEGER},
       </if>
       <if test="rejectReason != null">
         reject_reason = #{rejectReason,jdbcType=VARCHAR},
@@ -594,19 +319,17 @@
       <if test="alreadyAmount != null">
         already_amount = #{alreadyAmount,jdbcType=DECIMAL},
       </if>
+      <if test="examineName != null">
+        examine_name = #{examineName,jdbcType=VARCHAR},
+      </if>
     </set>
     where id = #{id,jdbcType=INTEGER}
   </update>
   <update id="updateByPrimaryKey" parameterType="com.goafanti.common.model.TOrderInvoice">
-    <!--
-      WARNING - @mbg.generated
-      This element is automatically generated by MyBatis Generator, do not modify.
-      This element was generated on Fri May 17 09:46:50 CST 2019.
-    -->
     update t_order_invoice
     set order_no = #{orderNo,jdbcType=VARCHAR},
-      type = #{type,jdbcType=INTEGER},
-      status = #{status,jdbcType=INTEGER},
+      `type` = #{type,jdbcType=INTEGER},
+      `status` = #{status,jdbcType=INTEGER},
       reject_reason = #{rejectReason,jdbcType=VARCHAR},
       remarks = #{remarks,jdbcType=VARCHAR},
       invoice_type = #{invoiceType,jdbcType=INTEGER},
@@ -629,10 +352,13 @@
       create_time = #{createTime,jdbcType=TIMESTAMP},
       update_time = #{updateTime,jdbcType=TIMESTAMP},
       approval = #{approval,jdbcType=INTEGER},
-      already_amount = #{alreadyAmount,jdbcType=DECIMAL}
+      already_amount = #{alreadyAmount,jdbcType=DECIMAL},
+      examine_name = #{examineName,jdbcType=VARCHAR}
     where id = #{id,jdbcType=INTEGER}
   </update>
-  <select id="checkApplyAmount" resultType="java.lang.String">
+
+
+    <select id="checkApplyAmount" resultType="java.lang.String">
   select ifnull(sum(amount),0) from t_order_invoice
 	where order_no= #{orderNo,jdbcType=VARCHAR}  and status !=4
 	<if test="id != null">
@@ -732,8 +458,9 @@
 
   <select id="salesmanOrderInvoiceList" resultType="com.goafanti.order.bo.TOrderInvoiceBo">
     select a.id ,a.order_no as orderNo,b.contract_no contractNo,a.amount,date_format(a.create_time,'%Y-%m-%d %H:%i:%S') as createTime,
-	a.reject_reason as  rejectReason,a.status ,a.approval from t_order_invoice a left join t_order_new b
-	on a.order_no=b.order_no where a.status !=4
+	a.reject_reason as  rejectReason,a.status ,a.approval,a.examine_name examineName
+    from t_order_invoice a left join t_order_new b on a.order_no=b.order_no
+    where a.status in (0,1,2,3)
 	<if test="orderNo !=null">
 	and a.order_no = #{orderNo,jdbcType=VARCHAR}
 	</if>
@@ -744,7 +471,7 @@
   </select>
 
   <select id="salesmanOrderInvoiceCount" resultType="java.lang.Integer">
-   select count(*) from t_order_invoice where status !=4
+   select count(*) from t_order_invoice where status in (0,1,2,3)
 	<if test="orderNo !=null">
 	and order_no = #{orderNo,jdbcType=VARCHAR}
 	</if>
@@ -865,4 +592,65 @@ where a.status=2 and a.order_no=  #{orderNo,jdbcType=VARCHAR}
     from invoice_log a left join admin b on a.aid =b.id
     where a.invoice_id =#{id} order by a.create_time
   </select>
+
+  <update id="updateExamineName">
+    update  t_order_invoice a,t_order_new b
+    <if test="names ==null">
+      ,admin c
+      set a.examine_name=c.name
+      where 1=1
+      <if test="type==0">
+        and a.type=0 and a.status =1 and a.approval in (0,2)
+      </if>
+      <if test="type==1">
+        and a.type=1 and a.status =1 and a.approval in (0,2)
+      </if>
+      <if test="type==2">
+        and  a.`type` =1 and a.status =1 and a.approval =1
+      </if>
+      and a.order_no =b.order_no
+      <if test="type==1">
+        and b.order_dep = #{depId}
+      </if>
+      and c.id= #{aid}
+    </if>
+    <if test="names !=null">
+      set a.examine_name= #{names}
+      where 1=1
+      <if test="type==0">
+        and a.type=0 and a.status =1 and a.approval in (0,2)
+      </if>
+      <if test="type==1">
+        and a.type=1 and a.status =1 and a.approval in (0,2)
+      </if>
+      <if test="type==2">
+        and  a.`type` =1 and a.status =1 and a.approval =1
+      </if>
+      and a.order_no =b.order_no
+      <if test="type==1">
+        and b.order_dep = #{depId}
+      </if>
+    </if>
+  </update>
+  <update id="updateListExamineName">
+    <if test="type==1">
+      update t_order_invoice t0,(select a.id , ifnull(GROUP_CONCAT(x.name) ,'暂无人员')name
+      from t_order_invoice a left join t_order_new b on a.order_no =b.order_no left join (select name ,department_id
+      from admin a left join user_role b on a.id =b.uid left join `role` c on b.rid =c.id where a.status ='0'
+      and c.role_type in (#{roleType}))x on b.order_dep =x.department_id where a.`type` =1
+      and a.status =1 and a.approval =0  and b.order_dep= #{depId}  group by a.id)t1
+      set t0.examine_name =t1.name
+      where t0.id=t1.id
+    </if>
+    <if test="type==2">
+      update t_order_invoice t0,(select a.id , ifnull(GROUP_CONCAT(x.name) ,'暂无人员')name
+      from t_order_invoice a left join t_order_new b on a.order_no =b.order_no left join (select name ,department_id
+      from admin a left join user_role b on a.id =b.uid left join `role` c on b.rid =c.id where a.status ='0'
+      and c.role_type in (#{roleType}))x on b.order_dep =x.department_id where a.`type` =1 and a.status =1
+      and a.approval =1 and b.order_dep= #{depId}  group by a.id)t1
+      set t0.examine_name =t1.name
+      where t0.id=t1.id
+    </if>
+
+  </update>
 </mapper>

+ 43 - 8
src/main/java/com/goafanti/common/mapper/TOrderNewMapper.xml

@@ -48,6 +48,7 @@
     <result column="channel_id" jdbcType="VARCHAR" property="channelId" />
     <result column="other" jdbcType="VARCHAR" property="other" />
     <result column="user_type" jdbcType="INTEGER" property="userType" />
+    <result column="examine_name" jdbcType="VARCHAR" property="examineName" />
   </resultMap>
   <sql id="Base_Column_List">
     order_no, order_type, creater, create_time, update_time, buyer_id, first_amount,
@@ -57,7 +58,7 @@
     contract_type, contacts, contact_mobile, legal_person, legal_person_tel, proof_count,
     proof_aid, proof_time, proof_status, order_dep, outsource, additional_order, primary_order,
     old_salesman_id, back_status, agreement_url, new_user, service_content, sales_type,
-    channel_id, other, user_type
+    channel_id, other, user_type, examine_name
   </sql>
   <select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="BaseResultMap">
     select
@@ -85,7 +86,7 @@
       primary_order, old_salesman_id, back_status,
       agreement_url, new_user, service_content,
       sales_type, channel_id, other,
-      user_type)
+      user_type, examine_name)
     values (#{orderNo,jdbcType=VARCHAR}, #{orderType,jdbcType=INTEGER}, #{creater,jdbcType=VARCHAR},
       #{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP}, #{buyerId,jdbcType=VARCHAR},
       #{firstAmount,jdbcType=DECIMAL}, #{totalAmount,jdbcType=DECIMAL}, #{settlementAmount,jdbcType=DECIMAL},
@@ -101,7 +102,7 @@
       #{primaryOrder,jdbcType=VARCHAR}, #{oldSalesmanId,jdbcType=VARCHAR}, #{backStatus,jdbcType=INTEGER},
       #{agreementUrl,jdbcType=VARCHAR}, #{newUser,jdbcType=INTEGER}, #{serviceContent,jdbcType=VARCHAR},
       #{salesType,jdbcType=INTEGER}, #{channelId,jdbcType=VARCHAR}, #{other,jdbcType=VARCHAR},
-      #{userType,jdbcType=INTEGER})
+      #{userType,jdbcType=INTEGER}, #{examineName,jdbcType=VARCHAR})
   </insert>
   <insert id="insertSelective" parameterType="com.goafanti.common.model.TOrderNew">
     insert into t_order_new
@@ -244,6 +245,9 @@
       <if test="userType != null">
         user_type,
       </if>
+      <if test="examineName != null">
+        examine_name,
+      </if>
     </trim>
     <trim prefix="values (" suffix=")" suffixOverrides=",">
       <if test="orderNo != null">
@@ -384,6 +388,9 @@
       <if test="userType != null">
         #{userType,jdbcType=INTEGER},
       </if>
+      <if test="examineName != null">
+        #{examineName,jdbcType=VARCHAR},
+      </if>
     </trim>
   </insert>
   <update id="updateByPrimaryKeySelective" parameterType="com.goafanti.common.model.TOrderNew">
@@ -524,6 +531,9 @@
       <if test="userType != null">
         user_type = #{userType,jdbcType=INTEGER},
       </if>
+      <if test="examineName != null">
+        examine_name = #{examineName,jdbcType=VARCHAR},
+      </if>
     </set>
     where order_no = #{orderNo,jdbcType=VARCHAR}
   </update>
@@ -573,7 +583,8 @@
       sales_type = #{salesType,jdbcType=INTEGER},
       channel_id = #{channelId,jdbcType=VARCHAR},
       other = #{other,jdbcType=VARCHAR},
-      user_type = #{userType,jdbcType=INTEGER}
+      user_type = #{userType,jdbcType=INTEGER},
+      examine_name = #{examineName,jdbcType=VARCHAR}
     where order_no = #{orderNo,jdbcType=VARCHAR}
   </update>
 
@@ -746,7 +757,7 @@
       date_format(a.`final_Receivables_time`, '%Y-%m-%d %H:%i:%s')finalReceivablesTime,a.patent_cost patentCost,a.patent_cost_actual patentCostActual ,
       a.soft_cost softCost ,a.soft_cost_actual softCostActual ,a.audit_cost auditCost ,a.audit_cost_actual auditCostActual ,a.other_cost otherCost ,
       a.other_cost_actual otherCostActual , a.expect_profit expectProfit ,a.actual_profit  actualProfit,a.service_type serviceType,
-      a.service_project serviceProject
+      a.service_project serviceProject,o.examine_name examineName
     from t_order_new o left join department d on o.order_dep = d.id left join `user` u on o.buyer_id = u.id left join t_order_mid a on o.order_no=a.order_no
     left join (select * from  t_order_outsource where type=0) too on o.order_no=too.order_no where delete_sign in(0,2) and approval in(0,1,2,4,5)
     and outsource=   #{o.outsource,jdbcType=INTEGER}
@@ -924,7 +935,7 @@ left join department d on o.order_dep = d.id   left join t_order_mid a on o.orde
   	a.contract_no as contractNo, b.nickname as userName ,a.process_status as processStatus,a.total_amount as totalAmount,
   	a.order_status as orderStatus, a.liquidation_status as liquidationStatus,a.approval,c.salesman_name as salesmanName,c.project_type projectType,
   	dep.name as depName,c.finance_name as financeName,c.invoice_amount invoiceAmount,a.settlement_amount settlementAmount,
-    a.sales_type salesType, a.channel_id channelId ,a.other
+    a.sales_type salesType, a.channel_id channelId ,a.other,a.examine_name examineName
     <if test="specially == 2">
   	,f.name as initiateName ,e.reason ,date_format(e.create_time,'%Y-%m-%d' ) as backDate,e.id as backId
   	</if>
@@ -1403,7 +1414,7 @@ left join department d on o.order_dep = d.id   left join t_order_mid a on o.orde
       e.reason,date_format(e.create_time,'%Y-%m-%d') as backDate,a.buyer_id as uid,a.order_dep as orderDep, g.location_province as locationProvince,
       g.location_city as locationCity,g.location_area locationArea,g.postal_address postalAddress,outsource,a.primary_order primaryOrder,a.agreement_url agreementUrl,
       h.name NowFinance,h.contact_mobile NowFinanceMobile,a.additional_order additionalOrder,i.name as oldSalesmanName, i.contact_mobile oldSalesmanMobile,
-      a.service_content serviceContent
+      a.service_content serviceContent,a.examine_name examineName
     from t_order_new a left join `user` b on a.buyer_id=b.id left join admin i on a.old_salesman_id=i.id
          left join admin c on a.salesman_id=c.id left join department dep on a.order_dep=dep.id
          left join admin d on a.finance_id=d.id left join admin h on dep.finance_id=h.id
@@ -1492,7 +1503,8 @@ left join department d on o.order_dep = d.id   left join t_order_mid a on o.orde
   </select>
 
   <select id="countTotalAndActually" parameterType="Map" resultType="java.util.Map">
-    select sum(o.settlement_amount) actuallyTotalAmount,sum(o.total_amount) signTotalAmount from t_order_new o
+    select IFNULL( sum(o.settlement_amount),0) actuallyTotalAmount,IFNULL(sum(o.total_amount),0)  signTotalAmount
+    from t_order_new o
     left join department d   on o.order_dep=d.id left join `user` u on o.buyer_id = u.id  left join t_order_mid a on o.order_no=a.order_no
     where o.delete_sign in(0,2,3)  and (o.approval = 0 or o.approval = 2) and outsource=  #{o.outsource,jdbcType=INTEGER}
     <if test="o.processStatus == 3">
@@ -1603,6 +1615,7 @@ left join department d on o.order_dep = d.id   left join t_order_mid a on o.orde
                            refund_amount=#{refundAmount,jdbcType=DECIMAL}	where order_no=#{orderNo}
   </update>
 
+
   <select id="selectArrearsDunListByPage" resultType="com.goafanti.order.bo.OutArrearsDunListBo">
     select a.id, b.contract_no contractNo,a.order_no as orderNo,c.nickname as userName,tm.salesman_name as salesmanName,
     b.project_status projectStatus, b.total_amount as totalAmount,b.liquidation_status as liquidationStatus,a.`type`,
@@ -1928,4 +1941,26 @@ left join department d on o.order_dep = d.id   left join t_order_mid a on o.orde
     where order_no = (select t_order_task.order_no from t_order_task where id=#{tid})
   </select>
 
+  <update id="updateExamineName">
+    update  t_order_new a
+    <if test="names==null">
+      ,admin b
+      set a.examine_name=b.name
+      where a.process_status = #{type}
+      <if test="type==1">
+        and a.order_dep = #{depId}
+      </if>
+      and b.id= #{aid}
+    </if>
+    <if test="names!=null">
+      set a.examine_name= #{names}
+      where a.process_status = #{type}
+      <if test="type==1">
+        and a.order_dep = #{depId}
+      </if>
+    </if>
+
+
+  </update>
+
 </mapper>

+ 26 - 26
src/main/java/com/goafanti/common/mapper/TOrderPaymentMapper.xml

@@ -31,8 +31,8 @@
       This element is automatically generated by MyBatis Generator, do not modify.
       This element was generated on Tue Jul 20 09:16:18 CST 2021.
     -->
-    id, tid, node_id, choose_type, payment_type, company_name, quantity, payment_status, 
-    `status`, application_amount, payment_amount, remarks, create_time, aid, aname, tpc_id, 
+    id, tid, node_id, choose_type, payment_type, company_name, quantity, payment_status,
+    `status`, application_amount, payment_amount, remarks, create_time, aid, aname, tpc_id,
     process_status
   </sql>
   <select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
@@ -41,7 +41,7 @@
       This element is automatically generated by MyBatis Generator, do not modify.
       This element was generated on Tue Jul 20 09:16:18 CST 2021.
     -->
-    select 
+    select
     <include refid="Base_Column_List" />
     from t_order_payment
     where id = #{id,jdbcType=INTEGER}
@@ -61,17 +61,17 @@
       This element is automatically generated by MyBatis Generator, do not modify.
       This element was generated on Tue Jul 20 09:16:18 CST 2021.
     -->
-    insert into t_order_payment (id, tid, node_id, 
-      choose_type, payment_type, company_name, 
-      quantity, payment_status, `status`, 
-      application_amount, payment_amount, remarks, 
-      create_time, aid, aname, 
+    insert into t_order_payment (id, tid, node_id,
+      choose_type, payment_type, company_name,
+      quantity, payment_status, `status`,
+      application_amount, payment_amount, remarks,
+      create_time, aid, aname,
       tpc_id, process_status)
-    values (#{id,jdbcType=INTEGER}, #{tid,jdbcType=INTEGER}, #{nodeId,jdbcType=INTEGER}, 
-      #{chooseType,jdbcType=INTEGER}, #{paymentType,jdbcType=INTEGER}, #{companyName,jdbcType=VARCHAR}, 
-      #{quantity,jdbcType=INTEGER}, #{paymentStatus,jdbcType=INTEGER}, #{status,jdbcType=INTEGER}, 
-      #{applicationAmount,jdbcType=DECIMAL}, #{paymentAmount,jdbcType=DECIMAL}, #{remarks,jdbcType=VARCHAR}, 
-      #{createTime,jdbcType=TIMESTAMP}, #{aid,jdbcType=VARCHAR}, #{aname,jdbcType=VARCHAR}, 
+    values (#{id,jdbcType=INTEGER}, #{tid,jdbcType=INTEGER}, #{nodeId,jdbcType=INTEGER},
+      #{chooseType,jdbcType=INTEGER}, #{paymentType,jdbcType=INTEGER}, #{companyName,jdbcType=VARCHAR},
+      #{quantity,jdbcType=INTEGER}, #{paymentStatus,jdbcType=INTEGER}, #{status,jdbcType=INTEGER},
+      #{applicationAmount,jdbcType=DECIMAL}, #{paymentAmount,jdbcType=DECIMAL}, #{remarks,jdbcType=VARCHAR},
+      #{createTime,jdbcType=TIMESTAMP}, #{aid,jdbcType=VARCHAR}, #{aname,jdbcType=VARCHAR},
       #{tpcId,jdbcType=INTEGER}, #{processStatus,jdbcType=INTEGER})
   </insert>
   <insert id="insertSelective" parameterType="com.goafanti.common.model.TOrderPayment">
@@ -272,8 +272,8 @@
       process_status = #{processStatus,jdbcType=INTEGER}
     where id = #{id,jdbcType=INTEGER}
   </update>
-  
-  
+
+
     <insert id="insertSelectiveGetId" keyColumn="id" keyProperty="id" parameterType="com.goafanti.common.model.TOrderPayment" useGeneratedKeys="true">
      insert into t_order_payment
     <trim prefix="(" suffix=")" suffixOverrides=",">
@@ -388,18 +388,18 @@
   </insert>
   <select id="selectByidGetDetails" resultType="com.goafanti.organization.bo.outOrderPayment">
 select a.id,a.tid,a.node_id nodeId,a.payment_type paymentType,a.company_name companyName,a.quantity,
-	a.payment_status paymentStatus,a.status,a.payment_amount paymentAmount,a.remarks ,
+	a.payment_status paymentStatus,a.status,a.payment_amount paymentAmount,a.remarks ,d.finance_name examineName,
 	d.finance_name financeName ,c.order_no orderNo,a.application_amount applicationAmount
 	 from t_order_payment a
 	 left join t_order_task c on a.tid=c.id left join t_order_mid d on c.order_no=d.order_no where a.id= #{id}
   </select>
-  
+
   <select id="selectByTid" resultType="com.goafanti.organization.bo.outOrderPayment">
 		select a.id,a.tid,a.node_id nodeId,a.payment_type paymentType,a.company_name companyName,a.quantity,choose_type chooseType,tpc.id tpcId,
 	  a.payment_status paymentStatus, a.status,a.payment_amount paymentAmount,a.remarks ,tpc.company_name tpcName,d.finance_name financeName ,
-	  c.order_no orderNo,date_format(a.create_time,'%Y-%m-%d %H:%i:%s')createTimes,a.application_amount applicationAmount 
-	 from t_order_payment a	 left join t_order_task c on a.tid=c.id left join t_order_mid d on c.order_no=d.order_no 
-	 left join third_party_company tpc on tpc.id=a.tpc_id where  a.tid= #{tid} 
+	  c.order_no orderNo,date_format(a.create_time,'%Y-%m-%d %H:%i:%s')createTimes,a.application_amount applicationAmount
+	 from t_order_payment a	 left join t_order_task c on a.tid=c.id left join t_order_mid d on c.order_no=d.order_no
+	 left join third_party_company tpc on tpc.id=a.tpc_id where  a.tid= #{tid}
 	 <if test="chooseType != null">
 	 and a.choose_type = #{chooseType}
 	 </if>
@@ -407,7 +407,7 @@ select a.id,a.tid,a.node_id nodeId,a.payment_type paymentType,a.company_name com
 	 and a.status in(0,1,2,3)
 	 </if>
   </select>
-  
+
   <select id="selectList" resultType="com.goafanti.organization.bo.outOrderPayment">
   select a.id,a.tid,a.node_id nodeId,a.payment_type paymentType,a.company_name companyName,a.quantity,
 	  a.payment_status paymentStatus, a.status,a.payment_amount paymentAmount,a.remarks , b.quantity NodeQuantity,
@@ -425,19 +425,19 @@ select a.id,a.tid,a.node_id nodeId,a.payment_type paymentType,a.company_name com
 	 and a.choose_type= #{chooseType}
 	 </if>
   </select>
-  
+
   <update id="updateByids">
   	 update t_order_payment set process_status= #{processStatus}
-	 where id in 
+	 where id in
   <foreach close=")" collection="list" index="" item="item" open="(" separator=",">
        #{item}
      </foreach>
   </update>
-  
+
   <select id="selectByCid" resultType="java.lang.Integer">
   select count(*) from t_order_payment where tpc_id = #{tpcId}
   </select>
-  
+
   <delete id="deleteByParam">
   delete from t_order_payment
     where 1=1
@@ -446,4 +446,4 @@ select a.id,a.tid,a.node_id nodeId,a.payment_type paymentType,a.company_name com
     and choose_type = #{chooseType}
     </if>
   </delete>
-</mapper>
+</mapper>

+ 16 - 13
src/main/java/com/goafanti/common/mapper/TOrderTaskMapper.xml

@@ -869,10 +869,10 @@
       and e.approval = 0
     </if>
     <if test="approval ==1">
-      and e.approval = 1
+      and e.approval in(1,2)
     </if>
     <if test="approval ==2">
-      and e.approval &gt; 1
+      and e.approval in (4,5)
     </if>
     <if test="cid != null">
       and c.id = #{cid}
@@ -895,9 +895,6 @@
     <if test="name != null">
       and f.nickname like CONCAT('%',#{name,jdbcType=VARCHAR},'%')
     </if>
-    <if test="orderNo != null">
-      and a.order_no= #{orderNo,jdbcType=VARCHAR}
-    </if>
     <if test="taskId != null">
       and (a.id= #{taskId,jdbcType=VARCHAR} or a.split_super= #{taskId,jdbcType=VARCHAR})
     </if>
@@ -917,9 +914,18 @@
   </select>
 
   <select id="selectOrderTaskListCount" resultType="java.lang.Integer">
-    select  count(*) from t_order_task a left join business_project b on a.commodity_id=b.id left join business_category c on b.cid=c.id
-        left join t_order_new e on a.order_no=e.order_no left join user f on e.buyer_id=f.id left join admin g on e.salesman_id=g.id
-    left join t_order_outsource l on a.id=l.tid left join department h on g.department_id=h.id
+    select  count(*) from t_order_task a
+        left join t_order_new e on a.order_no=e.order_no
+    <if test="cid != null">
+      left join business_project b on a.commodity_id=b.id
+      left join business_category c on b.cid=c.id
+    </if>
+    <if test="name != null">
+        left join user f on e.buyer_id=f.id
+    </if>
+    <if test="outsourceStatus !=null">
+    left join t_order_outsource l on a.id=l.tid
+    </if>
     where e.delete_sign in (0,2,3)  and e.order_status in (2,4)
     and a.outsource= #{outsource,jdbcType=INTEGER}
     <if test="role == 0 ">
@@ -941,10 +947,10 @@
       and e.approval = 0
     </if>
     <if test="approval ==1">
-      and e.approval = 1
+      and e.approval in(1,2)
     </if>
     <if test="approval ==2">
-      and e.approval &gt; 1
+      and e.approval in (4,5)
     </if>
     <if test="cid != null">
       and c.id = #{cid}
@@ -967,9 +973,6 @@
     <if test="name != null">
       and f.nickname like CONCAT('%',#{name,jdbcType=VARCHAR},'%')
     </if>
-    <if test="orderNo != null">
-      and a.order_no= #{orderNo,jdbcType=VARCHAR}
-    </if>
     <if test="taskId != null">
       and (a.id= #{taskId,jdbcType=VARCHAR} or a.split_super= #{taskId,jdbcType=VARCHAR})
     </if>

+ 4 - 4
src/main/java/com/goafanti/common/mapper/UserMapperExt.xml

@@ -1404,7 +1404,7 @@
 		</if>
 	</select>
 
-	<select id="findAdminName" resultType="com.goafanti.customer.bo.CustomerListOut">
+	<select id="findAdminName" resultType="com.goafanti.common.model.Admin">
 		select d.name as adminName,d.id as aid
 		from admin d left join department dm on dm.id = d.department_id
 		where d.department_id=(select department_id from admin where id=#{aid,jdbcType=INTEGER})
@@ -1855,7 +1855,7 @@ inner join(
 	left join (select x.aid,count(1)as count from (select x1.aid,x1.uid from user_lock_release x1
 				left join user y on x1.uid=y.id where x1.type=1
 				and x1.status=0 and y.integrity=1 group by aid,uid)x group by aid) i on a.id=i.aid
-	where a.status='正常'
+	where a.status= 0
 	<if test="deps!=null  and deps.size()>0">
 	and a.department_id in
 		<foreach close=")" collection="deps" item="depId" open="(" separator=",">
@@ -1883,7 +1883,7 @@ inner join(
 	left join (select x.aid,count(1)as count from (select x1.aid,x1.uid from user_lock_release x1
 				left join user y on x1.uid=y.id where x1.type=1
 				and x1.status=0 and y.integrity=1 group by aid,uid)x group by aid) i on a.id=i.aid
-	where a.status='正常'
+	where a.status= 0
 	<if test="deps!=null and deps.size()>0">
 	and a.department_id in
 		<foreach close=")" collection="deps" item="depId" open="(" separator=",">
@@ -1972,7 +1972,7 @@ inner join(
 	<select id="checkUserMax" parameterType="string" resultType="integer">
 		select count(*) from `user`
 		where aid= #{aid,jdbcType=VARCHAR}
-		and source in(1,2,3) and share_type=0 and channel =0
+		and source in(1,2,3) and share_type=0 and channel =0 and new_channel =0
 	</select>
 
 	<select id="checkRoleMax" parameterType="string" resultType="string">

+ 2 - 2
src/main/java/com/goafanti/common/mapper/UserMidMapper.xml

@@ -570,7 +570,7 @@
       and a.sign_time BETWEEN #{signTimeStart} and #{signTimeEnd}
     </if>
     group by b.aid,b.id)x group by x.aid)y on y.aid=a.id
-    where a.status='正常' and r.role_type in (96,996)
+    where a.status= 0 and r.role_type in (96,996)
     <if test="aid != null">
       and a.id= #{aid}
     </if>
@@ -606,7 +606,7 @@
     from t_order_new a left join user b on b.id=a.buyer_id
     where a.process_status >4 and b.share_type =2 and a.delete_sign in(0,2)
     group by b.aid)x on a.id=x.aid
-    where a.status='正常' and r.role_type in (96,996)
+    where a.status= 0 and r.role_type in (96,996)
     <if test="aid != null">
       and a.id= #{aid}
     </if>

+ 50 - 8
src/main/java/com/goafanti/common/model/Admin.java

@@ -3,7 +3,7 @@ package com.goafanti.common.model;
 import com.goafanti.common.constant.AFTConstants;
 import org.apache.commons.lang3.time.DateFormatUtils;
 
-import java.io.Serializable;
+
 import java.util.Date;
 
 /**
@@ -11,8 +11,6 @@ import java.util.Date;
  * @author
  */
 public class Admin extends BaseModel implements AftUser {
-    private static final long	serialVersionUID	= 1L;
-
     private String id;
 
     /**
@@ -118,11 +116,31 @@ public class Admin extends BaseModel implements AftUser {
     private String reviewer;
 
     /**
+     * 阿米巴编号
+     */
+    private String ambId;
+
+    /**
+     * 阿米巴权限
+     */
+    private String ambRole;
+
+    /**
+     * 阿米巴管理者 0巴员 1巴主
+     */
+    private Integer ambManage;
+
+    private static final long serialVersionUID = 1L;
+
+
+    /**
      * 上级管理用户名称
      */
     private String	superior;
     private String reviewerName;
 
+
+
     public String getReviewerName() {
         return reviewerName;
     }
@@ -147,6 +165,11 @@ public class Admin extends BaseModel implements AftUser {
             return DateFormatUtils.format(this.getCreateTime(), AFTConstants.YYYYMMDDHHMMSS);
         }
     }
+    @Override
+    public String getAid() {
+        return getId();
+    }
+
 
     public String getId() {
         return id;
@@ -192,11 +215,6 @@ public class Admin extends BaseModel implements AftUser {
         return createTime;
     }
 
-    @Override
-    public String getAid() {
-        return id;
-    }
-
     public void setCreateTime(Date createTime) {
         this.createTime = createTime;
     }
@@ -328,4 +346,28 @@ public class Admin extends BaseModel implements AftUser {
     public void setReviewer(String reviewer) {
         this.reviewer = reviewer;
     }
+
+    public String getAmbId() {
+        return ambId;
+    }
+
+    public void setAmbId(String ambId) {
+        this.ambId = ambId;
+    }
+
+    public String getAmbRole() {
+        return ambRole;
+    }
+
+    public void setAmbRole(String ambRole) {
+        this.ambRole = ambRole;
+    }
+
+    public Integer getAmbManage() {
+        return ambManage;
+    }
+
+    public void setAmbManage(Integer ambManage) {
+        this.ambManage = ambManage;
+    }
 }

+ 247 - 0
src/main/java/com/goafanti/common/model/AmbSystem.java

@@ -0,0 +1,247 @@
+package com.goafanti.common.model;
+
+import java.io.Serializable;
+import java.math.BigDecimal;
+import java.util.Date;
+
+/**
+ * amb_system
+ * @author 
+ */
+public class AmbSystem implements Serializable {
+    /**
+     * 部门id
+     */
+    private Long id;
+
+    /**
+     * 父部门id
+     */
+    private Long parentId;
+
+    /**
+     * 祖级列表
+     */
+    private String ancestors;
+
+    /**
+     * 部门名称
+     */
+    private String name;
+
+    /**
+     * 显示顺序
+     */
+    private Integer orderNum;
+
+    /**
+     * 负责人
+     */
+    private String leader;
+
+    /**
+     * 部门状态(0正常 1停用)
+     */
+    private String status;
+
+    /**
+     * 创建者
+     */
+    private String createBy;
+
+    /**
+     * 创建时间
+     */
+    private Date createTime;
+
+    /**
+     * 更新者
+     */
+    private String updateBy;
+
+    /**
+     * 更新时间
+     */
+    private Date updateTime;
+
+    /**
+     * 层级 0=集团,1=管综经开总,2=大区总,3=区总,4=事业部总,5=战区总,6=巴总
+     */
+    private Integer lvl;
+
+    /**
+     * 财务id
+     */
+    private String financeId;
+
+    /**
+     * 祖级名称
+     */
+    private String ancestorsNames;
+
+    /**
+     * 会计id
+     */
+    private String accountant;
+
+    /**
+     * 说明
+     */
+    private String remarks;
+
+    /**
+     * 总金额
+     */
+    private BigDecimal totalAmount;
+
+    /**
+     * 成员数
+     */
+    private Integer membersCount;
+
+    private static final long serialVersionUID = 1L;
+
+    public Long getId() {
+        return id;
+    }
+
+    public void setId(Long id) {
+        this.id = id;
+    }
+
+    public Long getParentId() {
+        return parentId;
+    }
+
+    public void setParentId(Long parentId) {
+        this.parentId = parentId;
+    }
+
+    public String getAncestors() {
+        return ancestors;
+    }
+
+    public void setAncestors(String ancestors) {
+        this.ancestors = ancestors;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    public Integer getOrderNum() {
+        return orderNum;
+    }
+
+    public void setOrderNum(Integer orderNum) {
+        this.orderNum = orderNum;
+    }
+
+    public String getLeader() {
+        return leader;
+    }
+
+    public void setLeader(String leader) {
+        this.leader = leader;
+    }
+
+    public String getStatus() {
+        return status;
+    }
+
+    public void setStatus(String status) {
+        this.status = status;
+    }
+
+    public String getCreateBy() {
+        return createBy;
+    }
+
+    public void setCreateBy(String createBy) {
+        this.createBy = createBy;
+    }
+
+    public Date getCreateTime() {
+        return createTime;
+    }
+
+    public void setCreateTime(Date createTime) {
+        this.createTime = createTime;
+    }
+
+    public String getUpdateBy() {
+        return updateBy;
+    }
+
+    public void setUpdateBy(String updateBy) {
+        this.updateBy = updateBy;
+    }
+
+    public Date getUpdateTime() {
+        return updateTime;
+    }
+
+    public void setUpdateTime(Date updateTime) {
+        this.updateTime = updateTime;
+    }
+
+    public Integer getLvl() {
+        return lvl;
+    }
+
+    public void setLvl(Integer lvl) {
+        this.lvl = lvl;
+    }
+
+    public String getFinanceId() {
+        return financeId;
+    }
+
+    public void setFinanceId(String financeId) {
+        this.financeId = financeId;
+    }
+
+    public String getAncestorsNames() {
+        return ancestorsNames;
+    }
+
+    public void setAncestorsNames(String ancestorsNames) {
+        this.ancestorsNames = ancestorsNames;
+    }
+
+    public String getAccountant() {
+        return accountant;
+    }
+
+    public void setAccountant(String accountant) {
+        this.accountant = accountant;
+    }
+
+    public String getRemarks() {
+        return remarks;
+    }
+
+    public void setRemarks(String remarks) {
+        this.remarks = remarks;
+    }
+
+    public BigDecimal getTotalAmount() {
+        return totalAmount;
+    }
+
+    public void setTotalAmount(BigDecimal totalAmount) {
+        this.totalAmount = totalAmount;
+    }
+
+    public Integer getMembersCount() {
+        return membersCount;
+    }
+
+    public void setMembersCount(Integer membersCount) {
+        this.membersCount = membersCount;
+    }
+}

+ 13 - 0
src/main/java/com/goafanti/common/model/NewOrderChange.java

@@ -179,6 +179,11 @@ public class NewOrderChange implements Serializable {
      */
     private BigDecimal firstAmount;
 
+    /**
+     * 审核人员名称
+     */
+    private String examineName;
+
     private static final long serialVersionUID = 1L;
 
     public Integer getId() {
@@ -452,4 +457,12 @@ public class NewOrderChange implements Serializable {
     public void setFirstAmount(BigDecimal firstAmount) {
         this.firstAmount = firstAmount;
     }
+
+    public String getExamineName() {
+        return examineName;
+    }
+
+    public void setExamineName(String examineName) {
+        this.examineName = examineName;
+    }
 }

+ 14 - 4
src/main/java/com/goafanti/common/model/Role.java

@@ -3,12 +3,13 @@ package com.goafanti.common.model;
 import java.io.Serializable;
 import java.util.Date;
 
-public class Role extends BaseModel implements Serializable{
+public class Role  implements Serializable{
     /**
-	 * 
+	 *
 	 */
 	private static final long serialVersionUID = 1L;
 
+	private String id;
 
     private String roleName;
 
@@ -23,7 +24,16 @@ public class Role extends BaseModel implements Serializable{
      */
     private Date createTime;
 
-	public String getCreater() {
+
+    public String getId() {
+        return id;
+    }
+
+    public void setId(String id) {
+        this.id = id;
+    }
+
+    public String getCreater() {
 		return creater;
 	}
 
@@ -56,4 +66,4 @@ public class Role extends BaseModel implements Serializable{
     public void setRoleType(Integer roleType) {
         this.roleType = roleType;
     }
-}
+}

Разница между файлами не показана из-за своего большого размера
+ 376 - 639
src/main/java/com/goafanti/common/model/TOrderInvoice.java


+ 18 - 4
src/main/java/com/goafanti/common/model/TOrderNew.java

@@ -6,9 +6,9 @@ import java.util.Date;
 
 /**
  * t_order_new
- * @author
+ * @author 
  */
-public class TOrderNew {
+public class TOrderNew implements Serializable {
     /**
      * 订单编号
      */
@@ -80,7 +80,7 @@ public class TOrderNew {
     private Integer projectStatus;
 
     /**
-     * 特批状态 0-非特批 ,1-待审核,2-通过,3-驳回
+     * 特批状态 0-非特批 ,1-总裁待审核,2-总裁通过,3-总裁驳回 4董事长待审核 5董事长通过 6董事长驳回
      */
     private Integer approval;
 
@@ -239,6 +239,12 @@ public class TOrderNew {
      */
     private Integer userType;
 
+    /**
+     * 审核人员名称
+     */
+    private String examineName;
+
+    private static final long serialVersionUID = 1L;
 
     public String getOrderNo() {
         return orderNo;
@@ -607,4 +613,12 @@ public class TOrderNew {
     public void setUserType(Integer userType) {
         this.userType = userType;
     }
-}
+
+    public String getExamineName() {
+        return examineName;
+    }
+
+    public void setExamineName(String examineName) {
+        this.examineName = examineName;
+    }
+}

+ 61 - 6
src/main/java/com/goafanti/common/utils/AsyncUtils.java

@@ -9,20 +9,20 @@ import java.util.UUID;
 import javax.mail.MessagingException;
 
 import com.goafanti.admin.bo.AdminListBo;
-import com.goafanti.common.dao.AdminMapper;
-import com.goafanti.common.dao.NewOrderChangeMapper;
-import com.goafanti.common.dao.TChangeTaskMapper;
+import com.goafanti.common.constant.AFTConstants;
+import com.goafanti.common.dao.*;
 import com.goafanti.common.enums.NoticeStatus;
 import com.goafanti.common.model.Admin;
 import com.goafanti.common.model.TChangeTask;
 import com.goafanti.core.shiro.token.TokenManager;
 import com.goafanti.order.bo.NewOrderChangeBo;
+import com.goafanti.order.enums.OrderChangeProcess;
+import com.goafanti.order.enums.ProcessStatus;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.scheduling.annotation.Async;
 import org.springframework.stereotype.Component;
 
 import com.goafanti.common.bo.EmailBo;
-import com.goafanti.common.dao.NoticeMapper;
 import com.goafanti.common.enums.NoticeTypes;
 import com.goafanti.common.model.Notice;
 
@@ -34,9 +34,11 @@ public class AsyncUtils {
 	@Autowired
 	private AdminMapper adminMapper;
 	@Autowired
-	private TChangeTaskMapper tChangeTaskMapper;
+	private TOrderNewMapper tOrderNewMapper;
 	@Autowired
 	private NewOrderChangeMapper newOrderChangeMapper;
+	@Autowired
+	private TOrderInvoiceMapper tOrderInvoiceMapper;
 
 
 
@@ -111,7 +113,60 @@ public class AsyncUtils {
     }
 
 
+	/**
+	 * 切换审核人员
+	 * @param depId 部门编号
+	 * @param aid 切换后审核人
+	 * @return
+	 */
+    public void updateExamineName( String depId, String aid) {
+			tOrderNewMapper.updateExamineName(3,depId,aid,null);
+			newOrderChangeMapper.updateExamineName(5,depId,aid,null);
+			tOrderInvoiceMapper.updateExamineName(0,depId,aid,null);
+	}
 
+	/**
+	 *
+	 * @param type 1营销管理 2公司管理 3财务管理 4咨询管理
+	 * @param id 管理员id
+	 * @param roleType
+	 */
+	public void updateListExamineName(Integer type, String id, String roleType) {
+		Admin admin = adminMapper.selectByPrimaryKey(id);
+		String depId=admin.getDepartmentId();
+		String names="";
+		if (type==1){
+			names=getNames(type,depId, roleType);
+			tOrderNewMapper.updateExamineName(ProcessStatus.YPYXGLY.getCode(),depId,null,names);
+			newOrderChangeMapper.updateExamineName(OrderChangeProcess.YXGLY.getCode(),depId,null,names);
+			tOrderInvoiceMapper.updateExamineName(1,depId,null,names);
+		}else if (type==2){
+			tOrderInvoiceMapper.updateListExamineName(type,depId,roleType);
+		}else if (type==3){
+			names=getNames(type,depId, roleType);
+			newOrderChangeMapper.updateExamineName(OrderChangeProcess.CWZJ.getCode(),depId,null,names);
+		}else if (type==4){
+			names=getNames(type,depId, roleType);
+			tOrderNewMapper.updateExamineName(ProcessStatus.YPZXSGLY.getCode(),depId,null,names);
+			newOrderChangeMapper.updateExamineName(OrderChangeProcess.JSZJ.getCode(),depId,null,names);
+		}else if (type==5){
+			newOrderChangeMapper.updateTaskExamineName(admin.getId(),admin.getId(),2);
+		}else if (type==6){
+			newOrderChangeMapper.updateTaskExamineName(admin.getId(),admin.getId(),3);
+		}
+	}
 
-
+	private String getNames(Integer type,String depId, String roleType) {
+		StringBuffer str=new StringBuffer();
+		List<Admin> admins = adminMapper.selectAdminByRoleType(roleType);
+		for (Admin admin : admins) {
+			if (type==1&&admin.getDepartmentId().equals(depId)){
+				str = str.append(admin.getName()).append(",");
+			}else if(type!=1){
+				str = str.append(admin.getName()).append(",");
+			}
+		}
+		if (str.length()>1)return str.substring(0,str.length()-1);
+		else return "暂无";
+	}
 }

+ 5 - 0
src/main/java/com/goafanti/common/utils/StringUtils.java

@@ -42,4 +42,9 @@ public class StringUtils extends org.apache.commons.lang3.StringUtils {
 		}
 		return false;
 	}
+
+	public static void main(String[] args) {
+
+		System.out.println(isContainChinese("91430100060111212G"));
+	}
 }

+ 1 - 1
src/main/java/com/goafanti/core/mybatis/page/Pagination.java

@@ -18,7 +18,7 @@ public class Pagination<T> extends SimplePage implements java.io.Serializable, P
 		super(pageNo, pageSize, totalCount);
 	}
 
-	public Pagination(int pageNo, int pageSize, int totalCount, List<?> list) {
+	public Pagination(int pageNo, int pageSize, int totalCount, List<T> list) {
 		super(pageNo, pageSize, totalCount);
 		this.list = list;
 	}

+ 1 - 0
src/main/java/com/goafanti/customer/controller/AdminCustomerApiController.java

@@ -891,6 +891,7 @@ public class AdminCustomerApiController extends BaseApiController{
 	@RequestMapping(value = "/listAdminByName",method = RequestMethod.GET)
 	public Result listAdminByName(String adminName,Integer status){
 		Result res = new Result();
+		adminName=adminName.trim();
 		if(StringUtils.isNotBlank(adminName))res.setData(adminService.listAdminByName(adminName,status));
 		return res;
 	}

+ 2 - 1
src/main/java/com/goafanti/customer/service/impl/CustomerServiceImpl.java

@@ -215,14 +215,15 @@ public class CustomerServiceImpl extends BaseMybatisDao<UserMapper> implements C
 	public Pagination<CustomerListOut> listAllOrganizationCustomer(CustomerListIn cli, Integer pageNo,
 			Integer pageSize) {
 		cli.setType(AFTConstants.USER_TYPE_ORGANIZATION);
-		Map<String, Object> params = disposeParams(cli);
 		String name=null;
 		String orgCode=null;
 		if (StringUtils.isContainChinese(cli.getName())){
 			name= cli.getName();
 		}else {
 			orgCode= cli.getName();
+			cli.setName(null);
 		}
+		Map<String, Object> params = disposeParams(cli);
 		if (TokenManager.hasRole(AFTConstants.SUPERADMIN)||TokenManager.hasRole(AFTConstants.APPROVAL_DECISION)) {
 			params.put("role", 1);
 			if (name!=null)params.put("name",name);

+ 13 - 3
src/main/java/com/goafanti/order/bo/NewOderCahngeListBo.java

@@ -17,9 +17,19 @@ public class NewOderCahngeListBo {
 	private BigDecimal settlementAmount;
 	private BigDecimal arrears;
 	private String salesmanName;
+	private String examineName;
 	private String depName;
 	private Integer processState;
 	private Integer backStatus;
+
+	public String getExamineName() {
+		return examineName;
+	}
+
+	public void setExamineName(String examineName) {
+		this.examineName = examineName;
+	}
+
 	public String getCreateTimes() {
 		return createTimes;
 	}
@@ -122,7 +132,7 @@ public class NewOderCahngeListBo {
 	public void setBackStatus(Integer backStatus) {
 		this.backStatus = backStatus;
 	}
-	
-	
-	
+
+
+
 }

+ 9 - 0
src/main/java/com/goafanti/order/bo/OrderListBo.java

@@ -146,10 +146,19 @@ public class OrderListBo {
 	private Integer salesType;
 	@Excel(name="销售说明")
 	private String other;
+	private String examineName;
 
 
 	private String departmentId;
 
+	public String getExamineName() {
+		return examineName;
+	}
+
+	public void setExamineName(String examineName) {
+		this.examineName = examineName;
+	}
+
 	public String getServiceType() {
 		return serviceType;
 	}

+ 13 - 3
src/main/java/com/goafanti/order/bo/TOrderInvoiceBo.java

@@ -25,7 +25,17 @@ public class TOrderInvoiceBo {
 	private BigDecimal notAmount;
 	private BigDecimal settlementAmount;
 	private String rejectReason;
+	private String examineName;
 	private Integer approval;
+
+	public String getExamineName() {
+		return examineName;
+	}
+
+	public void setExamineName(String examineName) {
+		this.examineName = examineName;
+	}
+
 	public Integer getId() {
 		return id;
 	}
@@ -56,7 +66,7 @@ public class TOrderInvoiceBo {
 	public void setProjectStatus(Integer projectStatus) {
 		this.projectStatus = projectStatus;
 	}
-	
+
 	public String getCreateTime() {
 		return createTime;
 	}
@@ -117,6 +127,6 @@ public class TOrderInvoiceBo {
 	public void setContractNo(String contractNo) {
 		this.contractNo = contractNo;
 	}
-	
-	
+
+
 }

+ 59 - 58
src/main/java/com/goafanti/order/enums/OrderStage.java

@@ -1,58 +1,59 @@
-package com.goafanti.order.enums;
-
-import java.util.HashMap;
-import java.util.Map;
-
-/**
- * 订单阶段
- * @author Administrator
- *
- */
-public enum OrderStage {
-	/** 意向阶段 **/
-	INTENTION(0,"意向阶段 "),
-	/** 跟单阶段 **/
-	FOLLOWING(1,"跟单阶段"),
-	/** 合同阶段 **/
-	SIGNED(2,"合同阶段"),
-	/** 项目阶段 **/
-	PROJECT(3, "项目阶段 "),
-	/** 无效 **/
-	INVALID(10, "无效");
-	
-	private OrderStage(Integer code, String desc) {
-		this.code = code;
-		this.desc = desc;
-	}
-
-	private static Map<Integer, OrderStage> status = new HashMap<Integer, OrderStage>();
-
-	static {
-		for (OrderStage value : OrderStage.values()) {
-			status.put(value.getCode(), value);
-		}
-	}
-	public static OrderStage getStatus(Integer code) {
-		if (containsType(code)) {
-			return status.get(code);
-		}
-		return INVALID;
-	}
-	public static boolean containsType(Integer code) {
-		return status.containsKey(code);
-	}
-	private Integer	code;
-	private String	desc;
-	public Integer getCode() {
-		return code;
-	}
-	public void setCode(Integer code) {
-		this.code = code;
-	}
-	public String getDesc() {
-		return desc;
-	}
-	public void setDesc(String desc) {
-		this.desc = desc;
-	}
-}
+package com.goafanti.order.enums;
+
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * 订单阶段
+ * @author Administrator
+ *
+ */
+public enum OrderChangeProcess {
+
+	YXY(0,"营销员"),
+	YXGLY(1,"营销管理员"),
+	JSY(2,"技术员"),
+	JSJL(3, "技术经理"),
+	JSZJ(4, "技术总监"),
+	CWZY(5, "财务专员"),
+	CWZJ(6, "财务总监 "),
+	ZC(7, "总裁"),
+	DSZ(8, "董事长"),
+	INVALID(10, "无效");
+
+	private OrderChangeProcess(Integer code, String desc) {
+		this.code = code;
+		this.desc = desc;
+	}
+
+	private static Map<Integer, OrderChangeProcess> status = new HashMap<Integer, OrderChangeProcess>();
+
+	static {
+		for (OrderChangeProcess value : OrderChangeProcess.values()) {
+			status.put(value.getCode(), value);
+		}
+	}
+	public static OrderChangeProcess getStatus(Integer code) {
+		if (containsType(code)) {
+			return status.get(code);
+		}
+		return INVALID;
+	}
+	public static boolean containsType(Integer code) {
+		return status.containsKey(code);
+	}
+	private Integer	code;
+	private String	desc;
+	public Integer getCode() {
+		return code;
+	}
+	public void setCode(Integer code) {
+		this.code = code;
+	}
+	public String getDesc() {
+		return desc;
+	}
+	public void setDesc(String desc) {
+		this.desc = desc;
+	}
+}

+ 2 - 0
src/main/java/com/goafanti/order/service/OrderNewService.java

@@ -213,4 +213,6 @@ public interface OrderNewService {
 	int updateSalesType(TOrderNew in);
 
 	void addTaskMid(Integer id, String commodityId, String orderNo);
+
+	void pushExamineName(TOrderNew t);
 }

+ 3 - 7
src/main/java/com/goafanti/order/service/impl/FundManagerOrderServiceImpl.java

@@ -12,6 +12,7 @@ import java.util.UUID;
 
 import com.goafanti.admin.service.DepartmentService;
 import com.goafanti.common.dao.*;
+import com.goafanti.common.model.*;
 import com.goafanti.order.bo.TOrderTaskBo;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -25,13 +26,6 @@ import com.goafanti.common.constant.AFTConstants;
 import com.goafanti.common.enums.NoticeStatus;
 import com.goafanti.common.enums.OrderLogProcess;
 import com.goafanti.common.error.BusinessException;
-import com.goafanti.common.model.Admin;
-import com.goafanti.common.model.TOrderBack;
-import com.goafanti.common.model.TOrderBillNew;
-import com.goafanti.common.model.TOrderBonus;
-import com.goafanti.common.model.TOrderLog;
-import com.goafanti.common.model.TOrderNew;
-import com.goafanti.common.model.TOrderRefund;
 import com.goafanti.common.utils.AsyncUtils;
 import com.goafanti.common.utils.LoggerUtils;
 import com.goafanti.common.utils.StringUtils;
@@ -484,6 +478,7 @@ public class FundManagerOrderServiceImpl extends BaseMybatisDao<TOrderNewMapper>
 			throw new BusinessException("订单流程不正确。");
 		}
 		t.setOrderNo(orderNo);
+		t.setApproval(new1.getApproval());
 		if (new1.getBackStatus()==3) {
 			t.setBackStatus(0);
 		}
@@ -516,6 +511,7 @@ public class FundManagerOrderServiceImpl extends BaseMybatisDao<TOrderNewMapper>
 				aids.add(admin.getId());
 			}
 		}
+		orderNewService.pushExamineName(t);
 		TOrderLog tl=new TOrderLog();
 		tl.setAid(TokenManager.getAdminId());
 		tl.setOrderNo(t.getOrderNo());

+ 90 - 52
src/main/java/com/goafanti/order/service/impl/OrderChangeServiceImpl.java

@@ -12,7 +12,9 @@ import com.goafanti.admin.service.DepartmentService;
 import com.goafanti.common.dao.*;
 import com.goafanti.common.model.*;
 import com.goafanti.common.utils.OrderUtils;
+import com.goafanti.order.enums.*;
 import com.goafanti.order.service.*;
+import com.goafanti.organization.bo.OrganizationListOut;
 import org.apache.poi.xssf.usermodel.XSSFCell;
 import org.apache.poi.xssf.usermodel.XSSFRow;
 import org.apache.poi.xssf.usermodel.XSSFSheet;
@@ -49,10 +51,6 @@ import com.goafanti.order.bo.TChangeTaskOut;
 import com.goafanti.order.bo.TOrderLogBo;
 import com.goafanti.order.bo.TOrderNewBo;
 import com.goafanti.order.bo.TOrderTaskBo;
-import com.goafanti.order.enums.OrderChangeType;
-import com.goafanti.order.enums.OrderNewState;
-import com.goafanti.order.enums.OrderType;
-import com.goafanti.order.enums.ProcessStatus;
 import com.goafanti.techproject.enums.TaskState;
 
 @Service
@@ -107,6 +105,8 @@ public class OrderChangeServiceImpl extends BaseMybatisDao<NewOrderChangeMapper>
 	private DepartmentService departmentService;
 	@Autowired
 	private OrderProjectService orderProjectService;
+	@Autowired
+	private DepartmentMapper departmentMapper;
 
 
 
@@ -179,16 +179,7 @@ public class OrderChangeServiceImpl extends BaseMybatisDao<NewOrderChangeMapper>
 			}
 			tChangeTaskMapper.insertSelectiveList(listck);
 		}
-		if (t.getType()==OrderChangeType.TDTK.getCode()) {
-			OrderChangeLog ocl=new OrderChangeLog();
-			ocl.setAuditor(TokenManager.getAdminId());
-			ocl.setOrderNo(t.getOrderNo());
-			ocl.setRemarks(startRemarks);
-			ocl.setChangeId(ncb.getId());
-			ocl.setStatus(0);
-			sendNotice(0, t);//设置与通过一样发送信息
-			orderChangeLogMapper.insertSelective(ocl);
-		}
+
 	return 1;
 	}
 
@@ -223,11 +214,11 @@ public class OrderChangeServiceImpl extends BaseMybatisDao<NewOrderChangeMapper>
 	public List<NewOrderChangeBo> orderChangeDetails(String orderNo) {
 		List<NewOrderChangeBo> list=newOrderChangeMapper.selectByorderNo(orderNo);
 		for (NewOrderChangeBo noc : list) {
-			List<OrderExamineBo> consultantExamine =orderExamineMapper.selectByOrderNo(noc.getOrderNo(),0);
-			List<OrderExamineBo> managerExamine=orderExamineMapper.selectByOrderNo(noc.getOrderNo(),1);
+//			List<OrderExamineBo> consultantExamine =orderExamineMapper.selectByOrderNo(noc.getOrderNo(),0);
+//			List<OrderExamineBo> managerExamine=orderExamineMapper.selectByOrderNo(noc.getOrderNo(),1);
 			int isExamine=orderExamineMapper.selectByOrderNoAndAid(noc.getOrderNo(),TokenManager.getAdminId());
-			noc.setConsultantExamine(consultantExamine);
-			noc.setManagerExamine(managerExamine);
+//			noc.setConsultantExamine(consultantExamine);
+//			noc.setManagerExamine(managerExamine);
 			if (noc.getVoucherUrl()!=null) {
 				TOrderNew t=tOrderNewMapper.selectByPrimaryKey(noc.getOrderNo());
 				noc.setVoucherUrl(pushOrderService.changeProcessStatusConstant(noc.getVoucherUrl(),t.getSalesmanId(),noc.getProcessState(),noc.getStatus()));
@@ -239,11 +230,11 @@ public class OrderChangeServiceImpl extends BaseMybatisDao<NewOrderChangeMapper>
 	@Override
 	public NewOrderChangeBo orderChangeDetailsById(Integer id) {
 		NewOrderChangeBo nb=newOrderChangeMapper.selectById(id);
-		List<OrderExamineBo> consultantExamine =orderExamineMapper.selectByOrderNo(nb.getOrderNo(),0);
-		List<OrderExamineBo> managerExamine=orderExamineMapper.selectByOrderNo(nb.getOrderNo(),1);
+//		List<OrderExamineBo> consultantExamine =orderExamineMapper.selectByOrderNo(nb.getOrderNo(),0);
+//		List<OrderExamineBo> managerExamine=orderExamineMapper.selectByOrderNo(nb.getOrderNo(),1);
 		int isExamine=orderExamineMapper.selectByOrderNoAndAid(nb.getOrderNo(),TokenManager.getAdminId());
-		nb.setConsultantExamine(consultantExamine);
-		nb.setManagerExamine(managerExamine);
+//		nb.setConsultantExamine(consultantExamine);
+//		nb.setManagerExamine(managerExamine);
 		nb.setIsExamine(isExamine);
 		if(nb.getProcessState()!=null){
 			TOrderNew t=tOrderNewMapper.selectByPrimaryKey(nb.getOrderNo());
@@ -362,6 +353,7 @@ public class OrderChangeServiceImpl extends BaseMybatisDao<NewOrderChangeMapper>
 		ocl.setStatus(status);
 		orderChangeLogMapper.insertSelective(ocl);
 		sendNotice(status,nb);
+		pushOrderCangeProcess(nb);
 		newOrderChangeMapper.updateByPrimaryKeySelective(nb);
 		return 1;
 	}
@@ -385,7 +377,7 @@ public class OrderChangeServiceImpl extends BaseMybatisDao<NewOrderChangeMapper>
 			alist.add(o.getSalesmanId());
 			break;
 		case 1:
-			alist.addAll(adminMapper.listNameByDepAndName(a.getDepartmentId(), "营销管理员"));
+			alist.addAll(adminMapper.listNameByDepAndName(a.getDepartmentId(), AFTConstants.SALESMAN_ADMIN));
 			break;
 		case 2:
 			alist.addAll(tOrderTaskMapper.listNameByDepAndName(o.getOrderNo(),0));
@@ -562,6 +554,7 @@ public class OrderChangeServiceImpl extends BaseMybatisDao<NewOrderChangeMapper>
 	public int updateOrderChange(NewOrderChangeBo t,Integer changeType,String startRemarks) {
 		NewOrderChange  noc=new NewOrderChange();
 		t.setProcessState(1);
+		noc.setOrderNo(t.getOrderNo());
 		noc.setId(t.getId());
 		if (changeType==0) {
 //			chekeChangeTaskNumber(noc);
@@ -593,10 +586,70 @@ public class OrderChangeServiceImpl extends BaseMybatisDao<NewOrderChangeMapper>
 			noc.setCwCost(t.getCwCost());
 			noc.setRefundableAmount(t.getRefundableAmount());
 		}
+		if(changeType!=2)pushOrderCangeProcess(noc);
 		if(changeType!=1)newOrderChangeMapper.updateByPrimaryKeySelective(noc);
 		return 1;
 	}
 
+	public  void pushOrderCangeProcess(NewOrderChange noc) {
+		if (noc.getProcessState()== OrderChangeProcess.YXY.getCode()){
+			TOrderNewBo ton = tOrderNewMapper.getSaleIdByOno(noc.getOrderNo());
+			noc.setExamineName(ton.getSalesmanName());
+		}else if (noc.getProcessState()== OrderChangeProcess.YXGLY.getCode()){
+			TOrderNewBo ton = tOrderNewMapper.getSaleIdByOno(noc.getOrderNo());
+			OrganizationListOut dep = departmentMapper.selectAllById(ton.getOrderDep());
+			noc.setExamineName(dep.getManagerName());
+		}else if (noc.getProcessState()== OrderChangeProcess.JSY.getCode()){
+			List<OrderExamineBo> os = orderExamineMapper.selectByOrderNo(noc.getOrderNo(), 0);
+			StringBuffer str=new StringBuffer();
+			for (OrderExamineBo o : os) {
+				if (o.getStatus()==0){
+					if (!str.toString().contains(o.getName()))str.append(o.getName()).append(",");
+				}
+			}
+			if (str.length()>0)noc.setExamineName(str.substring(0,str.length()-1));
+
+
+		}else if (noc.getProcessState()== OrderChangeProcess.JSJL.getCode()){
+			List<OrderExamineBo> os = orderExamineMapper.selectByOrderNo(noc.getOrderNo(), 1);
+			StringBuffer str=new StringBuffer();
+			for (OrderExamineBo o : os) {
+				if (o.getStatus()==0){
+					if (!str.toString().contains(o.getName()))str.append(o.getName()).append(",");
+				}
+			}
+			if (str.length()>0)noc.setExamineName(str.substring(0,str.length()-1));
+		}else if (noc.getProcessState()== OrderChangeProcess.JSZJ.getCode()){
+			StringBuffer str=new StringBuffer();
+			List<Admin> admins = adminMapper.getAdminRoleTypeList(AFTConstants.TECH_ADMIN);
+			for (Admin a : admins) {
+				str=str.append(a.getName()).append(",");
+			}
+			if (str.length()>0)noc.setExamineName(str.substring(0,str.length()-1));
+
+		}else if (noc.getProcessState()== OrderChangeProcess.CWZY.getCode()){
+			TOrderNewBo ton = tOrderNewMapper.getSaleIdByOno(noc.getOrderNo());
+			OrganizationListOut dep = departmentMapper.selectAllById(ton.getOrderDep());
+			noc.setExamineName(dep.getFinanceName());
+		}else if (noc.getProcessState()== OrderChangeProcess.CWZJ.getCode()){
+			StringBuffer str=new StringBuffer();
+			List<Admin> admins = adminMapper.getAdminRoleTypeList(AFTConstants.FINANCE_ADMIN);
+			for (Admin a : admins) {
+				str=str.append(a.getName()).append(",");
+			}
+			if (str.length()>0)noc.setExamineName(str.substring(0,str.length()-1));
+
+		}else if (noc.getProcessState()== OrderChangeProcess.ZC.getCode()||noc.getProcessState()== OrderChangeProcess.DSZ.getCode()){
+			if(noc.getStatus()==2){
+				TOrderNewBo ton = tOrderNewMapper.getSaleIdByOno(noc.getOrderNo());
+				OrganizationListOut dep = departmentMapper.selectAllById(ton.getOrderDep());
+				noc.setExamineName(dep.getFinanceName());
+			}else {
+				noc.setExamineName("");
+			}
+		}
+	}
+
 	private void chekeAmout(NewOrderChangeBo t) {
 		BigDecimal amout=t.getTotalAmount();
 		List<TChangeTaskOut> list = selectChangeTask(t.getId());
@@ -619,27 +672,7 @@ public class OrderChangeServiceImpl extends BaseMybatisDao<NewOrderChangeMapper>
 	}
 
 
-	/**
-	   *   判断变更项目是否拆分父子数量是否一直
-	 * @param noc
-	 */
-	private void chekeChangeTaskNumber(NewOrderChange noc) {
-		List<TChangeTaskOut> list=tChangeTaskMapper.selectByCid(noc.getId(),null);
-		//x记录父值y记录子值
-		int x=0;
-		int y=0;
-
-		for (TChangeTaskOut tcto : list) {
-			if (tcto.getSplitStatus()==1&&tcto.getType()!=3) {
-				x+=tcto.getCommodityQuantity();
-			}else if (tcto.getSplitStatus()==2&&tcto.getType()!=3) {
-				y+=tcto.getCommodityQuantity();
-			}
-		}
-		if (x!=y) {
-			throw new BusinessException("变更子项目与父项目数量不符");
-		}
-	}
+
 
 	@Override
 	public int addOrderRefundInvoice(OrderRefundInvoice o) {
@@ -707,7 +740,15 @@ public class OrderChangeServiceImpl extends BaseMybatisDao<NewOrderChangeMapper>
 		TOrderNewBo o=tOrderNewMapper.getSaleIdByOno(nob.getOrderNo());
 		List<String> alist = new ArrayList<>();
 		alist.add(o.getSalesmanId());
+		nb.setExamineName("");
 		newOrderChangeMapper.updateByPrimaryKeySelective(nb);
+		OrderChangeLog ocl=new OrderChangeLog();
+		ocl.setAuditor(TokenManager.getAdminId());
+		ocl.setOrderNo(nob.getOrderNo());
+		ocl.setRemarks("变更财务退票。");
+		ocl.setChangeId(nb.getId());
+		ocl.setStatus(2);
+		orderChangeLogMapper.insertSelective(ocl);
 		orderNewService.pushGeneralSendNoticeAndEmail(alist,NoticeStatus.ORDER_CHANGE_YES.getCode(), o, TokenManager.getAdminId(),0);
 		return 1;
 	}
@@ -731,8 +772,11 @@ public class OrderChangeServiceImpl extends BaseMybatisDao<NewOrderChangeMapper>
 		TOrderNew o=tOrderNewMapper.selectByPrimaryKey(nb.getOrderNo());
 		NewOrderChangeBo nob=newOrderChangeMapper.selectById(nb.getId());
 //		变更类型 0退单退款 1项目及金额变更 2仅项目变更 3仅金额变更 4重报 5赠送
-		//退单退款不需改变内容
-		if (nob.getType()==OrderChangeType.XMJJEBG.getCode()) {
+		if(nob.getType()==OrderChangeType.TDTK.getCode()) {
+			o.setTotalAmount(nob.getTotalAmount());
+			if (nob.getFirstAmount()!=null)o.setFirstAmount(nob.getFirstAmount());
+			pushTaskAndDun(nob.getId(),o);
+		}else if (nob.getType()==OrderChangeType.XMJJEBG.getCode()) {
 			o.setTotalAmount(nob.getTotalAmount());
 			if (nob.getFirstAmount()!=null)o.setFirstAmount(nob.getFirstAmount());
 			//处理项目及催款
@@ -749,12 +793,6 @@ public class OrderChangeServiceImpl extends BaseMybatisDao<NewOrderChangeMapper>
 			pushTaskAndDun(nob.getId(),o);
 		}else if (nob.getType()==OrderChangeType.ZS.getCode()) {
 			pushTaskAndDun(nob.getId(),o);
-		}else if(nob.getType()==OrderChangeType.TDTK.getCode()) {
-			//先将业务锁关闭 退单退款不做任何处理
-//			List<String> list=tOrderTaskMapper.getLockId(nb.getOrderNo(),o.getSalesmanId(),o.getBuyerId());
-//			if(!list.isEmpty())userLockReleaseMapper.updateReleaseList(list);
-//			int i=userLockReleaseMapper.selectByUidGetCount(o.getSalesmanId(),o.getBuyerId());
-//			if (i<1) userLockReleaseMapper.updateReleaseUser(o.getOrderNo());
 		}
 		//
 		o.setProcessStatus(orderProjectService.getOrderProcessStatus(nb.getOrderNo()));

+ 52 - 5
src/main/java/com/goafanti/order/service/impl/OrderInvoiceServiceImpl.java

@@ -12,6 +12,7 @@ import com.goafanti.admin.service.DepartmentService;
 import com.goafanti.common.dao.*;
 import com.goafanti.common.model.InvoiceLog;
 import com.goafanti.order.bo.*;
+import com.goafanti.organization.bo.OrganizationListOut;
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
@@ -54,11 +55,51 @@ public class OrderInvoiceServiceImpl extends BaseMybatisDao<TOrderInvoiceMapper>
 		//前端直接会直接调取上一个发起数据给新开票,防止前一个数据为审核后
 		if (o.getApproval()==2)o.setApproval(1);
 		if (o.getStatus()!=1)o.setStatus(1);
+		pushOrderInvoiceExamine(o);
 		 Integer i=tOrderInvoiceMapper.insertSelective(o);
 		addInvoiceLog(o.getId(),0);
 		return i;
 	}
 
+	private void pushOrderInvoiceExamine(TOrderInvoice o) {
+		//新增与修改
+		List<Admin> admins =new ArrayList<>();
+		StringBuffer str=new StringBuffer();
+		TOrderNewBo t = tOrderNewMapper.getSaleIdByOno(o.getOrderNo());
+		if (o.getType()==0){
+			if (o.getApproval()==0){
+				addExamineFinance(o, t);
+			}else if(o.getApproval()==1&&o.getStatus()==1){
+				admins = adminMapper.getAdminRoleTypeList(AFTConstants.HN_APPROVED);
+			}else if (o.getApproval()==2){
+				addExamineFinance(o, t);
+			}else if (o.getApproval()==1&&o.getStatus()==3){
+				o.setExamineName("");
+			}
+		}else if (o.getType()==1){
+			if(o.getApproval()==0) {
+				admins = adminMapper.listAdminBydepIdAndRoleType(t.getOrderDep(), AFTConstants.SALESMAN_ADMIN);
+			}else if(o.getApproval()==1&&o.getStatus()==1) {
+				admins = adminMapper.listAdminBydepIdAndRoleType(t.getOrderDep(), AFTConstants.COMPANY_MANAGER);
+			}else if (o.getApproval()==2){
+				admins = adminMapper.listAdminBydepIdAndRoleType(t.getOrderDep(), AFTConstants.SALESMAN_ADMIN);
+			}else if (o.getApproval()==1&&o.getStatus()==3){
+				o.setExamineName("");
+			}
+		}
+		if (!admins.isEmpty()){
+			for (Admin a : admins) {
+				if (!str.toString().contains(a.getName()))str=str.append(a.getName()).append(",");
+			}
+			if (str.length()>0)o.setExamineName(str.substring(0,str.length()-1));
+		}
+	}
+
+	private void addExamineFinance(TOrderInvoice o, TOrderNewBo t) {
+		OrganizationListOut dep = departmentMapper.selectAllById(t.getOrderDep());
+		o.setExamineName(dep.getFinanceName());
+	}
+
 	/**
 	 *
 	 * @param id 开票编号
@@ -74,7 +115,9 @@ public class OrderInvoiceServiceImpl extends BaseMybatisDao<TOrderInvoiceMapper>
 		sendNoticeAndEmail(o);
 		addInvoiceLog(o.getId(),5);
 		o.setStatus(1);
-		return tOrderInvoiceMapper.updateByPrimaryKeySelective(o);
+		int i=tOrderInvoiceMapper.updateByPrimaryKeySelective(o);
+		pushOrderInvoiceExamine(o);
+		return i;
 	}
 	/**
 	 * 	开票提交发送站内消息及邮件
@@ -94,9 +137,9 @@ public class OrderInvoiceServiceImpl extends BaseMybatisDao<TOrderInvoiceMapper>
 				}
 			}else if (o.getType()==1) {//省外
 				if(o.getApproval()==0) {
-					aids.addAll(adminMapper.listNameByDepAndName(t.getOrderDep(), "营销管理员"));
+					aids.addAll(adminMapper.listNameByDepAndName(t.getOrderDep(), AFTConstants.SALESMAN_ADMIN));
 				}else {
-					aids.addAll(adminMapper.listNameByDepAndName(t.getOrderDep(), "公司管理"));
+					aids.addAll(adminMapper.listNameByDepAndName(t.getOrderDep(), AFTConstants.COMPANY_MANAGER));
 				}
 			}
 		}
@@ -204,6 +247,7 @@ public class OrderInvoiceServiceImpl extends BaseMybatisDao<TOrderInvoiceMapper>
 		t.setId(id);
 		t.setRejectReason(reason);
 		t.setStatus(examine);
+		t.setExamineName("");
 		//examine 2通过 3拒绝
 		List<String> aids = new ArrayList<>();
 		TOrderInvoice t2=tOrderInvoiceMapper.selectByPrimaryKey(id);
@@ -219,7 +263,6 @@ public class OrderInvoiceServiceImpl extends BaseMybatisDao<TOrderInvoiceMapper>
 			//重新计算开票金额
 			addInvoiceLog(id,1);
 		}
-
 		TOrderNewBo order = tOrderNewMapper.getSaleIdByOno(t2.getOrderNo());
 		orderNewService.pushGeneralSendNoticeAndEmail(aids, type,order, TokenManager.getAdminId(),0);
 		tOrderInvoiceMapper.updateByPrimaryKeySelective(t);
@@ -266,6 +309,9 @@ public class OrderInvoiceServiceImpl extends BaseMybatisDao<TOrderInvoiceMapper>
 		t.setRejectReason(reason);
 		List<String> aids=new ArrayList<>();
 		TOrderInvoice o=tOrderInvoiceMapper.selectByPrimaryKey(id);
+		t.setType(o.getType());
+		t.setStatus(o.getStatus());
+		t.setOrderNo(o.getOrderNo());
 		TOrderNew ts=tOrderNewMapper.selectByPrimaryKey(o.getOrderNo());
 		//examine 2通过 3拒绝
 		Integer type =null;
@@ -281,10 +327,11 @@ public class OrderInvoiceServiceImpl extends BaseMybatisDao<TOrderInvoiceMapper>
 			if (o.getType()==0) {
 				aids.add(departmentMapper.selectByPrimaryKey(ts.getOrderDep()).getFinanceId());
 			}else if(o.getType()==1) {
-				aids.addAll(adminMapper.listNameByDepAndName(ts.getOrderDep(), "营销管理员"));
+				aids.addAll(adminMapper.listNameByDepAndName(ts.getOrderDep(), AFTConstants.SALESMAN_ADMIN));
 			}
 
 		}
+		pushOrderInvoiceExamine(t);
 		TOrderNewBo order = tOrderNewMapper.getSaleIdByOno(o.getOrderNo());
 		orderNewService.pushGeneralSendNoticeAndEmail(aids,type,order, TokenManager.getAdminId(),0);
 		return tOrderInvoiceMapper.updateByPrimaryKeySelective(t);

+ 38 - 2
src/main/java/com/goafanti/order/service/impl/OrderNewServiceImpl.java

@@ -488,12 +488,15 @@ public class OrderNewServiceImpl extends BaseMybatisDao<TOrderNewMapper> impleme
 			List<String> aids = new ArrayList<>();
 			Integer type;
 			AdminListBo a = adminMapper.getDeptNameByAid(TokenManager.getAdminId());
-			aids.addAll(adminMapper.listNameByDepAndName(a.getDepartmentId(), "营销管理员"));
+			aids.addAll(adminMapper.listNameByDepAndName(a.getDepartmentId(), AFTConstants.SALESMAN_ADMIN));
 			type=NoticeStatus.ORDER_START.getCode();
 
 			TOrderNewBo order = tOrderNewMapper.getSaleIdByOno(t2.getOrderNo());
 			pushGeneralSendNoticeAndEmail(aids, type,order, TokenManager.getAdminId(),t.getApproval());
-
+			if (t.getOrderDep()!=null){
+				OrganizationListOut dep = departmentMapper.selectAllById(t.getOrderDep());
+				t.setExamineName(dep.getManagerName());
+			}
 		}
 		if (t2.getApproval().equals(ApprovalNewState.ZCBH.getCode()) ||
 				t2.getApproval().equals(ApprovalNewState.DSZBH.getCode()) ||
@@ -516,6 +519,8 @@ public class OrderNewServiceImpl extends BaseMybatisDao<TOrderNewMapper> impleme
 				t.setLiquidationStatus(LiquidationNewState.WAIT_PAY_FIRST_BALANCE.getCode());
 			}
 		}
+
+
 		return tOrderNewMapper.updateByPrimaryKeySelective(t);
 	}
 
@@ -894,6 +899,7 @@ public class OrderNewServiceImpl extends BaseMybatisDao<TOrderNewMapper> impleme
 		TOrderNew t= new TOrderNew();
 		TOrderNew t2= checkDeleteSign(orderNo);
 		t.setOrderNo(orderNo);
+		t.setOrderDep(t2.getOrderDep());
 		List<String> aids = new ArrayList<>();
 		Integer type=null;
 		TOrderLog tl=new TOrderLog();
@@ -943,6 +949,8 @@ public class OrderNewServiceImpl extends BaseMybatisDao<TOrderNewMapper> impleme
 				type=NoticeStatus.ORDER_NO.getCode();
 		}
 		t.setOrderStatus(orderStatus);
+		//设置审核人员名称
+		pushExamineName(t);
 		tOrderNewMapper.updateByPrimaryKeySelective(t);
 		if (aids.isEmpty()) {
 			throw new BusinessException(new Error( "邮件发送失败,对方设置邮箱错误","邮件发送失败,对方设置邮箱错误"));
@@ -951,7 +959,35 @@ public class OrderNewServiceImpl extends BaseMybatisDao<TOrderNewMapper> impleme
 		pushGeneralSendNoticeAndEmail(aids, type,order, TokenManager.getAdminId(),t2.getApproval());
 		return 1;
 	}
+	@Override
+	public void pushExamineName(TOrderNew t){
+		StringBuffer str =new StringBuffer();
+		if (t.getProcessStatus()==ProcessStatus.YPYXY.getCode()){
+			Admin admin = adminMapper.selectByPrimaryKey(t.getSalesmanId());
+			t.setExamineName(admin.getName());
+		}else if (t.getProcessStatus()==ProcessStatus.YPCWZY.getCode()){
+			if (t.getOrderDep()!=null){
+				OrganizationListOut dep = departmentMapper.selectAllById(t.getOrderDep());
+				t.setExamineName(dep.getFinanceName());
+			}
+		}else if (t.getProcessStatus()==ProcessStatus.YPYXGLY.getCode()){
+			if (t.getOrderDep()!=null){
+				OrganizationListOut dep = departmentMapper.selectAllById(t.getOrderDep());
+				t.setExamineName(dep.getManagerName());
+			}
+		}else if (t.getProcessStatus()==ProcessStatus.YPZXSGLY.getCode()){
+			List<Admin> admins = adminMapper.getAdminRoleTypeList(AFTConstants.TECH_ADMIN);
+			for (Admin e : admins) {
+				str=str.append(e.getName()).append(",");
+			}
+		}else if (t.getProcessStatus()==ProcessStatus.YPYXY.getCode()){
+			t.setExamineName("");
+		} else {
+			t.setExamineName("");
+		}
+		if (StringUtils.isNotBlank(str))t.setExamineName(str.substring(0,str.length()-1));
 
+	}
 	/**
 	 *  订单分配触发
 	 * @param orderNo

+ 32 - 2
src/main/java/com/goafanti/order/service/impl/OrderProjectServiceImpl.java

@@ -119,6 +119,11 @@ public class OrderProjectServiceImpl extends BaseMybatisDao<TOrderTaskMapper> im
 	private TTaskMemberMapper tTaskMemberMapper;
 	@Autowired
 	private TOrderMidMapper	tOrderMidMapper;
+	@Autowired
+	private OrderExamineMapper orderExamineMapper;
+	@Autowired
+	private NewOrderChangeMapper newOrderChangeMapper;
+
 	@Value(value = "${upload.path}")
 	private String 					uploadPath 			= null;
 
@@ -160,6 +165,7 @@ public class OrderProjectServiceImpl extends BaseMybatisDao<TOrderTaskMapper> im
 			t.setConsultantId(null);
 			t.setManagerId(taskReceiverId);
 		}
+
 		t.setReceiverName(a.getName());
 		tOrderTaskMapper.updateByPrimaryKey(t);
 		List<String> aids = new ArrayList<>();
@@ -167,9 +173,34 @@ public class OrderProjectServiceImpl extends BaseMybatisDao<TOrderTaskMapper> im
 		TOrderNewBo order = tOrderNewMapper.getSaleIdByOno(t.getOrderNo());
 		orderNewService.pushGeneralSendNoticeAndEmail(aids, NoticeStatus.ORDER_TASK_TO.getCode(),order, TokenManager.getAdminId(),0,taskId);
 		checkProjiectAllocation(t.getOrderNo());
+		pushTaskChange(TokenManager.getAdminId(),taskReceiverId,type,t.getOrderNo());
 		return 1;
 	}
 
+	/**
+	 *
+	 * @param aid 操作者
+	 * @param taskReceiverId 接收方
+	 * @param type type – 0管理员派单 1经理转交 2经理派单 3咨询师转交 4回退
+	 */
+	private void pushTaskChange(String aid, String taskReceiverId,Integer type,String orderNo) {
+		if (type==1||type==3){
+			orderExamineMapper.updateDimissionTransfer(aid,taskReceiverId,null);
+		}else if (type==2){
+			OrderExamine o=new OrderExamine();
+			o.setAid(taskReceiverId);
+			o.setOrderNo(orderNo);
+			o.setCreateTime(new Date());
+			o.setType(0);//咨询师经理
+			o.setStatus(0);//正常
+			orderExamineMapper.insertSelective(o);
+		}else if (type==4){
+			orderExamineMapper.updateBack(aid,taskReceiverId);
+		}
+		newOrderChangeMapper.updateTaskExamineName(aid,taskReceiverId,2);
+		newOrderChangeMapper.updateTaskExamineName(aid,taskReceiverId,3);
+	}
+
 	private void projectDistributionPushUserMid(TOrderNew tn) {
 		if (tn.getProcessStatus()==4){
 			UserMid um=new UserMid();
@@ -277,11 +308,10 @@ public class OrderProjectServiceImpl extends BaseMybatisDao<TOrderTaskMapper> im
 
 	}
 	public void checkProjiectAllocation(String  orderNo) {
-		List<TOrderTaskBo> taskBos=tOrderTaskMapper.selectOrderTaskAll(orderNo,null);
 		TOrderNew tNew=new TOrderNew();
 		tNew.setOrderNo(orderNo);
 		tNew.setProcessStatus(getOrderProcessStatus(orderNo));
-
+		tNew.setExamineName("");
 		tOrderNewMapper.updateByPrimaryKeySelective(tNew);
 	}
 

+ 9 - 5
src/main/java/com/goafanti/order/service/impl/OrderServiceImpl.java

@@ -60,7 +60,7 @@ import com.goafanti.order.enums.CommodityType;
 import com.goafanti.order.enums.LiquidationState;
 import com.goafanti.order.enums.OrderAction;
 import com.goafanti.order.enums.OrderChannel;
-import com.goafanti.order.enums.OrderStage;
+
 import com.goafanti.order.enums.OrderState;
 import com.goafanti.order.enums.PayChannel;
 import com.goafanti.order.enums.ProjectStage;
@@ -229,7 +229,11 @@ public class OrderServiceImpl extends BaseMybatisDao<TOrderMapper> implements Or
 		if(orderAction == OrderAction.ADD_INTENTION){ //添加意向订单
 			tOrder.setOrderStatus(OrderState.WAIT_FOR_CONFIRM.getCode());
 			tOrder.setLiquidationStatus(LiquidationState.WAIT_PAY_FIRST_BALANCE.getCode());
-			tOrder.setOrderStage(OrderStage.INTENTION.getCode());
+//			tOrder.setOrderStage(OrderStage.INTENTION.getCode());
+			/** 意向阶段 **/
+			/** 跟单阶段 **/
+			/** 合同阶段 **/
+			/** 项目阶段 **/
 			tOrder.setProjectStage(ProjectStage.NOT_SATISFY_CONDITION.getCode());
 			tOrder.setLiquidationStatus(LiquidationState.WAIT_PAY_FIRST_BALANCE.getCode());
 			tOrder.setActuallyFirstPayment(initial);
@@ -242,7 +246,7 @@ public class OrderServiceImpl extends BaseMybatisDao<TOrderMapper> implements Or
 			}
 			if (confrim) {
 				tOrder.setOrderStatus(OrderState.WAIT_FOR_SIGN.getCode()); // 卖家同意
-				tOrder.setOrderStage(OrderStage.FOLLOWING.getCode());
+//				tOrder.setOrderStage(OrderStage.FOLLOWING.getCode());
 			} else {
 				tOrder.setOrderStatus(OrderState.SELLER_REFUSE_BEFORE_SIGNL.getCode()); // 买家拒绝
 			}
@@ -958,7 +962,7 @@ public class OrderServiceImpl extends BaseMybatisDao<TOrderMapper> implements Or
 		} else {
 			tOrder.setSignFirstPayment(new BigDecimal(signFirstPayment));
 			tOrder.setSignTotalAmount(new BigDecimal(signTotalAmount));
-			tOrder.setOrderStage(OrderStage.SIGNED.getCode());
+//			tOrder.setOrderStage(OrderStage.SIGNED.getCode());
 			tOrder.setOrderStatus(OrderState.ALREADY_SIGN.getCode());
 			tOrder.setProjectStage(ProjectStage.NOT_SATISFY_CONDITION.getCode());
 			tOrder.setApproval(Integer.valueOf(approval));
@@ -1574,7 +1578,7 @@ public class OrderServiceImpl extends BaseMybatisDao<TOrderMapper> implements Or
 		if(!flag)
 			throw new BusinessException(new Error(ErrorConstants.ORDER_CAN_NOT_MODIFY, orderNo, ""));
 		tOrder.setProjectStage(ProjectStage.ALREADY_SET_UP.getCode());
-		tOrder.setOrderStage(OrderStage.PROJECT.getCode());
+//		tOrder.setOrderStage(OrderStage.PROJECT.getCode());
 		tOrder.setUpdateTime(createTime);
 		tOrder.setSetUpTime(createTime);
 		tOrderMapper.updateByPrimaryKeySelective(tOrder);

+ 2 - 1
src/main/java/com/goafanti/order/service/impl/OutsourceOrgServiceImpl.java

@@ -7,6 +7,7 @@ import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 
+import com.goafanti.common.constant.AFTConstants;
 import com.goafanti.common.dao.*;
 import com.goafanti.common.model.*;
 import com.goafanti.order.bo.*;
@@ -132,7 +133,7 @@ public class OutsourceOrgServiceImpl  extends BaseMybatisDao<TOrderOutsourceMapp
 				t.setOrderStatus(1);
 				t.setProcessStatus(ProcessStatus.YPYXGLY.getCode());
 				addOrderLog(o.getOrderNo(),OrderLogProcess.WBBH.getCode(),o.getRemarks());
-				aids.addAll(adminMapper.listNameByDepAndName(adminMapper.getDeptNameByAid(t2.getSalesmanId()).getDepartmentId(), "营销管理员"));
+				aids.addAll(adminMapper.listNameByDepAndName(adminMapper.getDeptNameByAid(t2.getSalesmanId()).getDepartmentId(), AFTConstants.SALESMAN_ADMIN));
 				type=NoticeStatus.ORDER_OUTSOURCE_NO.getCode();
 			}
 			tOrderNewMapper.updateByPrimaryKeySelective(t);

+ 2 - 0
src/main/java/com/goafanti/order/service/impl/PushOrderService.java

@@ -49,6 +49,8 @@ public class PushOrderService {
             return  t.getContractPictureUrl();
         }else if (TokenManager.hasRole(AFTConstants.TECH_ADMIN)&&t.getProcessStatus()== ProcessStatus.YPZXSGLY.getCode()){
             return  t.getContractPictureUrl();
+        }else if (TokenManager.hasRole(AFTConstants.OUTSOURCE_AUDITOR)){
+            return  t.getContractPictureUrl();
         }else{
             return DEFAULTS_URL;
         }

+ 2 - 0
src/main/java/com/goafanti/organization/bo/outOrderPayment.java

@@ -94,6 +94,8 @@ public class outOrderPayment {
 	 */
 	private Integer processStatus;
 
+
+
 	/**
 	 * This method was generated by MyBatis Generator. This method returns the value of the database column t_order_payment.id
 	 * @return  the value of t_order_payment.id

+ 14 - 0
src/main/java/com/goafanti/organization/service/impl/OrganizationServiceImpl.java

@@ -3,7 +3,10 @@ package com.goafanti.organization.service.impl;
 import java.util.*;
 
 import com.goafanti.common.dao.DepartmentMapper;
+import com.goafanti.common.dao.NewOrderChangeMapper;
+import com.goafanti.common.dao.TOrderNewMapper;
 import com.goafanti.common.model.Department;
+import com.goafanti.common.utils.AsyncUtils;
 import com.goafanti.organization.bo.DepOut;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
@@ -22,6 +25,12 @@ public class OrganizationServiceImpl extends BaseMybatisDao<DepartmentMapper> im
 	private DepartmentMapper departmentMapper;
 	@Autowired
 	private TOrderMidMapper	tOrderMidMapper;
+	@Autowired
+	private TOrderNewMapper	tOrderNewMapper;
+	@Autowired
+	private NewOrderChangeMapper newOrderChangeMapper;
+	@Autowired
+	private AsyncUtils asyncUtils;
 
 	@Override
 	public Pagination<OrganizationListOut> listOrganizationManagement(OrganizationListOut olo, Integer pageNo,
@@ -187,6 +196,11 @@ public class OrganizationServiceImpl extends BaseMybatisDao<DepartmentMapper> im
 		dep.setProvince(province);
 		dep.setHideSign(hideSign);
 		dep.setWorkingHoursType(workingHoursType);
+		Department use = departmentMapper.selectByPrimaryKey(id);
+		if (!use.getFinanceId().equals(financeId)){
+			//切换后更换审核人
+			asyncUtils.updateExamineName(id,financeId);
+		}
 		tOrderMidMapper.updateFinanceId(id,financeId);
 		int x=departmentMapper.updateByPrimaryKeySelective(dep);
 		return x;

+ 4 - 0
src/main/java/com/goafanti/permission/service/impl/NewRoleServiceImpl.java

@@ -217,6 +217,7 @@ public class NewRoleServiceImpl extends BaseMybatisDao<RoleMapper> implements Ne
 				userTransferLogMapper.insertUserLockLog(aid,transferId,date);
 				patentNewMapper.updateAdmin(aid,transferId);
 				roleResourcesMapper.updateLockRelease("1",aid,transferId);//将业务锁转给指定人
+
 			}
 			if (s == roleResources.YQDD.getCode()) {
 
@@ -271,6 +272,7 @@ public class NewRoleServiceImpl extends BaseMybatisDao<RoleMapper> implements Ne
 				int x=1;
 				if (changeBo.getProcessState()==2){
 					x=orderExamineMapper.checkCountStatus(changeBo.getOrderNo(), 0,0);
+
 				}else if (changeBo.getProcessState()==3){
 					  x=orderExamineMapper.checkCountStatus(changeBo.getOrderNo(), 1,0);
 				}
@@ -287,6 +289,8 @@ public class NewRoleServiceImpl extends BaseMybatisDao<RoleMapper> implements Ne
 					newOrderChangeMapper.updateByPrimaryKeySelective(changeBo);
 				}
 			}
+			newOrderChangeMapper.updateTaskExamineName(aid,transferId,2);
+			newOrderChangeMapper.updateTaskExamineName(aid,transferId,3);
 			taskAttributionLogMapper.insertList(aid, transferId, date);
 			tTaskLogMapper.updateDimissionTransfer(aid, transferId);
 		}

+ 4 - 4
src/main/java/com/goafanti/user/controller/UserLoginController.java

@@ -100,18 +100,18 @@ public class UserLoginController extends BaseController {
 	@CrossOrigin
 	public Result managesignin(Admin admin, Boolean remember) {
 		Result res = new Result();
-		String mobile=adminMapper.selectStatusByMobile(admin.getMobile());
-		if("锁定".equals(mobile)){
+		Admin a =adminMapper.selectByMobile(admin.getMobile());
+		if("1".equals(a.getStatus())){
 			res.getError().add(buildError("","用户已被锁定不能登录"));
 			return res;
 		}
-		if("注销".equals(mobile)){
+		if("2".equals(a.getStatus())){
 			res.getError().add(buildError("","用户已被注销"));
 			return res;
 		}
 
 		res.setData(TokenManager.manageLogin(admin, remember));
-		Admin a =adminMapper.selectByMobile(admin.getMobile());
+
 		if (a!=null) {
 			shiroAddRedis();
 			a.setLastLoginTime(new Date());

+ 3 - 1
src/main/resources/props/config_local.properties

@@ -49,8 +49,10 @@ yxzj_max=800
 yxy_max=100
 yxjl_max=100
 
+amb.maxLvl=6
+
 avatar.host=//static.jishutao.com
-static.host=//static.jishutao.com/1.2.49
+static.host=//static.jishutao.com/1.2.50
 #avatar.host=//172.16.0.255:3000
 #static.host=//172.16.0.255:3000/1.2.27
 #static.host=http://172.16.1.187/prod/1.2.25

+ 3 - 1
src/main/resources/props/config_test.properties

@@ -47,7 +47,9 @@ yxzj_max=800
 yxy_max=100
 yxjl_max=100
 
-static.host=//static.jishutao.com/1.2.49
+amb.maxLvl=6
+
+static.host=//static.jishutao.com/1.2.50
 portal.host=//static.jishutao.com/portal/2.0.6
 avatar.host=//static.jishutao.com
 avatar.upload.host=//static.jishutao.com/upload

+ 1 - 1
src/main/resources/shiro_base_auth.ini

@@ -25,4 +25,4 @@
 /admin/**=admin
 /role/**=admin,permission
 /permission/**=admin,permission
-/**=login
+/**=login

+ 18 - 0
src/main/webapp/WEB-INF/views/admin/amiba.html

@@ -0,0 +1,18 @@
+<!DOCTYPE html>
+<html xmlns="http://www.w3.org/1999/xhtml"
+	xmlns:th="http://www.thymeleaf.org">
+<head th:replace="common::header(~{::title},~{::link})">
+	<title>管理中心首页</title>
+	<link th:href="${staticHost+'/dll/dll.css'}" rel="stylesheet">
+	<link th:href="${staticHost+'/admin/index.css'}" rel="stylesheet">
+</head>
+<body>
+	<div id="root"></div>
+
+	<div th:replace="common::footer(~{::script})">
+		<script type="text/javascript" th:src="${staticHost+'/vendors.js'}"></script>
+		<script type="text/javascript" th:src="${staticHost+'/dll/dll.js'}"></script>
+		<script type="text/javascript" th:src="${staticHost+'/admin/amiba.js'}"></script>
+	</div>
+</body>
+</html>

+ 36 - 59
src/main/webapp/WEB-INF/views/portal/websocket.html

@@ -1,65 +1,42 @@
 <!DOCTYPE html>
-<html xmlns="http://www.w3.org/1999/xhtml" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
-
-
+<html>
 <head>
-	<style type="text/css">
-		div
-			{
-				border:2px dashed #000000
-			}
-	</style>
-
-	<script type="text/javascript">
-
-	</script>
+	<meta charset="utf-8">
+	<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=0.5, maximum-scale=2.0, user-scalable=yes" />
+	<title>聊天室示例</title>
 </head>
-
 <body>
-	<h1>Rumia chat room</h1>
-	
-	<div>
-		<p id="talked"></p>
-	</div>
-	<br>
-	<div>
-		<input type="text" id="say">
-		<button onclick="sendData()">SAY</button>
-	</div>
-	
-	
-
-	<script type="text/javascript">
-
-		var ws = new WebSocket("ws://" + window.location.host + "/webSocketServer");
-
-		function sendData()
-		{
-			var msg = document.getElementById("say").value;
-			ws.send(msg);
+<textarea id="sendText"></textarea>
+<button onclick="sendMessage()">发送</button>
+<script>
+	var connect;
+	window.onload=function unit(){
+		if ("WebSocket" in window){
+			// 打开一个 web socket
+			connect = new WebSocket("ws://localhost:8080/webSocketServer");
+			connect.onopen = function(){
+				// Web Socket 已连接上
+				alert("已连接");
+			};
+			connect.onmessage = function (evt){
+				var r_msg = evt.data;
+				document.body.innerHTML+="<br/>接收的信息为:"+r_msg;
+			};//接收时自己也会接收,可以自己设置过滤的if语句
+
+			connect.onclose = function(){
+				// 关闭 websocket
+				alert("连接关闭");
+			};
 		}
-
-		ws.onopen = function(evt)
-		{ 
-			console.log("Connection open ..."); 
-		};
-
-		ws.onmessage = function(evt)
-		{
-			console.log("Received Message: " + evt.data);
-			document.getElementById("talked").innerHTML = document.getElementById("talked").innerHTML + "<br>" + evt.data;
-		};
-
-		ws.onclose = function(evt)
-		{
-			console.log("Connection closed.");
-		};
-
-		ws.onerror = function(evt)
-		{
-			console.log("error!!!"); 
-		};
-
-	</script>
-
+		else{
+			// 浏览器不支持 WebSocket
+			alert("您的浏览器不支持 WebSocket!");
+		}
+	};
+	function sendMessage(){
+		connect.send(document.getElementById("sendText").value);
+		document.getElementById("sendText").innerHTML="";
+	}
+</script>
 </body>
+</html>