Commit 7b8954a4 by manxiaoqiang

二版

parent 0e60f9ae
......@@ -57,6 +57,10 @@
<dmp.username>root</dmp.username>
<dmp.password>reyun123</dmp.password>
<io.url>jdbc:mysql://192.168.2.57:3306/userio?characterEncoding=utf-8</io.url>
<io.username>root</io.username>
<io.password>reyun123</io.password>
<mail.host>smtp.exmail.qq.com</mail.host>
<mail.username>manager@reyun.com</mail.username>
<mail.password>Reyun123</mail.password>
......
......@@ -32,6 +32,8 @@ public class Contract {
private Long payMoney;
private Long invoice;
private String createName;
private Long type;
private Long priceName;
private Long modifyAccount;
private Long createAccount;
......@@ -225,6 +227,23 @@ public class Contract {
this.invoice = invoice;
}
public Long getType() {
return type;
}
public void setType(Long type) {
this.type = type;
}
@Transient
public Long getPriceName() {
return priceName;
}
public void setPriceName(Long priceName) {
this.priceName = priceName;
}
@Transient
public String getSaleName() {
return saleName;
......
package common.model;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import java.util.Date;
/**
* Created by mxq on 2018/4/11.
*/
@Entity
public class PressMoney {
private Long id;
private Long accountId;
private String email;
private Boolean pressStatus;
private Date modifyTime;
private String platform;
private Long user;
private String userName;
private String ds;
@Id
@GeneratedValue
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
public Boolean getPressStatus() {
return pressStatus;
}
public void setPressStatus(Boolean pressStatus) {
this.pressStatus = pressStatus;
}
public Date getModifyTime() {
return modifyTime;
}
public void setModifyTime(Date modifyTime) {
this.modifyTime = modifyTime;
}
public String getPlatform() {
return platform;
}
public void setPlatform(String platform) {
this.platform = platform;
}
public Long getAccountId() {
return accountId;
}
public void setAccountId(Long accountId) {
this.accountId = accountId;
}
public Long getUser() {
return user;
}
public void setUser(Long user) {
this.user = user;
}
public String getUserName() {
return userName;
}
public void setUserName(String userName) {
this.userName = userName;
}
public String getDs() {
return ds;
}
public void setDs(String ds) {
this.ds = ds;
}
}
package common.repository;
import common.model.BackVisit;
import common.model.PressMoney;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
@Transactional
public interface PressMoneyRepository extends JpaRepository<PressMoney, Long> {
@Query(value = "SELECT * from press_money where platform = ?1 and press_status is true", nativeQuery = true)
List<PressMoney> findAllPress(String platform);
}
......@@ -83,8 +83,14 @@ public class ContractServiceImpl implements ContractService{
@Override
public Double getRebat(String product, Integer level, Long money) {
Double rebat = 1d;
try{
PriceLevelMoney levelMoney = priceLevelMoneyRepository.getOne(product, level);
return money * 1.0 / levelMoney.getMoney();
rebat = money * 1.0 / levelMoney.getMoney();
} catch (Exception e){
e.printStackTrace();
}
return rebat;
}
@Override
......
package dic;
/**
* Created by mxq on 18/4/12.
* desc:合同类型
*/
public enum ContractTypeEnum {
MAIN("main","产品基础套餐"),
INCREMENT("increment","增值服务套餐");
private String key;
private String value;
ContractTypeEnum(String key, String value) {
this.key = key;
this.value = value;
}
public String getKey() {
return key;
}
public String getValue() {
return value;
}
}
......@@ -64,6 +64,24 @@ public class TkioAccountController {
return ResultModel.OK(tkioAccountService.enable(loginAccount, resource));
}
//关闭缴费提醒
@RequestMapping(value = "/forbidenpress", method = RequestMethod.PUT)
@ResponseBody
public ResultModel forbidenPress(@CurrentAccount User loginAccount, @RequestBody PressMoney resource, HttpServletRequest request) {
UserLogThread userlog = new UserLogThread(loginAccount.getEmail(), loginAccount.getName(), OperateObjectTypeEnum.CUSTOMER.getKey(), resource.getEmail(), "关闭异常状态跟进", request,loginAccount.getRole());
userlog.start();
return ResultModel.OK(tkioAccountService.forbidenPress(loginAccount, resource));
}
//开启缴费提醒
@RequestMapping(value = "/enablepress", method = RequestMethod.PUT)
@ResponseBody
public ResultModel enablePress(@CurrentAccount User loginAccount, @RequestBody PressMoney resource, HttpServletRequest request) {
UserLogThread userlog = new UserLogThread(loginAccount.getEmail(), loginAccount.getName(), OperateObjectTypeEnum.CUSTOMER.getKey(), resource.getEmail(), "开启异常状态跟进", request,loginAccount.getRole());
userlog.start();
return ResultModel.OK(tkioAccountService.enablePress(loginAccount, resource));
}
//缴费
@RequestMapping(value = "/pay", method = RequestMethod.PUT)
@ResponseBody
......
......@@ -20,6 +20,12 @@ public interface TkioAccountService {
//到期提醒开启
Reminder enable(User user, Reminder resource);
//催款提醒关闭
PressMoney forbidenPress(User user, PressMoney resource);
//催款提醒开启
PressMoney enablePress(User user, PressMoney resource);
//缴费
Payment pay(User user, Payment resource);
......
......@@ -72,6 +72,8 @@ public class TkioAccountServiceImpl implements TkioAccountService {
UserService userService;
@Autowired
ReminderLevelRepository reminderLevelRepository;
@Autowired
PressMoneyRepository pressMoneyRepository;
@Override
public List<Account4Web> findAll(User user) {
......@@ -224,6 +226,26 @@ public class TkioAccountServiceImpl implements TkioAccountService {
}
@Override
public PressMoney forbidenPress(User user, PressMoney resource) {
resource.setUser(user.getId());
resource.setModifyTime(new Date());
resource.setPlatform("tkio");
resource.setPressStatus(false);
resource.setDs(DateUtil.getBeforeDays(0));
return pressMoneyRepository.save(resource);
}
@Override
public PressMoney enablePress(User user, PressMoney resource) {
resource.setUser(user.getId());
resource.setModifyTime(new Date());
resource.setPlatform("tkio");
resource.setPressStatus(true);
resource.setDs(DateUtil.getBeforeDays(0));
return pressMoneyRepository.save(resource);
}
@Override
public Payment pay(User user, Payment resource) {
resource.setUser(user.getId());
resource.setPayDate(new Date());
......
......@@ -58,6 +58,24 @@ public class TrackAccountController {
return ResultModel.OK(tkioAccountService.enable(loginAccount, resource));
}
//关闭缴费提醒
@RequestMapping(value = "/forbidenpress", method = RequestMethod.PUT)
@ResponseBody
public ResultModel forbidenPress(@CurrentAccount User loginAccount, @RequestBody PressMoney resource, HttpServletRequest request) {
UserLogThread userlog = new UserLogThread(loginAccount.getEmail(), loginAccount.getName(), OperateObjectTypeEnum.CUSTOMER.getKey(), resource.getEmail(), "关闭异常状态跟进", request,loginAccount.getRole());
userlog.start();
return ResultModel.OK(tkioAccountService.forbidenPress(loginAccount, resource));
}
//开启缴费提醒
@RequestMapping(value = "/enablepress", method = RequestMethod.PUT)
@ResponseBody
public ResultModel enablePress(@CurrentAccount User loginAccount, @RequestBody PressMoney resource, HttpServletRequest request) {
UserLogThread userlog = new UserLogThread(loginAccount.getEmail(), loginAccount.getName(), OperateObjectTypeEnum.CUSTOMER.getKey(), resource.getEmail(), "开启异常状态跟进", request,loginAccount.getRole());
userlog.start();
return ResultModel.OK(tkioAccountService.enablePress(loginAccount, resource));
}
//缴费
@RequestMapping(value = "/pay", method = RequestMethod.PUT)
@ResponseBody
......
......@@ -19,6 +19,13 @@ public interface TrackAccountService {
//到期提醒开启
Reminder enable(User user, Reminder resource);
//催款提醒关闭
PressMoney forbidenPress(User user, PressMoney resource);
//催款提醒开启
PressMoney enablePress(User user, PressMoney resource);
//缴费
Payment pay(User user, Payment resource);
......
......@@ -60,6 +60,8 @@ public class TrackAccountServiceImpl implements TrackAccountService{
ContractChangeRepository contractChangeRepository;
@Autowired
PackageTypeRepository packageTypeRepository;
@Autowired
PressMoneyRepository pressMoneyRepository;
@Override
public List<TrackAccount4Web> findAll(User user) {
......@@ -163,6 +165,26 @@ public class TrackAccountServiceImpl implements TrackAccountService{
}
@Override
public PressMoney forbidenPress(User user, PressMoney resource) {
resource.setUser(user.getId());
resource.setModifyTime(new Date());
resource.setPlatform("track");
resource.setPressStatus(false);
resource.setDs(DateUtil.getBeforeDays(0));
return pressMoneyRepository.save(resource);
}
@Override
public PressMoney enablePress(User user, PressMoney resource) {
resource.setUser(user.getId());
resource.setModifyTime(new Date());
resource.setPlatform("track");
resource.setPressStatus(true);
resource.setDs(DateUtil.getBeforeDays(0));
return pressMoneyRepository.save(resource);
}
@Override
public Payment pay(User user, Payment resource) {
resource.setUser(user.getId());
resource.setPayDate(new Date());
......
......@@ -20,3 +20,7 @@ track.dataSource.password=${track.password}
dmp.dataSource.url=${dmp.url}
dmp.dataSource.username=${dmp.username}
dmp.dataSource.password=${dmp.password}
io.dataSource.url=${io.url}
io.dataSource.username=${io.username}
io.dataSource.password=${io.password}
\ No newline at end of file
......@@ -18,6 +18,7 @@
<context:component-scan base-package="tkio" />
<context:component-scan base-package="track" />
<context:component-scan base-package="userio" />
<context:component-scan base-package="common" />
<context:component-scan base-package="office" />
<context:component-scan base-package="dmp" />
......@@ -80,6 +81,11 @@
<property name="username" value="${dmp.dataSource.username}"/>
<property name="password" value="${dmp.dataSource.password}"/>
</bean>
<bean id="ioDataSource" parent="parentDataSource">
<property name="url" value="${io.dataSource.url}"/>
<property name="username" value="${io.dataSource.username}"/>
<property name="password" value="${io.dataSource.password}"/>
</bean>
<!-- JPA实体管理工厂的配置 -->
<bean id="entityManagerFactory" class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
......@@ -173,6 +179,25 @@
</props>
</property>
</bean>
<bean id="ioEntityManagerFactory" class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
<property name="dataSource" ref="ioDataSource"/>
<property name="packagesToScan" value="userio.model"></property>
<property name="persistenceUnitName" value="ioUnit" />
<property name="jpaVendorAdapter" ref="hibernateJpaVendorAdapter"/>
<property name="jpaProperties">
<props>
<prop key="hibernate.ejb.naming_strategy">org.hibernate.cfg.ImprovedNamingStrategy</prop>
<prop key="hibernate.show_sql">false</prop>
<prop key="hibernate.hbm2ddl.auto">update</prop><!-- none -->
<prop key="hibernate.connection.CharSet">utf8</prop>
<prop key="hibernate.connection.characterEncoding">utf8</prop>
<prop key="hibernate.connection.useUnicode">true</prop>
</props>
</property>
</bean>
<!--指定实现JPA的适配器 -->
<bean id="hibernateJpaVendorAdapter" class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter">
<property name="databasePlatform" value="org.hibernate.dialect.MySQLDialect"/>
......@@ -194,6 +219,9 @@
<bean id="dmpTransactionManager" class="org.springframework.orm.jpa.JpaTransactionManager">
<property name="entityManagerFactory" ref="dmpEntityManagerFactory"/>
</bean>
<bean id="ioTransactionManager" class="org.springframework.orm.jpa.JpaTransactionManager">
<property name="entityManagerFactory" ref="ioEntityManagerFactory"/>
</bean>
<!-- Spring Data Jpa配置 -->
<jpa:repositories base-package="common.repository"
......@@ -211,6 +239,9 @@
<jpa:repositories base-package="dmp.repository"
repository-impl-postfix="Impl" transaction-manager-ref="dmpTransactionManager"
entity-manager-factory-ref="dmpEntityManagerFactory"/>
<jpa:repositories base-package="userio.repository"
repository-impl-postfix="Impl" transaction-manager-ref="ioTransactionManager"
entity-manager-factory-ref="ioEntityManagerFactory"/>
<!-- 使用annotation定义事务 -->
......@@ -219,6 +250,7 @@
<tx:annotation-driven transaction-manager="tkioTransactionManager" proxy-target-class="true"/>
<tx:annotation-driven transaction-manager="trackTransactionManager" proxy-target-class="true"/>
<tx:annotation-driven transaction-manager="dmpTransactionManager" proxy-target-class="true"/>
<tx:annotation-driven transaction-manager="ioTransactionManager" proxy-target-class="true"/>
<tx:advice id="txAdvice" transaction-manager="transactionManager">
<tx:attributes>
......@@ -266,6 +298,15 @@
<tx:method name="*" propagation="REQUIRED"/>
</tx:attributes>
</tx:advice>
<tx:advice id="ioTxAdvice" transaction-manager="ioTransactionManager">
<tx:attributes>
<tx:method name="report*" propagation="SUPPORTS" read-only="true"/>
<tx:method name="list*" propagation="SUPPORTS" read-only="true"/>
<tx:method name="query*" propagation="SUPPORTS" read-only="true"/>
<tx:method name="find*" propagation="SUPPORTS" read-only="true"/>
<tx:method name="*" propagation="REQUIRED"/>
</tx:attributes>
</tx:advice>
<aop:config expose-proxy="true">
<aop:pointcut id="txPointcut" expression="execution(* common.service.*.*(..))"/>
......@@ -283,6 +324,10 @@
<aop:pointcut id="tracktxPointcut" expression="execution(* track.service.*.*(..))"/>
<aop:advisor advice-ref="trackTxAdvice" pointcut-ref="tracktxPointcut"/>
</aop:config>
<aop:config expose-proxy="true">
<aop:pointcut id="iotxPointcut" expression="execution(* userio.service.*.*(..))"/>
<aop:advisor advice-ref="ioTxAdvice" pointcut-ref="iotxPointcut"/>
</aop:config>
<!-- SpringMVC上传文件时,需要配置MultipartResolver处理器 -->
<bean id="multipartResolver" class="org.springframework.web.multipart.commons.CommonsMultipartResolver">
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment