Browse Source

Merge remote-tracking branch 'origin/test'

anderx 7 years ago
parent
commit
f17f62edb8

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

@@ -127,6 +127,7 @@ public class BaseController {
 		if (TokenManager.isLogin() && TokenManager.getToken() instanceof Admin) {
 			model.addAttribute("adminData", TokenManager.getAdminToken());
 			model.addAttribute("userName", TokenManager.getAdminToken().getName());
+			model.addAttribute("departmentId", TokenManager.getAdminToken().getDepartmentId());
 			model.addAttribute("isAdmin", true);
 		}
 	}

+ 4 - 0
src/main/java/com/goafanti/common/dao/OrganizationContactBookMapper.java

@@ -77,4 +77,8 @@ public interface OrganizationContactBookMapper {
 	int updateByPrimaryKey(OrganizationContactBook record);
 	
 	int checkContacts(@Param("uid")String uid,@Param("mobile")String mobile,@Param("aid")String aid);
+
+	int updateMainContact(@Param("ocbId")String ocbId);
+	
+	int updateSubContact(@Param("uid")String uid);
 }

+ 7 - 0
src/main/java/com/goafanti/common/mapper/OrganizationContactBookMapper.xml

@@ -419,4 +419,11 @@
 			and uid = #{uid,jdbcType=VARCHAR}
 			and mobile = #{mobile,jdbcType=VARCHAR}
   </select>
+  
+  <update id="updateSubContact">
+  	 update organization_contact_book set major = 0 where uid = #{uid,jdbcType=VARCHAR}
+  </update>
+  <update id="updateMainContact">
+  	 update organization_contact_book set major = 1 where id = #{ocbId,jdbcType=VARCHAR}
+  </update>
 </mapper>

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

@@ -1021,6 +1021,7 @@
 			a.order_no as orderNo,
 			a.order_type as orderType,
 			date_format(a.create_time,'%Y-%m-%d %H:%i:%S') as createTime,
+			date_format(a.sign_time,'%Y-%m-%d') as signTime,
 			a.sign_total_amount as signTotalAmount,
 			a.actually_total_amount as actuallyTotalAmount,
 			a.order_status as orderStatus,
@@ -1179,7 +1180,7 @@
 			a.order_no as orderNo,
 			a.order_type as orderType,
 			date_format(a.create_time,'%Y-%m-%d %H:%i:%S') as createTime,
-			date_format(a.sign_time,'%Y-%m-%d %H:%i:%S') as signTime,
+			date_format(a.sign_time,'%Y-%m-%d') as signTime,
 			date_format(a.set_up_time,'%Y-%m-%d %H:%i:%S') as setUpTime,
 			date_format(a.settlement_time,'%Y-%m-%d %H:%i:%S') as settlementTime,
 			a.order_amount as orderAmount,
@@ -1189,6 +1190,7 @@
 			a.actually_total_amount as actuallyTotalAmount,
 			a.order_status as orderStatus,
 			a.order_stage as orderStage,
+			a.project_stage as projectStage,
 			a.delete_sign as deleteSign,
 			a.liquidation_status as liquidationStatus,
 			a.approval,
@@ -1198,6 +1200,7 @@
 			a.buyer_id as buyerId,
 			a.seller_id as sellerId,
 			a.buyer_id as buyerId,
+			b.type as buyerType,
 			b.nickname as buyerName,
 			c.name as salesmanName,
 			a.finance_id as financeId,
@@ -1564,7 +1567,7 @@
 			d.name as financeName,
 			e.name as technicianName,
 			f.name as departmentName,
-			g.cname as projectName
+			g.cname as projectType
 		from
 			t_order a left join user b on
 			a.buyer_id = b.id left join admin c on

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

@@ -573,10 +573,9 @@
 		a.status as projectStatus,
 		a.deleted_sign as deletedSign,
 		a.order_no as orderNo,
-		a.type as projectType,
 		b.nickname as buyerName,
 		b.type as buyerType,
-		f.cname as buyerType,
+		f.cname as projectType,
 		c.create_time as orderTime,
 		c.order_status as orderStatus,
 		c.liquidation_status as liquidationStatus,
@@ -682,16 +681,13 @@
 				a.status as projectStatus,
 				a.deleted_sign as deletedSign,
 				a.order_no as orderNo,
-				a.type as projectType,
 				b.nickname as buyerName,
-				c.name as technicianName,
 				d.name as principalName,
 				f.name as buyerProvince,
 				g.cname as projectType
 			from
 				contract a left join user b on
-				a.uid = b.id left join admin c on
-				a.uid = c.id left join admin d on
+				a.uid = b.id left join admin d on
 				a.principal = d.id left join user_identity e on
 				a.uid = e.uid left join district_glossory f on
 				e.province  = f.id left join business_varieties g on
@@ -710,16 +706,13 @@
 				a.status as projectStatus,
 				a.deleted_sign as deletedSign,
 				a.order_no as orderNo,
-				a.type as projectType,
 				b.nickname as buyerName,
-				c.name as technicianName,
 				d.name as principalName,
 				f.name as buyerProvince,
 				g.cname as projectType
 			from
 				contract a left join user b on
-				a.uid = b.id left join admin c on
-				a.uid = c.id left join admin d on
+				a.uid = b.id left join admin d on
 				a.principal = d.id left join organization_identity e on
 				a.uid = e.uid left join district_glossory f on
 				e.location_province  = f.id left join business_varieties g on

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

@@ -486,12 +486,12 @@
 	</select>
 	
 	<select id="findCustomerContacts" parameterType="java.lang.String" resultType="com.goafanti.common.model.OrganizationContactBook">
-		select id,name,mobile,email,qq,wechat,depatrment,position from organization_contact_book
+		select id,name,mobile,email,qq,wechat,depatrment,position,major from organization_contact_book
 		where uid = #{uid,jdbcType=VARCHAR} and aid = #{aid,jdbcType=VARCHAR}
 	</select>
 	
 	<select id="findAllContacts" parameterType="java.lang.String" resultType="com.goafanti.common.model.OrganizationContactBook">
-		select id,name,mobile from organization_contact_book 
+		select id,name,mobile,major,sex,depatrment,wechat,qq from organization_contact_book 
 		where uid = #{uid,jdbcType=VARCHAR}
 	</select>
 	

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

@@ -807,6 +807,18 @@ public class AdminCustomerApiController extends BaseApiController{
 		return res;
 	}
 	
+	/** 修改主要联系人 **/
+	@RequestMapping(value = "/updateMainContact", method = RequestMethod.GET)
+	public Result updateMainContact(String ocbId,String uid){
+		Result res = new Result();
+		if(StringUtils.isBlank(uid) || StringUtils.isBlank(ocbId)){
+			res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR,""));
+			return res;
+		}
+		customerService.updateMainContact(ocbId,uid);
+		return res;
+	}
+	
 	/** 删除 业务 **/
 	@RequestMapping(value = "/deleteBusiness", method =RequestMethod.GET)
 	public Result deleteBusiness(String businessId){

+ 7 - 0
src/main/java/com/goafanti/customer/service/CustomerService.java

@@ -402,4 +402,11 @@ public interface CustomerService {
 	Pagination<CustomerListOut> findEnteringAuditIsNo(CustomerListOut clo, Integer pageNo, Integer pageSize);
 	
 	int updateEnteringAudit(User bo);
+	
+	/**
+	 * 修改为主要联系人
+	 * @param ocbId
+	 * @return
+	 */
+	int updateMainContact(String ocbId,String uid);
 }

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

@@ -269,6 +269,7 @@ public class CustomerServiceImpl  extends BaseMybatisDao<UserMapper> implements
 		cob.setUid(uid);
 		cob.setName(contacts);
 		cob.setMobile(contactMobile);
+		cob.setMajor(AFTConstants.NO);
 		organizationContactBookMapper.insert(cob);
 		return 1;
 	}
@@ -679,6 +680,7 @@ public class CustomerServiceImpl  extends BaseMybatisDao<UserMapper> implements
 		cob.setUid(uid);
 		cob.setName(bo.getContacts());
 		cob.setMobile(bo.getMobile());
+		cob.setMajor(AFTConstants.NO);
 		organizationContactBookMapper.insert(cob);
 	}
 	
@@ -923,6 +925,7 @@ public class CustomerServiceImpl  extends BaseMybatisDao<UserMapper> implements
 	public int addOneContact(OrganizationContactBook ocb) {
 		ocb.setAid(TokenManager.getAdminId());
 		ocb.setId(UUID.randomUUID().toString());
+		ocb.setMajor(AFTConstants.NO);
 		return organizationContactBookMapper.insert(ocb);
 	}
 
@@ -1006,6 +1009,13 @@ public class CustomerServiceImpl  extends BaseMybatisDao<UserMapper> implements
 		String auditOpinion=bo.getAuditOpinion();
 		return userMapper.updateEnteringAudit(id,auditStatus,auditOpinion);
 	}
+
+	@Override
+	public int updateMainContact(String ocbId,String uid) {
+		organizationContactBookMapper.updateSubContact(uid);
+		organizationContactBookMapper.updateMainContact(ocbId);
+		return 1;
+	}
 	
 	
 }

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

@@ -14,6 +14,8 @@ public class OrderListBo {
 	private String projectType;
 	/** 订单创建时间 **/
 	private String createTime;
+	/** 签单时间 **/
+	private String signTime;
 	/** 合同首付金额 **/
 	private String signFirstPayment;
 	/** 合同订单金额 **/
@@ -76,6 +78,12 @@ public class OrderListBo {
 	public void setCreateTime(String createTime) {
 		this.createTime = createTime;
 	}
+	public String getSignTime() {
+		return signTime;
+	}
+	public void setSignTime(String signTime) {
+		this.signTime = signTime;
+	}
 	public String getSignFirstPayment() {
 		return signFirstPayment;
 	}

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

@@ -17,6 +17,8 @@ public class ServiceOrderDetailBo extends OrderListBo{
 	private String contractPictureUrl;
 	/** 买家 id **/
 	private String buyerId;
+	/** 买家类型 **/
+	private int buyerType;
 	/** 订单负责人 **/
 	private String salesmanId;
 	/** 财务负责人 **/
@@ -75,6 +77,12 @@ public class ServiceOrderDetailBo extends OrderListBo{
 	public void setBuyerId(String buyerId) {
 		this.buyerId = buyerId;
 	}
+	public int getBuyerType() {
+		return buyerType;
+	}
+	public void setBuyerType(int buyerType) {
+		this.buyerType = buyerType;
+	}
 	public String getSalesmanId() {
 		return salesmanId;
 	}

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

@@ -92,7 +92,7 @@ public class AdminOrderApiController extends CertifyApiController {
 	 */
 	@RequestMapping(value = "/signServiceOrder", method = RequestMethod.POST)
 	public Result signServiceOrder(String orderNo,String contractNo,String signFirstPayment,String signTotalAmount,
-			String approval,String orderRemarks){
+			String approval,String orderRemarks,String signTime){
 		Result res = new Result();
 		if(StringUtils.isBlank(orderNo)){
 			res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "订单编号"));
@@ -106,7 +106,7 @@ public class AdminOrderApiController extends CertifyApiController {
 			res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "特批状态"));
 			return res;
 		}
-		orderServiceImpl.updateSignServiceOrder(orderNo,contractNo,signFirstPayment,signTotalAmount,approval,orderRemarks);
+		orderServiceImpl.updateSignServiceOrder(orderNo,contractNo,signFirstPayment,signTotalAmount,approval,orderRemarks,signTime);
 		return res;
 	}
 	

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

@@ -148,7 +148,7 @@ public interface OrderService {
 	 * @return
 	 */
 	int updateSignServiceOrder(String orderNo,String contractNo,String signFirstPayment, String signTotalAmount,
-			String approval,String orderRemarks);
+			String approval,String orderRemarks,String signTime);
 
 	/**
 	 * 作废订单

+ 10 - 6
src/main/java/com/goafanti/order/service/impl/OrderServiceImpl.java

@@ -868,21 +868,24 @@ public class OrderServiceImpl extends BaseMybatisDao<TOrderMapper> implements Or
 
 	@Override
 	public int updateSignServiceOrder(String orderNo,String contractNo, String signFirstPayment, String signTotalAmount,
-			String approval,String orderRemarks) {
+			String approval,String orderRemarks,String signTime) {
 		TOrder tOrder = tOrderMapper.selectByPrimaryKey(orderNo);
 		checkOrder(tOrder);
 		if (tOrder.getOrderStatus() != OrderState.WAIT_FOR_SIGN.getCode()) {
 			throw new BusinessException(new Error(ErrorConstants.NOT_ACCORD_WITH_NEXT, orderNo, ""));
 		} else {
-			Date signTime = new Date();
 			tOrder.setSignFirstPayment(new BigDecimal(signFirstPayment));
 			tOrder.setSignTotalAmount(new BigDecimal(signTotalAmount));
 			tOrder.setOrderStage(OrderStage.SIGNED.getCode());
 			tOrder.setOrderStatus(OrderState.ALREADY_SIGN.getCode());
 			tOrder.setProjectStage(ProjectStage.WAIT_SET_UP.getCode());
 			tOrder.setApproval(Integer.valueOf(approval));
-			tOrder.setUpdateTime(signTime);
-			tOrder.setSignTime(signTime);
+			tOrder.setUpdateTime(new Date());
+			try {
+				tOrder.setSignTime(DateUtils.parseDate(signTime, AFTConstants.YYYYMMDD));
+			} catch (ParseException e) {
+				e.printStackTrace();
+			}
 			tOrder.setOrderRemarks(orderRemarks);
 			tOrder.setContractNo(contractNo);
 			tOrderMapper.updateByPrimaryKeySelective(tOrder);
@@ -1361,6 +1364,7 @@ public class OrderServiceImpl extends BaseMybatisDao<TOrderMapper> implements Or
 	@Transactional
 	public int updateSetUpProject(String orderNo, String signComment) {
 		TOrder tOrder = tOrderMapper.selectByPrimaryKey(orderNo);
+		Date createTime = new Date();
 		checkOrder(tOrder);
 		boolean flag = false;
 		if(tOrder.getOrderStatus() == OrderState.ALREADY_SIGN.getCode()){
@@ -1374,13 +1378,13 @@ public class OrderServiceImpl extends BaseMybatisDao<TOrderMapper> implements Or
 		if(!flag) 
 			throw new BusinessException(new Error(ErrorConstants.ORDER_CAN_NOT_MODIFY, orderNo, ""));
 		tOrder.setProjectStage(ProjectStage.ALREADY_SET_UP.getCode());
-		tOrder.setUpdateTime(new Date());
+		tOrder.setUpdateTime(createTime);
+		tOrder.setSetUpTime(createTime);
 		tOrderMapper.updateByPrimaryKeySelective(tOrder);
 		//-------------- 查询订单详情 --------------------------
 		List<TOrderDetail> detailList = tOrderMapper.selectOrderCommodity(orderNo);
 		List<ContractTask> taskList = new ArrayList<>();
 		ContractTask task = null;
-		Date createTime = new Date();
 		Contract contract = new Contract();
 		String contractId = UUID.randomUUID().toString().replace("-", "");
 		contract.setId(contractId);

+ 1 - 1
src/main/java/com/goafanti/techproject/bo/ProjectListBo.java

@@ -22,7 +22,7 @@ public class ProjectListBo {
 	private Integer approval;
 	/** 客户名 **/
 	private String buyerName;
-	/** 客户省份 **/
+	/** 客户类型 **/
 	private Integer buyerType;
 	/** 营销员 **/
 	private String salesmanName;

+ 1 - 0
src/main/webapp/WEB-INF/views/common.html

@@ -373,6 +373,7 @@
 				email : /*[[${adminData.email}]]*/'',
 				createTime : /*[[${adminData.createTime}]]*/'',
 				uid : /*[[${adminData.id}]]*/'',
+				departmentId : /*[[${adminData.departmentId}]]*/'',
 				isSuperAdmin : /*[[${shiro.hasRole('999999')}]]*/false,
 				isApprovalDecision : /*[[${shiro.hasRole('99999')}]]*/false
 			}