Browse Source

Merge branch 'test' of jishutao/kede-server into prod

anderx 3 years ago
parent
commit
3f769920a3
85 changed files with 3487 additions and 601 deletions
  1. 85 28
      src/main/java/com/goafanti/admin/controller/AdminApiController.java
  2. 6 6
      src/main/java/com/goafanti/admin/controller/AdminSuperviseApiController.java
  3. 3 2
      src/main/java/com/goafanti/admin/controller/AdminSuperviserApiController.java
  4. 2 2
      src/main/java/com/goafanti/admin/service/impl/NewAdminServiceImpl.java
  5. 79 0
      src/main/java/com/goafanti/ambSystem/bo/InputAmbInvest.java
  6. 27 0
      src/main/java/com/goafanti/ambSystem/bo/InputAmbPayment.java
  7. 88 0
      src/main/java/com/goafanti/ambSystem/bo/InputInvestList.java
  8. 114 0
      src/main/java/com/goafanti/ambSystem/bo/OutInvestList.java
  9. 69 0
      src/main/java/com/goafanti/ambSystem/bo/OutInvestLog.java
  10. 11 0
      src/main/java/com/goafanti/ambSystem/controller/AmbApiController.java
  11. 159 0
      src/main/java/com/goafanti/ambSystem/controller/AmbInvestApiController.java
  12. 32 28
      src/main/java/com/goafanti/ambSystem/controller/AmbPaymentApiController.java
  13. 29 0
      src/main/java/com/goafanti/ambSystem/service/AmbInvestService.java
  14. 11 1
      src/main/java/com/goafanti/ambSystem/service/AmbPaymentService.java
  15. 5 0
      src/main/java/com/goafanti/ambSystem/service/AmbService.java
  16. 235 0
      src/main/java/com/goafanti/ambSystem/service/Impl/AmbInvestServiceImpl.java
  17. 34 2
      src/main/java/com/goafanti/ambSystem/service/Impl/AmbPaymentServiceImpl.java
  18. 39 9
      src/main/java/com/goafanti/ambSystem/service/Impl/AmbServiceImpl.java
  19. 2 2
      src/main/java/com/goafanti/common/controller/BaseApiController.java
  20. 3 1
      src/main/java/com/goafanti/common/controller/BaseController.java
  21. 1 1
      src/main/java/com/goafanti/common/dao/AdminMapper.java
  22. 23 0
      src/main/java/com/goafanti/common/dao/AmbInvestLogMapper.java
  23. 30 0
      src/main/java/com/goafanti/common/dao/AmbInvestMapper.java
  24. 2 1
      src/main/java/com/goafanti/common/dao/AmbSystemMapper.java
  25. 3 0
      src/main/java/com/goafanti/common/dao/NewOrderChangeMapper.java
  26. 2 2
      src/main/java/com/goafanti/common/dao/OrderExamineMapper.java
  27. 19 0
      src/main/java/com/goafanti/common/dao/TOrderHighTechMapper.java
  28. 2 0
      src/main/java/com/goafanti/common/dao/TOrderNewMapper.java
  29. 9 1
      src/main/java/com/goafanti/common/dao/UserRoleMapper.java
  30. 3 0
      src/main/java/com/goafanti/common/enums/NoticeStatus.java
  31. 1 0
      src/main/java/com/goafanti/common/enums/OrderLogProcess.java
  32. 40 24
      src/main/java/com/goafanti/common/mapper/AdminMapper.xml
  33. 119 0
      src/main/java/com/goafanti/common/mapper/AmbInvestLogMapper.xml
  34. 220 0
      src/main/java/com/goafanti/common/mapper/AmbInvestMapper.xml
  35. 35 24
      src/main/java/com/goafanti/common/mapper/AmbPaymentApplicationMapper.xml
  36. 46 4
      src/main/java/com/goafanti/common/mapper/AmbSystemMapper.xml
  37. 107 61
      src/main/java/com/goafanti/common/mapper/NewOrderChangeMapper.xml
  38. 14 2
      src/main/java/com/goafanti/common/mapper/OrderExamineMapper.xml
  39. 29 30
      src/main/java/com/goafanti/common/mapper/PermissionMapper.xml
  40. 147 0
      src/main/java/com/goafanti/common/mapper/TOrderHighTechMapper.xml
  41. 1 1
      src/main/java/com/goafanti/common/mapper/TOrderInvoiceMapper.xml
  42. 56 19
      src/main/java/com/goafanti/common/mapper/TOrderNewMapper.xml
  43. 1 1
      src/main/java/com/goafanti/common/mapper/TOrderTaskMapper.xml
  44. 19 6
      src/main/java/com/goafanti/common/mapper/TTaskMidMapper.xml
  45. 20 15
      src/main/java/com/goafanti/common/mapper/UserRoleMapper.xml
  46. 21 0
      src/main/java/com/goafanti/common/model/Admin.java
  47. 127 0
      src/main/java/com/goafanti/common/model/AmbInvest.java
  48. 98 0
      src/main/java/com/goafanti/common/model/AmbInvestLog.java
  49. 26 13
      src/main/java/com/goafanti/common/model/AmbPaymentApplication.java
  50. 48 2
      src/main/java/com/goafanti/common/model/AmbSystem.java
  51. 126 0
      src/main/java/com/goafanti/common/model/TOrderHighTech.java
  52. 83 4
      src/main/java/com/goafanti/common/model/TOrderNewWithBLOBs.java
  53. 14 0
      src/main/java/com/goafanti/common/model/TTaskMid.java
  54. 7 14
      src/main/java/com/goafanti/common/task/ReleaseUserTask.java
  55. 20 1
      src/main/java/com/goafanti/common/utils/AsyncUtils.java
  56. 8 2
      src/main/java/com/goafanti/common/utils/FileUtils.java
  57. 1 0
      src/main/java/com/goafanti/core/shiro/token/TokenManager.java
  58. 1 0
      src/main/java/com/goafanti/customer/service/impl/CustomerServiceImpl.java
  59. 9 0
      src/main/java/com/goafanti/order/bo/InputAddTask.java
  60. 95 0
      src/main/java/com/goafanti/order/bo/OrderProcessName.java
  61. 149 0
      src/main/java/com/goafanti/order/bo/OutProcessName.java
  62. 95 0
      src/main/java/com/goafanti/order/bo/TOrderNewBo.java
  63. 8 0
      src/main/java/com/goafanti/order/bo/TOrderTaskBo.java
  64. 17 1
      src/main/java/com/goafanti/order/controller/AdminNewOrderApiController.java
  65. 1 1
      src/main/java/com/goafanti/order/controller/AdminOrderApiController.java
  66. 14 1
      src/main/java/com/goafanti/order/controller/OrderChangeApiController.java
  67. 9 8
      src/main/java/com/goafanti/order/enums/OrderChangeProcess.java
  68. 4 1
      src/main/java/com/goafanti/order/enums/OrderImgEnums.java
  69. 13 13
      src/main/java/com/goafanti/order/enums/ProcessStatus.java
  70. 7 0
      src/main/java/com/goafanti/order/service/OrderChangeService.java
  71. 3 0
      src/main/java/com/goafanti/order/service/OrderNewService.java
  72. 1 1
      src/main/java/com/goafanti/order/service/impl/FundManagerOrderServiceImpl.java
  73. 322 163
      src/main/java/com/goafanti/order/service/impl/OrderChangeServiceImpl.java
  74. 101 58
      src/main/java/com/goafanti/order/service/impl/OrderNewServiceImpl.java
  75. 5 4
      src/main/java/com/goafanti/order/service/impl/OrderProjectServiceImpl.java
  76. 2 1
      src/main/java/com/goafanti/order/service/impl/OrderServiceImpl.java
  77. 10 1
      src/main/java/com/goafanti/order/service/impl/PushOrderService.java
  78. 23 16
      src/main/java/com/goafanti/permission/bo/PermissionBo.java
  79. 1 4
      src/main/java/com/goafanti/permission/controller/NewPermissionApiController.java
  80. 4 2
      src/main/java/com/goafanti/permission/service/impl/NewRoleServiceImpl.java
  81. 24 13
      src/main/java/com/goafanti/permission/service/impl/PermissionServiceImpl.java
  82. 4 0
      src/main/java/com/goafanti/user/controller/UserLoginController.java
  83. 2 2
      src/main/resources/props/config_local.properties
  84. 1 1
      src/main/resources/props/config_test.properties
  85. 1 1
      src/main/webapp/WEB-INF/views/admin/amiba.html

+ 85 - 28
src/main/java/com/goafanti/admin/controller/AdminApiController.java

@@ -2,20 +2,19 @@ package com.goafanti.admin.controller;
 
 import java.math.BigDecimal;
 import java.text.ParseException;
-import java.util.Arrays;
-import java.util.Calendar;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.TreeMap;
-import java.util.UUID;
+import java.util.*;
+import java.util.stream.Collectors;
 
 import javax.annotation.Resource;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 import javax.validation.Valid;
 
+import com.goafanti.ambSystem.service.AmbPaymentService;
+import com.goafanti.common.model.*;
+import com.goafanti.order.enums.OrderImgEnums;
 import org.springframework.beans.BeanUtils;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.stereotype.Controller;
 import org.springframework.validation.BindingResult;
@@ -91,27 +90,6 @@ import com.goafanti.common.enums.UserFields;
 import com.goafanti.common.enums.UserIdentityFields;
 import com.goafanti.common.enums.UserLevel;
 import com.goafanti.common.enums.UserType;
-import com.goafanti.common.model.Admin;
-import com.goafanti.common.model.OrgActivity;
-import com.goafanti.common.model.OrgActivityCost;
-import com.goafanti.common.model.OrgAnnualReport;
-import com.goafanti.common.model.OrgCognizance;
-import com.goafanti.common.model.OrgCognizanceProportion;
-import com.goafanti.common.model.OrgFinance;
-import com.goafanti.common.model.OrgHonorDatum;
-import com.goafanti.common.model.OrgHumanResource;
-import com.goafanti.common.model.OrgIntellectualProperty;
-import com.goafanti.common.model.OrgRatepay;
-import com.goafanti.common.model.OrgStandard;
-import com.goafanti.common.model.OrgTechAchievement;
-import com.goafanti.common.model.OrgTechCenter;
-import com.goafanti.common.model.OrgTechCenterDetail;
-import com.goafanti.common.model.OrgTechProduct;
-import com.goafanti.common.model.OrganizationIdentity;
-import com.goafanti.common.model.PatentInfo;
-import com.goafanti.common.model.User;
-import com.goafanti.common.model.UserAbility;
-import com.goafanti.common.model.UserIdentity;
 import com.goafanti.common.utils.DateUtils;
 import com.goafanti.common.utils.HttpUtils;
 import com.goafanti.common.utils.LoggerUtils;
@@ -183,6 +161,8 @@ public class AdminApiController extends CertifyApiController {
 	private CopyrightInfoService			copyrightInfoService;
 	@Resource
 	private OrgCognizanceProportionService	orgCognizanceProportionService;
+	@Autowired
+	private AmbPaymentService ambPaymentService;
 
 
 
@@ -3070,4 +3050,81 @@ public class AdminApiController extends CertifyApiController {
 		return res;
 	}
 
+
+	/** 图片上传 **/
+	@RequestMapping(value = "/uploadImg", method = RequestMethod.POST)
+	public synchronized Result uploadImg(HttpServletRequest req, String id, String sign){
+		Result res = new Result();
+		if (StringUtils.isBlank(id)){
+			res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR,"编号","编号"));
+			return  res;
+		}
+		if (sign.equals(OrderImgEnums.AMBPAYMENT.getCode())){
+			String imageUrl=uploadFile(res, "/amb_payment/", req,id, sign);
+			Long idL=Long.valueOf(id);
+			AmbPaymentApplication bo = ambPaymentService.selectByid(idL);
+			String newURL=pushUploadURL(bo.getAnnexUrl(),imageUrl);
+			AmbPaymentApplication newBo=new AmbPaymentApplication();
+			newBo.setId(idL);
+			newBo.setAnnexUrl(newURL);
+			ambPaymentService.updateById(newBo);
+			res.setData(imageUrl);
+		}else {
+			res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR,"sign","sign"));
+			return  res;
+		}
+
+		return res;
+	}
+
+	private String pushUploadURL(String annexUrl,String imageUrl) {
+		StringBuffer str=new StringBuffer();
+		if (StringUtils.isNotBlank(annexUrl)){
+			str=str.append(annexUrl).append(",").append(imageUrl);
+		}else {
+			str=str.append(imageUrl);
+		}
+		return str.toString();
+	}
+
+	@RequestMapping(value = "/deleteImg", method = RequestMethod.POST)
+	public Result deleteOrderImg(String fileName,String id,String sign){
+		Result res = new Result();
+		if (StringUtils.isBlank(id)){
+			res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR,"编号","编号"));
+			return  res;
+		}
+		if (sign.equals(OrderImgEnums.AMBPAYMENT.getCode())){
+			deleteFile(res,fileName);
+			Long idL=Long.valueOf(id);
+			AmbPaymentApplication bo = ambPaymentService.selectByid(idL);
+			String newURL=pushDeleteURL(bo.getAnnexUrl(),fileName);
+			AmbPaymentApplication newBo=new AmbPaymentApplication();
+			newBo.setId(idL);
+			newBo.setAnnexUrl(newURL);
+			res.setData(ambPaymentService.updateById(newBo));
+		}else {
+			res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR,"sign","sign"));
+			return  res;
+		}
+
+		return res;
+	}
+
+	private String pushDeleteURL(String annexUrl, String fileName) {
+		List<String > list=new ArrayList<>();
+		StringBuffer str=new StringBuffer();
+		if (StringUtils.isNotBlank(annexUrl)){
+			String[] ss=annexUrl.split(",");
+			list= Arrays.stream(ss).filter(e ->!e.equals(fileName)).collect(Collectors.toList());
+		}
+		if (list.size()<1){
+			return "";
+		}else {
+			for (String s : list) {
+				str=str.append(s).append(",");
+			}
+			return str.substring(0,str.length()-1);
+		}
+	}
 }

+ 6 - 6
src/main/java/com/goafanti/admin/controller/AdminSuperviseApiController.java

@@ -60,7 +60,7 @@ public class AdminSuperviseApiController extends CertifyApiController {
 			res.getError().add(buildError("", "查询条件不能为空!"));
 			return res;
 		}
-		
+
 		if (UserType.PERSONAL.getCode().equals(type)){
 			res.setData(userService.findUserNameByNameAndMobile(name, mobile));
 		} else {
@@ -170,7 +170,7 @@ public class AdminSuperviseApiController extends CertifyApiController {
 	}
 
 	/**
-	 * 修改管理员信息
+	 * 修改管理员信息(不是管理员列表修改)
 	 */
 	@RequestMapping(value = "/updateAdmin", method = RequestMethod.POST)
 	public Result updateAdmin(@RequestParam(value = "roles[]", required = false) String[] roleIds, String data) {
@@ -201,10 +201,10 @@ public class AdminSuperviseApiController extends CertifyApiController {
 			}
 
 			Admin a = adminService.selectByPrimaryKey(admin.getId());
-			if (null == a) {	
-				res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "用户id"));				
+			if (null == a) {
+				res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "用户id"));
 				return res;
-				
+
 			}
 			Admin ad = new Admin();
 			BeanUtils.copyProperties(admin, ad);
@@ -212,7 +212,7 @@ public class AdminSuperviseApiController extends CertifyApiController {
 			if (!res.getError().isEmpty()) {
 				return res;
 			}
-		
+
 			List<String> roles = new ArrayList<String>();
 			if (roleIds != null && roleIds.length > 0) {
 				for (String role : roleIds) {

+ 3 - 2
src/main/java/com/goafanti/admin/controller/AdminSuperviserApiController.java

@@ -157,15 +157,16 @@ public class AdminSuperviserApiController extends CertifyApiController {
 			}
 			Admin ad = new Admin();
 			BeanUtils.copyProperties(admin, ad);
+			ad.setNumber(a.getNumber());
 			res = disposeAdminLocationList(res, jo, ad);
 			if (!res.getError().isEmpty()) {
 				return res;
 			}
 			//如果锁定,清楚登陆者的token
-			if (!a.getStatus().equals(ad.getStatus())&&!ad.getStatus().equals("正常")){
+			if (!a.getStatus().equals(ad.getStatus())&&!ad.getStatus().equals("0")){
 				redisUtil.deleteAid(aa.getId());
 			}
-		res.setData(newAdminService.updateByPrimaryKeySelective(ad, roles));
+			res.setData(newAdminService.updateByPrimaryKeySelective(ad, roles));
 		}
 		return res;
 	}

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

@@ -106,7 +106,7 @@ public class NewAdminServiceImpl extends BaseMybatisDao<AdminMapper> implements
 		}
 
 		ad.setType(sumType(roleIds));
-		int count=adminMapper.updateByPrimaryKeySelective(ad);
+		int count=adminMapper.updateByPrimaryKey(ad);
 		pushAmbRole(ad);
 		pushAdminRole(ad.getId(),roleIds,useRole);
 		if (count>0&&ad.getAmbId()!=null){
@@ -326,7 +326,7 @@ public class NewAdminServiceImpl extends BaseMybatisDao<AdminMapper> implements
 			TokenManager.clearUserAuthByUserId(ad.getId());
 		}
 		if(ad.getAmbId()!=null)pushAmbRole(ad);
-		adminMapper.insertSelective(ad);
+		adminMapper.insert(ad);
 		pushAdminRole(ad.getId(),roleIds,null);
 		return 1;
 	}

+ 79 - 0
src/main/java/com/goafanti/ambSystem/bo/InputAmbInvest.java

@@ -0,0 +1,79 @@
+package com.goafanti.ambSystem.bo;
+
+import com.goafanti.common.constant.ErrorConstants;
+import com.goafanti.common.utils.Param;
+
+import javax.validation.constraints.NotNull;
+import java.math.BigDecimal;
+
+public class InputAmbInvest {
+    private Long id;
+
+    private Long myAmbId;
+    @NotNull(message = "{"+ ErrorConstants.PARAM_EMPTY_ERROR+"}")
+    @Param(name = "接收阿米巴编号")
+    private Long otherAmbId;
+    @NotNull(message = "{"+ ErrorConstants.PARAM_EMPTY_ERROR+"}")
+    @Param(name = "金额")
+    private BigDecimal amount;
+    private String comment;
+    private Integer status;
+    /** 0其他 1董事长或助理*/
+    private Integer roleType;
+
+    public Integer getRoleType() {
+        return roleType;
+    }
+
+    public void setRoleType(Integer roleType) {
+        this.roleType = roleType;
+    }
+
+    public Long getId() {
+        return id;
+    }
+
+    public void setId(Long id) {
+        this.id = id;
+    }
+
+    public Integer getStatus() {
+        return status;
+    }
+
+    public void setStatus(Integer status) {
+        this.status = status;
+    }
+
+    public Long getMyAmbId() {
+        return myAmbId;
+    }
+
+    public void setMyAmbId(Long myAmbId) {
+        this.myAmbId = myAmbId;
+    }
+
+    public Long getOtherAmbId() {
+        return otherAmbId;
+    }
+
+    public void setOtherAmbId(Long otherAmbId) {
+        this.otherAmbId = otherAmbId;
+    }
+
+    public BigDecimal getAmount() {
+        return amount;
+    }
+
+    public void setAmount(BigDecimal amount) {
+        this.amount = amount;
+    }
+
+    public String getComment() {
+        return comment;
+    }
+
+    public void setComment(String comment) {
+        this.comment = comment;
+    }
+}

+ 27 - 0
src/main/java/com/goafanti/ambSystem/bo/InputAmbPayment.java

@@ -16,6 +16,33 @@ public class InputAmbPayment extends AmbPaymentApplication {
     @Param(name="付款金额")
     @NotNull(message = "{"+ ErrorConstants.PARAM_EMPTY_ERROR+"}")
     private BigDecimal totalAmount;
+    @Param(name="发起阿米巴")
+    @NotNull(message = "{"+ ErrorConstants.PARAM_EMPTY_ERROR+"}")
+    private Long initiateAmbId;
+
+    @Param(name="接受阿米巴")
+    @NotNull(message = "{"+ ErrorConstants.PARAM_EMPTY_ERROR+"}")
+    private Long acceptAmbId;
+
+    @Override
+    public Long getInitiateAmbId() {
+        return initiateAmbId;
+    }
+
+    @Override
+    public void setInitiateAmbId(Long initiateAmbId) {
+        this.initiateAmbId = initiateAmbId;
+    }
+
+    @Override
+    public Long getAcceptAmbId() {
+        return acceptAmbId;
+    }
+
+    @Override
+    public void setAcceptAmbId(Long acceptAmbId) {
+        this.acceptAmbId = acceptAmbId;
+    }
 
     @Override
     public Integer getType() {

+ 88 - 0
src/main/java/com/goafanti/ambSystem/bo/InputInvestList.java

@@ -0,0 +1,88 @@
+package com.goafanti.ambSystem.bo;
+
+public class InputInvestList {
+    private Integer pageSize;
+    private Integer pageNo;
+    private Integer status;
+    /**
+     * 0 巴主发起列表 1财务审核列表 2部门投资出 3获取投资
+     */
+    private Integer roleType;
+    private Long initiateAmbId;
+    private Long acceptAmbId;
+    private String startTime;
+    private String endTime;
+    private String operator;
+
+    public String getOperator() {
+        return operator;
+    }
+
+    public void setOperator(String operator) {
+        this.operator = operator;
+    }
+
+    public Integer getStatus() {
+        return status;
+    }
+
+    public void setStatus(Integer status) {
+        this.status = status;
+    }
+
+    public Long getInitiateAmbId() {
+        return initiateAmbId;
+    }
+
+    public void setInitiateAmbId(Long initiateAmbId) {
+        this.initiateAmbId = initiateAmbId;
+    }
+
+    public Long getAcceptAmbId() {
+        return acceptAmbId;
+    }
+
+    public void setAcceptAmbId(Long acceptAmbId) {
+        this.acceptAmbId = acceptAmbId;
+    }
+
+    public String getStartTime() {
+        return startTime;
+    }
+
+    public void setStartTime(String startTime) {
+        this.startTime = startTime;
+    }
+
+    public String getEndTime() {
+        return endTime;
+    }
+
+    public void setEndTime(String endTime) {
+        this.endTime = endTime;
+    }
+
+    public Integer getRoleType() {
+        return roleType;
+    }
+
+    public void setRoleType(Integer roleType) {
+        this.roleType = roleType;
+    }
+
+    public Integer getPageSize() {
+        return pageSize;
+    }
+
+    public void setPageSize(Integer pageSize) {
+        this.pageSize = pageSize;
+    }
+
+    public Integer getPageNo() {
+        return pageNo;
+    }
+
+    public void setPageNo(Integer pageNo) {
+        this.pageNo = pageNo;
+    }
+}

+ 114 - 0
src/main/java/com/goafanti/ambSystem/bo/OutInvestList.java

@@ -0,0 +1,114 @@
+package com.goafanti.ambSystem.bo;
+
+import java.math.BigDecimal;
+
+public class OutInvestList {
+    private Long id;
+    private Long initiateAmbId;
+    private Long acceptAmbId;
+    private String initiateName;
+    private String acceptName;
+    private BigDecimal amount;
+    private BigDecimal countAmount;
+    private Integer status;
+    private String operator;
+    private String comment;
+    private String createTimes;
+    private String ambRole;
+
+    public String getAmbRole() {
+        return ambRole;
+    }
+
+    public void setAmbRole(String ambRole) {
+        this.ambRole = ambRole;
+    }
+
+    public BigDecimal getCountAmount() {
+        return countAmount;
+    }
+
+    public void setCountAmount(BigDecimal countAmount) {
+        this.countAmount = countAmount;
+    }
+
+    public Long getInitiateAmbId() {
+        return initiateAmbId;
+    }
+
+    public void setInitiateAmbId(Long initiateAmbId) {
+        this.initiateAmbId = initiateAmbId;
+    }
+
+    public Long getAcceptAmbId() {
+        return acceptAmbId;
+    }
+
+    public void setAcceptAmbId(Long acceptAmbId) {
+        this.acceptAmbId = acceptAmbId;
+    }
+
+    public Long getId() {
+        return id;
+    }
+
+    public void setId(Long id) {
+        this.id = id;
+    }
+
+    public String getInitiateName() {
+        return initiateName;
+    }
+
+    public void setInitiateName(String initiateName) {
+        this.initiateName = initiateName;
+    }
+
+    public String getAcceptName() {
+        return acceptName;
+    }
+
+    public void setAcceptName(String acceptName) {
+        this.acceptName = acceptName;
+    }
+
+    public BigDecimal getAmount() {
+        return amount;
+    }
+
+    public void setAmount(BigDecimal amount) {
+        this.amount = amount;
+    }
+
+    public Integer getStatus() {
+        return status;
+    }
+
+    public void setStatus(Integer status) {
+        this.status = status;
+    }
+
+    public String getOperator() {
+        return operator;
+    }
+
+    public void setOperator(String operator) {
+        this.operator = operator;
+    }
+
+    public String getComment() {
+        return comment;
+    }
+
+    public void setComment(String comment) {
+        this.comment = comment;
+    }
+
+    public String getCreateTimes() {
+        return createTimes;
+    }
+
+    public void setCreateTimes(String createTimes) {
+        this.createTimes = createTimes;
+    }
+}

+ 69 - 0
src/main/java/com/goafanti/ambSystem/bo/OutInvestLog.java

@@ -0,0 +1,69 @@
+package com.goafanti.ambSystem.bo;
+
+import java.math.BigDecimal;
+
+public class OutInvestLog {
+    private Long id;
+    private Long ambInvestId;
+    private BigDecimal amount;
+    private Integer status;
+    private String comment;
+    private String operator;
+    private String createTimes;
+
+    public Long getId() {
+        return id;
+    }
+
+    public void setId(Long id) {
+        this.id = id;
+    }
+
+    public Long getAmbInvestId() {
+        return ambInvestId;
+    }
+
+    public void setAmbInvestId(Long ambInvestId) {
+        this.ambInvestId = ambInvestId;
+    }
+
+    public BigDecimal getAmount() {
+        return amount;
+    }
+
+    public void setAmount(BigDecimal amount) {
+        this.amount = amount;
+    }
+
+    public Integer getStatus() {
+        return status;
+    }
+
+    public void setStatus(Integer status) {
+        this.status = status;
+    }
+
+    public String getComment() {
+        return comment;
+    }
+
+    public void setComment(String comment) {
+        this.comment = comment;
+    }
+
+    public String getOperator() {
+        return operator;
+    }
+
+    public void setOperator(String operator) {
+        this.operator = operator;
+    }
+
+    public String getCreateTimes() {
+        return createTimes;
+    }
+
+    public void setCreateTimes(String createTimes) {
+        this.createTimes = createTimes;
+    }
+}

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

@@ -119,4 +119,15 @@ public class AmbApiController extends CertifyApiController {
 		return res;
 	}
 
+	/**
+	 * 下拉把列表
+	 * @return
+	 */
+	@RequestMapping(value="/getMyambDtails",method = RequestMethod.GET)
+	public Result getMyambDtails( ){
+		Result res =new Result();
+		res.data(ambService.getMyambDtails());
+		return res;
+	}
+
 }

+ 159 - 0
src/main/java/com/goafanti/ambSystem/controller/AmbInvestApiController.java

@@ -0,0 +1,159 @@
+package com.goafanti.ambSystem.controller;
+
+import com.goafanti.ambSystem.bo.InputAmb;
+import com.goafanti.ambSystem.bo.InputAmbInvest;
+import com.goafanti.ambSystem.bo.InputInvestList;
+import com.goafanti.ambSystem.service.AmbInvestService;
+import com.goafanti.ambSystem.service.AmbService;
+import com.goafanti.common.bo.Result;
+import com.goafanti.common.constant.AFTConstants;
+import com.goafanti.common.constant.ErrorConstants;
+import com.goafanti.common.controller.CertifyApiController;
+import com.goafanti.common.enums.ActivityFields;
+import com.goafanti.common.utils.ParamUtils;
+import com.goafanti.core.shiro.token.TokenManager;
+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;
+
+import javax.validation.Valid;
+import java.math.BigDecimal;
+
+
+@RestController
+@RequestMapping(value = "/api/admin/amb/Invest")
+public class AmbInvestApiController extends CertifyApiController {
+	@Autowired
+	private AmbInvestService ambInvestService;
+
+	/**
+	 * 投资金额
+	 * @return
+	 */
+	@RequestMapping(value="/addTransfer",method = RequestMethod.POST)
+	public Result transfer(@Validated InputAmbInvest 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;
+		}
+		if(!TokenManager.hasRole(AFTConstants.APPROVAL_DECISION)&&!TokenManager.hasRole(AFTConstants.APPROVAL_DECISION_AUDITOR)){
+			in.setRoleType(0);
+			if (in.getMyAmbId()==null){
+				res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR,"发起部门","发起部门"));
+				return res;
+			}
+			if (ambInvestService.checkMyAmb(in.getMyAmbId())){
+				res.getError().add(buildError("只有当前阿米巴负责人可以发起投资划拨。"));
+				return res;
+			}
+		}else {
+			in.setRoleType(1);
+		}
+		if (in.getStatus()==null){
+			in.setStatus(0);
+		} else if (in.getStatus()>1){
+			res.getError().add(buildError("状态不可大于发起。"));
+			return res;
+		}
+		res.data(ambInvestService.pushInvestTransfer(in));
+		return res;
+	}
+
+
+	/**
+	 * 投资列表
+	 * @return
+	 */
+	@RequestMapping(value="/InvestList",method = RequestMethod.GET)
+	public Result InvestList(InputInvestList in){
+		Result res =new Result();
+		res.data(ambInvestService.InvestList(in));
+		return res;
+	}
+
+	/**
+	 * 投资日志
+	 * @return
+	 */
+	@RequestMapping(value="/InvestLog",method = RequestMethod.GET)
+	public Result InvestLog(String id){
+		Result res =new Result();
+		res.data(ambInvestService.InvestLog(id));
+		return res;
+	}
+
+	/**
+	 * 修改投资金额
+	 * @return
+	 */
+	@RequestMapping(value="/updateTransfer",method = RequestMethod.POST)
+	public Result updateTransfer(InputAmbInvest in){
+		Result res =new Result();
+		if(!TokenManager.hasRole(AFTConstants.APPROVAL_DECISION)&&!TokenManager.hasRole(AFTConstants.APPROVAL_DECISION_AUDITOR)){
+			in.setRoleType(0);
+			if (in.getMyAmbId()==null){
+				res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR,"发起部门","发起部门"));
+				return res;
+			}
+			if (in.getMyAmbId()!=null&&ambInvestService.checkMyAmb(in.getMyAmbId())){
+				res.getError().add(buildError("只有当前阿米巴负责人可以发起投资划拨。"));
+				return res;
+			}
+		}else {
+			in.setRoleType(1);
+		}
+		if (in.getStatus()==null){
+			in.setStatus(0);
+		} else if (in.getStatus()>1){
+			res.getError().add(buildError("状态不可大于发起。"));
+			return res;
+		}
+
+		res.data(ambInvestService.updateInvestTransfer(in));
+		return res;
+	}
+
+	/**
+	 * 修改投资金额
+	 * @return
+	 */
+	@RequestMapping(value="/examineTransfer",method = RequestMethod.POST)
+	public Result examineTransfer(InputAmbInvest in){
+		Result res =new Result();
+		if (in.getStatus()<1){
+			res.getError().add(buildError("状态不可小于。"));
+			return res;
+		}
+		res.data(ambInvestService.updateExamineTransfer(in));
+		return res;
+	}
+
+
+	/**
+	 * 获取可投资列表
+	 * @return
+	 */
+	@RequestMapping(value="/getInvestAmbList",method = RequestMethod.GET)
+	public Result getInvestAmbList(Long id){
+		Result res =new Result();
+		if (TokenManager.hasRole(AFTConstants.APPROVAL_DECISION)||TokenManager.hasRole(AFTConstants.APPROVAL_DECISION_AUDITOR)){
+			if (id==null)id=1L;
+		}
+		if (id==null){
+			res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR,"当前阿米巴","当前阿米巴"));
+			return res;
+		}
+		res.data(ambInvestService.getInvestAmbList(id));
+		return res;
+	}
+
+
+
+
+
+}

+ 32 - 28
src/main/java/com/goafanti/ambSystem/controller/AmbPaymentApiController.java

@@ -8,6 +8,8 @@ import com.goafanti.common.bo.Result;
 import com.goafanti.common.constant.ErrorConstants;
 import com.goafanti.common.controller.CertifyApiController;
 import com.goafanti.common.utils.ParamUtils;
+import com.goafanti.order.enums.OrderImgEnums;
+import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.validation.BindingResult;
 import org.springframework.validation.annotation.Validated;
@@ -15,9 +17,11 @@ import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RequestMethod;
 import org.springframework.web.bind.annotation.RestController;
 
+import javax.servlet.http.HttpServletRequest;
+
 
 @RestController
-@RequestMapping(value = "/api/admin/ambPayment")
+@RequestMapping(value = "/api/admin/amb/payment")
 public class AmbPaymentApiController extends CertifyApiController {
 	@Autowired
 	private AmbPaymentService ambPaymentService;
@@ -28,33 +32,31 @@ public class AmbPaymentApiController extends CertifyApiController {
 	 * @param bindingResult
 	 * @return
 	 */
-//	@RequestMapping(value="/add",method = RequestMethod.POST)
-//	public Result addAmb(@Validated InputAmbPayment 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=ambPaymentService.checkAmbPayment(in);
-//		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="/add",method = RequestMethod.POST)
+	public Result add(@Validated InputAmbPayment 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;
+		}
+
+		res.data(ambPaymentService.add(in));
+		return res;
+	}
+
+	/**
+	 * 修改巴付款
+	 * @param in
+	 * @return
+	 */
+	@RequestMapping(value="/update",method = RequestMethod.POST)
+	public Result update( InputAmbPayment in){
+		Result res =new Result();
+
+		res.data(ambPaymentService.update(in));
+		return res;
+	}
 //
 //	@RequestMapping(value="/delete",method = RequestMethod.POST)
 //	public Result deleteAmb( InputAmb in){
@@ -97,4 +99,6 @@ public class AmbPaymentApiController extends CertifyApiController {
 //		return res;
 //	}
 
+
+
 }

+ 29 - 0
src/main/java/com/goafanti/ambSystem/service/AmbInvestService.java

@@ -0,0 +1,29 @@
+package com.goafanti.ambSystem.service;
+
+import com.goafanti.ambSystem.bo.InputAmbInvest;
+import com.goafanti.ambSystem.bo.InputInvestList;
+import com.goafanti.ambSystem.bo.OutInvestList;
+import com.goafanti.ambSystem.bo.OutInvestLog;
+import com.goafanti.common.model.AmbSystem;
+import com.goafanti.core.mybatis.page.Pagination;
+
+import java.util.List;
+
+public interface AmbInvestService {
+    int pushInvestTransfer(InputAmbInvest in);
+
+    boolean checkMyAmb(Long myAmbId);
+
+    Pagination<?> InvestList(InputInvestList in);
+
+    List<OutInvestLog> InvestLog(String id);
+
+    int updateInvestTransfer(InputAmbInvest in);
+
+    int updateExamineTransfer(InputAmbInvest in);
+
+    List<AmbSystem> getInvestAmbList(Long id);
+
+
+
+}

+ 11 - 1
src/main/java/com/goafanti/ambSystem/service/AmbPaymentService.java

@@ -1,7 +1,17 @@
 package com.goafanti.ambSystem.service;
 
 import com.goafanti.ambSystem.bo.InputAmbPayment;
+import com.goafanti.common.model.AmbPaymentApplication;
 
 public interface AmbPaymentService {
-    int checkAmbPayment(InputAmbPayment in);
+
+    int add(InputAmbPayment in);
+
+
+
+    AmbPaymentApplication selectByid(Long id);
+
+    int updateById(AmbPaymentApplication newBo);
+
+    int update(InputAmbPayment in);
 }

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

@@ -1,8 +1,10 @@
 package com.goafanti.ambSystem.service;
 
 import com.goafanti.ambSystem.bo.InputAmb;
+import com.goafanti.ambSystem.bo.InputAmbInvest;
 import com.goafanti.core.mybatis.page.Pagination;
 
+import java.math.BigDecimal;
 import java.util.List;
 
 public interface AmbService {
@@ -25,4 +27,7 @@ public interface AmbService {
     int checkAmb(InputAmb in,Integer type);
 
     Object detailsAmb(InputAmb in);
+
+
+    Object getMyambDtails();
 }

+ 235 - 0
src/main/java/com/goafanti/ambSystem/service/Impl/AmbInvestServiceImpl.java

@@ -0,0 +1,235 @@
+package com.goafanti.ambSystem.service.Impl;
+
+import com.goafanti.ambSystem.bo.InputAmbInvest;
+import com.goafanti.ambSystem.bo.InputInvestList;
+import com.goafanti.ambSystem.bo.OutInvestList;
+import com.goafanti.ambSystem.bo.OutInvestLog;
+import com.goafanti.ambSystem.service.AmbInvestService;
+import com.goafanti.common.constant.AFTConstants;
+import com.goafanti.common.dao.AmbInvestLogMapper;
+import com.goafanti.common.dao.AmbInvestMapper;
+import com.goafanti.common.dao.AmbSystemMapper;
+import com.goafanti.common.enums.NoticeStatus;
+import com.goafanti.common.error.BusinessException;
+import com.goafanti.common.model.AmbInvest;
+import com.goafanti.common.model.AmbInvestLog;
+import com.goafanti.common.model.AmbSystem;
+import com.goafanti.common.utils.AsyncUtils;
+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.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import javax.print.attribute.standard.MediaSize;
+import java.math.BigDecimal;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+@Service
+public class AmbInvestServiceImpl extends BaseMybatisDao<AmbInvestMapper> implements AmbInvestService {
+    @Autowired
+    private AmbSystemMapper ambSystemMapper;
+    @Autowired
+    private AmbInvestMapper ambInvestMapper;
+    @Autowired
+    private AmbInvestLogMapper ambInvestLogMapper;
+    @Autowired
+    private AsyncUtils asyncUtils;
+
+
+
+    @Override
+    @Transactional
+    public int pushInvestTransfer(InputAmbInvest in) {
+        AmbSystem myAmb =null;
+        AmbInvest ambInvest=new AmbInvest();
+
+        if (in.getRoleType()==1){
+            myAmb= ambSystemMapper.selectByPrimaryKey(1l);
+        }else {
+            myAmb=ambSystemMapper.selectByPrimaryKey(in.getMyAmbId());
+            chekAmount(in, myAmb);
+        }
+        ambInvest.setInitiateAmbId(myAmb.getId());
+        ambInvest.setAcceptAmbId(in.getOtherAmbId());
+        ambInvest.setAmount(in.getAmount());
+        ambInvest.setStatus(in.getStatus());
+        ambInvest.setOperator(TokenManager.getAdminId());
+        ambInvest.setComment(in.getComment());
+        AmbSystem other=ambSystemMapper.selectByPrimaryKey(in.getOtherAmbId());
+        //计算累计金额
+        ambInvest.setCountAmount(sumCountAmount( ambInvest));
+        ambInvestMapper.insertSelective(ambInvest);
+        addAmbInvestLog(in, ambInvest);
+        if (in.getStatus()==1)addNoticAndEmail(1,myAmb,other);
+        return 1;
+    }
+
+    /**
+     *
+     * @param in 当前数据
+     * @param myAmb 发起方
+     */
+    private void chekAmount(InputAmbInvest in, AmbSystem myAmb) {
+            BigDecimal count = new BigDecimal(0);
+            List<OutInvestList> outInvestLists = ambInvestMapper.selectAmbInvestDtailsList(in.getMyAmbId(), 0);
+            for (OutInvestList out : outInvestLists) {
+                if (in.getId()!=null&&!in.getId().equals(out.getId())){
+                    count=count.add(out.getAmount());
+                }
+            }
+            count=count.add(in.getAmount());
+        if (myAmb.getLvl()!=1){
+            if (count.compareTo(myAmb.getSurplus())>0){
+                throw new BusinessException("发起投资金额不可大于剩余投资金额!(注意:包含审核中投资金额)");
+            }
+        }
+    }
+
+
+
+    private BigDecimal sumCountAmount( AmbInvest ambInvest) {
+        BigDecimal count=ambInvestMapper.selectCountAmountById(ambInvest.getInitiateAmbId(),ambInvest.getAcceptAmbId());
+        return count!=null?count:new BigDecimal(0);
+    }
+
+    private void addNoticAndEmail(Integer i,AmbSystem myAmb,AmbSystem other) {
+        StringBuffer str=new StringBuffer();
+        Integer notceType=0;
+        String aid="";
+        if (i==1){
+            aid=myAmb.getAccountant();
+            str=str.append("[").append(myAmb.getName()).append("]负责人发起了对[").append(other.getName()).append("]的金额投资,请及时确认!");
+            notceType=NoticeStatus.AMB_INVEST_START.getCode();
+        }else if (i==2){
+            str=str.append("发起的对[").append(other.getName()).append("]"+"的金额投资,已通过审核!");
+            notceType=NoticeStatus.AMB_INVEST_YES.getCode();
+            aid=myAmb.getLeader();
+            if(StringUtils.isNotBlank(other.getLeader())){
+                StringBuffer str2=new StringBuffer()
+                        .append("[").append(myAmb.getName()).append("]负责人对[").append(other.getName()).append("]的金额投资已完成,请及时确认!");
+                asyncUtils.addNoticAndEmail(other.getLeader(),notceType ,str2.toString());
+            }
+        }else if (i==3){
+            str=str.append("发起的对[").append(other.getName()).append("]"+"的金额投资,已拒绝,请及时修改!");
+            notceType=NoticeStatus.AMB_INVEST_NO.getCode();
+            aid=myAmb.getLeader();
+        }
+           if(aid!=null) asyncUtils.addNoticAndEmail(aid,notceType ,str.toString());
+    }
+
+    @Override
+    public boolean checkMyAmb(Long myAmbId) {
+        AmbSystem myAmb = ambSystemMapper.selectByPrimaryKey(myAmbId);
+        if (!myAmb.getLeader().equals(TokenManager.getAdminId())){
+            return true;
+        }
+        return false;
+    }
+
+    @Override
+    public Pagination<?> InvestList(InputInvestList in) {
+        Map<String,Object> params=new HashMap<>();
+        if (in.getRoleType()!=null){
+            params.put("roleType",in.getRoleType());
+            params.put("aid",TokenManager.getAdminId());
+        }
+        if (in.getOperator()!=null)params.put("operator",in.getOperator());
+        params.put("startTime",in.getStartTime());
+        params.put("endTime",in.getEndTime()+" 23:59:59");
+        params.put("status",in.getStatus());
+        params.put("initiateAmbId",in.getInitiateAmbId());
+        params.put("acceptAmbId",in.getAcceptAmbId());
+
+
+        return findPage("selectInvestList","selectInvestCount",params,in.getPageNo(),in.getPageSize());
+    }
+
+    @Override
+    public List<OutInvestLog> InvestLog(String id) {
+        return ambInvestLogMapper.selectByAmbInvestId(id);
+    }
+
+    @Override
+    public int updateInvestTransfer(InputAmbInvest in) {
+        AmbSystem myAmb = ambSystemMapper.selectByPrimaryKey(in.getMyAmbId());
+        if(in.getRoleType()==0){
+            chekAmount(in, myAmb);
+        }
+        AmbSystem other=ambSystemMapper.selectByPrimaryKey(in.getOtherAmbId());
+        AmbInvest ambInvest=new AmbInvest();
+        ambInvest.setId(in.getId());
+        if (in.getOtherAmbId()!=null)ambInvest.setAcceptAmbId(in.getOtherAmbId());
+        if (in.getAmount()!=null)ambInvest.setAmount(in.getAmount());
+        if (in.getStatus()!=null)ambInvest.setStatus(in.getStatus());
+        if (in.getComment()!=null)ambInvest.setComment(in.getComment());
+        ambInvest.setOperator(TokenManager.getAdminId());
+        ambInvestMapper.updateByPrimaryKeySelective(ambInvest);
+        addAmbInvestLog(in, ambInvest);
+        if (in.getStatus()==1)addNoticAndEmail(1,myAmb,other);
+        return 1;
+    }
+
+    @Override
+    @Transactional
+    public int updateExamineTransfer(InputAmbInvest in) {
+        AmbInvest ambInvest = ambInvestMapper.selectByPrimaryKey(in.getId());
+        if (ambInvest.getStatus()==2){
+            throw new BusinessException("重复通过。");
+        }
+        AmbSystem myAmb = ambSystemMapper.selectByPrimaryKey(ambInvest.getInitiateAmbId());
+        AmbSystem other=ambSystemMapper.selectByPrimaryKey(ambInvest.getAcceptAmbId());
+        AmbInvest newAmbInvest=new AmbInvest();
+        newAmbInvest.setId(in.getId());
+        newAmbInvest.setStatus(in.getStatus());
+        newAmbInvest.setAmount(ambInvest.getAmount());
+        if (in.getStatus()==2){
+                AmbSystem newMy=new AmbSystem();
+                newMy.setId(myAmb.getId());
+            if (myAmb.getId()==1L){
+                newMy.setForeign(myAmb.getForeign().add(ambInvest.getAmount()));
+            }else {
+                newMy.setForeign(myAmb.getForeign().add(ambInvest.getAmount()));
+                newMy.setTotalAmount(myAmb.getTotalAmount().subtract(ambInvest.getAmount()));
+                newMy.setSurplus(myAmb.getSurplus().subtract(ambInvest.getAmount()));
+            }
+            ambSystemMapper.updateByPrimaryKeySelective(newMy);
+            AmbSystem newOther=new AmbSystem();
+            newOther.setId(other.getId());
+            newOther.setReceived(other.getReceived().add(ambInvest.getAmount()));
+            newOther.setSurplus(other.getSurplus().add(ambInvest.getAmount()));
+            newOther.setTotalAmount(other.getTotalAmount().add(ambInvest.getAmount()));
+            ambSystemMapper.updateByPrimaryKeySelective(newOther);
+            //计算累计金额
+            newAmbInvest.setCountAmount(sumCountAmount(ambInvest).add(ambInvest.getAmount()));
+        }
+        ambInvestMapper.updateByPrimaryKeySelective(newAmbInvest);
+        addAmbInvestLog(in, ambInvest);
+        addNoticAndEmail(in.getStatus(),myAmb,other);
+        return 1;
+    }
+
+
+    private void addAmbInvestLog(InputAmbInvest in, AmbInvest ambInvest) {
+        AmbInvestLog log = new AmbInvestLog();
+        log.setAmbInvestId(ambInvest.getId());
+        log.setComment(in.getComment());
+        log.setOperator(TokenManager.getAdminId());
+        log.setStatus(in.getStatus());
+        ambInvestLogMapper.insertSelective(log);
+    }
+
+    @Override
+    public List<AmbSystem> getInvestAmbList(Long id) {
+        AmbSystem ambSystem = ambSystemMapper.selectByPrimaryKey(id);
+        return ambSystemMapper.selectBySuperId(ambSystem);
+    }
+
+
+
+
+}

+ 34 - 2
src/main/java/com/goafanti/ambSystem/service/Impl/AmbPaymentServiceImpl.java

@@ -4,10 +4,18 @@ import com.goafanti.ambSystem.bo.InputAmbPayment;
 import com.goafanti.ambSystem.service.AmbPaymentService;
 import com.goafanti.common.dao.AmbPaymentApplicationMapper;
 import com.goafanti.common.dao.AmbSystemMapper;
+import com.goafanti.common.model.AmbPaymentApplication;
 import com.goafanti.core.mybatis.BaseMybatisDao;
+import com.goafanti.core.shiro.token.TokenManager;
+import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+import java.util.stream.Collectors;
+
 @Service
 public class AmbPaymentServiceImpl extends BaseMybatisDao<AmbPaymentApplicationMapper> implements AmbPaymentService {
     @Autowired
@@ -15,9 +23,33 @@ public class AmbPaymentServiceImpl extends BaseMybatisDao<AmbPaymentApplicationM
     @Autowired
     private AmbSystemMapper ambSystemMapper;
 
+
+
     @Override
-    public int checkAmbPayment(InputAmbPayment in) {
+    public int add(InputAmbPayment in) {
+        in.setStatus(0);
+        in.setProcessStatus(0);
+        return ambPaymentApplicationMapper.insertSelective(in);
+    }
 
-        return 0;
+    @Override
+    public int update(InputAmbPayment in) {
+
+        return ambPaymentApplicationMapper.updateByPrimaryKeySelective(in);
     }
+
+
+
+
+    @Override
+    public AmbPaymentApplication selectByid(Long id) {
+        return ambPaymentApplicationMapper.selectByPrimaryKey(id);
+    }
+
+    @Override
+    public int updateById(AmbPaymentApplication newBo) {
+        return ambPaymentApplicationMapper.updateByPrimaryKeySelective(newBo);
+    }
+
+
 }

+ 39 - 9
src/main/java/com/goafanti/ambSystem/service/Impl/AmbServiceImpl.java

@@ -4,11 +4,11 @@ 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.dao.*;
 import com.goafanti.common.error.BusinessException;
 import com.goafanti.common.model.Admin;
 import com.goafanti.common.model.AmbSystem;
+import com.goafanti.common.model.UserRole;
 import com.goafanti.common.utils.StringUtils;
 import com.goafanti.core.mybatis.BaseMybatisDao;
 import com.goafanti.core.mybatis.page.Pagination;
@@ -27,6 +27,11 @@ public class AmbServiceImpl extends BaseMybatisDao<AmbSystemMapper> implements A
     private AmbSystemMapper ambSystemMapper;
     @Autowired
     private AdminMapper adminMapper;
+    @Autowired
+    private UserRoleMapper userRoleMapper;
+    @Autowired
+    private RoleMapper  roleMapper;
+
 
     @Override
     public int addAmb(InputAmb in) {
@@ -59,6 +64,7 @@ public class AmbServiceImpl extends BaseMybatisDao<AmbSystemMapper> implements A
         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);
@@ -88,18 +94,32 @@ public class AmbServiceImpl extends BaseMybatisDao<AmbSystemMapper> implements A
         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);
+        if (!list.isEmpty()){
+            //不为空就是巴主,如果不是巴主则设置成巴主
+            Integer i = userRoleMapper.selectByUidAndRoleName(leader, "巴主");
+            if (i<1){
+                String roleId = roleMapper.selectIdByName("巴主");
+                UserRole userRole=new UserRole();
+                userRole.setUid(leader);
+                userRole.setRid(roleId);
+                userRoleMapper.insert(userRole);
             }
-            str.append(ambSystem.getLvl()).append(",");
-
+            int ambManage=0;
+            for (AmbSystem ambSystem : list) {
+                str.append(ambSystem.getLvl()).append(",");
+                if(ambSystem.getLvl()==5||ambSystem.getLvl()==6){
+                    ambManage=1;
+                }
+            }
+            a.setAmbManage(ambManage);
         }
         a.setId(leader);
         if (StringUtils.isNotBlank(str)) a.setAmbRole(str.substring(0,str.length()-1));
-        adminMapper.updateByPrimaryKeySelective(a);
-
+        if (a.getAmbRole()!=null){
+            adminMapper.updateByPrimaryKeySelective(a);
+        }
     }
+
     private List<AmbSystem> selectByLeader(String leader) {
         AmbSystem a =new AmbSystem();
         a.setLeader(leader);
@@ -167,6 +187,9 @@ public class AmbServiceImpl extends BaseMybatisDao<AmbSystemMapper> implements A
         return ambSystemMapper.selectDtailsAmb(in.getId());
     }
 
+
+
+
     private void pushLvl(AmbAll a , List<AmbAll> list) {
         if (a.getLvl()<7){
             List<AmbAll> all=new ArrayList<>();
@@ -201,4 +224,11 @@ public class AmbServiceImpl extends BaseMybatisDao<AmbSystemMapper> implements A
         if (sb.length()>1)str=sb.substring(0,sb.length()-1);
         return str;
     }
+
+    @Override
+    public Object getMyambDtails() {
+        List<AmbSystem> ambSystems = ambSystemMapper.selectByParameter(new AmbSystem(TokenManager.getAdminId()));
+        return ambSystems;
+    }
+
 }

+ 2 - 2
src/main/java/com/goafanti/common/controller/BaseApiController.java

@@ -78,13 +78,13 @@ public class BaseApiController extends BaseController {
 	}
 
 
-	protected String uploadFile(Result res, String path,  HttpServletRequest req,String orderNo, String sign) {
+	protected String uploadFile(Result res, String path,  HttpServletRequest req,String id, String sign) {
 		List<MultipartFile> files = getFiles(req);
 		String fileName = "";
 		if (!files.isEmpty()) {
 			try {
 				MultipartFile mf = files.get(0);
-				fileName = FileUtils.orderFileName(mf,orderNo,path,sign);
+				fileName = FileUtils.orderFileName(mf,id,path,sign);
 				mf.transferTo(toFile(fileName));
 				LoggerUtils.debug(getClass(), fileName + " 文件上传成功");
 			} catch (Exception e) {

+ 3 - 1
src/main/java/com/goafanti/common/controller/BaseController.java

@@ -156,7 +156,7 @@ public class BaseController {
 	/**
 	 *	获取权利列表
 	 * @return String  返回权限列表 逗号隔开 1=营销员,2=营销经理,3=营销管理员,4=营销总监,5=财务专员,6=财务经理,7=财务管理员,
-	 * 					8=技术员,9=技术经理,10=技术管理员,11=运营管理,12=总裁助理,13=总裁
+	 * 					8=技术员,9=技术经理,10=技术管理员,11=运营管理,12=总裁助理,13=总裁,14=董事长助理,15=董事长
 	 */
 	public String shiroAddRedis() {
 		redisUtil.deleteString("shiroList");
@@ -174,6 +174,8 @@ public class BaseController {
 		if (TokenManager.hasRole(AFTConstants.OPERATION_MANAGER))str=str.append(11).append(",");
 		if (TokenManager.hasRole(AFTConstants.CED_ASSISTANT))str=str.append(12).append(",");
 		if (TokenManager.hasRole(AFTConstants.CED))str=str.append(13).append(",");
+		if (TokenManager.hasRole(AFTConstants.APPROVAL_DECISION_AUDITOR))str=str.append(14).append(",");
+		if (TokenManager.hasRole(AFTConstants.APPROVAL_DECISION))str=str.append(15).append(",");
 		if (str.length()<1)return "";
 		String shiroList=str.substring(0,str.length()-1);
 		redisUtil.setString("shiroList",shiroList);

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

@@ -134,7 +134,7 @@ public interface AdminMapper {
      * @param roleType
      * @return
      */
-        List<String> listNameByDepAndName(@Param("depId")String depId,@Param("roleType")String roleType);
+    List<String> listNameByDepAndName(@Param("depId")String depId,@Param("roleType")String roleType);
 
     List<Admin> listAdminBydepIdAndRoleType(@Param("depId")String depId,@Param("roleType")String roleType);
 

+ 23 - 0
src/main/java/com/goafanti/common/dao/AmbInvestLogMapper.java

@@ -0,0 +1,23 @@
+package com.goafanti.common.dao;
+
+import com.goafanti.ambSystem.bo.OutInvestLog;
+import com.goafanti.common.model.AmbInvestLog;
+
+import java.util.List;
+
+public interface AmbInvestLogMapper {
+    int deleteByPrimaryKey(Long id);
+
+    int insert(AmbInvestLog record);
+
+    int insertSelective(AmbInvestLog record);
+
+    AmbInvestLog selectByPrimaryKey(Long id);
+
+    int updateByPrimaryKeySelective(AmbInvestLog record);
+
+    int updateByPrimaryKey(AmbInvestLog record);
+
+    List<OutInvestLog> selectByAmbInvestId(String id);
+
+}

+ 30 - 0
src/main/java/com/goafanti/common/dao/AmbInvestMapper.java

@@ -0,0 +1,30 @@
+package com.goafanti.common.dao;
+
+import com.goafanti.ambSystem.bo.OutInvestList;
+import com.goafanti.common.model.AmbInvest;
+import org.apache.ibatis.annotations.Param;
+
+import java.math.BigDecimal;
+import java.util.List;
+
+public interface AmbInvestMapper {
+    int deleteByPrimaryKey(Long id);
+
+    int insert(AmbInvest record);
+
+    int insertSelective(AmbInvest record);
+
+    AmbInvest selectByPrimaryKey(Long id);
+
+    int updateByPrimaryKeySelective(AmbInvest record);
+
+    int updateByPrimaryKey(AmbInvest record);
+
+    BigDecimal selectCountAmountById(@Param("initiateAmbId")Long initiateAmbId, @Param("acceptAmbId")Long acceptAmbId);
+
+    List<OutInvestList> selectAmbInvestDtailsList(@Param("id") Long id, @Param("type")Integer type);
+
+
+
+
+}

+ 2 - 1
src/main/java/com/goafanti/common/dao/AmbSystemMapper.java

@@ -31,5 +31,6 @@ public interface AmbSystemMapper {
 
     int updateAncestorsNames(@Param(value = "id") Long id, @Param(value = "name")String name, @Param(value = "useName")String useName);
 
-    
+
+    List<AmbSystem> selectBySuperId(AmbSystem ambSystem);
 }

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

@@ -8,6 +8,7 @@ import java.math.BigDecimal;
 import java.util.List;
 import java.util.Map;
 
+import com.goafanti.order.bo.OutProcessName;
 import org.apache.ibatis.annotations.Param;
 
 public interface NewOrderChangeMapper {
@@ -52,4 +53,6 @@ public interface NewOrderChangeMapper {
                           @Param("names")String names);
 
     int updateTaskExamineName(@Param("aid") String aid, @Param("taskReceiverId") String taskReceiverId,@Param("type") Integer type);
+
+    OutProcessName gerProcessName(@Param("id") Integer id, @Param("orderNo") String orderNo);
 }

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

@@ -104,7 +104,7 @@ public interface OrderExamineMapper {
 
 	int selectByOrderNoAndAid(@Param("orderNo") String orderNo,@Param("aid") String aid);
 
-	void updateByOrderNo(@Param("orderNo") String orderNo,@Param("status")Integer status);
+	void updateByOrderNo(@Param("orderNo") String orderNo,@Param("status")Integer status,@Param("type")Integer type);
 
 	void updateDimissionTransfer(@Param("aid")String aid, @Param("transferId")String transferId, @Param("type")Integer type);
 
@@ -113,7 +113,7 @@ public interface OrderExamineMapper {
      * @param aid
      * @param type 0咨询师 1经理
      */
-    void deleteByAidAndStatus(@Param("aid")String aid,  @Param("type")Integer type);
+    void deleteByAidAndStatus(@Param("orderNo")String orderNo,@Param("aid")String aid,  @Param("type")Integer type);
 
 
     void updateBack(@Param("aid")String aid, @Param("taskReceiverId")String taskReceiverId);

+ 19 - 0
src/main/java/com/goafanti/common/dao/TOrderHighTechMapper.java

@@ -0,0 +1,19 @@
+package com.goafanti.common.dao;
+
+import com.goafanti.common.model.TOrderHighTech;
+
+public interface TOrderHighTechMapper {
+    int deleteByPrimaryKey(Integer id);
+
+    int insert(TOrderHighTech record);
+
+    int insertSelective(TOrderHighTech record);
+
+    TOrderHighTech selectByPrimaryKey(Integer id);
+
+    int updateByPrimaryKeySelective(TOrderHighTech record);
+
+    int updateByPrimaryKey(TOrderHighTech record);
+
+    int updateByOrder(TOrderHighTech tighTech);
+}

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

@@ -69,4 +69,6 @@ public interface TOrderNewMapper {
                           @Param("names")String names);
 
     List<TOrderNew> selectgetAll();
+
+    OrderProcessName getProcessName(String orderNo);
 }

+ 9 - 1
src/main/java/com/goafanti/common/dao/UserRoleMapper.java

@@ -5,6 +5,7 @@ import java.util.Map;
 
 import com.goafanti.common.model.Role;
 import com.goafanti.common.model.UserRole;
+import org.apache.ibatis.annotations.Param;
 
 public interface UserRoleMapper {
 	int insert(UserRole record);
@@ -24,7 +25,14 @@ public interface UserRoleMapper {
 
 	List<String> listAuditor();
 
+	/**
+	 * 获取角色对应管理员编号
+	 * @param roleName
+	 * @return
+	 */
 	List<UserRole> selectAdminRole(String roleName);
 
     Role selectById(String roleId);
-}
+
+	Integer  selectByUidAndRoleName(@Param("aid") String aid, @Param("roleName") String roleName);
+}

+ 3 - 0
src/main/java/com/goafanti/common/enums/NoticeStatus.java

@@ -75,6 +75,9 @@ public enum NoticeStatus {
 	PROJECT_RENEW_START(66,"项目重启流程发起"),
 	PROJECT_RENEW_YES(67,"项目重启流程通过"),
 	PROJECT_RENEW_NO(68,"项目重启流程拒绝"),
+	AMB_INVEST_START(69,"阿米巴投资发起"),
+	AMB_INVEST_YES(70,"阿米巴投资通过"),
+	AMB_INVEST_NO(71,"阿米巴投资拒绝"),
 	OTHER(0, "其他");
 
 	private NoticeStatus(Integer code, String desc) {

+ 1 - 0
src/main/java/com/goafanti/common/enums/OrderLogProcess.java

@@ -28,6 +28,7 @@ public enum OrderLogProcess {
 	XMWBTG(15,"项目外包通过"),
 	XMWBBH(16,"项目外包驳回"),
 	DDLZZJ(17,"订单离职转交"),
+	YXJLTT(18,"营销经理审核"),
 	NOT(99,"未知"),
 	;
 

+ 40 - 24
src/main/java/com/goafanti/common/mapper/AdminMapper.xml

@@ -27,11 +27,13 @@
     <result column="amb_id" jdbcType="VARCHAR" property="ambId" />
     <result column="amb_role" jdbcType="VARCHAR" property="ambRole" />
     <result column="amb_manage" jdbcType="INTEGER" property="ambManage" />
+    <result column="manager_id" jdbcType="VARCHAR" property="managerId" />
   </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, amb_id, amb_role, amb_manage
+    contact_mobile, last_login_time, open_id, `type`, reviewer, amb_id, amb_role, amb_manage,
+    manager_id
   </sql>
   <select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="BaseResultMap">
     select
@@ -43,27 +45,27 @@
     delete from admin
     where id = #{id,jdbcType=VARCHAR}
   </delete>
-  <insert id="insert" keyColumn="id" keyProperty="id" parameterType="com.goafanti.common.model.Admin" useGeneratedKeys="true">
-    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,
-      amb_id, amb_role, amb_manage
-      )
-    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},
-      #{ambId,jdbcType=VARCHAR}, #{ambRole,jdbcType=VARCHAR}, #{ambManage,jdbcType=INTEGER}
-      )
+  <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, amb_id, amb_role,
+      amb_manage, manager_id)
+    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}, #{ambId,jdbcType=VARCHAR}, #{ambRole,jdbcType=VARCHAR},
+      #{ambManage,jdbcType=INTEGER}, #{managerId,jdbcType=VARCHAR})
   </insert>
-  <insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="com.goafanti.common.model.Admin" useGeneratedKeys="true">
+  <insert id="insertSelective" parameterType="com.goafanti.common.model.Admin">
     insert into admin
     <trim prefix="(" suffix=")" suffixOverrides=",">
       <if test="id != null">
@@ -141,6 +143,9 @@
       <if test="ambManage != null">
         amb_manage,
       </if>
+      <if test="managerId != null">
+        manager_id,
+      </if>
     </trim>
     <trim prefix="values (" suffix=")" suffixOverrides=",">
       <if test="id != null">
@@ -218,6 +223,9 @@
       <if test="ambManage != null">
         #{ambManage,jdbcType=INTEGER},
       </if>
+      <if test="managerId != null">
+        #{managerId,jdbcType=VARCHAR},
+      </if>
     </trim>
   </insert>
   <update id="updateByPrimaryKeySelective" parameterType="com.goafanti.common.model.Admin">
@@ -295,6 +303,9 @@
       <if test="ambManage != null">
         amb_manage = #{ambManage,jdbcType=INTEGER},
       </if>
+      <if test="managerId != null">
+        manager_id = #{managerId,jdbcType=VARCHAR},
+      </if>
     </set>
     where id = #{id,jdbcType=VARCHAR}
   </update>
@@ -323,9 +334,13 @@
       reviewer = #{reviewer,jdbcType=VARCHAR},
       amb_id = #{ambId,jdbcType=VARCHAR},
       amb_role = #{ambRole,jdbcType=VARCHAR},
-      amb_manage = #{ambManage,jdbcType=INTEGER}
+      amb_manage = #{ambManage,jdbcType=INTEGER},
+      manager_id = #{managerId,jdbcType=VARCHAR}
     where id = #{id,jdbcType=VARCHAR}
   </update>
+
+
+
   <select id="selectAllAdmin" resultMap="BaseResultMap">
     select
     <include refid="Base_Column_List" />
@@ -686,8 +701,9 @@
            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,a.amb_id ambId
+           b.name superior,c.name reviewerName,a.type,a.amb_id ambId,a.manager_id managerId ,d.name managerName
     from admin a left join admin b on a.superior_id =b.id left join admin c on a.reviewer =c.id
+    left join admin d on a.manager_id=d.id
     where a.id= #{id,jdbcType=VARCHAR}
   </select>
   <select id="selectNameByid" parameterType="java.lang.String" resultType="java.lang.String">
@@ -1072,7 +1088,7 @@
 
   <select id="listAdminBydepIdAndRoleType" resultType="com.goafanti.common.model.Admin">
     select a.id,a.name,a.email  from admin a left join user_role b on a.id =b.uid
-                                     left join `role` c on b.rid=c.id
+                                             left join `role` c on b.rid=c.id
     where department_id= #{depId}
       and c.role_type= #{roleType}
   </select>

+ 119 - 0
src/main/java/com/goafanti/common/mapper/AmbInvestLogMapper.xml

@@ -0,0 +1,119 @@
+<?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.AmbInvestLogMapper">
+  <resultMap id="BaseResultMap" type="com.goafanti.common.model.AmbInvestLog">
+    <id column="id" jdbcType="BIGINT" property="id" />
+    <result column="amb_invest_id" jdbcType="BIGINT" property="ambInvestId" />
+    <result column="amount" jdbcType="DECIMAL" property="amount" />
+    <result column="status" jdbcType="INTEGER" property="status" />
+    <result column="comment" jdbcType="VARCHAR" property="comment" />
+    <result column="operator" jdbcType="VARCHAR" property="operator" />
+    <result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
+  </resultMap>
+  <sql id="Base_Column_List">
+    id, amb_invest_id, amount, `status`, `comment`, `operator`, create_time
+  </sql>
+  <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
+    select
+    <include refid="Base_Column_List" />
+    from amb_invest_log
+    where id = #{id,jdbcType=BIGINT}
+  </select>
+
+  <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
+    delete from amb_invest_log
+    where id = #{id,jdbcType=BIGINT}
+  </delete>
+  <insert id="insert" keyColumn="id" keyProperty="id" parameterType="com.goafanti.common.model.AmbInvestLog" useGeneratedKeys="true">
+    insert into amb_invest_log (amb_invest_id, amount, `status`,
+      `comment`, `operator`, create_time
+      )
+    values (#{ambInvestId,jdbcType=BIGINT}, #{amount,jdbcType=DECIMAL}, #{status,jdbcType=INTEGER},
+      #{comment,jdbcType=VARCHAR}, #{operator,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP}
+      )
+  </insert>
+  <insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="com.goafanti.common.model.AmbInvestLog" useGeneratedKeys="true">
+    insert into amb_invest_log
+    <trim prefix="(" suffix=")" suffixOverrides=",">
+      <if test="ambInvestId != null">
+        amb_invest_id,
+      </if>
+      <if test="amount != null">
+        amount,
+      </if>
+      <if test="status != null">
+        `status`,
+      </if>
+      <if test="comment != null">
+        `comment`,
+      </if>
+      <if test="operator != null">
+        `operator`,
+      </if>
+      <if test="createTime != null">
+        create_time,
+      </if>
+    </trim>
+    <trim prefix="values (" suffix=")" suffixOverrides=",">
+      <if test="ambInvestId != null">
+        #{ambInvestId,jdbcType=BIGINT},
+      </if>
+      <if test="amount != null">
+        #{amount,jdbcType=DECIMAL},
+      </if>
+      <if test="status != null">
+        #{status,jdbcType=INTEGER},
+      </if>
+      <if test="comment != null">
+        #{comment,jdbcType=VARCHAR},
+      </if>
+      <if test="operator != null">
+        #{operator,jdbcType=VARCHAR},
+      </if>
+      <if test="createTime != null">
+        #{createTime,jdbcType=TIMESTAMP},
+      </if>
+    </trim>
+  </insert>
+  <update id="updateByPrimaryKeySelective" parameterType="com.goafanti.common.model.AmbInvestLog">
+    update amb_invest_log
+    <set>
+      <if test="ambInvestId != null">
+        amb_invest_id = #{ambInvestId,jdbcType=BIGINT},
+      </if>
+      <if test="amount != null">
+        amount = #{amount,jdbcType=DECIMAL},
+      </if>
+      <if test="status != null">
+        `status` = #{status,jdbcType=INTEGER},
+      </if>
+      <if test="comment != null">
+        `comment` = #{comment,jdbcType=VARCHAR},
+      </if>
+      <if test="operator != null">
+        `operator` = #{operator,jdbcType=VARCHAR},
+      </if>
+      <if test="createTime != null">
+        create_time = #{createTime,jdbcType=TIMESTAMP},
+      </if>
+    </set>
+    where id = #{id,jdbcType=BIGINT}
+  </update>
+  <update id="updateByPrimaryKey" parameterType="com.goafanti.common.model.AmbInvestLog">
+    update amb_invest_log
+    set amb_invest_id = #{ambInvestId,jdbcType=BIGINT},
+      amount = #{amount,jdbcType=DECIMAL},
+      `status` = #{status,jdbcType=INTEGER},
+      `comment` = #{comment,jdbcType=VARCHAR},
+      `operator` = #{operator,jdbcType=VARCHAR},
+      create_time = #{createTime,jdbcType=TIMESTAMP}
+    where id = #{id,jdbcType=BIGINT}
+  </update>
+
+  <select id="selectByAmbInvestId" resultType="com.goafanti.ambSystem.bo.OutInvestLog">
+    select a.id ,a.amb_invest_id ambInvestId ,a.status ,a.comment ,b.name operator,
+           date_format(a.create_time,'%Y-%m-%d %H:%i:%S') createTimes
+    from amb_invest_log a  left join admin b on a.operator =b.id
+    where amb_invest_id = #{id}
+  </select>
+</mapper>

+ 220 - 0
src/main/java/com/goafanti/common/mapper/AmbInvestMapper.xml

@@ -0,0 +1,220 @@
+<?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.AmbInvestMapper">
+  <resultMap id="BaseResultMap" type="com.goafanti.common.model.AmbInvest">
+    <id column="id" jdbcType="BIGINT" property="id" />
+    <result column="initiate_amb_id" jdbcType="BIGINT" property="initiateAmbId" />
+    <result column="accept_amb_id" jdbcType="BIGINT" property="acceptAmbId" />
+    <result column="amount" jdbcType="DECIMAL" property="amount" />
+    <result column="status" jdbcType="INTEGER" property="status" />
+    <result column="operator" jdbcType="VARCHAR" property="operator" />
+    <result column="comment" jdbcType="VARCHAR" property="comment" />
+    <result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
+    <result column="count_amount" jdbcType="DECIMAL" property="countAmount" />
+  </resultMap>
+  <sql id="Base_Column_List">
+    id, initiate_amb_id, accept_amb_id, amount, `status`, `operator`, `comment`, create_time,
+    count_amount
+  </sql>
+  <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
+    select
+    <include refid="Base_Column_List" />
+    from amb_invest
+    where id = #{id,jdbcType=BIGINT}
+  </select>
+  <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
+    delete from amb_invest
+    where id = #{id,jdbcType=BIGINT}
+  </delete>
+  <insert id="insert" keyColumn="id" keyProperty="id" parameterType="com.goafanti.common.model.AmbInvest" useGeneratedKeys="true">
+    insert into amb_invest (initiate_amb_id, accept_amb_id, amount,
+      `status`, `operator`, `comment`,
+      create_time, count_amount)
+    values (#{initiateAmbId,jdbcType=BIGINT}, #{acceptAmbId,jdbcType=BIGINT}, #{amount,jdbcType=DECIMAL},
+      #{status,jdbcType=INTEGER}, #{operator,jdbcType=VARCHAR}, #{comment,jdbcType=VARCHAR},
+      #{createTime,jdbcType=TIMESTAMP}, #{countAmount,jdbcType=DECIMAL})
+  </insert>
+  <insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="com.goafanti.common.model.AmbInvest" useGeneratedKeys="true">
+    insert into amb_invest
+    <trim prefix="(" suffix=")" suffixOverrides=",">
+      <if test="initiateAmbId != null">
+        initiate_amb_id,
+      </if>
+      <if test="acceptAmbId != null">
+        accept_amb_id,
+      </if>
+      <if test="amount != null">
+        amount,
+      </if>
+      <if test="status != null">
+        `status`,
+      </if>
+      <if test="operator != null">
+        `operator`,
+      </if>
+      <if test="comment != null">
+        `comment`,
+      </if>
+      <if test="createTime != null">
+        create_time,
+      </if>
+      <if test="countAmount != null">
+        count_amount,
+      </if>
+    </trim>
+    <trim prefix="values (" suffix=")" suffixOverrides=",">
+      <if test="initiateAmbId != null">
+        #{initiateAmbId,jdbcType=BIGINT},
+      </if>
+      <if test="acceptAmbId != null">
+        #{acceptAmbId,jdbcType=BIGINT},
+      </if>
+      <if test="amount != null">
+        #{amount,jdbcType=DECIMAL},
+      </if>
+      <if test="status != null">
+        #{status,jdbcType=INTEGER},
+      </if>
+      <if test="operator != null">
+        #{operator,jdbcType=VARCHAR},
+      </if>
+      <if test="comment != null">
+        #{comment,jdbcType=VARCHAR},
+      </if>
+      <if test="createTime != null">
+        #{createTime,jdbcType=TIMESTAMP},
+      </if>
+      <if test="countAmount != null">
+        #{countAmount,jdbcType=DECIMAL},
+      </if>
+    </trim>
+  </insert>
+  <update id="updateByPrimaryKeySelective" parameterType="com.goafanti.common.model.AmbInvest">
+    update amb_invest
+    <set>
+      <if test="initiateAmbId != null">
+        initiate_amb_id = #{initiateAmbId,jdbcType=BIGINT},
+      </if>
+      <if test="acceptAmbId != null">
+        accept_amb_id = #{acceptAmbId,jdbcType=BIGINT},
+      </if>
+      <if test="amount != null">
+        amount = #{amount,jdbcType=DECIMAL},
+      </if>
+      <if test="status != null">
+        `status` = #{status,jdbcType=INTEGER},
+      </if>
+      <if test="operator != null">
+        `operator` = #{operator,jdbcType=VARCHAR},
+      </if>
+      <if test="comment != null">
+        `comment` = #{comment,jdbcType=VARCHAR},
+      </if>
+      <if test="createTime != null">
+        create_time = #{createTime,jdbcType=TIMESTAMP},
+      </if>
+      <if test="countAmount != null">
+        count_amount = #{countAmount,jdbcType=DECIMAL},
+      </if>
+    </set>
+    where id = #{id,jdbcType=BIGINT}
+  </update>
+  <update id="updateByPrimaryKey" parameterType="com.goafanti.common.model.AmbInvest">
+    update amb_invest
+    set initiate_amb_id = #{initiateAmbId,jdbcType=BIGINT},
+      accept_amb_id = #{acceptAmbId,jdbcType=BIGINT},
+      amount = #{amount,jdbcType=DECIMAL},
+      `status` = #{status,jdbcType=INTEGER},
+      `operator` = #{operator,jdbcType=VARCHAR},
+      `comment` = #{comment,jdbcType=VARCHAR},
+      create_time = #{createTime,jdbcType=TIMESTAMP},
+      count_amount = #{countAmount,jdbcType=DECIMAL}
+    where id = #{id,jdbcType=BIGINT}
+  </update>
+
+  <select id="selectInvestList" resultType="com.goafanti.ambSystem.bo.OutInvestList">
+    select a.id,a.initiate_amb_id initiateAmbId,b.name initiateName,a.accept_amb_id acceptAmbId,
+    c.name acceptName,a.amount ,a.status ,d.name operator,a.comment ,a.count_amount countAmount,
+    date_format(a.create_time,'%Y-%m-%d %H:%i:%S') createTimes,d.amb_role ambRole
+    from amb_invest a  left join amb_system b on a.initiate_amb_id =b.id
+    left join amb_system c on a.accept_amb_id =c.id
+    left join admin d on a.operator =d.id
+    where 1=1
+    <if test="roleType==0">
+      and a.operator= #{aid}
+    </if>
+    <if test="roleType==1">
+      and a.status in (1,2,3)
+      and b.accountant =#{aid}
+    </if>
+    <if test="initiateAmbId != null ">
+      and a.initiate_amb_id= #{initiateAmbId}
+    </if>
+    <if test="acceptAmbId !=null">
+      and a.accept_amb_id = #{acceptAmbId}
+    </if>
+    <if test="operator !=null">
+      and a.operator= #{operator}
+    </if>
+    <if test="startTime!=null and endTime !=null">
+      and a.create_time between #{startTime} and #{endTime}
+    </if>
+    <if test="status !=null">
+      and a.status= #{status}
+    </if>
+    order by
+    <if test="roleType==0 or roleType==1">
+    a.status ,
+    </if>
+    a.create_time desc
+    <if test="page_sql !=null">
+      ${page_sql}
+    </if>
+  </select>
+
+  <select id="selectInvestCount" resultType="integer">
+    select count(*)
+    from amb_invest a left join amb_system b on a.initiate_amb_id =b.id
+    where 1=1
+    <if test="roleType==0">
+      and a.operator= #{aid}
+    </if>
+    <if test="roleType==1">
+      and a.status in (1,2,3)
+      and b.accountant =#{aid}
+    </if>
+    <if test="startTime!=null and endTime !=null">
+      and a.create_time between #{startTime} and #{endTime}
+    </if>
+    <if test="initiateAmbId != null ">
+      and a.initiate_amb_id= #{initiateAmbId}
+    </if>
+    <if test="acceptAmbId !=null">
+      and a.accept_amb_id = #{acceptAmbId}
+    </if>
+    <if test="operator !=null">
+      and a.operator= #{operator}
+    </if>
+    <if test="status !=null">
+      and a.status= #{status}
+    </if>
+  </select>
+  <select id="selectCountAmountById" resultType="java.math.BigDecimal">
+    select sum(amount)amount
+    from amb_invest
+    where status=2 and  accept_amb_id = #{acceptAmbId} and initiate_amb_id= #{initiateAmbId}
+  </select>
+  <select id="selectAmbInvestDtailsList" resultType="com.goafanti.ambSystem.bo.OutInvestList">
+    select a.id,a.initiate_amb_id initiateAmbId ,a.accept_amb_id acceptAmbId,a.amount ,a.status ,
+           a.comment , date_format(a.create_time,'%Y-%m-%d %H:%i:%S') createTimes,
+           b.name initiateName,c.name acceptName,d.name operator
+    from amb_invest  a left join amb_system b on a.initiate_amb_id =b.id
+    left join amb_system c on a.accept_amb_id =c.id left join admin d on a.operator =d.id
+    where  1=1
+    <if test="type==0">
+      and a.status in (0,1,3)
+    </if>
+      and a.initiate_amb_id= #{id}
+    order by  a.create_time desc
+  </select>
+</mapper>

+ 35 - 24
src/main/java/com/goafanti/common/mapper/AmbPaymentApplicationMapper.xml

@@ -5,6 +5,8 @@
     <id column="id" jdbcType="BIGINT" property="id" />
     <result column="type" jdbcType="INTEGER" property="type" />
     <result column="total_amount" jdbcType="DECIMAL" property="totalAmount" />
+    <result column="initiate_amb_id" jdbcType="BIGINT" property="initiateAmbId" />
+    <result column="accept_amb_id" jdbcType="BIGINT" property="acceptAmbId" />
     <result column="content" jdbcType="VARCHAR" property="content" />
     <result column="remarks" jdbcType="VARCHAR" property="remarks" />
     <result column="annex_url" jdbcType="VARCHAR" property="annexUrl" />
@@ -14,11 +16,10 @@
     <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="payment_amb_id" jdbcType="VARCHAR" property="paymentAmbId" />
   </resultMap>
   <sql id="Base_Column_List">
-    id, `type`, total_amount, content, remarks, annex_url, process_status, `status`, 
-    create_by, create_time, update_by, update_time, payment_amb_id
+    id, `type`, total_amount, initiate_amb_id, accept_amb_id, content, remarks, annex_url, 
+    process_status, `status`, create_by, create_time, update_by, update_time
   </sql>
   <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
     select 
@@ -31,16 +32,16 @@
     where id = #{id,jdbcType=BIGINT}
   </delete>
   <insert id="insert" keyColumn="id" keyProperty="id" parameterType="com.goafanti.common.model.AmbPaymentApplication" useGeneratedKeys="true">
-    insert into amb_payment_application (`type`, total_amount, content, 
-      remarks, annex_url, process_status, 
-      `status`, create_by, create_time, 
-      update_by, update_time, payment_amb_id
-      )
-    values (#{type,jdbcType=INTEGER}, #{totalAmount,jdbcType=DECIMAL}, #{content,jdbcType=VARCHAR}, 
-      #{remarks,jdbcType=VARCHAR}, #{annexUrl,jdbcType=VARCHAR}, #{processStatus,jdbcType=INTEGER}, 
-      #{status,jdbcType=INTEGER}, #{createBy,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP}, 
-      #{updateBy,jdbcType=VARCHAR}, #{updateTime,jdbcType=TIMESTAMP}, #{paymentAmbId,jdbcType=VARCHAR}
-      )
+    insert into amb_payment_application (`type`, total_amount, initiate_amb_id, 
+      accept_amb_id, content, remarks, 
+      annex_url, process_status, `status`, 
+      create_by, create_time, update_by, 
+      update_time)
+    values (#{type,jdbcType=INTEGER}, #{totalAmount,jdbcType=DECIMAL}, #{initiateAmbId,jdbcType=BIGINT}, 
+      #{acceptAmbId,jdbcType=BIGINT}, #{content,jdbcType=VARCHAR}, #{remarks,jdbcType=VARCHAR}, 
+      #{annexUrl,jdbcType=VARCHAR}, #{processStatus,jdbcType=INTEGER}, #{status,jdbcType=INTEGER}, 
+      #{createBy,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP}, #{updateBy,jdbcType=VARCHAR}, 
+      #{updateTime,jdbcType=TIMESTAMP})
   </insert>
   <insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="com.goafanti.common.model.AmbPaymentApplication" useGeneratedKeys="true">
     insert into amb_payment_application
@@ -51,6 +52,12 @@
       <if test="totalAmount != null">
         total_amount,
       </if>
+      <if test="initiateAmbId != null">
+        initiate_amb_id,
+      </if>
+      <if test="acceptAmbId != null">
+        accept_amb_id,
+      </if>
       <if test="content != null">
         content,
       </if>
@@ -78,9 +85,6 @@
       <if test="updateTime != null">
         update_time,
       </if>
-      <if test="paymentAmbId != null">
-        payment_amb_id,
-      </if>
     </trim>
     <trim prefix="values (" suffix=")" suffixOverrides=",">
       <if test="type != null">
@@ -89,6 +93,12 @@
       <if test="totalAmount != null">
         #{totalAmount,jdbcType=DECIMAL},
       </if>
+      <if test="initiateAmbId != null">
+        #{initiateAmbId,jdbcType=BIGINT},
+      </if>
+      <if test="acceptAmbId != null">
+        #{acceptAmbId,jdbcType=BIGINT},
+      </if>
       <if test="content != null">
         #{content,jdbcType=VARCHAR},
       </if>
@@ -116,9 +126,6 @@
       <if test="updateTime != null">
         #{updateTime,jdbcType=TIMESTAMP},
       </if>
-      <if test="paymentAmbId != null">
-        #{paymentAmbId,jdbcType=VARCHAR},
-      </if>
     </trim>
   </insert>
   <update id="updateByPrimaryKeySelective" parameterType="com.goafanti.common.model.AmbPaymentApplication">
@@ -130,6 +137,12 @@
       <if test="totalAmount != null">
         total_amount = #{totalAmount,jdbcType=DECIMAL},
       </if>
+      <if test="initiateAmbId != null">
+        initiate_amb_id = #{initiateAmbId,jdbcType=BIGINT},
+      </if>
+      <if test="acceptAmbId != null">
+        accept_amb_id = #{acceptAmbId,jdbcType=BIGINT},
+      </if>
       <if test="content != null">
         content = #{content,jdbcType=VARCHAR},
       </if>
@@ -157,9 +170,6 @@
       <if test="updateTime != null">
         update_time = #{updateTime,jdbcType=TIMESTAMP},
       </if>
-      <if test="paymentAmbId != null">
-        payment_amb_id = #{paymentAmbId,jdbcType=VARCHAR},
-      </if>
     </set>
     where id = #{id,jdbcType=BIGINT}
   </update>
@@ -167,6 +177,8 @@
     update amb_payment_application
     set `type` = #{type,jdbcType=INTEGER},
       total_amount = #{totalAmount,jdbcType=DECIMAL},
+      initiate_amb_id = #{initiateAmbId,jdbcType=BIGINT},
+      accept_amb_id = #{acceptAmbId,jdbcType=BIGINT},
       content = #{content,jdbcType=VARCHAR},
       remarks = #{remarks,jdbcType=VARCHAR},
       annex_url = #{annexUrl,jdbcType=VARCHAR},
@@ -175,8 +187,7 @@
       create_by = #{createBy,jdbcType=VARCHAR},
       create_time = #{createTime,jdbcType=TIMESTAMP},
       update_by = #{updateBy,jdbcType=VARCHAR},
-      update_time = #{updateTime,jdbcType=TIMESTAMP},
-      payment_amb_id = #{paymentAmbId,jdbcType=VARCHAR}
+      update_time = #{updateTime,jdbcType=TIMESTAMP}
     where id = #{id,jdbcType=BIGINT}
   </update>
 </mapper>

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

@@ -20,11 +20,14 @@
     <result column="remarks" jdbcType="VARCHAR" property="remarks" />
     <result column="total_amount" jdbcType="DECIMAL" property="totalAmount" />
     <result column="members_count" jdbcType="INTEGER" property="membersCount" />
+    <result column="received" jdbcType="DECIMAL" property="received" />
+    <result column="foreign" jdbcType="DECIMAL" property="foreign" />
+    <result column="surplus" jdbcType="DECIMAL" property="surplus" />
   </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
+    members_count, received, `foreign`, surplus
   </sql>
   <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
     select
@@ -42,13 +45,15 @@
       create_by, create_time, update_by,
       update_time, lvl, finance_id,
       ancestors_names, accountant, remarks,
-      total_amount, members_count)
+      total_amount, members_count, received,
+      `foreign`, surplus)
     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})
+      #{totalAmount,jdbcType=DECIMAL}, #{membersCount,jdbcType=INTEGER}, #{received,jdbcType=DECIMAL},
+      #{foreign,jdbcType=DECIMAL}, #{surplus,jdbcType=DECIMAL})
   </insert>
   <insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="com.goafanti.common.model.AmbSystem" useGeneratedKeys="true">
     insert into amb_system
@@ -104,6 +109,15 @@
       <if test="membersCount != null">
         members_count,
       </if>
+      <if test="received != null">
+        received,
+      </if>
+      <if test="foreign != null">
+        `foreign`,
+      </if>
+      <if test="surplus != null">
+        surplus,
+      </if>
     </trim>
     <trim prefix="values (" suffix=")" suffixOverrides=",">
       <if test="parentId != null">
@@ -157,6 +171,15 @@
       <if test="membersCount != null">
         #{membersCount,jdbcType=INTEGER},
       </if>
+      <if test="received != null">
+        #{received,jdbcType=DECIMAL},
+      </if>
+      <if test="foreign != null">
+        #{foreign,jdbcType=DECIMAL},
+      </if>
+      <if test="surplus != null">
+        #{surplus,jdbcType=DECIMAL},
+      </if>
     </trim>
   </insert>
   <update id="updateByPrimaryKeySelective" parameterType="com.goafanti.common.model.AmbSystem">
@@ -213,6 +236,15 @@
       <if test="membersCount != null">
         members_count = #{membersCount,jdbcType=INTEGER},
       </if>
+      <if test="received != null">
+        received = #{received,jdbcType=DECIMAL},
+      </if>
+      <if test="foreign != null">
+        `foreign` = #{foreign,jdbcType=DECIMAL},
+      </if>
+      <if test="surplus != null">
+        surplus = #{surplus,jdbcType=DECIMAL},
+      </if>
     </set>
     where id = #{id,jdbcType=BIGINT}
   </update>
@@ -234,7 +266,10 @@
       accountant = #{accountant,jdbcType=VARCHAR},
       remarks = #{remarks,jdbcType=VARCHAR},
       total_amount = #{totalAmount,jdbcType=DECIMAL},
-      members_count = #{membersCount,jdbcType=INTEGER}
+      members_count = #{membersCount,jdbcType=INTEGER},
+      received = #{received,jdbcType=DECIMAL},
+      `foreign` = #{foreign,jdbcType=DECIMAL},
+      surplus = #{surplus,jdbcType=DECIMAL}
     where id = #{id,jdbcType=BIGINT}
   </update>
   <update id="updateAncestorsNames">
@@ -332,4 +367,11 @@
     left join admin d on a.accountant =d.id
     where a.id= #{id}
   </select>
+    <select id="selectBySuperId" parameterType="com.goafanti.common.model.AmbSystem" resultMap="BaseResultMap">
+  select
+  <include refid="Base_Column_List" />
+  from amb_system
+  where  lvl= #{lvl}+1
+and find_in_set(#{id},ancestors)
+</select>
 </mapper>

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

@@ -461,7 +461,7 @@ select
 	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.back_status backStatus ,a.contract_picture_url contractPictureUrl,a.first_amount firstAmount
-    from new_order_change a where 1 = 1 and status!=4
+    from new_order_change a where 1 = 1
 	and a.id= #{ChangeId}
 	order by a.create_time desc
   </select>
@@ -501,32 +501,35 @@ select
   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
   left join department e on b.order_dep=e.id
- 	<if test="processState==2">
+ 	<if test="processState==3">
  	left join (select order_no, aid from order_examine where`type`=0 group by order_no,aid)x on a.order_no = x.order_no
 	</if>
-	<if test="processState==3">
+	<if test="processState==4">
 	left join (select order_no, aid from order_examine where`type`=1 group by order_no,aid)x on a.order_no = x.order_no
 	</if>
 	where 1=1
 	<if test="processState==0">
 	and b.salesman_id= #{aid}
 	</if>
-	<if test="processState==2 and complete !=5">
-	and  x.aid=#{aid}  and a.process_state &gt;= 2
-	</if>
+    <if test="processState==1">
+      and d.manager_id= #{aid}
+    </if>
 	<if test="processState==3 and complete !=5">
-	and x.aid=#{aid}  and a.process_state &gt;= 3
+	and  x.aid=#{aid}  and a.process_state &gt;= #{processState}
 	</if>
-	<if test="processState==2 and complete ==5">
-	and  x.aid=#{aid}  and a.back_status &gt;= #{processState}
+	<if test="processState==4 and complete !=5">
+	and x.aid=#{aid}  and a.process_state &gt;= #{processState}
 	</if>
 	<if test="processState==3 and complete ==5">
+	and  x.aid=#{aid}  and a.back_status &gt;= #{processState}
+	</if>
+	<if test="processState==4 and complete ==5">
 	and x.aid=#{aid}  and a.back_status &gt;= #{processState}
 	</if>
-	<if test="processState==5 and aid !=null">
+	<if test="processState==6 and aid !=null">
 	and e.finance_id =#{aid}
 	</if>
-	<if test="processState==5 and aids !=null">
+	<if test="processState==6 and aids !=null">
 	and e.finance_id in
 		<foreach close=")" collection="aids" item="id" open="(" separator=",">
 		#{id}
@@ -559,35 +562,35 @@ select
 	<if test="salesmanName !=null">
 	and d.name like concat('%',#{salesmanName},'%')
 	</if>
-	<if test="complete ==0 and processState != 8">
+	<if test="complete ==0 and processState != 9">
 	 and (a.process_state &gt;= #{processState} or a.back_status &gt;= #{processState})
 	</if>
-	<if test="complete ==0 and processState == 8">
-	 and (a.process_state &gt;= #{processState} and  a.process_state &lt; 9)or a.back_status &gt;= #{processState}
-	</if>
-	<if test="complete ==1 and processState != 5 and processState != 7 and processState != 8">
-	 and a.process_state = #{processState}
+	<if test="complete ==0 and processState == 9">
+	 and (a.process_state &gt;= #{processState} and  a.process_state &lt; 10)or a.back_status &gt;= #{processState}
 	</if>
-	<if test="complete ==1 and processState == 5">
-	 and (a.process_state in(5,9)  and a.status !=4)
+	<if test="complete ==1 and processState != 6 and processState != 8 and processState != 9">
+	 and a.process_state = #{processState} and a.status in (0,1,2,3)
 	</if>
-	<if test="complete ==1 and processState == 7">
-	 and (a.process_state = 7  and  a.status =1)
+	<if test="complete ==1 and processState == 6">
+	 and (a.process_state in(6)  and a.status in (0,1,2,3,5,6))
 	</if>
 	<if test="complete ==1 and processState == 8">
+	 and (a.process_state = 8  and  a.status =1)
+	</if>
+	<if test="complete ==1 and processState == 9">
 	 and (a.process_state = #{processState}  and a.status =1)
 	</if>
-	<if test="complete ==2 and processState != 5 and processState != 7 and processState != 8">
+	<if test="complete ==2 and processState != 6 and processState != 8 and processState != 9">
 	 and a.process_state &gt; #{processState}
 	</if>
-	<if test="complete ==2 and processState == 5">
-	 and (a.process_state &gt; 5 and a.process_state &lt; 9) or (a.process_state =9 and a.status=4)
-	</if>
-	<if test="complete ==2 and processState == 7">
-	 and ((a.process_state = 7  and  (a.status = 4 or a.status = 2))or a.process_state &gt; 7)
+	<if test="complete ==2 and processState == 6">
+	 and a.process_state &gt; 6 and a.process_state &lt; 10
 	</if>
 	<if test="complete ==2 and processState == 8">
-	 and a.process_state = 8  and   (a.status = 4 or a.status = 2)
+	 and ((a.process_state = 8  and  (a.status = 4 or a.status = 2))or a.process_state &gt; 8)
+	</if>
+	<if test="complete ==2 and processState == 9">
+	 and a.process_state = 9  and   (a.status = 4 or a.status = 2)
 	</if>
 	<if test="complete ==3">
 	 and   a.status = 2
@@ -595,7 +598,7 @@ select
 	<if test="complete ==4">
 	 and   a.status = 4
 	</if>
-    <if test="complete ==5 and processState != 2 and processState != 3">
+    <if test="complete ==5 and processState != 3 and processState != 4">
 	 and a.back_status &gt;= #{processState}
 	</if>
     <if test="complete ==6">
@@ -611,32 +614,35 @@ select
   select count(*) 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 left join department e on b.order_dep=e.id
-		<if test="processState==2">
+		<if test="processState==3">
  	left join (select order_no, aid from order_examine where`type`=0 group by order_no,aid)x on a.order_no = x.order_no
 	</if>
-	<if test="processState==3">
+	<if test="processState==4">
 	left join (select order_no, aid from order_examine where`type`=1 group by order_no,aid)x on a.order_no = x.order_no
 	</if>
 	where 1=1
-	<if test="processState==0">
-	and b.salesman_id= #{aid}
-	</if>
-	<if test="processState==2 and complete !=5">
-	and  x.aid=#{aid}  and a.process_state &gt;= 2
-	</if>
+    <if test="processState==0">
+      and b.salesman_id= #{aid}
+    </if>
+    <if test="processState==1">
+      and d.manager_id= #{aid}
+    </if>
 	<if test="processState==3 and complete !=5">
-	and x.aid=#{aid}  and a.process_state &gt;= 3
+	and  x.aid=#{aid}  and a.process_state &gt;= #{processState}
 	</if>
-	<if test="processState==2 and complete ==5">
-	and  x.aid=#{aid}  and a.back_status &gt;= #{processState}
+	<if test="processState==4 and complete !=5">
+	and x.aid=#{aid}  and a.process_state &gt;= #{processState}
 	</if>
 	<if test="processState==3 and complete ==5">
+	and  x.aid=#{aid}  and a.back_status &gt;= #{processState}
+	</if>
+	<if test="processState==4 and complete ==5">
 	and x.aid=#{aid}  and a.back_status &gt;= #{processState}
 	</if>
-	<if test="processState==5 and aid !=null">
+	<if test="processState==6 and aid !=null">
 	and e.finance_id =#{aid}
 	</if>
-	<if test="processState==5 and aids !=null">
+	<if test="processState==6 and aids !=null">
 	and e.finance_id in
 		<foreach close=")" collection="aids" item="id" open="(" separator=",">
 		#{id}
@@ -669,35 +675,35 @@ select
 	<if test="salesmanName !=null">
 	and d.name like concat('%',#{salesmanName},'%')
 	</if>
-	<if test="complete ==0 and processState != 8">
+	<if test="complete ==0 and processState != 9">
 	 and (a.process_state &gt;= #{processState} or a.back_status &gt;= #{processState})
 	</if>
-	<if test="complete ==0 and processState == 8">
-	 and (a.process_state &gt;= #{processState} and  a.process_state &lt; 9)or a.back_status &gt;= #{processState}
+	<if test="complete ==0 and processState == 9">
+	 and (a.process_state &gt;= #{processState} and  a.process_state &lt; 10)or a.back_status &gt;= #{processState}
 	</if>
-	<if test="complete ==1 and processState != 5 and processState != 7 and processState != 8">
-	 and a.process_state = #{processState}
+	<if test="complete ==1 and processState != 6 and processState != 8 and processState != 9">
+      and a.process_state = #{processState} and a.status in (0,1,2,3)
 	</if>
-	<if test="complete ==1 and processState == 5">
-	 and (a.process_state in(5,9)  and a.status !=4)
+	<if test="complete ==1 and processState == 6">
+	 and (a.process_state in(6)  and a.status in (0,1,2,3,5,6))
 	</if>
-    <if test="complete ==1 and processState == 7">
-      and (a.process_state = 7  and  a.status =1)
-    </if>
     <if test="complete ==1 and processState == 8">
+      and (a.process_state = 8  and  a.status =1)
+    </if>
+    <if test="complete ==1 and processState == 9">
       and (a.process_state = #{processState} and   a.status =1)
     </if>
-	<if test="complete ==2 and processState != 5 and processState != 7 and processState != 8">
+	<if test="complete ==2 and processState != 6 and processState != 8 and processState != 9">
 	 and a.process_state &gt; #{processState}
 	</if>
-	<if test="complete ==2 and processState == 5">
-	 and (a.process_state &gt; 5 and a.process_state &lt; 9) or (a.process_state =9 and a.status=4)
-	</if>
-	<if test="complete ==2 and processState == 7">
-	 and ((a.process_state = 7  and  (a.status = 4 or a.status = 2))or a.process_state &gt; 7)
+	<if test="complete ==2 and processState == 6">
+	 and a.process_state &gt; 6 and a.process_state &lt; 10
 	</if>
 	<if test="complete ==2 and processState == 8">
-	 and a.process_state = 8  and   (a.status = 4 or a.status = 2)
+	 and ((a.process_state = 8  and  (a.status = 4 or a.status = 2))or a.process_state &gt; 8)
+	</if>
+	<if test="complete ==2 and processState == 9">
+	 and a.process_state = 9  and   (a.status = 4 or a.status = 2)
 	</if>
 	<if test="complete ==3">
 	 and   a.status = 2
@@ -705,7 +711,7 @@ select
 	<if test="complete ==4">
 	 and   a.status = 4
 	</if>
-	<if test="complete ==5 and processState != 2 and processState != 3">
+	<if test="complete ==5 and processState != 3 and processState != 4">
 	 and a.back_status &gt;= #{processState}
 	</if>
     <if test="complete ==6">
@@ -724,9 +730,10 @@ select
 	</update>
 
     <select id="getOrderChange" resultType="java.util.Map">
-	select id,used_order usedOrder from new_order_change where  order_no= #{orderNo} order by id
+	select id,used_order usedOrder from new_order_change where  order_no= #{orderNo} order by id desc
 	</select>
 
+
   <update id="updateExamineName">
     update  new_order_change a
     <if test="names ==null">
@@ -765,4 +772,43 @@ select
       set n.examine_name =a.name
       where n.process_state =#{type}
     </update>
+
+  <select id="gerProcessName" resultType="com.goafanti.order.bo.OutProcessName">
+    select a.id,a.order_no orderNo ,a.`type`,a.change_amount changeAmount ,a.status,a.process_state processState,
+           c.name yxy,mg.name yxjl, yxgly.name yxgly,zxs.name zxs,zxsjl.name zxsjl, zxsgly.name zxsgly,
+           fm.name cwzy,cwgly.name cwgly, zc.name zc,dsz.name dsz
+    from new_order_change a
+           left join t_order_new b on a.order_no =b.order_no
+           left join admin c on b.salesman_id =c.id
+           left join department dep on b.order_dep =dep.id
+           left join admin fm on dep.finance_id =fm.id
+           left join admin mg on c.manager_id =mg.id
+           left join (select a.department_id depId,group_concat(a.name) 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 ='9996' and a.status ='0' group by a.department_id )yxgly on b.order_dep =yxgly.depId
+           left join (select a.order_no ,a.`type` ,GROUP_CONCAT(distinct b.name) name
+                      from order_examine a left join admin b on a.aid=b.id where a.order_no = #{orderNo} and a.`type` =0
+                      group by order_no ,type)zxs on a.order_no =zxs.order_no
+           left join (select a.order_no ,a.`type` ,GROUP_CONCAT(distinct b.name) name
+                      from order_examine a left join admin b on a.aid=b.id where a.order_no = #{orderNo} and a.`type` =1
+                      group by order_no ,type)zxsjl on a.order_no =zxsjl.order_no
+           left join (select group_concat(a.name) 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 in ('99998','99988') and a.status ='0' ) zc on 1=1
+           left join (select group_concat(a.name) 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 in ('99999','99989') and a.status ='0' ) dsz on 1=1
+           left join (select group_concat(a.name) 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 in ('9998') and a.status ='0' ) zxsgly on 1=1
+           left join (select group_concat(a.name) 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 in ('9997') and a.status ='0' ) cwgly on 1=1
+    where a.id= #{id}
+  </select>
 </mapper>

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

@@ -315,7 +315,7 @@
   </select>
 
   <select id="selectByOrderNo" resultType="com.goafanti.common.bo.OrderExamineBo">
-    		select a.id,b.name,a.type,a.status
+    		select a.id,a.aid,b.name,a.type,a.status
     from order_examine a left join admin b on a.aid=b.id
     where a.order_no= #{orderNo} and a.type= #{type}
   </select>
@@ -329,6 +329,9 @@
     <if test="status != null">
     and status=#{status}
     </if>
+    <if test="type !=null">
+      and type =#{type}
+    </if>
   </update>
    <update id="updateDimissionTransfer">
   update order_examine set aid= #{transferId}
@@ -340,7 +343,16 @@
 
   <delete id="deleteByAidAndStatus">
     delete  from order_examine
-    where status=0 and  aid=#{aid} and type=#{type}
+    where status=0
+    <if  test="orderNo != null">
+      and  order_no=#{orderNo}
+    </if>
+    <if  test="aid != null">
+    and  aid=#{aid}
+    </if>
+    <if  test="type != null">
+    and type=#{type}
+    </if>
   </delete>
   <update id="updateBack">
     update order_examine

+ 29 - 30
src/main/java/com/goafanti/common/mapper/PermissionMapper.xml

@@ -21,7 +21,7 @@
      deleted_sign as deletedSign, aut_no as autNo, hierarchies,status ,show_order as showOrder, super_id as superId,type
   </sql>
   <select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="BaseResultMap">
-    select 
+    select
     <include refid="Base_Column_List" />
     from permission
     where id = #{id,jdbcType=VARCHAR}
@@ -87,14 +87,14 @@
     where tur.uid = #{userId,jdbcType=VARCHAR}
   </select>
   <select id="findAll" resultMap="BaseResultMap">
-    select 
+    select
     <include refid="Base_Column_List" />
     from permission order by name
   </select>
-  
+
   <insert id="insertBatch" parameterType="com.goafanti.common.model.Permission">
     insert into permission (id, name, url)
-    values 
+    values
     <foreach item="item" index="index" collection="list" separator=",">
       (#{item.id,jdbcType=VARCHAR}, #{item.name,jdbcType=VARCHAR}, #{item.url,jdbcType=VARCHAR})
     </foreach>
@@ -102,31 +102,31 @@
 	    name = values(name),
 	    url = values(url)
   </insert>
-  
+
   <delete id="deleteByPrimaryKeys" parameterType="java.lang.String">
     delete from permission
-    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>
   <insert id="insertn" parameterType="com.goafanti.common.model.Permission">
-    insert into permission (id, url, name, 
-      create_id, create_time, update_time, 
-      deleted_sign, aut_no, hierarchies, 
+    insert into permission (id, url, name,
+      create_id, create_time, update_time,
+      deleted_sign, aut_no, hierarchies,
       status, show_order, super_id,type
       )
-    values (#{id,jdbcType=VARCHAR}, #{url,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR}, 
-      #{createId,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP}, 
-      #{deletedSign,jdbcType=VARCHAR}, #{autNo,jdbcType=VARCHAR}, #{hierarchies,jdbcType=VARCHAR}, 
+    values (#{id,jdbcType=VARCHAR}, #{url,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR},
+      #{createId,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP},
+      #{deletedSign,jdbcType=VARCHAR}, #{autNo,jdbcType=VARCHAR}, #{hierarchies,jdbcType=VARCHAR},
       #{status,jdbcType=VARCHAR}, #{showOrder,jdbcType=VARCHAR}, #{superId,jdbcType=VARCHAR},#{type,jdbcType=INTEGER}
       )
   </insert>
   <select id="selectAdminNameById" parameterType="java.lang.String" resultType="java.lang.String">
-  		select 
+  		select
   		name
   		from admin
-  		where 
+  		where
   		id=#{id,jdbcType=VARCHAR}
   </select>
   <select id="selectAutNoCount" parameterType="String" resultType="java.lang.Integer">
@@ -135,7 +135,7 @@
 		from permission
 		where
 		super_id=#{superId,jdbcType=VARCHAR}
-  </select>	
+  </select>
   <select id="selectIdByAutNo" parameterType="java.lang.String" resultType="java.lang.String">
   		select
   		id
@@ -155,14 +155,14 @@
 		name as superId
 		from permission
 		where
-		id=#{id,jdbcType=VARCHAR} 
+		id=#{id,jdbcType=VARCHAR}
   </select>
   <delete id="deleteById" parameterType="java.lang.String">
 	    delete from permission
 	    where id = #{id,jdbcType=VARCHAR}
   </delete>
   <select id="selectAllById" parameterType="java.lang.String" resultType="com.goafanti.common.model.Permission">
-  		select 
+  		select
     	<include refid="Base_Column_List" />
     	from permission
     	where
@@ -223,12 +223,12 @@
       	type = #{type,jdbcType=INTEGER},
       </if>
     </set>
-    where id = #{id,jdbcType=VARCHAR} 		
+    where id = #{id,jdbcType=VARCHAR}
   </update>
   <select id="selectIDNBySuperId" parameterType="java.lang.String" resultType="com.goafanti.common.model.Permission">
   		select
   		<include refid="Base_Column_List" />
-  		from permission 		
+  		from permission
   		where
   		super_id=#{superId,jdbcType=VARCHAR}
   		order by aut_no
@@ -244,9 +244,8 @@
   <select id="selectOneAll" resultType="com.goafanti.permission.bo.PermissionBo">
   		select
   		<include refid="Base_Column_List" />
-  		from permission 		
-  		where
-  		hierarchies=1
+  		from permission
+  		where 1=1
   		order by show_order
   </select>
   <select id="selectNameById" parameterType="java.lang.String" resultType="java.lang.String">
@@ -254,7 +253,7 @@
 		name as superId
 		from permission
 		where
-		id=#{id,jdbcType=VARCHAR} 
+		id=#{id,jdbcType=VARCHAR}
   </select>
   <select id="selectAllBySuperId" parameterType="String" resultType="com.goafanti.permission.bo.PermissionBo">
   		select
@@ -278,7 +277,7 @@
 		where
 		name=#{name,jdbcType=VARCHAR}
   </select>
-  
+
   <select id="selectIdByNameCount" resultType="java.lang.Integer">
 		select count(*)
 		from permission
@@ -290,7 +289,7 @@
   		count(0)
   		from role_permission
   		where
-  		pid=#{id,jdbcType=VARCHAR} 
+  		pid=#{id,jdbcType=VARCHAR}
   </select>
   <select id="selectNavList" parameterType="java.lang.String" resultType="com.goafanti.permission.bo.Navigation">
 		<choose>
@@ -302,7 +301,7 @@
 					url
 				from
 					permission
-				where type = 0	 
+				where type = 0
 			</when>
 			<otherwise>
 				select
@@ -334,7 +333,7 @@
 					super_id = #{superId,jdbcType=VARCHAR}
 					and (type = 1 or type = 2)
   			</when>
-  			<otherwise>				
+  			<otherwise>
 				select
 					d.id,
 					d.name,
@@ -356,4 +355,4 @@
   <select id="selectTopNavBySubUrl" resultType="java.lang.String" parameterType="java.lang.String">
   	select super_id  from permission where id = (select super_id from permission where url = #{subUrl,jdbcType=VARCHAR})
   </select>
-</mapper>
+</mapper>

+ 147 - 0
src/main/java/com/goafanti/common/mapper/TOrderHighTechMapper.xml

@@ -0,0 +1,147 @@
+<?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.TOrderHighTechMapper">
+  <resultMap id="BaseResultMap" type="com.goafanti.common.model.TOrderHighTech">
+    <id column="id" jdbcType="INTEGER" property="id" />
+    <result column="order_no" jdbcType="VARCHAR" property="orderNo" />
+    <result column="knowledge_services" jdbcType="INTEGER" property="knowledgeServices" />
+    <result column="audit_services" jdbcType="INTEGER" property="auditServices" />
+    <result column="add_deduction_services" jdbcType="INTEGER" property="addDeductionServices" />
+    <result column="knowledge_other" jdbcType="VARCHAR" property="knowledgeOther" />
+    <result column="audit_other" jdbcType="VARCHAR" property="auditOther" />
+    <result column="add_deduction_other" jdbcType="VARCHAR" property="addDeductionOther" />
+    <result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
+  </resultMap>
+  <sql id="Base_Column_List">
+    id, order_no, knowledge_services, audit_services, add_deduction_services, knowledge_other,
+    audit_other, add_deduction_other, create_time
+  </sql>
+  <select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
+    select
+    <include refid="Base_Column_List" />
+    from t_order_high_tech
+    where id = #{id,jdbcType=INTEGER}
+  </select>
+  <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
+    delete from t_order_high_tech
+    where id = #{id,jdbcType=INTEGER}
+  </delete>
+  <insert id="insert" keyColumn="id" keyProperty="id" parameterType="com.goafanti.common.model.TOrderHighTech" useGeneratedKeys="true">
+    insert into t_order_high_tech (order_no, knowledge_services, audit_services,
+      add_deduction_services, knowledge_other, audit_other,
+      add_deduction_other, create_time)
+    values (#{orderNo,jdbcType=VARCHAR}, #{knowledgeServices,jdbcType=INTEGER}, #{auditServices,jdbcType=INTEGER},
+      #{addDeductionServices,jdbcType=INTEGER}, #{knowledgeOther,jdbcType=VARCHAR}, #{auditOther,jdbcType=VARCHAR},
+      #{addDeductionOther,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP})
+  </insert>
+  <insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="com.goafanti.common.model.TOrderHighTech" useGeneratedKeys="true">
+    insert into t_order_high_tech
+    <trim prefix="(" suffix=")" suffixOverrides=",">
+      <if test="orderNo != null">
+        order_no,
+      </if>
+      <if test="knowledgeServices != null">
+        knowledge_services,
+      </if>
+      <if test="auditServices != null">
+        audit_services,
+      </if>
+      <if test="addDeductionServices != null">
+        add_deduction_services,
+      </if>
+      <if test="knowledgeOther != null">
+        knowledge_other,
+      </if>
+      <if test="auditOther != null">
+        audit_other,
+      </if>
+      <if test="addDeductionOther != null">
+        add_deduction_other,
+      </if>
+      <if test="createTime != null">
+        create_time,
+      </if>
+    </trim>
+    <trim prefix="values (" suffix=")" suffixOverrides=",">
+      <if test="orderNo != null">
+        #{orderNo,jdbcType=VARCHAR},
+      </if>
+      <if test="knowledgeServices != null">
+        #{knowledgeServices,jdbcType=INTEGER},
+      </if>
+      <if test="auditServices != null">
+        #{auditServices,jdbcType=INTEGER},
+      </if>
+      <if test="addDeductionServices != null">
+        #{addDeductionServices,jdbcType=INTEGER},
+      </if>
+      <if test="knowledgeOther != null">
+        #{knowledgeOther,jdbcType=VARCHAR},
+      </if>
+      <if test="auditOther != null">
+        #{auditOther,jdbcType=VARCHAR},
+      </if>
+      <if test="addDeductionOther != null">
+        #{addDeductionOther,jdbcType=VARCHAR},
+      </if>
+      <if test="createTime != null">
+        #{createTime,jdbcType=TIMESTAMP},
+      </if>
+    </trim>
+  </insert>
+  <update id="updateByPrimaryKeySelective" parameterType="com.goafanti.common.model.TOrderHighTech">
+    update t_order_high_tech
+    <set>
+      <if test="orderNo != null">
+        order_no = #{orderNo,jdbcType=VARCHAR},
+      </if>
+      <if test="knowledgeServices != null">
+        knowledge_services = #{knowledgeServices,jdbcType=INTEGER},
+      </if>
+      <if test="auditServices != null">
+        audit_services = #{auditServices,jdbcType=INTEGER},
+      </if>
+      <if test="addDeductionServices != null">
+        add_deduction_services = #{addDeductionServices,jdbcType=INTEGER},
+      </if>
+      <if test="knowledgeOther != null">
+        knowledge_other = #{knowledgeOther,jdbcType=VARCHAR},
+      </if>
+      <if test="auditOther != null">
+        audit_other = #{auditOther,jdbcType=VARCHAR},
+      </if>
+      <if test="addDeductionOther != null">
+        add_deduction_other = #{addDeductionOther,jdbcType=VARCHAR},
+      </if>
+      <if test="createTime != null">
+        create_time = #{createTime,jdbcType=TIMESTAMP},
+      </if>
+    </set>
+    where id = #{id,jdbcType=INTEGER}
+  </update>
+  <update id="updateByPrimaryKey" parameterType="com.goafanti.common.model.TOrderHighTech">
+    update t_order_high_tech
+    set order_no = #{orderNo,jdbcType=VARCHAR},
+    knowledge_services = #{knowledgeServices,jdbcType=INTEGER},
+    audit_services = #{auditServices,jdbcType=INTEGER},
+    add_deduction_services = #{addDeductionServices,jdbcType=INTEGER},
+    knowledge_other = #{knowledgeOther,jdbcType=VARCHAR},
+    audit_other = #{auditOther,jdbcType=VARCHAR},
+    add_deduction_other = #{addDeductionOther,jdbcType=VARCHAR},
+    create_time = #{createTime,jdbcType=TIMESTAMP}
+    where id = #{id,jdbcType=INTEGER}
+  </update>
+
+  <update id="updateByOrder" parameterType="com.goafanti.common.model.TOrderHighTech">
+    update t_order_high_tech
+    set
+    knowledge_services = #{knowledgeServices,jdbcType=INTEGER},
+    audit_services = #{auditServices,jdbcType=INTEGER},
+    add_deduction_services = #{addDeductionServices,jdbcType=INTEGER},
+    knowledge_other = #{knowledgeOther,jdbcType=VARCHAR},
+    audit_other = #{auditOther,jdbcType=VARCHAR},
+    add_deduction_other = #{addDeductionOther,jdbcType=VARCHAR},
+    create_time = #{createTime,jdbcType=TIMESTAMP}
+    where order_no = #{orderNo,jdbcType=VARCHAR}
+  </update>
+</mapper>

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

@@ -360,7 +360,7 @@
 
     <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
+	where order_no= #{orderNo,jdbcType=VARCHAR}  and status =2
 	<if test="id != null">
 	and id != #{id,jdbcType=INTEGER}
 	</if>

+ 56 - 19
src/main/java/com/goafanti/common/mapper/TOrderNewMapper.xml

@@ -921,11 +921,11 @@ left join department d on o.order_dep = d.id   left join t_order_mid a on o.orde
   </select>
   <!-- 通过订单编号获得订单的负责人(营销员) -->
   <select id="getSaleIdByOno" parameterType="java.lang.String" resultType="com.goafanti.order.bo.TOrderNewBo">
-    select o.order_no orderNo ,o.salesman_id as salesmanId, a.name as salesmanName,
+    select o.order_no orderNo ,o.salesman_id as salesmanId, a.name as salesmanName,e.name managerName,
            o.contract_no contractNo,a.email ,u.nickname as userName,o.order_dep orderDep,d.name departmentName,
            d.finance_id  financeId
     from t_order_new o left join admin a on o.salesman_id = a.id left join `user` u on u.id = o.buyer_id
-    left join department d on o.order_dep=d.id
+    left join department d on o.order_dep=d.id left join admin e on a.manager_id=e.id
     where order_no = #{_parameter,jdbcType=VARCHAR}
   </select>
 
@@ -953,8 +953,11 @@ left join department d on o.order_dep = d.id   left join t_order_mid a on o.orde
   	left join (select order_no from new_order_change group by order_no)g on a.order_no=g.order_no
   	</if>
     <if test="specially == 9">
-    left join t_order_task tot on a.order_no =tot.order_no
-    left join business_project bp on tot.commodity_id =bp.id
+      left join t_order_task tot on a.order_no =tot.order_no
+      left join business_project bp on tot.commodity_id =bp.id
+    </if>
+    <if test="specially == 10">
+      left join admin mg on a.salesman_id=mg.id
     </if>
   	where a.delete_sign in(0,2)
     <if test="specially ==7">
@@ -983,9 +986,13 @@ left join department d on o.order_dep = d.id   left join t_order_mid a on o.orde
   	and a.order_status  in(0,1,2,4)
   	and a.salesman_id = #{aid,jdbcType=VARCHAR}
   	</if>
-  	<if test="specially == 1">
-  	and a.process_status = 1  and a.order_status = 1
-  	</if>
+    <if test="specially == 10">
+      and a.process_status = 1  and a.order_status in (0,1,2)
+  	  and mg.manager_id= #{aid}
+    </if>
+    <if test="specially == 1">
+      and a.process_status = 2  and a.order_status in (0,1,2)
+    </if>
   	<if test="specially == 2">
   	and a.order_status in(3,5)
   	and a.salesman_id = #{aid,jdbcType=VARCHAR}
@@ -993,11 +1000,11 @@ left join department d on o.order_dep = d.id   left join t_order_mid a on o.orde
     <if test="specially == 3">
       and  a.order_status=2
       <if test="approval ==0">
-        and a.process_status in(7)
+        and a.process_status in(4)
         and a.approval = 0
       </if>
       <if test="approval ==1">
-        and a.process_status in(7)
+        and a.process_status in(4)
         and a.approval in
             <if test="manageType ==0">
             (1)
@@ -1031,7 +1038,7 @@ left join department d on o.order_dep = d.id   left join t_order_mid a on o.orde
         </if>
       </if>
   	<if test="specially == 4">
-  	and a.process_status in (4,5,6,99)
+  	and a.process_status in (5,6,7,99)
   	and a.order_status  in(1,2,3,4,6)
   	</if>
     <if test="deps!=null">
@@ -1041,13 +1048,13 @@ left join department d on o.order_dep = d.id   left join t_order_mid a on o.orde
       </foreach>
     </if>
   	<if test="distribution == 0">
-  	and a.process_status &lt; 5
+  	and a.process_status &lt; 6
   	</if>
   	<if test="distribution == 1">
-  	and a.process_status = 5
+  	and a.process_status = 6
   	</if>
   	<if test="distribution == 2">
-  	and a.process_status = 6
+  	and a.process_status = 7
   	</if>
   	<if test="name != null">
   	and b.nickname like CONCAT('%',#{name,jdbcType=VARCHAR},'%')
@@ -1115,6 +1122,9 @@ left join department d on o.order_dep = d.id   left join t_order_mid a on o.orde
        left join t_order_task tot on a.order_no =tot.order_no
        left join business_project bp on tot.commodity_id =bp.id
      </if>
+  	 <if test="specially == 10">
+       left join admin mg on a.salesman_id=mg.id
+     </if>
   	where a.delete_sign in(0,2)
      <if test="specially ==7">
        and a.process_status > 4
@@ -1142,8 +1152,12 @@ left join department d on o.order_dep = d.id   left join t_order_mid a on o.orde
       and a.order_status  in(0,1,2,4)
       and a.salesman_id = #{aid,jdbcType=VARCHAR}
     </if>
+     <if test="specially == 10">
+       and a.process_status = 1  and a.order_status in (0,1,2)
+       and mg.manager_id= #{aid}
+     </if>
   	<if test="specially == 1">
-  	and a.process_status = 1  and a.order_status = 1
+  	and a.process_status = 2  and a.order_status in (0,1,2)
   	</if>
   	<if test="specially == 2">
   	and a.order_status in(3,5)
@@ -1190,7 +1204,7 @@ left join department d on o.order_dep = d.id   left join t_order_mid a on o.orde
        </if>
      </if>
   	<if test="specially == 4">
-  	and a.process_status in (4,5,6,99)
+  	and a.process_status in (5,6,7,99)
   	and a.order_status  in(1,2,3,4,6)
   	</if>
      <if test="deps!=null">
@@ -1200,13 +1214,13 @@ left join department d on o.order_dep = d.id   left join t_order_mid a on o.orde
        </foreach>
      </if>
   	<if test="distribution == 0">
-  	and a.process_status &lt; 5
+  	and a.process_status &lt; 6
   	</if>
   	<if test="distribution == 1">
-  	and a.process_status = 5
+  	and a.process_status = 6
   	</if>
   	<if test="distribution == 2">
-  	and a.process_status = 6
+  	and a.process_status = 7
   	</if>
   	<if test="name != null">
   	and b.nickname like CONCAT('%',#{name,jdbcType=VARCHAR},'%')
@@ -1414,12 +1428,14 @@ 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.examine_name examineName
+      a.service_content serviceContent,a.examine_name examineName, tht.knowledge_services knowledgeServices, tht.audit_services auditServices,c.manager_id managerId,
+      tht.add_deduction_services addDeductionServices, tht.knowledge_other knowledgeOther, tht.audit_other auditOther, tht.add_deduction_other addDeductionOther
     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
          left join  t_order_back  e on a.order_no=e.order_no and e.back_status=0
          left join admin f on e.initiate=f.id left join organization_identity g on a.buyer_id=g.uid
+        left join t_order_high_tech tht on a.order_no=tht.order_no
     where   a.order_no = #{orderNo,jdbcType=VARCHAR}
   </select>
 
@@ -1966,5 +1982,26 @@ left join department d on o.order_dep = d.id   left join t_order_mid a on o.orde
     select order_no orderNo,contract_picture_url contractPictureUrl ,agreement_url agreementUrl ,service_content serviceContent
     from t_order_new where delete_sign in (0,2)
   </select>
+  <select id="getProcessName" resultType="com.goafanti.order.bo.OrderProcessName">
+    select a.order_no orderNo,a.approval,a.process_status processStatus  ,b.name yxy,mg.name yxjl,
+        yxgly.name yxgly,d.name cwzy,zc.name zc, zxsgly.name zxsgly,dsz.name dsz
+    from t_order_new a left join admin b on a.salesman_id =b.id
+    left join admin mg on b.manager_id =mg.id
+     left join department c on a.order_dep =c.id
+     left join (select a.department_id depId,group_concat(a.name) 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 ='9996' and a.status ='0' group by a.department_id )yxgly on c.id =yxgly.depId
+     left join admin d on c.finance_id =d.id
+     left join (select group_concat(a.name) 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 in ('99998','99988') and a.status ='0' ) zc on 1=1
+     left join (select group_concat(a.name) 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 in ('99999','99989') and a.status ='0' ) dsz on 1=1
+     left join (select group_concat(a.name) 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 in ('9998') and a.status ='0' ) zxsgly on 1=1
+    where a.order_no = #{orderNo}
+  </select>
 
 </mapper>

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

@@ -792,7 +792,7 @@
     a.task_comment as taskComment ,a.commodity_price as commodityPrice, a.task_status as taskStatus,ttm.stop_type stopType,ttm.stop_status stopStatus,
     a.task_receiver as taskReceiver ,a.if_certification_fee ifCertificationFee , a.split_status splitStatus,
     a.cost_reduction costReduction,a.official_cost officialCost,i.`type` ,d.name ,a.declaration_batch declarationBatch,
-    a.patent_type patentType,a.picture_url pictureUrl,j.service_life serviceLife ,j.service_year serviceYear,j.year_sum yearSum,
+    a.patent_type patentType,a.picture_url pictureUrl,j.service_life serviceLife ,j.service_year serviceYear,j.year_sum yearSum,ttm.change,
     ttm.last_year lastYear,ttm.last_year_capital lastYearCapital,ttm.last_year_income lastYearIncome,ttm.stop_status projectStopStatus
     from t_order_task a left join business_project b on a.commodity_id=b.id left join t_order_new e on a.order_no=e.order_no
     left join admin f on e.salesman_id=f.id left join department g on e.order_dep=g.id left join user h on e.buyer_id=h.id

+ 19 - 6
src/main/java/com/goafanti/common/mapper/TTaskMidMapper.xml

@@ -41,6 +41,7 @@
     <result column="actual_profit" jdbcType="DECIMAL" property="actualProfit" />
     <result column="stop_type" jdbcType="INTEGER" property="stopType" />
     <result column="stop_status" jdbcType="INTEGER" property="stopStatus" />
+    <result column="change" jdbcType="INTEGER" property="change" />
   </resultMap>
   <sql id="Base_Column_List">
     id, tid, cost_amount, party_amount, create_time, certificates_count, urgent_day,
@@ -49,7 +50,7 @@
     dispatch_province, duty_dep, set_up_count, spot_check_count, fail_count, last_year,
     last_year_capital, last_year_income, cost_actual, patent_cost, patent_cost_actual,
     soft_cost, soft_cost_actual, audit_cost, audit_cost_actual, other_cost, other_cost_actual,
-    expect_profit, actual_profit, stop_type, stop_status
+    expect_profit, actual_profit, stop_type, stop_status, `change`
   </sql>
   <select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
     select
@@ -74,7 +75,8 @@
       patent_cost_actual, soft_cost, soft_cost_actual,
       audit_cost, audit_cost_actual, other_cost,
       other_cost_actual, expect_profit, actual_profit,
-      stop_type, stop_status)
+      stop_type, stop_status, `change`
+      )
     values (#{tid,jdbcType=INTEGER}, #{costAmount,jdbcType=DECIMAL}, #{partyAmount,jdbcType=DECIMAL},
       #{createTime,jdbcType=TIMESTAMP}, #{certificatesCount,jdbcType=INTEGER}, #{urgentDay,jdbcType=INTEGER},
       #{ifMaterial,jdbcType=INTEGER}, #{rejectCount,jdbcType=INTEGER}, #{acceptCount,jdbcType=INTEGER},
@@ -87,7 +89,8 @@
       #{patentCostActual,jdbcType=DECIMAL}, #{softCost,jdbcType=DECIMAL}, #{softCostActual,jdbcType=DECIMAL},
       #{auditCost,jdbcType=DECIMAL}, #{auditCostActual,jdbcType=DECIMAL}, #{otherCost,jdbcType=DECIMAL},
       #{otherCostActual,jdbcType=DECIMAL}, #{expectProfit,jdbcType=DECIMAL}, #{actualProfit,jdbcType=DECIMAL},
-      #{stopType,jdbcType=INTEGER}, #{stopStatus,jdbcType=INTEGER})
+      #{stopType,jdbcType=INTEGER}, #{stopStatus,jdbcType=INTEGER}, #{change,jdbcType=INTEGER}
+      )
   </insert>
   <insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="com.goafanti.common.model.TTaskMid" useGeneratedKeys="true">
     insert into t_task_mid
@@ -206,6 +209,9 @@
       <if test="stopStatus != null">
         stop_status,
       </if>
+      <if test="change != null">
+        `change`,
+      </if>
     </trim>
     <trim prefix="values (" suffix=")" suffixOverrides=",">
       <if test="tid != null">
@@ -322,6 +328,9 @@
       <if test="stopStatus != null">
         #{stopStatus,jdbcType=INTEGER},
       </if>
+      <if test="change != null">
+        #{change,jdbcType=INTEGER},
+      </if>
     </trim>
   </insert>
   <update id="updateByPrimaryKeySelective" parameterType="com.goafanti.common.model.TTaskMid">
@@ -441,6 +450,9 @@
       <if test="stopStatus != null">
         stop_status = #{stopStatus,jdbcType=INTEGER},
       </if>
+      <if test="change != null">
+        `change` = #{change,jdbcType=INTEGER},
+      </if>
     </set>
     where id = #{id,jdbcType=INTEGER}
   </update>
@@ -483,7 +495,8 @@
       expect_profit = #{expectProfit,jdbcType=DECIMAL},
       actual_profit = #{actualProfit,jdbcType=DECIMAL},
       stop_type = #{stopType,jdbcType=INTEGER},
-      stop_status = #{stopStatus,jdbcType=INTEGER}
+      stop_status = #{stopStatus,jdbcType=INTEGER},
+      `change` = #{change,jdbcType=INTEGER}
     where id = #{id,jdbcType=INTEGER}
   </update>
 
@@ -493,10 +506,10 @@
     update t_task_mid
     set party_amount = party_amount
     <if test="type == 0">
-       + #{paymentAmount,jdbcType=DECIMAL}
+      + #{paymentAmount,jdbcType=DECIMAL}
     </if>
     <if test="type == 1">
-       - #{paymentAmount,jdbcType=DECIMAL}
+      - #{paymentAmount,jdbcType=DECIMAL}
     </if>
     where tid = #{tid,jdbcType=INTEGER}
   </update>

+ 20 - 15
src/main/java/com/goafanti/common/mapper/UserRoleMapper.xml

@@ -30,47 +30,47 @@
   </insert>
   <delete id="deleteByRoleId" parameterType="java.lang.String">
     delete from user_role
-    where rid in 
-    <foreach item="item" index="index" collection="list" open="(" separator="," close=")">  
-	  #{item,jdbcType=VARCHAR}  
+    where rid in
+    <foreach item="item" index="index" collection="list" open="(" separator="," close=")">
+	  #{item,jdbcType=VARCHAR}
     </foreach>
   </delete>
-  
+
   <delete id="deleteByPrimaryKey">
     delete from user_role
     where rid = #{rid,jdbcType=VARCHAR} and uid = #{uid,jdbcType=VARCHAR}
   </delete>
-  
+
   <delete id="deleteByUserId" parameterType="java.lang.String">
     delete from user_role
-    where uid = #{userId,jdbcType=VARCHAR}  
+    where uid = #{userId,jdbcType=VARCHAR}
   </delete>
 
   <insert id="insertBatch">
     insert into user_role (uid, rid)
-    values 
+    values
     <foreach item="item" index="index" collection="roles" separator=",">
       (#{uid,jdbcType=VARCHAR}, #{item,jdbcType=VARCHAR})
     </foreach>
   </insert>
-  
+
   <select id ="findUserIdByRoleId" parameterType="java.lang.String" resultType="java.lang.String">
     select uid from user_role where rid = #{rid, jdbcType=VARCHAR}
   </select>
-  
+
   <select id="findUserIdByRoleIds" parameterType="java.util.List" resultType="java.lang.String">
     select uid from user_role where rid in
-     <foreach item="item" index="index" collection="list" open="(" separator="," close=")">  
-	  #{item,jdbcType=VARCHAR}  
+     <foreach item="item" index="index" collection="list" open="(" separator="," close=")">
+	  #{item,jdbcType=VARCHAR}
     </foreach>
   </select>
-  
+
   <select id ="listAuditor"  resultType="String">
     select uid from user_role where rid = 3
   </select>
-  
+
   <select id ="selectAdminRole"  resultType="com.goafanti.common.model.UserRole">
-    select a.uid,b.role_name,a.rid from user_role a 
+    select a.uid,b.role_name,a.rid from user_role a
 	left join role b on a.rid=b.id
 	where b.role_name=#{roleName,jdbcType=VARCHAR}
   </select>
@@ -78,4 +78,9 @@
       select id,role_name roleName,role_type roleType
       from `role` where id = #{roleId}
     </select>
-</mapper>
+  <select id="selectByUidAndRoleName" resultType="java.lang.Integer">
+    select count(*) from user_role a
+    left join role b on a.rid=b.id
+    where b.role_name= #{roleName} and a.uid=#{aid}
+  </select>
+</mapper>

+ 21 - 0
src/main/java/com/goafanti/common/model/Admin.java

@@ -130,6 +130,11 @@ public class Admin extends BaseModel implements AftUser {
      */
     private Integer ambManage;
 
+    /**
+     * 经理审核人员
+     */
+    private String managerId;
+
     private static final long serialVersionUID = 1L;
 
 
@@ -139,7 +144,15 @@ public class Admin extends BaseModel implements AftUser {
     private String	superior;
     private String reviewerName;
 
+    private  String managerName;
+
+    public String getManagerName() {
+        return managerName;
+    }
 
+    public void setManagerName(String managerName) {
+        this.managerName = managerName;
+    }
 
     public String getReviewerName() {
         return reviewerName;
@@ -370,4 +383,12 @@ public class Admin extends BaseModel implements AftUser {
     public void setAmbManage(Integer ambManage) {
         this.ambManage = ambManage;
     }
+
+    public String getManagerId() {
+        return managerId;
+    }
+
+    public void setManagerId(String managerId) {
+        this.managerId = managerId;
+    }
 }

+ 127 - 0
src/main/java/com/goafanti/common/model/AmbInvest.java

@@ -0,0 +1,127 @@
+package com.goafanti.common.model;
+
+import java.io.Serializable;
+import java.math.BigDecimal;
+import java.util.Date;
+
+/**
+ * amb_invest
+ * @author 
+ */
+public class AmbInvest implements Serializable {
+    private Long id;
+
+    /**
+     * 发起阿米巴
+     */
+    private Long initiateAmbId;
+
+    /**
+     * 接受阿米巴
+     */
+    private Long acceptAmbId;
+
+    /**
+     * 金额
+     */
+    private BigDecimal amount;
+
+    /**
+     * 状态 0=草稿,1=待审核,2=同意,3=驳回
+     */
+    private Integer status;
+
+    /**
+     * 操作人
+     */
+    private String operator;
+
+    /**
+     * 备注
+     */
+    private String comment;
+
+    /**
+     * 创建时间
+     */
+    private Date createTime;
+
+    /**
+     * 累计金额
+     */
+    private BigDecimal countAmount;
+
+    private static final long serialVersionUID = 1L;
+
+    public Long getId() {
+        return id;
+    }
+
+    public void setId(Long id) {
+        this.id = id;
+    }
+
+    public Long getInitiateAmbId() {
+        return initiateAmbId;
+    }
+
+    public void setInitiateAmbId(Long initiateAmbId) {
+        this.initiateAmbId = initiateAmbId;
+    }
+
+    public Long getAcceptAmbId() {
+        return acceptAmbId;
+    }
+
+    public void setAcceptAmbId(Long acceptAmbId) {
+        this.acceptAmbId = acceptAmbId;
+    }
+
+    public BigDecimal getAmount() {
+        return amount;
+    }
+
+    public void setAmount(BigDecimal amount) {
+        this.amount = amount;
+    }
+
+    public Integer getStatus() {
+        return status;
+    }
+
+    public void setStatus(Integer status) {
+        this.status = status;
+    }
+
+    public String getOperator() {
+        return operator;
+    }
+
+    public void setOperator(String operator) {
+        this.operator = operator;
+    }
+
+    public String getComment() {
+        return comment;
+    }
+
+    public void setComment(String comment) {
+        this.comment = comment;
+    }
+
+    public Date getCreateTime() {
+        return createTime;
+    }
+
+    public void setCreateTime(Date createTime) {
+        this.createTime = createTime;
+    }
+
+    public BigDecimal getCountAmount() {
+        return countAmount;
+    }
+
+    public void setCountAmount(BigDecimal countAmount) {
+        this.countAmount = countAmount;
+    }
+}

+ 98 - 0
src/main/java/com/goafanti/common/model/AmbInvestLog.java

@@ -0,0 +1,98 @@
+package com.goafanti.common.model;
+
+import java.io.Serializable;
+import java.math.BigDecimal;
+import java.util.Date;
+
+/**
+ * amb_invest_log
+ * @author 
+ */
+public class AmbInvestLog implements Serializable {
+    private Long id;
+
+    private Long ambInvestId;
+
+    /**
+     * 金额
+     */
+    private BigDecimal amount;
+
+    /**
+     * 状态 0=草稿,1=发起,2=同意,3=驳回
+     */
+    private Integer status;
+
+    /**
+     * 备注
+     */
+    private String comment;
+
+    /**
+     * 操作人
+     */
+    private String operator;
+
+    /**
+     * 创建时间
+     */
+    private Date createTime;
+
+    private static final long serialVersionUID = 1L;
+
+    public Long getId() {
+        return id;
+    }
+
+    public void setId(Long id) {
+        this.id = id;
+    }
+
+    public Long getAmbInvestId() {
+        return ambInvestId;
+    }
+
+    public void setAmbInvestId(Long ambInvestId) {
+        this.ambInvestId = ambInvestId;
+    }
+
+    public BigDecimal getAmount() {
+        return amount;
+    }
+
+    public void setAmount(BigDecimal amount) {
+        this.amount = amount;
+    }
+
+    public Integer getStatus() {
+        return status;
+    }
+
+    public void setStatus(Integer status) {
+        this.status = status;
+    }
+
+    public String getComment() {
+        return comment;
+    }
+
+    public void setComment(String comment) {
+        this.comment = comment;
+    }
+
+    public String getOperator() {
+        return operator;
+    }
+
+    public void setOperator(String operator) {
+        this.operator = operator;
+    }
+
+    public Date getCreateTime() {
+        return createTime;
+    }
+
+    public void setCreateTime(Date createTime) {
+        this.createTime = createTime;
+    }
+}

+ 26 - 13
src/main/java/com/goafanti/common/model/AmbPaymentApplication.java

@@ -22,6 +22,16 @@ public class AmbPaymentApplication implements Serializable {
     private BigDecimal totalAmount;
 
     /**
+     * 发起阿米巴
+     */
+    private Long initiateAmbId;
+
+    /**
+     * 接受阿米巴
+     */
+    private Long acceptAmbId;
+
+    /**
      * 内容及说明
      */
     private String content;
@@ -66,11 +76,6 @@ public class AmbPaymentApplication implements Serializable {
      */
     private Date updateTime;
 
-    /**
-     * 付款巴编号
-     */
-    private String paymentAmbId;
-
     private static final long serialVersionUID = 1L;
 
     public Long getId() {
@@ -97,6 +102,22 @@ public class AmbPaymentApplication implements Serializable {
         this.totalAmount = totalAmount;
     }
 
+    public Long getInitiateAmbId() {
+        return initiateAmbId;
+    }
+
+    public void setInitiateAmbId(Long initiateAmbId) {
+        this.initiateAmbId = initiateAmbId;
+    }
+
+    public Long getAcceptAmbId() {
+        return acceptAmbId;
+    }
+
+    public void setAcceptAmbId(Long acceptAmbId) {
+        this.acceptAmbId = acceptAmbId;
+    }
+
     public String getContent() {
         return content;
     }
@@ -168,12 +189,4 @@ public class AmbPaymentApplication implements Serializable {
     public void setUpdateTime(Date updateTime) {
         this.updateTime = updateTime;
     }
-
-    public String getPaymentAmbId() {
-        return paymentAmbId;
-    }
-
-    public void setPaymentAmbId(String paymentAmbId) {
-        this.paymentAmbId = paymentAmbId;
-    }
 }

+ 48 - 2
src/main/java/com/goafanti/common/model/AmbSystem.java

@@ -6,7 +6,7 @@ import java.util.Date;
 
 /**
  * amb_system
- * @author 
+ * @author
  */
 public class AmbSystem implements Serializable {
     /**
@@ -99,6 +99,21 @@ public class AmbSystem implements Serializable {
      */
     private Integer membersCount;
 
+    /**
+     * 我收到的投资款
+     */
+    private BigDecimal received;
+
+    /**
+     * 我对外的投资款
+     */
+    private BigDecimal foreign;
+
+    /**
+     * 我剩余的投资款
+     */
+    private BigDecimal surplus;
+
     private static final long serialVersionUID = 1L;
 
     public Long getId() {
@@ -244,4 +259,35 @@ public class AmbSystem implements Serializable {
     public void setMembersCount(Integer membersCount) {
         this.membersCount = membersCount;
     }
-}
+
+    public BigDecimal getReceived() {
+        return received;
+    }
+
+    public void setReceived(BigDecimal received) {
+        this.received = received;
+    }
+
+    public BigDecimal getForeign() {
+        return foreign;
+    }
+
+    public void setForeign(BigDecimal foreign) {
+        this.foreign = foreign;
+    }
+
+    public BigDecimal getSurplus() {
+        return surplus;
+    }
+
+    public void setSurplus(BigDecimal surplus) {
+        this.surplus = surplus;
+    }
+
+    public AmbSystem(String leader) {
+        this.leader = leader;
+    }
+
+    public AmbSystem() {
+    }
+}

+ 126 - 0
src/main/java/com/goafanti/common/model/TOrderHighTech.java

@@ -0,0 +1,126 @@
+package com.goafanti.common.model;
+
+import java.io.Serializable;
+import java.util.Date;
+
+/**
+ * t_order_high_tech
+ * @author 
+ */
+public class TOrderHighTech implements Serializable {
+    private Integer id;
+
+    /**
+     * 订单编号
+     */
+    private String orderNo;
+
+    /**
+     * 知识产权服务 1已签 2企业已经拥有可申报高新的知识产权 3企业自行申报/已有其他合作的代理机构申报 0其他
+     */
+    private Integer knowledgeServices;
+
+    /**
+     * 审计服务 1已签 2企业已经有符合申报的年审/专审 3 业自行找会计事务所出具报告 0其他
+     */
+    private Integer auditServices;
+
+    /**
+     * 加计扣除服务 1已签 2企业不符合加计扣除范围 3企业自己已经做了加计扣除 4企业自行找其他机构做了加计扣除 0其他
+     */
+    private Integer addDeductionServices;
+
+    /**
+     * 知识产权服务其他描述
+     */
+    private String knowledgeOther;
+
+    /**
+     * 审计服务其他描述
+     */
+    private String auditOther;
+
+    /**
+     * 加计扣除服务其他描述
+     */
+    private String addDeductionOther;
+
+    /**
+     * 时间戳
+     */
+    private Date createTime;
+
+    private static final long serialVersionUID = 1L;
+
+    public Integer getId() {
+        return id;
+    }
+
+    public void setId(Integer id) {
+        this.id = id;
+    }
+
+    public String getOrderNo() {
+        return orderNo;
+    }
+
+    public void setOrderNo(String orderNo) {
+        this.orderNo = orderNo;
+    }
+
+    public Integer getKnowledgeServices() {
+        return knowledgeServices;
+    }
+
+    public void setKnowledgeServices(Integer knowledgeServices) {
+        this.knowledgeServices = knowledgeServices;
+    }
+
+    public Integer getAuditServices() {
+        return auditServices;
+    }
+
+    public void setAuditServices(Integer auditServices) {
+        this.auditServices = auditServices;
+    }
+
+    public Integer getAddDeductionServices() {
+        return addDeductionServices;
+    }
+
+    public void setAddDeductionServices(Integer addDeductionServices) {
+        this.addDeductionServices = addDeductionServices;
+    }
+
+    public String getKnowledgeOther() {
+        return knowledgeOther;
+    }
+
+    public void setKnowledgeOther(String knowledgeOther) {
+        this.knowledgeOther = knowledgeOther;
+    }
+
+    public String getAuditOther() {
+        return auditOther;
+    }
+
+    public void setAuditOther(String auditOther) {
+        this.auditOther = auditOther;
+    }
+
+    public String getAddDeductionOther() {
+        return addDeductionOther;
+    }
+
+    public void setAddDeductionOther(String addDeductionOther) {
+        this.addDeductionOther = addDeductionOther;
+    }
+
+    public Date getCreateTime() {
+        return createTime;
+    }
+
+    public void setCreateTime(Date createTime) {
+        this.createTime = createTime;
+    }
+}

+ 83 - 4
src/main/java/com/goafanti/common/model/TOrderNewWithBLOBs.java

@@ -9,6 +9,85 @@ public class TOrderNewWithBLOBs extends TOrderNew {
 	private BigDecimal paymentRatio;
 	private BigDecimal serviceAmount;
 	private String serviceRemarks;
+
+	/**
+	 * 知识产权服务 1已签 2企业已经拥有可申报高新的知识产权 3企业自行申报/已有其他合作的代理机构申报 0其他
+	 */
+	private Integer knowledgeServices;
+
+	/**
+	 * 审计服务 1已签 2企业已经有符合申报的年审/专审 3 业自行找会计事务所出具报告 0其他
+	 */
+	private Integer auditServices;
+
+	/**
+	 * 加计扣除服务 1已签 2企业不符合加计扣除范围 3企业自己已经做了加计扣除 4企业自行找其他机构做了加计扣除 0其他
+	 */
+	private Integer addDeductionServices;
+
+	/**
+	 * 知识产权服务其他描述
+	 */
+	private String knowledgeOther;
+
+	/**
+	 * 审计服务其他描述
+	 */
+	private String auditOther;
+
+	/**
+	 * 加计扣除服务其他描述
+	 */
+	private String addDeductionOther;
+
+	public Integer getKnowledgeServices() {
+		return knowledgeServices;
+	}
+
+	public void setKnowledgeServices(Integer knowledgeServices) {
+		this.knowledgeServices = knowledgeServices;
+	}
+
+	public Integer getAuditServices() {
+		return auditServices;
+	}
+
+	public void setAuditServices(Integer auditServices) {
+		this.auditServices = auditServices;
+	}
+
+	public Integer getAddDeductionServices() {
+		return addDeductionServices;
+	}
+
+	public void setAddDeductionServices(Integer addDeductionServices) {
+		this.addDeductionServices = addDeductionServices;
+	}
+
+	public String getKnowledgeOther() {
+		return knowledgeOther;
+	}
+
+	public void setKnowledgeOther(String knowledgeOther) {
+		this.knowledgeOther = knowledgeOther;
+	}
+
+	public String getAuditOther() {
+		return auditOther;
+	}
+
+	public void setAuditOther(String auditOther) {
+		this.auditOther = auditOther;
+	}
+
+	public String getAddDeductionOther() {
+		return addDeductionOther;
+	}
+
+	public void setAddDeductionOther(String addDeductionOther) {
+		this.addDeductionOther = addDeductionOther;
+	}
+
 	public Integer getServiceStatus() {
 		return serviceStatus;
 	}
@@ -45,7 +124,7 @@ public class TOrderNewWithBLOBs extends TOrderNew {
 	public void setServiceRemarks(String serviceRemarks) {
 		this.serviceRemarks = serviceRemarks;
 	}
-	
-	
-	
-}
+
+
+
+}

+ 14 - 0
src/main/java/com/goafanti/common/model/TTaskMid.java

@@ -204,6 +204,11 @@ public class TTaskMid implements Serializable {
      */
     private Integer stopStatus;
 
+    /**
+     * 变更新增项目 0否 1是
+     */
+    private Integer change;
+
     private static final long serialVersionUID = 1L;
 
     public Integer getId() {
@@ -517,6 +522,13 @@ public class TTaskMid implements Serializable {
     public void setStopStatus(Integer stopStatus) {
         this.stopStatus = stopStatus;
     }
+    public void setChange(Integer change) {
+        this.change = change;
+    }
+
+    public Integer getChange() {
+        return change;
+    }
 
     public TTaskMid(Integer tid, BigDecimal costAmount) {
         this.tid = tid;
@@ -525,4 +537,6 @@ public class TTaskMid implements Serializable {
     public TTaskMid() {
 
     }
+
+
 }

+ 7 - 14
src/main/java/com/goafanti/common/task/ReleaseUserTask.java

@@ -56,9 +56,10 @@ public class ReleaseUserTask {
 	@Scheduled(cron = "0 0 1  * * ?")
 	public void startTask() {
 		try {
-			pushUserDays();
+			List<User> userList = userService.selectUserByRoleName("营销员", "营销经理");
+			pushUserDays(userList);
 			Thread.sleep(2000);
-			updateUser();
+			updateUser(userList);
 			Thread.sleep(2000);
 		} catch (InterruptedException e) {
 			e.printStackTrace();
@@ -66,16 +67,12 @@ public class ReleaseUserTask {
 
 	}
 
-//	@ResponseBody
-//	@RequestMapping(value = "/open/remindUser", method = RequestMethod.GET)
-	private void pushUserDays() throws InterruptedException {
+	private void pushUserDays(List<User> userList ) throws InterruptedException {
 		LoggerUtils.debug(getClass(), "==============客户提醒开始============");
-		List<User> userList = userService.selectUserByRoleName("营销员", "营销经理");
-		List<userDaysBo> userTmpList = null;
 		List<Notice> ln = new ArrayList<>();
 		for (User u : userList) {
 			if (StringUtils.isNotBlank(u.getId())) {
-				userTmpList = customerService.selectReleaseUserDays(u.getId());
+				List<userDaysBo> userTmpList  = customerService.selectReleaseUserDays(u.getId());
 				for (userDaysBo ub : userTmpList) {
 					String str=null;
 					if (ub.getChannel() == 0) {
@@ -113,20 +110,16 @@ public class ReleaseUserTask {
 	/**
 	 * 将客户和业务转为待释放
 	 */
-//	@RequestMapping(value = "/open/updateUser", method = RequestMethod.GET)
-	public void updateUser() {
+	public void updateUser(List<User> userList ) {
 		LoggerUtils.debug(getClass(), "==============客户释放开始============");
 		Date releaseTime = new Date();
 		try {
-			List<User> userList = userService.selectUserByRoleName("营销员", "营销经理");
 			List<LockingReleaseBo> lockUserList = new ArrayList<LockingReleaseBo>();
 			if (userList != null && !userList.isEmpty()) {
 				for (User u : userList) {
-					List<LockingReleaseBo> userTmpList = new ArrayList<LockingReleaseBo>();
-
 					if (StringUtils.isNotBlank(u.getId())) {
 						// 获取30天释放
-						userTmpList = customerService.selectWaitReleaseCustomer(u.getId());
+						List<LockingReleaseBo>  userTmpList = customerService.selectWaitReleaseCustomer(u.getId());
 						customerService.pushReleaseLog(userTmpList, 0);
 						addUserNotice(userTmpList);
 						if (userTmpList != null && !userTmpList.isEmpty())

+ 20 - 1
src/main/java/com/goafanti/common/utils/AsyncUtils.java

@@ -85,7 +85,26 @@ public class AsyncUtils {
 		AdminListBo a = adminMapper.getDeptNameByAid(n.getAid());
 		EmailBo bo=new EmailBo(NoticeStatus.getStatus(n.getNoticeType()).getDesc(),a.getEmail(),n.getContent()) ;
 		noticeMapper.insertSelective(n);
-		send(bo);
+		if (StringUtils.isNotBlank(bo.getAddress())){
+			send(bo);
+		}
+	}
+
+	/**
+	 *
+	 * @param aid 通知对象
+	 * @param noticeType  通知类型
+	 * @param content 通知内容
+	 */
+	public void addNoticAndEmail(String aid,Integer noticeType,String content) {
+		Notice n=new Notice();
+		n.setId(UUID.randomUUID().toString());
+		n.setAid(aid);
+		n.setNoticeType(noticeType);
+		n.setContent(content);
+		n.setReaded(0);
+		n.setType(NoticeTypes.getType(n.getNoticeType()));
+		addNoticAndEmail(n);
 	}
 
 

+ 8 - 2
src/main/java/com/goafanti/common/utils/FileUtils.java

@@ -162,9 +162,15 @@ public class FileUtils {
 	 * @param path
 	 * @return
 	 */
-	public static String orderFileName(MultipartFile mf, String orderNo, String path,String sign) {
+	public static String orderFileName(MultipartFile mf, String id, String path,String sign) {
 		String suffix = mf.getOriginalFilename().substring(mf.getOriginalFilename().lastIndexOf("."));
-		String fileName =  path + orderNo + "/" + System.nanoTime()+"_"+sign + suffix;
+		String fileName =  path + id + "/" + System.nanoTime()+"_"+sign + suffix;
+		return fileName;
+	}
+
+	public static String orderFileName(MultipartFile mf, String path,String sign) {
+		String suffix = mf.getOriginalFilename().substring(mf.getOriginalFilename().lastIndexOf("."));
+		String fileName =  path + sign + "/" + System.nanoTime()+"_"+sign + suffix;
 		return fileName;
 	}
 

+ 1 - 0
src/main/java/com/goafanti/core/shiro/token/TokenManager.java

@@ -2,6 +2,7 @@ package com.goafanti.core.shiro.token;
 
 import java.util.UUID;
 
+import com.goafanti.common.model.AmbSystem;
 import org.apache.shiro.SecurityUtils;
 import org.apache.shiro.session.Session;
 

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

@@ -2262,6 +2262,7 @@ public class CustomerServiceImpl extends BaseMybatisDao<UserMapper> implements C
 					newList.clear();
 					Thread.sleep(2000);
 				}
+
 			}
 
 		}

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

@@ -8,11 +8,20 @@ public class InputAddTask  extends TOrderTask {
     private String serviceLife;
     private String serviceYear;
     private Integer yearSum;
+    private Integer change;
     private String contractTerm;
     private String lastYear;
     private BigDecimal lastYearCapital;
     private BigDecimal lastYearIncome;
 
+    public Integer getChange() {
+        return change;
+    }
+
+    public void setChange(Integer change) {
+        this.change = change;
+    }
+
     public String getLastYear() {
         return lastYear;
     }

+ 95 - 0
src/main/java/com/goafanti/order/bo/OrderProcessName.java

@@ -0,0 +1,95 @@
+package com.goafanti.order.bo;
+
+public class OrderProcessName {
+
+    private String orderNo;
+    private Integer approval;
+    private Integer processStatus;
+    private String yxy;
+    private String yxjl;
+    private String yxgly;
+    private String cwzy;
+    private String zc;
+    private String zxsgly;
+    private String dsz;
+
+    public String getYxjl() {
+        return yxjl;
+    }
+
+    public void setYxjl(String yxjl) {
+        this.yxjl = yxjl;
+    }
+
+    public Integer getProcessStatus() {
+        return processStatus;
+    }
+
+    public void setProcessStatus(Integer processStatus) {
+        this.processStatus = processStatus;
+    }
+
+    public String getOrderNo() {
+        return orderNo;
+    }
+
+    public void setOrderNo(String orderNo) {
+        this.orderNo = orderNo;
+    }
+
+    public Integer getApproval() {
+        return approval;
+    }
+
+    public void setApproval(Integer approval) {
+        this.approval = approval;
+    }
+
+    public String getYxy() {
+        return yxy;
+    }
+
+    public void setYxy(String yxy) {
+        this.yxy = yxy;
+    }
+
+    public String getYxgly() {
+        return yxgly;
+    }
+
+    public void setYxgly(String yxgly) {
+        this.yxgly = yxgly;
+    }
+
+    public String getCwzy() {
+        return cwzy;
+    }
+
+    public void setCwzy(String cwzy) {
+        this.cwzy = cwzy;
+    }
+
+    public String getZc() {
+        return zc;
+    }
+
+    public void setZc(String zc) {
+        this.zc = zc;
+    }
+
+    public String getZxsgly() {
+        return zxsgly;
+    }
+
+    public void setZxsgly(String zxsgly) {
+        this.zxsgly = zxsgly;
+    }
+
+    public String getDsz() {
+        return dsz;
+    }
+
+    public void setDsz(String dsz) {
+        this.dsz = dsz;
+    }
+}

+ 149 - 0
src/main/java/com/goafanti/order/bo/OutProcessName.java

@@ -0,0 +1,149 @@
+package com.goafanti.order.bo;
+
+public class OutProcessName {
+    private String id;
+    private String orderNo;
+    private Integer type;
+    private String changeAmount;
+    private Integer status;
+    private Integer processState;
+    private String yxy;
+    private String yxjl;
+    private String yxgly;
+    private String zxs;
+    private String zxsjl;
+    private String zxsgly;
+    private String cwzy;
+    private String cwgly;
+    private String zc;
+    private String dsz;
+
+    public Integer getType() {
+        return type;
+    }
+
+    public void setType(Integer type) {
+        this.type = type;
+    }
+
+    public Integer getStatus() {
+        return status;
+    }
+
+    public void setStatus(Integer status) {
+        this.status = status;
+    }
+
+    public Integer getProcessState() {
+        return processState;
+    }
+
+    public void setProcessState(Integer processState) {
+        this.processState = processState;
+    }
+
+    public String getId() {
+        return id;
+    }
+
+    public void setId(String id) {
+        this.id = id;
+    }
+
+    public String getOrderNo() {
+        return orderNo;
+    }
+
+    public void setOrderNo(String orderNo) {
+        this.orderNo = orderNo;
+    }
+
+
+    public String getChangeAmount() {
+        return changeAmount;
+    }
+
+    public void setChangeAmount(String changeAmount) {
+        this.changeAmount = changeAmount;
+    }
+
+    public String getYxy() {
+        return yxy;
+    }
+
+    public void setYxy(String yxy) {
+        this.yxy = yxy;
+    }
+
+    public String getYxjl() {
+        return yxjl;
+    }
+
+    public void setYxjl(String yxjl) {
+        this.yxjl = yxjl;
+    }
+
+    public String getYxgly() {
+        return yxgly;
+    }
+
+    public void setYxgly(String yxgly) {
+        this.yxgly = yxgly;
+    }
+
+    public String getZxs() {
+        return zxs;
+    }
+
+    public void setZxs(String zxs) {
+        this.zxs = zxs;
+    }
+
+    public String getZxsjl() {
+        return zxsjl;
+    }
+
+    public void setZxsjl(String zxsjl) {
+        this.zxsjl = zxsjl;
+    }
+
+    public String getZxsgly() {
+        return zxsgly;
+    }
+
+    public void setZxsgly(String zxsgly) {
+        this.zxsgly = zxsgly;
+    }
+
+    public String getCwzy() {
+        return cwzy;
+    }
+
+    public void setCwzy(String cwzy) {
+        this.cwzy = cwzy;
+    }
+
+    public String getCwgly() {
+        return cwgly;
+    }
+
+    public void setCwgly(String cwgly) {
+        this.cwgly = cwgly;
+    }
+
+    public String getZc() {
+        return zc;
+    }
+
+    public void setZc(String zc) {
+        this.zc = zc;
+    }
+
+    public String getDsz() {
+        return dsz;
+    }
+
+    public void setDsz(String dsz) {
+        this.dsz = dsz;
+    }
+}

+ 95 - 0
src/main/java/com/goafanti/order/bo/TOrderNewBo.java

@@ -17,6 +17,8 @@ public class TOrderNewBo extends TOrderNew{
 	private String userName;
 	private String nickname;
 	private String salesmanName;
+	private String managerName;
+	private String managerId;
 	private String financeName;
 	private String consultantName;
 	private String dunSubject;
@@ -57,6 +59,99 @@ public class TOrderNewBo extends TOrderNew{
 	private Integer ischange;
 	private Integer stopProject;
 
+	/**
+	 * 知识产权服务 1已签 2企业已经拥有可申报高新的知识产权 3企业自行申报/已有其他合作的代理机构申报 0其他
+	 */
+	private Integer knowledgeServices;
+
+	/**
+	 * 审计服务 1已签 2企业已经有符合申报的年审/专审 3 业自行找会计事务所出具报告 0其他
+	 */
+	private Integer auditServices;
+
+	/**
+	 * 加计扣除服务 1已签 2企业不符合加计扣除范围 3企业自己已经做了加计扣除 4企业自行找其他机构做了加计扣除 0其他
+	 */
+	private Integer addDeductionServices;
+
+	/**
+	 * 知识产权服务其他描述
+	 */
+	private String knowledgeOther;
+
+	/**
+	 * 审计服务其他描述
+	 */
+	private String auditOther;
+
+	/**
+	 * 加计扣除服务其他描述
+	 */
+	private String addDeductionOther;
+
+	public String getManagerId() {
+		return managerId;
+	}
+
+	public void setManagerId(String managerId) {
+		this.managerId = managerId;
+	}
+
+	public String getManagerName() {
+		return managerName;
+	}
+
+	public void setManagerName(String managerName) {
+		this.managerName = managerName;
+	}
+
+	public Integer getKnowledgeServices() {
+		return knowledgeServices;
+	}
+
+	public void setKnowledgeServices(Integer knowledgeServices) {
+		this.knowledgeServices = knowledgeServices;
+	}
+
+	public Integer getAuditServices() {
+		return auditServices;
+	}
+
+	public void setAuditServices(Integer auditServices) {
+		this.auditServices = auditServices;
+	}
+
+	public Integer getAddDeductionServices() {
+		return addDeductionServices;
+	}
+
+	public void setAddDeductionServices(Integer addDeductionServices) {
+		this.addDeductionServices = addDeductionServices;
+	}
+
+	public String getKnowledgeOther() {
+		return knowledgeOther;
+	}
+
+	public void setKnowledgeOther(String knowledgeOther) {
+		this.knowledgeOther = knowledgeOther;
+	}
+
+	public String getAuditOther() {
+		return auditOther;
+	}
+
+	public void setAuditOther(String auditOther) {
+		this.auditOther = auditOther;
+	}
+
+	public String getAddDeductionOther() {
+		return addDeductionOther;
+	}
+
+	public void setAddDeductionOther(String addDeductionOther) {
+		this.addDeductionOther = addDeductionOther;
+	}
 
 	public Integer getStopProject() {
 		return stopProject;

+ 8 - 0
src/main/java/com/goafanti/order/bo/TOrderTaskBo.java

@@ -52,10 +52,18 @@ public class TOrderTaskBo extends TOrderTask{
 	private Integer	stopStatus;
 	private Integer	stopType;
 	private Integer	projectStopStatus;
+	private Integer	change;
 	private String lastYear;
 	private BigDecimal lastYearCapital;
 	private BigDecimal lastYearIncome;
 
+	public Integer getChange() {
+		return change;
+	}
+
+	public void setChange(Integer change) {
+		this.change = change;
+	}
 
 	public Integer getStopType() {
 		return stopType;

+ 17 - 1
src/main/java/com/goafanti/order/controller/AdminNewOrderApiController.java

@@ -19,6 +19,7 @@ import com.goafanti.order.service.OrderAssistService;
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
+import org.springframework.cache.annotation.Cacheable;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RequestMethod;
 import org.springframework.web.bind.annotation.RestController;
@@ -240,6 +241,21 @@ public class AdminNewOrderApiController extends CertifyApiController {
 		res.setData(orderNewService.getOrderNewDetail(orderNo));
 		return res;
 	}
+	/**
+	 * 订单详情
+	 * @param orderNo
+	 * @return
+	 */
+	@RequestMapping(value = "/getProcessName", method = RequestMethod.GET)
+	public Result getProcessName(String orderNo){
+		Result res = new Result();
+		if(StringUtils.isBlank(orderNo)){
+			res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "订单编号","订单编号"));
+			return res;
+		}
+		res.setData(orderNewService.getProcessName(orderNo));
+		return res;
+	}
 
 	@RequestMapping(value = "/updateSalesType",method = RequestMethod.POST)
 	public Result updateSalesType(TOrderNew in ){
@@ -298,7 +314,7 @@ public class AdminNewOrderApiController extends CertifyApiController {
 
 	/**
 	 * 		订单列表
-	 *  specially 0 个人 1 营销员管理 2 驳回 3 特批 4 咨询师管理 5部门订单查询 6客服查询 7统计签单订单 8客户订单列表 9 复审订单
+	 *  specially 0 个人 1 营销员管理 2 驳回 3 特批 4 咨询师管理 5部门订单查询 6客服查询 7统计签单订单 8客户订单列表 9 复审订单 10 营销经理
 	 *  distribution (咨询师管理列表 0 未分配 1部分 2全部
 	 *  amountStatus  0 10万元以下 1 10万~20万 2 20万~30万 3 30万~40万  4 40万以上
 	 * @return

+ 1 - 1
src/main/java/com/goafanti/order/controller/AdminOrderApiController.java

@@ -143,7 +143,7 @@ public class AdminOrderApiController extends CertifyApiController {
 
 	/** 图片上传 **/
 	@RequestMapping(value = "/uploadOrderImg", method = RequestMethod.POST)
-	public Result uploadOrderImg(HttpServletRequest req,String orderNo,String sign){
+	public synchronized Result uploadOrderImg(HttpServletRequest req,String orderNo,String sign){
 		Result res = new Result();
 		if (StringUtils.isBlank(orderNo)){
 			res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR,"订单编号","订单编号"));

+ 14 - 1
src/main/java/com/goafanti/order/controller/OrderChangeApiController.java

@@ -5,6 +5,7 @@ import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.cache.annotation.Cacheable;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RequestMethod;
 import org.springframework.web.bind.annotation.RestController;
@@ -221,6 +222,7 @@ public class OrderChangeApiController extends CertifyApiController {
 	}
 	/**
 	 * 变更修改
+	 * @param changeType 0发起修改 1财务修改
 	 */
 	@RequestMapping(value = "/updateOrderChange", method = RequestMethod.POST)
 	public Result orderChangeDetails(NewOrderChangeBo t ,Integer changeType,String startRemarks){
@@ -287,7 +289,7 @@ public class OrderChangeApiController extends CertifyApiController {
 	 * 	状态为通过,通过状态下为财务退票,退票完成后改状态为上传附件,实际为营销员上传附件,营销员上传完后触发完成变更,状态才变成完成
 	 * 	状态 0草稿 1审核中 2通过 3驳回 4完成 5撤销 6上传附件
 	 * @param userName
-	 * @param processState 流程状态 0营销员 1营销管理员 2技术员 3技术经理 4技术总监 5财务专员(退单) 6财务总监 7总裁 8董事长
+	 * @param processState 流程状态 0=营销员,1=营销经理,2=营销管理员,3=技术员,4=技术经理,5=技术总监,6=财务专员,7=财务总监,8=总裁,9=董事长
 	 * @param timeType
 	 * @param startTime
 	 * @param endTime
@@ -569,4 +571,15 @@ public class OrderChangeApiController extends CertifyApiController {
 		}
 		return res.data(orderChangeService.updateMemberSonProject( id,taskComment));
 	}
+
+
+	@RequestMapping(value = "/getChangeProcessName" ,method = RequestMethod.GET)
+	public Result getChangeProcessName(Integer id){
+		Result res = new Result();
+		if(id==null){
+			res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR,"","变更编号"));
+			return res;
+		}
+		return res.data(orderChangeService.gerProcessName( id));
+	}
 }

+ 9 - 8
src/main/java/com/goafanti/order/enums/OrderChangeProcess.java

@@ -11,14 +11,15 @@ import java.util.Map;
 public enum OrderChangeProcess {
 
 	YXY(0,"营销员"),
-	YXGLY(1,"营销管理员"),
-	JSY(2,"技术员"),
-	JSJL(3, "技术经理"),
-	JSZJ(4, "技术总监"),
-	CWZY(5, "财务专员"),
-	CWZJ(6, "财务总监 "),
-	ZC(7, "总裁"),
-	DSZ(8, "董事长"),
+	YXJL(1,"营销经理"),
+	YXGLY(2,"营销管理员"),
+	JSY(3,"技术员"),
+	JSJL(4, "技术经理"),
+	JSZJ(5, "技术总监"),
+	CWZY(6, "财务专员"),
+	CWZJ(7, "财务总监 "),
+	ZC(8, "总裁"),
+	DSZ(9, "董事长"),
 	INVALID(10, "无效");
 
 	private OrderChangeProcess(Integer code, String desc) {

+ 4 - 1
src/main/java/com/goafanti/order/enums/OrderImgEnums.java

@@ -9,7 +9,10 @@ public enum OrderImgEnums {
     /** 补充协议*/
     SUPPLEMENT("supplement","补充协议"),
     /** 服务内容*/
-    CONTENT("content","服务内容");
+    CONTENT("content","服务内容"),
+    /** 阿米巴付款*/
+    AMBPAYMENT("amb_payment","阿米巴付款"),
+    NOT("not","未知");
 
     private OrderImgEnums(String code, String desc){
         this.code=code;

+ 13 - 13
src/main/java/com/goafanti/order/enums/ProcessStatus.java

@@ -11,26 +11,26 @@ import java.util.Map;
 public enum ProcessStatus {
 	/** 已派营销员 **/
 	YPYXY(0,"已派营销员"),
+	/** 已派营销经理 **/
+	YPYXJL(1,"已派营经理"),
 	/** 已派营销管理员 **/
-	YPYXGLY(1,"已派营销管理员"),
-	/** 已派财务管理员 **/
-	YPCWGLY(2,"已派财务管理员"),
+	YPYXGLY(2,"已派营销管理员"),
 	/** 已派财务专员 **/
 	YPCWZY(3,"已派财务专员"),
+	/** 已派特批审核 **/
+	YPTPSH(4,"已派特批审核"),
 	/** 已派咨询师管理员 **/
-	YPZXSGLY(4,"已派咨询师管理员"),
+	YPZXSGLY(5,"已派咨询师管理员"),
 	/** 已部分派咨询师经理 **/
-	YBFPZXSGLY(5,"已部分分派咨询师经理"),
+	YBFPZXSGLY(6,"已部分分派咨询师经理"),
 	/** 已全部分派咨询师经理 **/
-	YQBFPZXSGLY(6,"已全部分派咨询师经理"),
-	/** 已派特批审核 **/
-	YPTPSH(7,"已派特批审核"),
-	/** 已派外包审核 **/
-	YPWBSH(8,"已派外包审核"),
+	YQBFPZXSGLY(7,"已全部分派咨询师经理"),
+
+
 	/** 无效 **/
 	INVALID(10, "INVALID");
-	
-	
+
+
 	private ProcessStatus(Integer code, String desc) {
 		this.code = code;
 		this.desc = desc;
@@ -73,5 +73,5 @@ public enum ProcessStatus {
             }
         }
         return  null;
-    }	
+    }
 }

+ 7 - 0
src/main/java/com/goafanti/order/service/OrderChangeService.java

@@ -19,6 +19,9 @@ import com.goafanti.order.bo.OutNewOrderRefund;
 import com.goafanti.order.bo.TChangeDunOut;
 import com.goafanti.order.bo.TChangeTaskOut;
 import com.goafanti.order.bo.TOrderNewBo;
+import org.springframework.cache.annotation.Cacheable;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
 
 public interface OrderChangeService {
 
@@ -113,4 +116,8 @@ public interface OrderChangeService {
 	int deleteMemberSonProject(Integer id);
 
     Object updateMemberSonProject(Integer id,String taskComment);
+
+
+
+	Object gerProcessName(Integer id);
 }

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

@@ -213,8 +213,11 @@ public interface OrderNewService {
 	int updateSalesType(TOrderNew in);
 
 	void addTaskMid(Integer id, String commodityId, String orderNo);
+	void addTaskMid(Integer id, String commodityId, String orderNo,Integer change);
 
 	void pushExamineName(TOrderNew t);
 
     int updateOrderUrl(String orderNo, String contractPictureUrl, String agreementUrl, String serviceContent);
+
+    OrderProcessName getProcessName(String orderNo);
 }

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

@@ -99,7 +99,7 @@ public class FundManagerOrderServiceImpl extends BaseMybatisDao<TOrderNewMapper>
 		onew.setOrderNo(orderNo);
 		//onew.setDeleteSign(0);//锁定订单也能走流程
 		onew.setApproval(approval);//特批状态
-		onew.setProcessStatus(ProcessStatus.YPCWGLY.getCode());//已派财务管理员
+//		onew.setProcessStatus(ProcessStatus.YPCWGLY.getCode());//已派财务管理员 废除
 		onew.setOrderStatus(OrderNewState.QDSHTG.getCode());//营销管理员审核通过
 		int idCount = tOrderNewMapper.getCountByIdAndStatus(onew);
 		int fidCount = adminMapper.getCountById(financeId);

+ 322 - 163
src/main/java/com/goafanti/order/service/impl/OrderChangeServiceImpl.java

@@ -12,6 +12,7 @@ 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.bo.*;
 import com.goafanti.order.enums.*;
 import com.goafanti.order.service.*;
 import com.goafanti.organization.bo.OrganizationListOut;
@@ -37,21 +38,8 @@ import com.goafanti.core.mybatis.BaseMybatisDao;
 import com.goafanti.core.mybatis.JDBCIdGenerator;
 import com.goafanti.core.mybatis.page.Pagination;
 import com.goafanti.core.shiro.token.TokenManager;
-import com.goafanti.order.bo.BillBo;
-import com.goafanti.order.bo.InputNewOrderRefund;
-import com.goafanti.order.bo.InputTChangeTask;
-import com.goafanti.order.bo.InvoiceBo;
-import com.goafanti.order.bo.NewOderCahngeListBo;
-import com.goafanti.order.bo.NewOrderChangeBo;
-import com.goafanti.order.bo.OrderChangeLogBo;
-import com.goafanti.order.bo.OutNewOrderDunBo;
-import com.goafanti.order.bo.OutNewOrderRefund;
-import com.goafanti.order.bo.TChangeDunOut;
-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.techproject.enums.TaskState;
+import org.springframework.transaction.annotation.Transactional;
 
 @Service
 public class OrderChangeServiceImpl extends BaseMybatisDao<NewOrderChangeMapper> implements OrderChangeService {
@@ -186,55 +174,70 @@ public class OrderChangeServiceImpl extends BaseMybatisDao<NewOrderChangeMapper>
 	/*
 	 * 新增审核流程中的
 	 */
-	private void insertOrderExamine(String orderNo) {
+	private void pushOrderExamine(String orderNo,Integer type) {
+		orderExamineMapper.deleteByAidAndStatus(orderNo,null,null);
 		List<TOrderTaskBo> list=tOrderTaskMapper.selectOrderTaskAll(orderNo,null);
 		for (TOrderTaskBo t : list) {
-			if (t.getConsultantId()!=null) {
-				OrderExamine o=new OrderExamine();
-				o.setAid(t.getConsultantId());
-				o.setOrderNo(orderNo);
-				o.setCreateTime(new Date());
-				o.setType(0);//咨询师
-				o.setStatus(0);//正常
-				orderExamineMapper.insertSelective(o);
-			}
-			if (t.getManagerId()!=null) {
-				OrderExamine o=new OrderExamine();
-				o.setAid(t.getManagerId());
-				o.setOrderNo(orderNo);
-				o.setCreateTime(new Date());
-				o.setType(1);//咨询师经理
-				o.setStatus(0);//正常
-				orderExamineMapper.insertSelective(o);
+			if (type==OrderChangeType.CB.getCode()||type==OrderChangeType.JXMBG.getCode()){
+				Integer receiverType=null;
+				if (t.getTaskReceiver()!=null){
+					if (t.getTaskReceiver().equals(t.getConsultantId())) {
+						receiverType=0;
+					}else if  (t.getTaskReceiver().equals(t.getManagerId())){
+						receiverType=1;
+					}
+				}
+				if (receiverType!=null){
+					OrderExamine o=new OrderExamine();
+					o.setAid(t.getTaskReceiver());
+					o.setOrderNo(orderNo);
+					o.setCreateTime(new Date());
+					o.setType(receiverType);//咨询师
+					o.setStatus(0);//正常
+					orderExamineMapper.insertSelective(o);
+				}
+			}else if (type==OrderChangeType.XMJJEBG.getCode()||type==OrderChangeType.TDBTK.getCode() ||
+						type==OrderChangeType.TDTK.getCode()){
+				if (t.getConsultantId()!=null) {
+					OrderExamine o=new OrderExamine();
+					o.setAid(t.getConsultantId());
+					o.setOrderNo(orderNo);
+					o.setCreateTime(new Date());
+					o.setType(0);//咨询师
+					o.setStatus(0);//正常
+					orderExamineMapper.insertSelective(o);
+				}
+				if (t.getManagerId()!=null) {
+					OrderExamine o=new OrderExamine();
+					o.setAid(t.getManagerId());
+					o.setOrderNo(orderNo);
+					o.setCreateTime(new Date());
+					o.setType(1);//咨询师经理
+					o.setStatus(0);//正常
+					orderExamineMapper.insertSelective(o);
+				}
 			}
+
 		}
 	}
 
 	@Override
 	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);
-			int isExamine=orderExamineMapper.selectByOrderNoAndAid(noc.getOrderNo(),TokenManager.getAdminId());
-//			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()));
-			}
-			noc.setIsExamine(isExamine);
-		}
+//		for (NewOrderChangeBo noc : list) {
+//			int isExamine=orderExamineMapper.selectByOrderNoAndAid(noc.getOrderNo(),TokenManager.getAdminId());
+//			if (noc.getVoucherUrl()!=null) {
+//				TOrderNew t=tOrderNewMapper.selectByPrimaryKey(noc.getOrderNo());
+//				noc.setVoucherUrl(pushOrderService.changeProcessStatusConstant(noc.getVoucherUrl(),t.getSalesmanId(),noc.getProcessState(),noc.getStatus()));
+//			}
+//			noc.setIsExamine(isExamine);
+//		}
 		return list;
 	}
 	@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);
 		int isExamine=orderExamineMapper.selectByOrderNoAndAid(nb.getOrderNo(),TokenManager.getAdminId());
-//		nb.setConsultantExamine(consultantExamine);
-//		nb.setManagerExamine(managerExamine);
 		nb.setIsExamine(isExamine);
 		if(nb.getProcessState()!=null){
 			TOrderNew t=tOrderNewMapper.selectByPrimaryKey(nb.getOrderNo());
@@ -243,6 +246,7 @@ public class OrderChangeServiceImpl extends BaseMybatisDao<NewOrderChangeMapper>
 		return nb;
 	}
 	@Override
+	@Transactional
 	public int pushOrderChangeAudit(String changeId, String remarks, Integer status,Integer processState,Integer rejectState) {
 		NewOrderChangeBo nb=newOrderChangeMapper.selectByChangeId(changeId);
 		String orderNo=nb.getOrderNo();
@@ -252,67 +256,94 @@ public class OrderChangeServiceImpl extends BaseMybatisDao<NewOrderChangeMapper>
 		if (nb.getStatus()==4) {
 			throw new BusinessException(new Error( "变更流程已通过审核","变更流程已通过审核"));
 		}
+		boolean zxsFlag=false;
+		boolean zxsjlFlag=false;
 		//2通过 3驳回
 		if (status==2) {
 			//变更类型 0退单退款 1项目及金额变更 2仅项目变更 3仅金额变更 4重报 5赠送 6退单不退款 7仅变更合同
 			if(nb.getType() !=null){
-				//仅合同变更只需要 营销管理员与财务专员审核
 				if(nb.getType()==OrderChangeType.JBGGT.getCode()){
-					if(nb.getProcessState()==1){
-						nb.setProcessState(5);
-					}else if(nb.getProcessState()==5){
+					//仅合同图片修改:营销-营销总经理
+					if(nb.getProcessState()==OrderChangeProcess.YXGLY.getCode()){
 						nb.setStatus(4);
+						addOrderChangeLog(remarks, 2, orderNo, nb.getId());
 						pushCompleteOrderChange(nb);
 						return 1;
 					}
-				}else {
-					if(nb.getProcessState()==8) {//董事长项目变更通过
-						nb.setStatus(2);
-					}
-					if (nb.getChangeAmount().compareTo(new BigDecimal("0.2"))<0) {//小于则总裁通过,大于则董事长
-						if(nb.getProcessState()==7) {//总裁项目变更通过
-							nb.setStatus(2);
+				} else {
+/*				 	 赠送:营销-经理-总经理审核-财务(已收款情况)-总裁
+				 	 重报:营销-经理-总经理审核-技术员-财务-财务总监-总裁
+					仅项目:营销-经理-总经理审核-技术员-技术总监-财务-财务总监-总裁
+				 项目&金额:营销-经理-总经理审核-技术员-经理经理-技术总监-财务-财务总监-总裁
+				  退单退款:营销-经理-总经理审核-技术员-经理经理-技术总监-财务-财务总监-总裁-董事长(大于2K,需董事长审核)-财务退票
+				 退单不退款:营销-经理-总经理审核-技术员-经理经理-技术总监-财务-财务总监-总裁-财务退票
+					仅金额:营销-经理-总经理审核-技术总监-财务-财务总监-总裁
+				 */
+					if (nb.getProcessState()==OrderChangeProcess.YXJL.getCode()){
+						nb.setProcessState(OrderChangeProcess.YXGLY.getCode());
+					}else if (nb.getProcessState()==OrderChangeProcess.YXGLY.getCode()){
+						if (nb.getType()==OrderChangeType.CB.getCode()||
+								nb.getType()==OrderChangeType.JXMBG.getCode()||
+								nb.getType()==OrderChangeType.XMJJEBG.getCode()||
+								nb.getType()==OrderChangeType.TDTK.getCode()||
+								nb.getType()==OrderChangeType.TDBTK.getCode()){
+							int zxs=orderExamineMapper.checkCountStatus(orderNo,0,null);
+							if (zxs>0){
+								nb.setProcessState(OrderChangeProcess.JSY.getCode());
+							}else {
+								zxsFlag=true;
+								zxsjlFlag=pushZXSJLprocess(nb);
+							}
+						}else if (nb.getType()==OrderChangeType.JJEBG.getCode()){
+							nb.setProcessState(OrderChangeProcess.JSZJ.getCode());
+						}else if (nb.getType()==OrderChangeType.ZS.getCode()){
+							nb.setProcessState(OrderChangeProcess.CWZY.getCode());
 						}
-					}else {
-						if(nb.getProcessState()==7) {
-							nb.setProcessState(nb.getProcessState()+1);
+					}else if (nb.getProcessState()==OrderChangeProcess.JSY.getCode()){
+						zxsFlag=pushZXSprocess(nb);
+						//咨询师审核,将自己审核的全部标记已审核
+					}else if (nb.getProcessState()==OrderChangeProcess.JSJL.getCode()){
+						//咨询师经理审核,将自己审核的全部标记已审核
+						orderExamineMapper.updateByOrderNoAndAid(orderNo,TokenManager.getAdminId(),1);
+						int wsh=orderExamineMapper.checkCountStatus(orderNo,1,0);
+						if (wsh==0){
+							pushZXSJLprocess(nb);
 						}
-					}
-					//营销管理通过则设置技术管理员通过表
-					if(nb.getProcessState()==1){
-						if (orderExamineMapper.checkCountStatus(orderNo,null,null)<1) {
-							insertOrderExamine(orderNo);
-						} else {
-							orderExamineMapper.updateByOrderNo(orderNo,null);
+					}else if (nb.getProcessState()==OrderChangeProcess.JSZJ.getCode()){
+						nb.setProcessState(OrderChangeProcess.CWZY.getCode());
+					}else if (nb.getProcessState()==OrderChangeProcess.CWZY.getCode()){
+						if (nb.getType()==OrderChangeType.ZS.getCode()){
+							nb.setProcessState(OrderChangeProcess.ZC.getCode());
+						}else {
+							nb.setProcessState(OrderChangeProcess.CWZJ.getCode());
 						}
-						nb.setProcessState(nb.getProcessState()+1);
-					}
-					//必须放置在咨询师与咨询师经理前,否则会直接通过不走咨询师管理员
-					if(nb.getProcessState()==4||nb.getProcessState()==5) {
-						nb.setProcessState(nb.getProcessState()+1);
-					}else if (nb.getProcessState()==6){
+					}else if (nb.getProcessState()==OrderChangeProcess.CWZJ.getCode()){
+						//财务总监审核,曹津不走总裁走董事长
 						TOrderNew tOrderNew = tOrderNewMapper.selectByPrimaryKey(nb.getOrderNo());
-						if (tOrderNew.getSalesmanId().equals(AFTConstants.CAOJIN_AID)){
-							nb.setProcessState(8);
-						} else{
-							nb.setProcessState(7);
-						}
-					}
-					if(nb.getProcessState()==2){//咨询师
-						//找出当时人的审核改为通过
-						orderExamineMapper.updateByOrderNoAndAid(orderNo,TokenManager.getAdminId(),0);
-						//全部通过了则跳下个流程
-						if (orderExamineMapper.checkCountStatus(orderNo,0,0)<1) {
-							nb.setProcessState(nb.getProcessState()+1);
+						if (tOrderNew.getSalesmanId().equals(AFTConstants.CAOJIN_AID)) {
+							nb.setProcessState(OrderChangeProcess.DSZ.getCode());
+						}else {
+							nb.setProcessState(OrderChangeProcess.ZC.getCode());
 						}
-					}
-					if(nb.getProcessState()==3){//咨询师经理
-						//找出当时人的审核改为通过
-						orderExamineMapper.updateByOrderNoAndAid(orderNo,TokenManager.getAdminId(),1);
-						//全部通过了则跳下个流程
-						if (orderExamineMapper.checkCountStatus(orderNo,1,0)<1) {
-							nb.setProcessState(nb.getProcessState()+1);
+					}else if (nb.getProcessState()==OrderChangeProcess.ZC.getCode()){
+						if (nb.getType()==OrderChangeType.TDTK.getCode()) {
+							if (nb.getChangeAmount().compareTo(new BigDecimal("0.2")) < 0) {
+								//小于则总裁通过,大于则董事长
+								nb.setStatus(2);
+							}else {
+								nb.setProcessState(OrderChangeProcess.DSZ.getCode());
+							}
+						}else if (nb.getType()==OrderChangeType.TDBTK.getCode()){
+							nb.setStatus(2);
+						}else {
+							nb.setStatus(4);
+							addOrderChangeLog(remarks, 2, orderNo, nb.getId());
+							pushCompleteOrderChange(nb);
+							return 1;
 						}
+
+					}else if (nb.getProcessState()==OrderChangeProcess.DSZ.getCode()){
+						nb.setStatus(2);
 					}
 				}
 			}
@@ -330,32 +361,93 @@ public class OrderChangeServiceImpl extends BaseMybatisDao<NewOrderChangeMapper>
 			if (processState>nb.getBackStatus()) {
 				nb.setBackStatus(processState);
 			}
-			//驳回位置查看有无审核人,没有则直接跳下一个
-			if (rejectState==2) {
-				if (orderExamineMapper.checkCountStatus(orderNo,0,null)<1) nb.setProcessState(nb.getProcessState()+1);
+			//驳回重置审核人
+			if (rejectState<=3) {
+				orderExamineMapper.updateByOrderNo(orderNo,1,null);
+			}else if (rejectState==4){
+				orderExamineMapper.updateByOrderNo(orderNo,1,1);
 			}
 			if (rejectState==3) {
-				if (orderExamineMapper.checkCountStatus(orderNo,1,null)<1) nb.setProcessState(nb.getProcessState()+1);
+				zxsFlag=pushZXSprocess(nb);
+			}else if(rejectState==4){
+				zxsjlFlag=pushZXSJLprocess(nb);
+			}
+		}
+		addOrderChangeLog(remarks, status, orderNo, nb.getId());
+		if (zxsFlag||zxsjlFlag){
+			Date date =new Date();
+			date.setTime(date.getTime()+1000);
+			if (zxsFlag){
+				addOrderChangeLog("无咨询师自动通过", status, orderNo, nb.getId(),date);
+			}
+			if (zxsjlFlag){
+				addOrderChangeLog("无咨询师经理自动通过", 2, nb.getOrderNo(), nb.getId(),date);
 			}
+		}
+
+		sendNotice(status,nb);
+		pushOrderCangeProcess(nb);
+		newOrderChangeMapper.updateByPrimaryKeySelective(nb);
+		return 1;
+	}
+
+	/**
+	 *  判断zxs是否全审核,全审核就去判断咨询师经理,跳过就返回x=1,在后续添加日志放到先审核,后添加日志
+	 * @param nb
+	 * @return
+	 */
+	private boolean pushZXSprocess(NewOrderChangeBo nb) {
+		orderExamineMapper.updateByOrderNoAndAid(nb.getOrderNo(),TokenManager.getAdminId(),0);
+		int wsh=orderExamineMapper.checkCountStatus(nb.getOrderNo(),0,0);
+		if (wsh==0){
+			return pushZXSJLprocess( nb);
+		}
+		return false;
+	}
 
-			//如果驳回到技术经理之前则将审核表中状态跳回
-			if(nb.getProcessState()==3) {
-				orderExamineMapper.updateByOrderNo(orderNo,1);
-			}else if (nb.getProcessState()<3) {
-				orderExamineMapper.updateByOrderNo(orderNo,null);
+	/**
+	 * 咨询师经理,跳过就返回x=1,在后续添加日志放到先审核,后添加日志
+	 * @param nb
+	 * @return
+	 */
+	private boolean pushZXSJLprocess(NewOrderChangeBo nb) {
+		int zxsjl=orderExamineMapper.checkCountStatus(nb.getOrderNo(),1,0);
+		boolean zxsjlFlag=false;
+		if (nb.getType()==OrderChangeType.XMJJEBG.getCode()||
+				nb.getType()==OrderChangeType.TDTK.getCode()||
+				nb.getType()==OrderChangeType.TDBTK.getCode()||
+				nb.getType()==OrderChangeType.CB.getCode()||
+				nb.getType()==OrderChangeType.JXMBG.getCode()){
+			if (zxsjl>0){
+				nb.setProcessState(OrderChangeProcess.JSJL.getCode());
+			}else {
+				zxsjlFlag=true;
+				//重报 没有技术员跳入财务
+				if (nb.getType()==OrderChangeType.CB.getCode()){
+					nb.setProcessState(OrderChangeProcess.CWZY.getCode());
+					//项目变更没有跳入技术总监
+				}else{
+					nb.setProcessState(OrderChangeProcess.JSZJ.getCode());
+				}
 			}
 		}
-		OrderChangeLog ocl=new OrderChangeLog();
+		return zxsjlFlag;
+	}
+
+	private void addOrderChangeLog(String remarks, Integer status, String orderNo, Integer id) {
+		addOrderChangeLog(remarks,status,orderNo,id,null);
+	}
+
+	private void addOrderChangeLog(String remarks, Integer status, String orderNo, Integer id,Date date) {
+		if (date ==null)date=new Date();
+		OrderChangeLog ocl = new OrderChangeLog();
 		ocl.setAuditor(TokenManager.getAdminId());
 		ocl.setOrderNo(orderNo);
 		ocl.setRemarks(remarks);
-		ocl.setChangeId(nb.getId());
+		ocl.setChangeId(id);
 		ocl.setStatus(status);
+		ocl.setCreateTime(date);
 		orderChangeLogMapper.insertSelective(ocl);
-		sendNotice(status,nb);
-		pushOrderCangeProcess(nb);
-		newOrderChangeMapper.updateByPrimaryKeySelective(nb);
-		return 1;
 	}
 
 	private void sendNotice(Integer status,NewOrderChangeBo nb) {
@@ -369,7 +461,7 @@ public class OrderChangeServiceImpl extends BaseMybatisDao<NewOrderChangeMapper>
 		//获取客户信息
 		TOrderNewBo o=tOrderNewMapper.getSaleIdByOno(nb.getOrderNo());
 		//获取接收者
-		//流程状态 0营销员 1营销管理员 2技术员 3技术经理 4技术总监 5财务专员(退单) 6财务总监 7总裁 8董事长
+		//流程状态 0=营销员,1=营销经理,2=营销管理员,3=技术员,4=技术经理,5=技术总监,6=财务专员,7=财务总监,8=总裁,9=董事长
 		List<String> alist = new ArrayList<>();
 		//获取部门负责财务人员
 		switch (nb.getProcessState()) {
@@ -377,41 +469,46 @@ public class OrderChangeServiceImpl extends BaseMybatisDao<NewOrderChangeMapper>
 			alist.add(o.getSalesmanId());
 			break;
 		case 1:
-			alist.addAll(adminMapper.listNameByDepAndName(a.getDepartmentId(), AFTConstants.SALESMAN_ADMIN));
+			Admin saleaman = adminMapper.selectByPrimaryKey(o.getSalesmanId());
+			alist.add(saleaman.getManagerId());
 			break;
 		case 2:
-			alist.addAll(tOrderTaskMapper.listNameByDepAndName(o.getOrderNo(),0));
+			alist.addAll(adminMapper.listNameByDepAndName(o.getOrderDep(), AFTConstants.SALESMAN_ADMIN));
 			break;
 		case 3:
-			alist.addAll(tOrderTaskMapper.listNameByDepAndName(o.getOrderNo(),1));
+
+			alist.addAll(addOrderExamine(o.getOrderNo(),0));
 			break;
 		case 4:
+			alist.addAll(addOrderExamine(o.getOrderNo(),1));
+			break;
+		case 5:
 			for (Admin admin : adminMapper.getAdminRoleTypeList(AFTConstants.TECH_ADMIN)) {
 				alist.add(admin.getId());
 			}
 			break;
-		case 5:
+		case 6:
 			alist.add(o.getFinanceId());
 			break;
-		case 6:
+		case 7:
 			for (Admin admin : adminMapper.getAdminRoleTypeList(AFTConstants.FINANCE_ADMIN)) {
 				alist.add(admin.getId());
 			}
 			break;
-		case 7:
+		case 8:
 			if(nb.getStatus()==2) {
 				alist.add(o.getFinanceId());
 			}else {
-				for (Admin admin : adminMapper.getAdminRoleTypeList(AFTConstants.CED)) {
+				for (Admin admin : adminMapper.selectAdminByRoleType(AFTConstants.CED)) {
 					alist.add(admin.getId());
 				}
 			}
 			break;
-		case 8:
+		case 9:
 			if(nb.getStatus()==2) {
 				alist.add(o.getFinanceId());
 			}else {
-				for (Admin admin : adminMapper.getAdminRoleTypeList(AFTConstants.APPROVAL_DECISION)) {
+				for (Admin admin : adminMapper.selectAdminByRoleType(AFTConstants.APPROVAL_DECISION)) {
 					alist.add(admin.getId());
 				}
 			}
@@ -422,6 +519,23 @@ public class OrderChangeServiceImpl extends BaseMybatisDao<NewOrderChangeMapper>
 	}
 
 	/**
+	 *
+	 * @param orderNo 订单编号
+	 * @param i	 0咨询师 1咨询师经理
+	 * @return
+	 */
+	private List<String> addOrderExamine(String orderNo, Integer i) {
+		List<String> list=new ArrayList<>();
+		List<OrderExamineBo> orderExamineBos = orderExamineMapper.selectByOrderNo(orderNo, i);
+		for (OrderExamineBo bo : orderExamineBos) {
+			if (bo.getStatus()==0){
+				list.add(bo.getAid());
+			}
+		}
+		return list;
+	}
+
+	/**
 	 * 变更完成复制出原订单镜像
 	 */
 	private void changeAdopt(NewOrderChangeBo nb) {
@@ -517,14 +631,13 @@ public class OrderChangeServiceImpl extends BaseMybatisDao<NewOrderChangeMapper>
 		parameter.put("processState", processState==null?0:processState);
 		parameter.put("complete", complete==null?0:complete);
 		if (StringUtils.isNotBlank(userName)) parameter.put("userName", userName);
-		if (null!=processState) parameter.put("processState", processState);
 		if (StringUtils.isNotBlank(orderNo)) parameter.put("orderNo", orderNo);
 		if (StringUtils.isNotBlank(contractNo)) parameter.put("contractNo", contractNo);
 		if (null!=type) parameter.put("type", type);
 		if (null!=timeType) parameter.put("timeType", timeType);
 		if (StringUtils.isNotBlank(startTime)) parameter.put("startTime", startTime);
 		if (StringUtils.isNotBlank(endTime)) parameter.put("endTime", endTime+" 23:59:59");
-		if (processState==1){
+		if (processState==2){
 			List<String > myDep;
 			if (deps!=null) {
 				myDep=departmentService.selectSubDeps(deps);
@@ -567,26 +680,79 @@ public class OrderChangeServiceImpl extends BaseMybatisDao<NewOrderChangeMapper>
 			noc.setChangeAmount(t.getChangeAmount());
 			noc.setApplicant(t.getApplicant());
 			noc.setStatus(1);//订单置为正常
-			noc.setProcessState(1);//流程置为营销管理员
 			noc.setDepName(t.getDepName());
-			OrderChangeLog ocl=new OrderChangeLog();
-			ocl.setAuditor(TokenManager.getAdminId());
-			ocl.setOrderNo(t.getOrderNo());
-			ocl.setRemarks(startRemarks==null?"":startRemarks);
-			ocl.setChangeId(noc.getId());
-			ocl.setStatus(0);
+			addOrderChangeLog(startRemarks==null?"":startRemarks, 0, t.getOrderNo(), noc.getId());
 			if(t.getType()!=0)chekeAmout(t);
-			orderChangeLogMapper.insertSelective(ocl);
 			TOrderNew ton=new TOrderNew();
 			ton.setOrderNo(noc.getOrderNo());
 			ton.setDeleteSign(2);
 			tOrderNewMapper.updateByPrimaryKeySelective(ton);
+			TOrderNewBo tOrderNew = tOrderNewMapper.getSaleIdByOno(t.getOrderNo());
+			if (t.getType()!=OrderChangeType.JBGGT.getCode()){
+				Date date =new Date();
+				if (tOrderNew.getManagerName()!=null){
+					noc.setProcessState(OrderChangeProcess.YXJL.getCode());
+				}else {
+					date.setTime(date.getTime()+500);
+					addOrderChangeLog("未设置营销经理自动通过", 2, t.getOrderNo(), noc.getId(),date);
+					List<Admin> admins = adminMapper.listAdminBydepIdAndRoleType(tOrderNew.getOrderDep(), AFTConstants.SALESMAN_ADMIN);
+					boolean flag=false;
+					for (Admin admin : admins) {
+						if (tOrderNew.getSalesmanId().equals(admin.getId())){
+							flag=true;
+						}
+					}
+					//如果自己是审核人员则跳过
+					if (flag){
+						boolean zxsFlag=false;
+						boolean zxsjlFlag=false;
+						if (t.getType()==OrderChangeType.CB.getCode()||
+								t.getType()==OrderChangeType.JXMBG.getCode()||
+								t.getType()==OrderChangeType.XMJJEBG.getCode()||
+								t.getType()==OrderChangeType.TDTK.getCode()||
+								t.getType()==OrderChangeType.TDBTK.getCode()){
+							orderExamineMapper.updateByOrderNoAndAid(t.getOrderNo(),TokenManager.getAdminId(),0);
+							int wsh=orderExamineMapper.checkCountStatus(t.getOrderNo(),0,0);
+							if (wsh==0){
+								zxsFlag=true;
+								zxsjlFlag= pushZXSJLprocess( t);
+							}
+							if (zxsFlag||zxsjlFlag){
+								date.setTime(date.getTime()+1000);
+								if (zxsFlag){
+									addOrderChangeLog("无咨询师自动通过", 2, t.getOrderNo(), t.getId(),date);
+									noc.setProcessState(OrderChangeProcess.JSJL.getCode());
+								}
+								if (zxsjlFlag){
+									addOrderChangeLog("无咨询师经理自动通过", 2, t.getOrderNo(), t.getId(),date);
+									if (t.getType()==OrderChangeType.CB.getCode()){
+										noc.setProcessState(OrderChangeProcess.CWZY.getCode());
+									}else {
+										noc.setProcessState(OrderChangeProcess.JSZJ.getCode());
+									}
+								}
+							}
+						}else if(t.getType()==OrderChangeType.ZS.getCode()){
+							noc.setProcessState(OrderChangeProcess.CWZY.getCode());
+						}else if(t.getType()==OrderChangeType.JJEBG.getCode()){
+							noc.setProcessState(OrderChangeProcess.JSZJ.getCode());
+						}
+					}else {
+						noc.setProcessState(OrderChangeProcess.YXGLY.getCode());
+					}
+
+				}
+			}else {
+				noc.setProcessState(OrderChangeProcess.YXGLY.getCode());
+				t.setProcessState(OrderChangeProcess.YXGLY.getCode());
+			}
 			sendNotice(0, t);
+			pushOrderCangeProcess(noc);
+			pushOrderExamine(noc.getOrderNo(),noc.getType());
 		}else  if (changeType==2) {
 			noc.setCwCost(t.getCwCost());
 			noc.setRefundableAmount(t.getRefundableAmount());
 		}
-		if(changeType!=2)pushOrderCangeProcess(noc);
 		if(changeType!=1)newOrderChangeMapper.updateByPrimaryKeySelective(noc);
 		return 1;
 	}
@@ -595,6 +761,11 @@ public class OrderChangeServiceImpl extends BaseMybatisDao<NewOrderChangeMapper>
 		if (noc.getProcessState()== OrderChangeProcess.YXY.getCode()){
 			TOrderNewBo ton = tOrderNewMapper.getSaleIdByOno(noc.getOrderNo());
 			noc.setExamineName(ton.getSalesmanName());
+		}else if (noc.getProcessState()== OrderChangeProcess.YXJL.getCode()){
+			TOrderNewBo ton = tOrderNewMapper.getSaleIdByOno(noc.getOrderNo());
+			Admin saleman = adminMapper.selectByPrimaryKey(ton.getSalesmanId());
+			Admin manager = adminMapper.selectByPrimaryKey(saleman.getManagerId());
+			noc.setExamineName(manager.getName());
 		}else if (noc.getProcessState()== OrderChangeProcess.YXGLY.getCode()){
 			TOrderNewBo ton = tOrderNewMapper.getSaleIdByOno(noc.getOrderNo());
 			StringBuffer str=new StringBuffer();
@@ -709,13 +880,9 @@ public class OrderChangeServiceImpl extends BaseMybatisDao<NewOrderChangeMapper>
 		newOrderChangeMapper.updateByPrimaryKeySelective(nb);
 		TOrderNewBo order=tOrderNewMapper.getSaleIdByOno(nb.getOrderNo());
 		List<String> alist = getAllAid(nb.getId());
-		OrderChangeLog ocl=new OrderChangeLog();
-		ocl.setAuditor(TokenManager.getAdminId());
-		ocl.setOrderNo(nb.getOrderNo());
-		ocl.setRemarks("变更完成。");
-		ocl.setChangeId(nb.getId());
-		ocl.setStatus(4);
-		orderChangeLogMapper.insertSelective(ocl);
+		Date date=new Date();
+		date.setTime(date.getTime()+500);
+		addOrderChangeLog("变更完成。", 4, nb.getOrderNo(), nb.getId(),date);
 		orderNewService.pushGeneralSendNoticeAndEmail(alist,NoticeStatus.ORDER_CHANGE_END.getCode(), order, TokenManager.getAdminId(),0);
 		return 1;
 	}
@@ -743,21 +910,18 @@ public class OrderChangeServiceImpl extends BaseMybatisDao<NewOrderChangeMapper>
 
 	@Override
 	public int pushCompleteRefund(NewOrderChangeBo nb) {
-		nb.setStatus(6);
 		NewOrderChangeBo nob=newOrderChangeMapper.selectById(nb.getId());
 		TOrderNewBo o=tOrderNewMapper.getSaleIdByOno(nob.getOrderNo());
 		List<String> alist = new ArrayList<>();
 		alist.add(o.getSalesmanId());
+		nb.setOrderNo(nob.getOrderNo());
 		nb.setExamineName("");
+		nb.setType(nob.getType());
 		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);
+		addOrderChangeLog("变更财务退票。", 2, nob.getOrderNo(), nb.getId());
 		orderNewService.pushGeneralSendNoticeAndEmail(alist,NoticeStatus.ORDER_CHANGE_YES.getCode(), o, TokenManager.getAdminId(),0);
+		nb.setStatus(4);
+		pushCompleteOrderChange(nb);
 		return 1;
 	}
 
@@ -783,26 +947,18 @@ public class OrderChangeServiceImpl extends BaseMybatisDao<NewOrderChangeMapper>
 		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());
-			//处理项目及催款
-			pushTaskAndDun(nob.getId(),o);
-		}else if (nob.getType()==OrderChangeType.JXMBG.getCode()) {
-			pushTaskAndDun(nob.getId(),o);
 		}else if (nob.getType()==OrderChangeType.JJEBG.getCode()) {
 			o.setTotalAmount(nob.getTotalAmount());
 			if (nob.getFirstAmount()!=null)o.setFirstAmount(nob.getFirstAmount());
-			pushTaskAndDun(nob.getId(),o);
 		}else if (nob.getType()==OrderChangeType.CB.getCode()){
 			o.setTotalAmount(nob.getTotalAmount());
 			if (nob.getFirstAmount()!=null)o.setFirstAmount(nob.getFirstAmount());
-			pushTaskAndDun(nob.getId(),o);
-		}else if (nob.getType()==OrderChangeType.ZS.getCode()) {
-			pushTaskAndDun(nob.getId(),o);
 		}
-		//
+		//处理变更项目与催款新增在订单中
+		pushTaskAndDun(nob.getId(),o);
 		o.setProcessStatus(orderProjectService.getOrderProcessStatus(nb.getOrderNo()));
 		o.setDeleteSign(0);
 		//处理客户中间表退单标识
@@ -903,6 +1059,7 @@ public class OrderChangeServiceImpl extends BaseMybatisDao<NewOrderChangeMapper>
 				if (cd.getDeclarationBatch()!=null)ot.setDeclarationBatch(cd.getDeclarationBatch());
 				if (cd.getPatentType()!=null)ot.setPatentType(cd.getPatentType());
 				tOrderTaskMapper.insertSelective(ot);
+				orderNewService.addTaskMid(ot.getId(),ot.getCommodityId(),ot.getOrderNo(),1);
 				if (cd.getSplitStatus()==1){
 					map.put(cd.getId(),ot.getId());
 				}
@@ -1326,13 +1483,7 @@ public class OrderChangeServiceImpl extends BaseMybatisDao<NewOrderChangeMapper>
 				TOrderNew t=new TOrderNew();
 				t.setOrderNo(nb.getOrderNo());
 				t.setDeleteSign(0);
-				OrderChangeLog ocl=new OrderChangeLog();
-				ocl.setAuditor(TokenManager.getAdminId());
-				ocl.setOrderNo(nb.getOrderNo());
-				ocl.setRemarks("变更撤销成功");
-				ocl.setChangeId(nb.getId());
-				ocl.setStatus(5);
-				orderChangeLogMapper.insertSelective(ocl);
+				addOrderChangeLog("变更撤销成功", 5, nb.getOrderNo(), nb.getId());
 				tOrderNewMapper.updateByPrimaryKeySelective(t);
 				return 1;
 			}
@@ -1343,7 +1494,7 @@ public class OrderChangeServiceImpl extends BaseMybatisDao<NewOrderChangeMapper>
 		TChangeTask tChangeTask = tChangeTaskMapper.selectByPrimaryKey(id);
 		Integer tid=tChangeTask.getTid();
 		tChangeTask.setSplitStatus(1);
-		tChangeTask.setType(2);
+		if (tChangeTask.getType()!=1)tChangeTask.setType(2);
 		tChangeTaskMapper.updateByPrimaryKey(tChangeTask);
 		//在判断是否有删除的年份没有就新增
 		tChangeTask.setId(null);
@@ -1406,6 +1557,8 @@ public class OrderChangeServiceImpl extends BaseMybatisDao<NewOrderChangeMapper>
 		return tChangeTask;
 	}
 
+
+
 	/**
 	 * 	如果是有splitSuper 是父有项目的tid,变更父项目有订单项目,则需要看订单项目变更后的子集,反正则不需要
 	 * 	changeSplitSuper 是当前变更项目的子集
@@ -1420,4 +1573,10 @@ public class OrderChangeServiceImpl extends BaseMybatisDao<NewOrderChangeMapper>
 	}
 
 
+
+	@Override
+	public Object gerProcessName(Integer id) {
+		NewOrderChange newOrderChange=newOrderChangeMapper.selectByPrimaryKey(id);
+		return newOrderChangeMapper.gerProcessName(id,newOrderChange.getOrderNo());
+	}
 }

+ 101 - 58
src/main/java/com/goafanti/order/service/impl/OrderNewServiceImpl.java

@@ -137,6 +137,9 @@ public class OrderNewServiceImpl extends BaseMybatisDao<TOrderNewMapper> impleme
 	private DepartmentService departmentService;
 	@Autowired
 	private TOrderPaymentMapper tOrderPaymentMapper;
+	@Autowired
+	private TOrderHighTechMapper tOrderHighTechMapper;
+
 	@Value(value = "${upload.path}")
 	private String					uploadPath			= null;
 
@@ -250,6 +253,16 @@ public class OrderNewServiceImpl extends BaseMybatisDao<TOrderNewMapper> impleme
 		addTaskMid( t);
 	}
 
+	@Override
+	public void addTaskMid(Integer id, String commodityId, String orderNo, Integer change) {
+		InputAddTask t = new InputAddTask();
+		t.setId(id);
+		t.setCommodityId(commodityId);
+		t.setOrderNo(orderNo);
+		t.setChange(change);
+		addTaskMid( t);
+	}
+
 
 	public int addTaskMid(InputAddTask t) {
 		TTaskMid tm=new TTaskMid();
@@ -278,6 +291,7 @@ public class OrderNewServiceImpl extends BaseMybatisDao<TOrderNewMapper> impleme
 		TTaskMid dtails = tTaskMidMapper.getDtails(t.getId());
 		tm.setDispatchProvince(dtails.getDispatchProvince());
 		tm.setDutyDep(dtails.getDutyDep());
+		tm.setChange(t.getChange());
 		return tTaskMidMapper.insertSelective(tm);
 	}
 
@@ -448,14 +462,41 @@ public class OrderNewServiceImpl extends BaseMybatisDao<TOrderNewMapper> impleme
 		if (StringUtils.isBlank(t.getOrderDep())) {
 			t.setOrderDep(a.getDepartmentId());
 		}
+		if (t.getKnowledgeServices()!=null||t.getAuditServices()!=null||t.getAddDeductionServices()!=null){
+			TOrderHighTech tighTech=new TOrderHighTech();
+			tighTech.setOrderNo(t.getOrderNo());
+			tighTech.setKnowledgeServices(t.getKnowledgeServices());
+			tighTech.setAuditServices(t.getAuditServices());
+			tighTech.setAddDeductionServices(t.getAddDeductionServices());
+			tighTech.setKnowledgeOther(t.getKnowledgeOther());
+			tighTech.setAuditOther(t.getAuditOther());
+			tighTech.setAddDeductionOther(t.getAddDeductionOther());
+			int i=tOrderHighTechMapper.updateByOrder(tighTech);
+			if(i==0){
+				tOrderHighTechMapper.insertSelective(tighTech);
+			}
+		}
 		//订单提交
 		if (isSubmit==1) {
 			t2.setApproval(t.getApproval());
-			if(t2.getProcessStatus()<ProcessStatus.YPYXGLY.getCode()) {
-				t.setOrderStatus(OrderNewState.QDDS.getCode());
-				t.setProcessStatus(ProcessStatus.YPYXGLY.getCode());
-			}else {
-				t.setOrderStatus(OrderNewState.QDSHTG.getCode());
+			addOrderLog(t2.getOrderNo(),OrderLogProcess.TJ.getCode(), null);
+			if(t2.getProcessStatus()<ProcessStatus.YPYXJL.getCode()) {
+				//添加营销管理员审核经理
+					Integer orderStatus=OrderNewState.QDDS.getCode();
+					if (a.getManagerId()!=null){
+						t.setProcessStatus(ProcessStatus.YPYXJL.getCode());
+					}else {
+						if (TokenManager.hasRole(AFTConstants.SALESMAN_ADMIN)){
+							addOrderLog(t2.getOrderNo(),OrderLogProcess.SH.getCode(), "管理员跳过自己审核");
+							t.setProcessStatus(ProcessStatus.YPCWZY.getCode());
+							orderStatus=OrderNewState.QDSHTG.getCode();
+						}else {
+							addOrderLog(t2.getOrderNo(),OrderLogProcess.YXJLTT.getCode(), "无经理跳过审核");
+							t.setProcessStatus(ProcessStatus.YPYXGLY.getCode());
+						}
+					}
+					t.setOrderStatus(orderStatus);
+
 			}
 			//特批逻辑处理
 			if (t2.getApproval()==ApprovalNewState.ZCDSH.getCode()){
@@ -471,11 +512,6 @@ public class OrderNewServiceImpl extends BaseMybatisDao<TOrderNewMapper> impleme
 				t.setApproval(ApprovalNewState.DSZDSH.getCode());
 			}
 			//生成流转
-			TOrderLog tl=new TOrderLog();
-			tl.setOrderNo(t.getOrderNo());
-			tl.setProcess(OrderLogProcess.TJ.getCode());
-			tl.setAid(TokenManager.getAdminId());
-			addOrderLog(tl,null);
 			if (StringUtils.isBlank(t2.getContractNo())) {
 				//没有合同编号则生成
 				createContractNo(t);
@@ -487,23 +523,32 @@ public class OrderNewServiceImpl extends BaseMybatisDao<TOrderNewMapper> impleme
 			t.setBuyerId(t2.getBuyerId());
 			updateOrderMid(t);
 			List<String> aids = new ArrayList<>();
-			Integer type;
-			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){
+			Integer type=NoticeStatus.OTHER.getCode();
+			StringBuffer str =new StringBuffer();
+			if (t.getProcessStatus()==ProcessStatus.YPYXJL.getCode()){
+				type=NoticeStatus.ORDER_START.getCode();
+				aids.add(a.getManagerId());
+				Admin manager = adminMapper.selectByPrimaryKey(a.getManagerId());
+				str=str.append(manager.getName()).append(",");
+			}else if (t.getProcessStatus()==ProcessStatus.YPYXGLY.getCode()){
+				type=NoticeStatus.ORDER_YES.getCode();
 				List<Admin> admins = adminMapper.listAdminBydepIdAndRoleType(t.getOrderDep(),AFTConstants.SALESMAN_ADMIN);
-				StringBuffer str =new StringBuffer();
-				if (admins.isEmpty()){
-					OrganizationListOut dep = departmentMapper.selectAllById(t.getOrderDep());
-					admins = adminMapper.listAdminBydepIdAndRoleType(dep.getSuperId(),AFTConstants.SALESMAN_ADMIN);
-				}
-				for (Admin admin : admins) {
-					if (!str.toString().contains(admin.getName()))str.append(admin.getName()).append(",");
+				if (!admins.isEmpty()){
+					for (Admin admin : admins) {
+						aids.add(admin.getId());
+						if (!str.toString().contains(admin.getName()))str.append(admin.getName()).append(",");
+					}
 				}
-				if (str.length()>0)t.setExamineName(str.substring(0,str.length()-1));
-			}
+			}else  if (t.getProcessStatus()==ProcessStatus.YPCWZY.getCode()){
+				type=NoticeStatus.ORDER_YES.getCode();
+				Department dep = departmentMapper.selectByPrimaryKey(t.getOrderDep());
+				aids.add(dep.getFinanceId());
+				Admin finance = adminMapper.selectByPrimaryKey(dep.getFinanceId());
+				str=str.append(finance.getName()).append(",");
+			}
+			if (str.length()>0)t.setExamineName(str.substring(0,str.length()-1));
+			TOrderNewBo order = tOrderNewMapper.getSaleIdByOno(t2.getOrderNo());
+			pushGeneralSendNoticeAndEmail(aids, type,order, TokenManager.getAdminId(),t.getApproval());
 		}
 		if (t2.getApproval().equals(ApprovalNewState.ZCBH.getCode()) ||
 				t2.getApproval().equals(ApprovalNewState.DSZBH.getCode()) ||
@@ -526,8 +571,6 @@ public class OrderNewServiceImpl extends BaseMybatisDao<TOrderNewMapper> impleme
 				t.setLiquidationStatus(LiquidationNewState.WAIT_PAY_FIRST_BALANCE.getCode());
 			}
 		}
-
-
 		return tOrderNewMapper.updateByPrimaryKeySelective(t);
 	}
 
@@ -663,6 +706,14 @@ public class OrderNewServiceImpl extends BaseMybatisDao<TOrderNewMapper> impleme
 
 	}
 
+	public void addOrderLog(String  orderNo,Integer process , String reason) {
+		TOrderLog tl=new TOrderLog();
+		tl.setOrderNo(orderNo);
+		tl.setProcess(process);
+		addOrderLog( tl,  reason);
+
+	}
+
 
 	@Override
 	public TOrderNewBo getOrderNewDetail(String orderNo) {
@@ -733,8 +784,11 @@ public class OrderNewServiceImpl extends BaseMybatisDao<TOrderNewMapper> impleme
 		return p;
 	}
 
+
 	private Pagination<TOrderNewBo> addParams(InputOrderNewListBo in, Map<String, Object> params) {
-		if (in.getSpecially()!=null&&(in.getSpecially()==0|| in.getSpecially()==1|| in.getSpecially()==2|| in.getSpecially()==4|| in.getSpecially()==5|| in.getSpecially()==7)) {
+//		specially 0 个人 1 营销员管理 2 驳回 3 特批 4 咨询师管理 5部门订单查询 6客服查询 7统计签单订单 8客户订单列表 9 复审订单 10 营销经理
+		if (in.getSpecially()!=null&&(in.getSpecially()==0|| in.getSpecially()==1|| in.getSpecially()==2||
+				in.getSpecially()==4|| in.getSpecially()==5|| in.getSpecially()==7|| in.getSpecially()==10)) {
 			//0 个人 1 营销员管理 2 驳回 3 特批 4 咨询师管理 5部门订单查询
 			if (in.getSpecially()!=3&& in.getSpecially()!=4) {
 				if (in.getAid() ==null){
@@ -912,42 +966,22 @@ public class OrderNewServiceImpl extends BaseMybatisDao<TOrderNewMapper> impleme
 		Integer type=null;
 		TOrderLog tl=new TOrderLog();
 		tl.setAid(TokenManager.getAdminId());
+		tl.setOrderNo(orderNo);
 		if (orderStatus.equals(OrderNewState.QDSHTG.getCode())) {
 			t.setOutsource(outsource);
-			//外包单给外包审核员 否则给财务专员
-				if(outsource==0) {
-					t.setProcessStatus(ProcessStatus.YPCWZY.getCode());
-					//如果是转的暂时不删除外包信息
-					aids.add(departmentMapper.selectByPrimaryKey(t2.getOrderDep()).getFinanceId());
-				} else if(outsource==1) {
-					for (Admin admin : adminMapper.getAdminRoleNameList("外包审核员")) {
-						aids.add(admin.getId());
-					}
-					t.setProcessStatus(ProcessStatus.YPWBSH.getCode());
-					tl.setOrderNo(orderNo);
-					tl.setProcess(OrderLogProcess.FQWB.getCode());
-					addOrderLog(tl,reason);
+			if (t2.getProcessStatus()==ProcessStatus.YPYXJL.getCode()){
+				tl.setProcess(OrderLogProcess.YXJLTT.getCode());
+				t.setProcessStatus(ProcessStatus.YPYXGLY.getCode());
+				aids.addAll(adminMapper.listNameByDepAndName(t2.getOrderDep(), AFTConstants.SALESMAN_ADMIN));
+			}else if (t2.getProcessStatus()==ProcessStatus.YPYXGLY.getCode()){
+				tl.setProcess(OrderLogProcess.SH.getCode());
+				t.setProcessStatus(ProcessStatus.YPCWZY.getCode());
+				aids.add(departmentMapper.selectByPrimaryKey(t2.getOrderDep()).getFinanceId());
+			}
 
-				}
 			type=NoticeStatus.ORDER_YES.getCode();
-			tl.setOrderNo(orderNo);
-			tl.setProcess(OrderLogProcess.SH.getCode());
 			//增加日志
 			addOrderLog(tl,reason);
-			//非特批增加催款信息
-			//外包
-			 if(outsource==1) {
-				 o.setRefundStatus(0);
-				if(o.getId()==null) {
-				o.setCreateTime(new Date());
-				tOrderOutsourceMapper.insertSelective(o);
-				}else {
-				tOrderOutsourceMapper.updateByPrimaryKeySelective(o);
-				}
-				//修改项目为外包项目
-				tOrderTaskMapper.updateByOutsourceToOrderNo(orderNo,1);
-			}
-//			pushOrderDun(t2);
 		}else if (orderStatus.equals(OrderNewState.QDSHJJ.getCode())) {//如果不通过新增驳回
 				if (outsource==0) {//非外包
 				t.setProcessStatus(ProcessStatus.YPYXY.getCode());
@@ -973,6 +1007,10 @@ public class OrderNewServiceImpl extends BaseMybatisDao<TOrderNewMapper> impleme
 		if (t.getProcessStatus()==ProcessStatus.YPYXY.getCode()){
 			Admin admin = adminMapper.selectByPrimaryKey(t.getSalesmanId());
 			t.setExamineName(admin.getName());
+		}else if (t.getProcessStatus()==ProcessStatus.YPYXJL.getCode()){
+			Admin a = adminMapper.selectByPrimaryKey(t.getSalesmanId());
+			Admin admin = adminMapper.selectByPrimaryKey(a.getManagerId());
+			t.setExamineName(admin.getName());
 		}else if (t.getProcessStatus()==ProcessStatus.YPCWZY.getCode()){
 			if (t.getOrderDep()!=null){
 				OrganizationListOut dep = departmentMapper.selectAllById(t.getOrderDep());
@@ -1897,4 +1935,9 @@ public class OrderNewServiceImpl extends BaseMybatisDao<TOrderNewMapper> impleme
 		return 0;
 	}
 
+	@Override
+	public OrderProcessName getProcessName(String orderNo) {
+		return tOrderNewMapper.getProcessName(orderNo);
+	}
+
 }

+ 5 - 4
src/main/java/com/goafanti/order/service/impl/OrderProjectServiceImpl.java

@@ -171,6 +171,7 @@ public class OrderProjectServiceImpl extends BaseMybatisDao<TOrderTaskMapper> im
 		aids.add(taskReceiverId);
 		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;
@@ -316,7 +317,7 @@ public class OrderProjectServiceImpl extends BaseMybatisDao<TOrderTaskMapper> im
 
 	@Override
 	public Integer getOrderProcessStatus(String  orderNo) {
-		Integer processStatus=4;
+		Integer processStatus=ProcessStatus.YPZXSGLY.getCode();
 		List<TOrderTaskBo> taskBos=tOrderTaskMapper.selectOrderTaskAll(orderNo,4);
 		int i=0;
 		for (TOrderTaskBo to : taskBos) {
@@ -325,11 +326,11 @@ public class OrderProjectServiceImpl extends BaseMybatisDao<TOrderTaskMapper> im
 			}
 		}
 		if (i==taskBos.size()) {
-			processStatus=6;
+			processStatus=ProcessStatus.YQBFPZXSGLY.getCode();
 		}else if(i>0&&i<taskBos.size()){
-			processStatus=5;
+			processStatus=ProcessStatus.YBFPZXSGLY.getCode();;
 		}else if(i==0){
-			processStatus=4;
+			processStatus=ProcessStatus.YPZXSGLY.getCode();
 		}
 		return processStatus;
 	}

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

@@ -1126,7 +1126,8 @@ public class OrderServiceImpl extends BaseMybatisDao<TOrderMapper> implements Or
 	}
 
 	@Override
-	public int pushOrderImg(String orderNo, String imageUrl,String sign) {
+	@Transactional
+	public  int pushOrderImg(String orderNo, String imageUrl,String sign) {
 		TOrderNew tOrderNew = tOrderNewMapper.selectByPrimaryKey(orderNo);
 		TOrderNew newOrder=new TOrderNew();
 		newOrder.setOrderNo(orderNo);

+ 10 - 1
src/main/java/com/goafanti/order/service/impl/PushOrderService.java

@@ -40,9 +40,18 @@ public class PushOrderService {
             }else {
                 return  t.getContractPictureUrl();
             }
-        }else if (((TokenManager.hasRole(AFTConstants.SALESMAN)||TokenManager.hasRole(AFTConstants.SALESMAN_MANAGER)))&&
+        }else if (TokenManager.hasRole(AFTConstants.SALESMAN)&&
                 TokenManager.getAdminId().equals(t.getSalesmanId())){
             return  t.getContractPictureUrl();
+        }else if (TokenManager.hasRole(AFTConstants.SALESMAN_MANAGER)&&
+                TokenManager.getAdminId().equals(t.getSalesmanId())){
+            return  t.getContractPictureUrl();
+        }else if (TokenManager.hasRole(AFTConstants.SALESMAN_MANAGER)&& !TokenManager.getAdminId().equals(t.getSalesmanId())){
+            if (TokenManager.getAdminId().equals(t.getManagerId())&&t.getProcessStatus()==ProcessStatus.YPYXJL.getCode()){
+                return  t.getContractPictureUrl();
+            }else {
+                return DEFAULTS_URL;
+            }
         }else if (TokenManager.hasRole(AFTConstants.SALESMAN_ADMIN)&&t.getProcessStatus()== ProcessStatus.YPYXGLY.getCode()){
             return  t.getContractPictureUrl();
         }else if (TokenManager.hasRole(AFTConstants.FINANCE)&&t.getProcessStatus()== ProcessStatus.YPCWZY.getCode()){

+ 23 - 16
src/main/java/com/goafanti/permission/bo/PermissionBo.java

@@ -15,31 +15,38 @@ public class PermissionBo {
 	 * 权限名字
 	 */
 	private String	name;
-	
+
 	private String createId;
-	
+
 	private Date createTime;
-	
+
 	private Date updateTime;
-	
+
 	private String deletedSign;
-	
+
 	private String autNo;
-	
+
 	private String hierarchies;
-	
+
 	private String status;
-	
+
 	private String showOrder;
-	
-	private String superId;	
-	
+
+	private String superId;
+
 	private List<PermissionBo> children;
-	
+
 	private String key;
-	
 
-	
+	private Integer type;
+
+	public Integer getType() {
+		return type;
+	}
+
+	public void setType(Integer type) {
+		this.type = type;
+	}
 
 	public String getKey() {
 		return key;
@@ -152,6 +159,6 @@ public class PermissionBo {
 	public void setName(String name) {
 		this.name = name;
 	}
-	
-	
+
+
 }

+ 1 - 4
src/main/java/com/goafanti/permission/controller/NewPermissionApiController.java

@@ -3,7 +3,6 @@ package com.goafanti.permission.controller;
 import javax.annotation.Resource;
 
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.cache.annotation.Cacheable;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RequestMethod;
 import org.springframework.web.bind.annotation.RestController;
@@ -22,10 +21,9 @@ public class NewPermissionApiController extends BaseApiController {
 	@Resource
 	private PermissionService permissionService;
 	@Autowired
-	PermissionMapper		permissionMapper;
+	private PermissionMapper		permissionMapper;
 	/**权限管理列表 **/
 	@RequestMapping(value = "/permissions", method = RequestMethod.POST)
-	@Cacheable(cacheNames = "permissions#60",key = "'permissions:'+'all'")
 	public Result permissions() {
 		Result res = new Result();
 		res.setData(permissionService.findPermissionsAll());
@@ -219,7 +217,6 @@ public class NewPermissionApiController extends BaseApiController {
 
 	/**
 	 * 查询导航
-	 * @param navId 导航
 	 * @return
 	 */
 	@RequestMapping(value = "/selectNavList",method=RequestMethod.GET)

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

@@ -163,6 +163,8 @@ public class NewRoleServiceImpl extends BaseMybatisDao<RoleMapper> implements Ne
 			}
 			List<String> ids = userRoleMapper.findUserIdByRoleId(record.getId());
 			TokenManager.clearUserAuthByUserId(ids.toArray(new String[ids.size()]));
+		}else {
+			record.setId(UUID.randomUUID().toString());
 		}
 		record.getId();
 		record.setCreater("管理员");
@@ -253,11 +255,11 @@ public class NewRoleServiceImpl extends BaseMybatisDao<RoleMapper> implements Ne
 			}else if (useType==0&&newType==1){//下转上 下清空
 				tOrderTaskMapper.updateDimissionTransfer(aid, transferId, 3);
 				orderExamineMapper.updateDimissionTransfer(aid, transferId,newType);
-				orderExamineMapper.deleteByAidAndStatus(aid,useType);
+				orderExamineMapper.deleteByAidAndStatus(null,aid,useType);
 			}else if (useType==1&&newType==0){//上转下  上清空
 				tOrderTaskMapper.updateDimissionTransfer(aid, transferId, 4);
 				orderExamineMapper.updateDimissionTransfer(aid, transferId,newType);
-				orderExamineMapper.deleteByAidAndStatus(aid,useType);
+				orderExamineMapper.deleteByAidAndStatus(null,aid,useType);
 			}
 			List<Integer> clist=new ArrayList<>();
 			for (TChangeTask tct : list) {

+ 24 - 13
src/main/java/com/goafanti/permission/service/impl/PermissionServiceImpl.java

@@ -8,6 +8,7 @@ import java.util.List;
 import java.util.Map;
 import java.util.Set;
 import java.util.UUID;
+import java.util.stream.Collectors;
 
 import org.apache.commons.beanutils.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -233,26 +234,36 @@ public class PermissionServiceImpl extends BaseMybatisDao<PermissionMapper> impl
 	@Override
 	public Map<String,Object> findPermissionsAll() {
 		Map<String,Object> params = new HashMap<String, Object>();
-		List<PermissionBo> one=permissionMapper.selectOneAll();
-		for (PermissionBo i:one){
-			i.setKey(i.getId());
-			List<PermissionBo> two=permissionMapper.selectAllBySuperId(i.getId());
-			for(PermissionBo o:two){
-				o.setChildren(permissionMapper.selectAllBySuperId(o.getId()));
-				o.setKey(o.getId());
-				List<PermissionBo> three=permissionMapper.selectAllBySuperId(o.getId());
-				for(PermissionBo p:three){
-					p.setChildren(permissionMapper.selectAllBySuperId(p.getId()));
-					p.setKey(p.getId());
+		List<PermissionBo> all=permissionMapper.selectOneAll();
+		List<PermissionBo> one = all.stream().filter(e -> e.getType()==0).collect(Collectors.toList());
+		List<PermissionBo> tow= all.stream().filter(e -> e.getType()==1).collect(Collectors.toList());
+		List<PermissionBo> three= all.stream().filter(e -> e.getType()==2).collect(Collectors.toList());
+		for (PermissionBo bo : one) {
+			bo.setKey(bo.getId());
+			List<PermissionBo> one2=new ArrayList<>();
+			for (PermissionBo bo2 : tow) {
+				bo2.setKey(bo2.getId());
+				if (bo2.getSuperId().equals(bo.getId())){
+					List<PermissionBo> one3=new ArrayList<>();
+					for (PermissionBo bo3 : three) {
+						bo3.setKey(bo3.getId());
+						if (bo3.getSuperId().equals(bo2.getId())){
+							one3.add(bo3);
+						}
+					}
+					bo2.setChildren(one3);
+					one2.add(bo2);
 				}
-				o.setChildren(three);
 			}
-			i.setChildren(two);
+			bo.setChildren(one2);
 		}
 		params.put("one", one);
 		return params;
 	}
 
+
+
+
 	@Override
 	public List<Navigation> selectNavList(){
 		String aid = TokenManager.hasRole(AFTConstants.SUPERADMIN) ? null : TokenManager.getAdminId();

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

@@ -101,6 +101,10 @@ public class UserLoginController extends BaseController {
 	public Result managesignin(Admin admin, Boolean remember) {
 		Result res = new Result();
 		Admin a =adminMapper.selectByMobile(admin.getMobile());
+		if(a==null){
+			res.getError().add(buildError(ErrorConstants.NON_REGISTER));
+			return res;
+		}
 		if("1".equals(a.getStatus())){
 			res.getError().add(buildError("","用户已被锁定不能登录"));
 			return res;

+ 2 - 2
src/main/resources/props/config_local.properties

@@ -52,9 +52,9 @@ yxjl_max=100
 amb.maxLvl=6
 
 avatar.host=//static.jishutao.com
-static.host=//static.jishutao.com/1.2.55
+static.host=//static.jishutao.com/1.2.57
 #avatar.host=//172.16.0.255:3000
-#static.host=//172.16.0.255:3000/1.2.53
+#static.host=//172.16.0.255:3000/1.2.14
 #static.host=http://172.16.1.187/prod/1.2.25
 
 wx.appId=wxff2f5720ed7d7f63

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

@@ -49,7 +49,7 @@ yxjl_max=100
 
 amb.maxLvl=6
 
-static.host=//static.jishutao.com/1.2.55
+static.host=//static.jishutao.com/1.2.57
 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/webapp/WEB-INF/views/admin/amiba.html

@@ -4,7 +4,7 @@
 <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">
+	<link th:href="${staticHost+'/admin/amiba.css'}" rel="stylesheet">
 </head>
 <body>
 	<div id="root"></div>